http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88868

Revision: 88868
Author:   reedy
Date:     2011-05-25 23:55:15 +0000 (Wed, 25 May 2011)
Log Message:
-----------
* (bug 29144) Move action=dublincore and action=creativecommons to extensions

Moved dublincore out to extension

Modified Paths:
--------------
    trunk/phase3/includes/AutoLoader.php
    trunk/phase3/includes/DefaultSettings.php
    trunk/phase3/includes/Metadata.php
    trunk/phase3/includes/OutputPage.php
    trunk/phase3/includes/Wiki.php
    trunk/phase3/maintenance/language/messages.inc

Added Paths:
-----------
    trunk/extensions/DublinCoreRdf/
    trunk/extensions/DublinCoreRdf/DublinCore.php
    trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php

Added: trunk/extensions/DublinCoreRdf/DublinCore.php
===================================================================
--- trunk/extensions/DublinCoreRdf/DublinCore.php                               
(rev 0)
+++ trunk/extensions/DublinCoreRdf/DublinCore.php       2011-05-25 23:55:15 UTC 
(rev 88868)
@@ -0,0 +1,25 @@
+<?php
+
+$wgExtensionCredits['other'][] = array(
+       'path' => __FILE__,
+       'name' => 'DublinCore',
+       'url' => '',
+       'author' => 'Evan Prodromou',
+);
+
+$wgHooks['MediaWikiPerformAction'][] = 'efDublinCorePreformAction';
+
+                                       $rdf = new DublinCoreRdf( $article );
+                                       $rdf->show();
+
+$wgAutoloadClasses['DublinCoreRdf'] = $dir . 'DublinCoreRdf_body.php';
+
+function efDublinCorePreformAction( $output, $article, $title, $user, 
$request, $mediaWiki ) {
+       if ( $mediaWiki->getAction() !== 'dublincore' ) {
+               return true;
+       }
+
+       $rdf = new DublinCoreRdf( $article );
+       $rdf->show();
+       return false;
+}
\ No newline at end of file


Property changes on: trunk/extensions/DublinCoreRdf/DublinCore.php
___________________________________________________________________
Added: svn:eol-style
   + native

Copied: trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php (from rev 88838, 
trunk/phase3/includes/Metadata.php)
===================================================================
--- trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php                       
        (rev 0)
+++ trunk/extensions/DublinCoreRdf/DublinCoreRdf_body.php       2011-05-25 
23:55:15 UTC (rev 88868)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Provides DublinCore metadata
+ *
+ * Copyright 2004, Evan Prodromou <[email protected]>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA
+ *
+ * @author Evan Prodromou <[email protected]>
+ * @file
+ */
+
+class DublinCoreRdf extends RdfMetaData {
+
+       public function show(){
+               if( $this->setup() ){
+                       $this->prologue();
+                       $this->basics();
+                       $this->epilogue();
+               }
+       }
+
+       /**
+        * begin of the page
+        */
+       protected function prologue() {
+               $url = htmlspecialchars( $this->reallyFullUrl() );
+               print <<<PROLOGUE
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN" 
"http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd";>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+       xmlns:dc="http://purl.org/dc/elements/1.1/";>
+       <rdf:Description rdf:about="{$url}">
+
+PROLOGUE;
+       }
+
+       /**
+        * end of the page
+        */
+       protected function epilogue() {
+               print <<<EPILOGUE
+       </rdf:Description>
+</rdf:RDF>
+EPILOGUE;
+       }
+}
\ No newline at end of file

Modified: trunk/phase3/includes/AutoLoader.php
===================================================================
--- trunk/phase3/includes/AutoLoader.php        2011-05-25 23:51:32 UTC (rev 
88867)
+++ trunk/phase3/includes/AutoLoader.php        2011-05-25 23:55:15 UTC (rev 
88868)
@@ -53,7 +53,6 @@
        'DiffHistoryBlob' => 'includes/HistoryBlob.php',
        'DjVuImage' => 'includes/DjVuImage.php',
        'DoubleReplacer' => 'includes/StringUtils.php',
-       'DublinCoreRdf' => 'includes/Metadata.php',
        'DummyLinker' => 'includes/Linker.php',
        'Dump7ZipOutput' => 'includes/Export.php',
        'DumpBZip2Output' => 'includes/Export.php',

Modified: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php   2011-05-25 23:51:32 UTC (rev 
88867)
+++ trunk/phase3/includes/DefaultSettings.php   2011-05-25 23:55:15 UTC (rev 
88868)
@@ -4407,7 +4407,6 @@
  */
 
 /** RDF metadata toggles */
