https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103333

Revision: 103333
Author:   jeroendedauw
Date:     2011-11-16 16:03:39 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
Follow up to r103331; 

Modified Paths:
--------------
    trunk/extensions/SemanticResultFormats/SemanticResultFormats.php

Added Paths:
-----------
    trunk/extensions/SemanticResultFormats/SRF_Hooks.php

Added: trunk/extensions/SemanticResultFormats/SRF_Hooks.php
===================================================================
--- trunk/extensions/SemanticResultFormats/SRF_Hooks.php                        
        (rev 0)
+++ trunk/extensions/SemanticResultFormats/SRF_Hooks.php        2011-11-16 
16:03:39 UTC (rev 103333)
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Static class for hooks handled by the Semantic Result Formats
+ * @since 1.7
+ * 
+ * @file SRF_Hooks.php
+ * @ingroup SemanticResultFormats
+ * 
+ * @licence GNU GPL v3+
+ * @author Jeroen De Dauw < [email protected] >
+ */
+final class SRFHooks {
+       
+       /**
+        * Adds a link to Admin Links page.
+        */
+       public static function addToAdminLinks( &$admin_links_tree ) {
+               $displaying_data_section = $admin_links_tree->getSection( 
wfMsg( 'smw_adminlinks_displayingdata' ) );
+               
+               // Escape is SMW hasn't added links.
+               if ( is_null( $displaying_data_section ) ) {
+                       return true;
+               }
+                       
+               $smw_docu_row = $displaying_data_section->getRow( 'smw' );
+               $srf_docu_label = wfMsg( 'adminlinks_documentation', wfMsg( 
'srf-name' ) );
+               $smw_docu_row->addItem( AlItem::newFromExternalLink( 
'http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats', 
$srf_docu_label ) );
+               
+               return true;
+       }
+       
+}
\ No newline at end of file


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

Modified: trunk/extensions/SemanticResultFormats/SemanticResultFormats.php
===================================================================
--- trunk/extensions/SemanticResultFormats/SemanticResultFormats.php    
2011-11-16 15:57:56 UTC (rev 103332)
+++ trunk/extensions/SemanticResultFormats/SemanticResultFormats.php    
2011-11-16 16:03:39 UTC (rev 103333)
@@ -51,14 +51,6 @@
 $srfgScriptPath = $wgScriptPath . '/extensions/SemanticResultFormats';
 $srfgIP = dirname( __FILE__ );
 
-$wgHooks['AdminLinks'][] = 'srffAddToAdminLinks';
-$wgHooks['ParserFirstCallInit'][] = 'SRFParserFunctions::registerFunctions';
-
-$wgAutoloadClasses['SRFParserFunctions'] = $srfgIP . 
'/SRF_ParserFunctions.php';
-
-// FIXME: Can be removed when new style magic words are used (introduced in 
r52503)
-$wgHooks['LanguageGetMagic'][] = 'SRFParserFunctions::languageGetMagic';
-
 $wgExtensionCredits['semantic'][] = array(
        'path' => __FILE__,
        'name' => 'Semantic Result Formats',
@@ -73,6 +65,43 @@
        'descriptionmsg' => 'srf-desc'
 );
 