-$wgEnableDublinCoreRdf = false;
 $wgEnableCreativeCommonsRdf = false;
 
 /** Override for copyright metadata.
@@ -5040,7 +5039,7 @@
 );
 
 /**
- * Array of disabled article actions, e.g. view, edit, dublincore, delete, etc.
+ * Array of disabled article actions, e.g. view, edit, delete, etc.
  * @deprecated since 1.18; just set $wgActions['action'] = false instead
  */
 $wgDisabledActions = array();

Modified: trunk/phase3/includes/Metadata.php
===================================================================
--- trunk/phase3/includes/Metadata.php  2011-05-25 23:51:32 UTC (rev 88867)
+++ trunk/phase3/includes/Metadata.php  2011-05-25 23:55:15 UTC (rev 88868)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Provides DublinCore and CreativeCommons metadata
+ * Provides CreativeCommons metadata
  *
  * Copyright 2004, Evan Prodromou <[email protected]>.
  *
@@ -198,42 +198,6 @@
        }
 }
 
-class DublinCoreRdf extends RdfMetaData {
-
-       public function show(){
-               if( $this->setup() ){
-                       $this->prologue();
-                       $this->basics();
-                       $this->epilogue();
-               }
-       }
-
-       /**
-        * begin of the page
-        */
-       protected function prologue() {
-               $url = htmlspecialchars( $this->reallyFullUrl() );
-               print <<<PROLOGUE
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN" 
"http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd";>
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
-       xmlns:dc="http://purl.org/dc/elements/1.1/";>
-       <rdf:Description rdf:about="{$url}">
-
-PROLOGUE;
-       }
-
-       /**
-        * end of the page
-        */
-       protected function epilogue() {
-               print <<<EPILOGUE
-       </rdf:Description>
-</rdf:RDF>
-EPILOGUE;
-       }
-}
-
 class CreativeCommonsRdf extends RdfMetaData {
 
        public function show(){

Modified: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php        2011-05-25 23:51:32 UTC (rev 
88867)
+++ trunk/phase3/includes/OutputPage.php        2011-05-25 23:55:15 UTC (rev 
88868)
@@ -2703,7 +2703,7 @@
                global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, 
$wgEnableAPI,
                        $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
                        $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
-                       $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf,
+                       $wgEnableCreativeCommonsRdf,
                        $wgDisableLangConversion, $wgCanonicalLanguageLinks, 
$wgContLang,
                        $wgRightsPage, $wgRightsUrl;
 
@@ -2844,15 +2844,6 @@
                                        'href' => 
$this->getTitle()->getLocalURL( 'action=creativecommons' ) )
                                );
                        }
-
-                       if ( $wgEnableDublinCoreRdf ) {
-                               $tags[] = Html::element( 'link', array(
-                                       'rel' => $this->getMetadataAttribute(),
-                                       'title' => 'Dublin Core',
-                                       'type' => 'application/rdf+xml',
-                                       'href' => 
$this->getTitle()->getLocalURL( 'action=dublincore' ) )
-                               );
-                       }
                }
 
                # Language variants

Modified: trunk/phase3/includes/Wiki.php
===================================================================
--- trunk/phase3/includes/Wiki.php      2011-05-25 23:51:32 UTC (rev 88867)
+++ trunk/phase3/includes/Wiki.php      2011-05-25 23:55:15 UTC (rev 88868)
@@ -407,7 +407,7 @@
         */
        private function performAction( $article ) {
                global $wgSquidMaxage, $wgUseExternalEditor,
-                       $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
+                       $wgEnableCreativeCommonsRdf;
 
                wfProfileIn( __METHOD__ );
 
@@ -450,14 +450,6 @@
                        case 'deletetrackback':
                                $article->$act();
                                break;
-                       case 'dublincore':
-                               if ( !$wgEnableDublinCoreRdf ) {
-                                       wfHttpError( 403, 'Forbidden', wfMsg( 
'nodublincore' ) );
-                               } else {
-                                       $rdf = new DublinCoreRdf( $article );
-                                       $rdf->show();
-                               }
-                               break;
                        case 'creativecommons':
                                if ( !$wgEnableCreativeCommonsRdf ) {
                                        wfHttpError( 403, 'Forbidden', wfMsg( 
'nocreativecommons' ) );

Modified: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc      2011-05-25 23:51:32 UTC 
(rev 88867)
+++ trunk/phase3/maintenance/language/messages.inc      2011-05-25 23:55:15 UTC 
(rev 88868)
@@ -2489,7 +2489,6 @@
                'group-bureaucrat.js',
        ),
        'metadata_cc' => array(
-               'nodublincore',
                'nocreativecommons',
                'notacceptable',
        ),


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to