+$formatDir = dirname( __FILE__ ) . '/';
+
+$wgAutoloadClasses['SRFTimeline'] = $formatDir . 'Timeline/SRF_Timeline.php';
+$wgAutoloadClasses['SRFvCard'] = $formatDir . 'vCard/SRF_vCard.php';
+$wgAutoloadClasses['SRFiCalendar'] = $formatDir . 
'iCalendar/SRF_iCalendar.php';
+$wgAutoloadClasses['SRFBibTeX'] = $formatDir . 'BibTeX/SRF_BibTeX.php';
+$wgAutoloadClasses['SRFCalendar'] = $formatDir . 'Calendar/SRF_Calendar.php';
+$wgAutoloadClasses['SRFOutline'] = $formatDir . 'Outline/SRF_Outline.php';
+$wgAutoloadClasses['SRFMath'] = $formatDir . 'Math/SRF_Math.php';
+$wgAutoloadClasses['SRFExhibit'] = $formatDir . 'Exhibit/SRF_Exhibit.php';
+$wgAutoloadClasses['SRFGoogleBar'] = $formatDir . 
'GoogleCharts/SRF_GoogleBar.php';
+$wgAutoloadClasses['SRFGooglePie'] = $formatDir . 
'GoogleCharts/SRF_GooglePie.php';
+$wgAutoloadClasses['SRFjqPlotPie'] = $formatDir . 'jqPlot/SRF_jqPlotPie.php';
+$wgAutoloadClasses['SRFjqPlotBar'] = $formatDir . 'jqPlot/SRF_jqPlotBar.php';
+$wgAutoloadClasses['SRFGraph'] = $formatDir . 'GraphViz/SRF_Graph.php';
+$wgAutoloadClasses['SRFProcess'] = $formatDir . 'GraphViz/SRF_Process.php';
+$wgAutoloadClasses['SRFPloticusVBar'] = $formatDir . 
'Ploticus/SRF_PloticusVBar.php';
+$wgAutoloadClasses['SRFGallery'] = $formatDir . 'Gallery/SRF_Gallery.php';
+$wgAutoloadClasses['SRFTagCloud'] = $formatDir . 'TagCloud/SRF_TagCloud.php';
+$wgAutoloadClasses['SRFArray'] = $formatDir . 'Array/SRF_Array.php';
+$wgAutoloadClasses['SRFHash'] = $formatDir . 'Array/SRF_Array.php';
+$wgAutoloadClasses['SRFValueRank'] = $formatDir . 
'ValueRank/SRF_ValueRank.php';
+$wgAutoloadClasses['SRFD3Line'] = $formatDir . 'D3/SRF_D3Line.php';
+$wgAutoloadClasses['SRFD3Bar'] = $formatDir . 'D3/SRF_D3Bar.php';
+$wgAutoloadClasses['SRFD3Treemap'] = $formatDir . 'D3/SRF_D3Treemap.php';  
+
+unset( $formatDir );
+
+$wgAutoloadClasses['SRFParserFunctions'] = $srfgIP . 
'/SRF_ParserFunctions.php';
+$wgAutoloadClasses['SRFHooks'] = $srfgIP . '/SRF_Hooks.php';
+
+$wgHooks['AdminLinks'][] = 'SRFHooks::addToAdminLinks';
+$wgHooks['ParserFirstCallInit'][] = 'SRFParserFunctions::registerFunctions';
+
+// FIXME: Can be removed when new style magic words are used (introduced in 
r52503)
+$wgHooks['LanguageGetMagic'][] = 'SRFParserFunctions::languageGetMagic';
+
 /**
  * Autoload the query printer classes and associate them with their formats in 
the $smwgResultFormats array.
  * 
@@ -81,32 +110,6 @@
 function srffInitFormats() {
        global $srfgFormats, $smwgResultFormats, $smwgResultAliases, 
$wgAutoloadClasses;
        
-       $formatDir = dirname( __FILE__ ) . '/';
-       
-       $wgAutoloadClasses['SRFTimeline'] = $formatDir . 
'Timeline/SRF_Timeline.php';
-       $wgAutoloadClasses['SRFvCard'] = $formatDir . 'vCard/SRF_vCard.php';
-       $wgAutoloadClasses['SRFiCalendar'] = $formatDir . 
'iCalendar/SRF_iCalendar.php';
-       $wgAutoloadClasses['SRFBibTeX'] = $formatDir . 'BibTeX/SRF_BibTeX.php';
-       $wgAutoloadClasses['SRFCalendar'] = $formatDir . 
'Calendar/SRF_Calendar.php';
-       $wgAutoloadClasses['SRFOutline'] = $formatDir . 
'Outline/SRF_Outline.php';
-       $wgAutoloadClasses['SRFMath'] = $formatDir . 'Math/SRF_Math.php';
-       $wgAutoloadClasses['SRFExhibit'] = $formatDir . 
'Exhibit/SRF_Exhibit.php';
-       $wgAutoloadClasses['SRFGoogleBar'] = $formatDir . 
'GoogleCharts/SRF_GoogleBar.php';
-       $wgAutoloadClasses['SRFGooglePie'] = $formatDir . 
'GoogleCharts/SRF_GooglePie.php';
-       $wgAutoloadClasses['SRFjqPlotPie'] = $formatDir . 
'jqPlot/SRF_jqPlotPie.php';
-       $wgAutoloadClasses['SRFjqPlotBar'] = $formatDir . 
'jqPlot/SRF_jqPlotBar.php';
-       $wgAutoloadClasses['SRFGraph'] = $formatDir . 'GraphViz/SRF_Graph.php';
-       $wgAutoloadClasses['SRFProcess'] = $formatDir . 
'GraphViz/SRF_Process.php';
-       $wgAutoloadClasses['SRFPloticusVBar'] = $formatDir . 
'Ploticus/SRF_PloticusVBar.php';
-       $wgAutoloadClasses['SRFGallery'] = $formatDir . 
'Gallery/SRF_Gallery.php';
-       $wgAutoloadClasses['SRFTagCloud'] = $formatDir . 
'TagCloud/SRF_TagCloud.php';
-       $wgAutoloadClasses['SRFArray'] = $formatDir . 'Array/SRF_Array.php';
-       $wgAutoloadClasses['SRFHash'] = $formatDir . 'Array/SRF_Array.php';
-       $wgAutoloadClasses['SRFValueRank'] = $formatDir . 
'ValueRank/SRF_ValueRank.php';
-       $wgAutoloadClasses['SRFD3Line'] = $formatDir . 'D3/SRF_D3Line.php';
-       $wgAutoloadClasses['SRFD3Bar'] = $formatDir . 'D3/SRF_D3Bar.php';
-       $wgAutoloadClasses['SRFD3Treemap'] = $formatDir . 
'D3/SRF_D3Treemap.php';        
-       
        $formatClasses = array(
                'timeline' => 'SRFTimeline',
                'eventline' => 'SRFTimeline',
@@ -148,11 +151,6 @@
                if ( array_key_exists( $format, $formatClasses ) ) {
                        $smwgResultFormats[$format] = $formatClasses[$format];
                        
-                       // Register the resource loader modules for when they 
are supported.
-                       if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) && 
method_exists( $formatClasses[$format], 'registerResourceModules' ) ) {
-                               call_user_func( array( $formatClasses[$format], 
'registerResourceModules' ) );
-                       }
-                       
                        if ( isset( $smwgResultAliases ) && array_key_exists( 
$format, $formatAliases ) ) {
                                $smwgResultAliases[$format] = 
$formatAliases[$format];
                        }
@@ -160,23 +158,7 @@
                else {
                        wfDebug( "There is not result format class associated 
with the format '$format'." );
                }
-       }               
+       }       
 }
 
-/**
- * Adds a link to Admin Links page.
- */
-function srffAddToAdminLinks( &$admin_links_tree ) {
-       $displaying_data_section = $admin_links_tree->getSection( wfMsg( 
'smw_adminlinks_displayingdata' ) );
-       
-       // Escape is SMW hasn't added links.
-       if ( is_null( $displaying_data_section ) ) {
-               return true;
-       }
-               
-       $smw_docu_row = $displaying_data_section->getRow( 'smw' );
-       $srf_docu_label = wfMsg( 'adminlinks_documentation', wfMsg( 'srf-name' 
) );
-       $smw_docu_row->addItem( AlItem::newFromExternalLink( 
'http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats', 
$srf_docu_label ) );
-       
-       return true;
-}
+


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

Reply via email to