r103333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103332‎ | r103333 | r103334 >
Date:16:03, 16 November 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r103331;
Modified paths:
  • /trunk/extensions/SemanticResultFormats/SRF_Hooks.php (added) (history)
  • /trunk/extensions/SemanticResultFormats/SemanticResultFormats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/SRF_Hooks.php
@@ -0,0 +1,33 @@
 2+<?php
 3+
 4+/**
 5+ * Static class for hooks handled by the Semantic Result Formats
 6+ * @since 1.7
 7+ *
 8+ * @file SRF_Hooks.php
 9+ * @ingroup SemanticResultFormats
 10+ *
 11+ * @licence GNU GPL v3+
 12+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 13+ */
 14+final class SRFHooks {
 15+
 16+ /**
 17+ * Adds a link to Admin Links page.
 18+ */
 19+ public static function addToAdminLinks( &$admin_links_tree ) {
 20+ $displaying_data_section = $admin_links_tree->getSection( wfMsg( 'smw_adminlinks_displayingdata' ) );
 21+
 22+ // Escape is SMW hasn't added links.
 23+ if ( is_null( $displaying_data_section ) ) {
 24+ return true;
 25+ }
 26+
 27+ $smw_docu_row = $displaying_data_section->getRow( 'smw' );
 28+ $srf_docu_label = wfMsg( 'adminlinks_documentation', wfMsg( 'srf-name' ) );
 29+ $smw_docu_row->addItem( AlItem::newFromExternalLink( 'http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats', $srf_docu_label ) );
 30+
 31+ return true;
 32+ }
 33+
 34+}
\ No newline at end of file
Property changes on: trunk/extensions/SemanticResultFormats/SRF_Hooks.php
___________________________________________________________________
Added: svn:eol-style
135 + native
Index: trunk/extensions/SemanticResultFormats/SemanticResultFormats.php
@@ -51,14 +51,6 @@
5252 $srfgScriptPath = $wgScriptPath . '/extensions/SemanticResultFormats';
5353 $srfgIP = dirname( __FILE__ );
5454
55 -$wgHooks['AdminLinks'][] = 'srffAddToAdminLinks';
56 -$wgHooks['ParserFirstCallInit'][] = 'SRFParserFunctions::registerFunctions';
57 -
58 -$wgAutoloadClasses['SRFParserFunctions'] = $srfgIP . '/SRF_ParserFunctions.php';
59 -
60 -// FIXME: Can be removed when new style magic words are used (introduced in r52503)
61 -$wgHooks['LanguageGetMagic'][] = 'SRFParserFunctions::languageGetMagic';
62 -
6355 $wgExtensionCredits['semantic'][] = array(
6456 'path' => __FILE__,
6557 'name' => 'Semantic Result Formats',
@@ -73,6 +65,43 @@
7466 'descriptionmsg' => 'srf-desc'
7567 );
7668
 69+$formatDir = dirname( __FILE__ ) . '/';
 70+
 71+$wgAutoloadClasses['SRFTimeline'] = $formatDir . 'Timeline/SRF_Timeline.php';
 72+$wgAutoloadClasses['SRFvCard'] = $formatDir . 'vCard/SRF_vCard.php';
 73+$wgAutoloadClasses['SRFiCalendar'] = $formatDir . 'iCalendar/SRF_iCalendar.php';
 74+$wgAutoloadClasses['SRFBibTeX'] = $formatDir . 'BibTeX/SRF_BibTeX.php';
 75+$wgAutoloadClasses['SRFCalendar'] = $formatDir . 'Calendar/SRF_Calendar.php';
 76+$wgAutoloadClasses['SRFOutline'] = $formatDir . 'Outline/SRF_Outline.php';
 77+$wgAutoloadClasses['SRFMath'] = $formatDir . 'Math/SRF_Math.php';
 78+$wgAutoloadClasses['SRFExhibit'] = $formatDir . 'Exhibit/SRF_Exhibit.php';
 79+$wgAutoloadClasses['SRFGoogleBar'] = $formatDir . 'GoogleCharts/SRF_GoogleBar.php';
 80+$wgAutoloadClasses['SRFGooglePie'] = $formatDir . 'GoogleCharts/SRF_GooglePie.php';
 81+$wgAutoloadClasses['SRFjqPlotPie'] = $formatDir . 'jqPlot/SRF_jqPlotPie.php';
 82+$wgAutoloadClasses['SRFjqPlotBar'] = $formatDir . 'jqPlot/SRF_jqPlotBar.php';
 83+$wgAutoloadClasses['SRFGraph'] = $formatDir . 'GraphViz/SRF_Graph.php';
 84+$wgAutoloadClasses['SRFProcess'] = $formatDir . 'GraphViz/SRF_Process.php';
 85+$wgAutoloadClasses['SRFPloticusVBar'] = $formatDir . 'Ploticus/SRF_PloticusVBar.php';
 86+$wgAutoloadClasses['SRFGallery'] = $formatDir . 'Gallery/SRF_Gallery.php';
 87+$wgAutoloadClasses['SRFTagCloud'] = $formatDir . 'TagCloud/SRF_TagCloud.php';
 88+$wgAutoloadClasses['SRFArray'] = $formatDir . 'Array/SRF_Array.php';
 89+$wgAutoloadClasses['SRFHash'] = $formatDir . 'Array/SRF_Array.php';
 90+$wgAutoloadClasses['SRFValueRank'] = $formatDir . 'ValueRank/SRF_ValueRank.php';
 91+$wgAutoloadClasses['SRFD3Line'] = $formatDir . 'D3/SRF_D3Line.php';
 92+$wgAutoloadClasses['SRFD3Bar'] = $formatDir . 'D3/SRF_D3Bar.php';
 93+$wgAutoloadClasses['SRFD3Treemap'] = $formatDir . 'D3/SRF_D3Treemap.php';
 94+
 95+unset( $formatDir );
 96+
 97+$wgAutoloadClasses['SRFParserFunctions'] = $srfgIP . '/SRF_ParserFunctions.php';
 98+$wgAutoloadClasses['SRFHooks'] = $srfgIP . '/SRF_Hooks.php';
 99+
 100+$wgHooks['AdminLinks'][] = 'SRFHooks::addToAdminLinks';
 101+$wgHooks['ParserFirstCallInit'][] = 'SRFParserFunctions::registerFunctions';
 102+
 103+// FIXME: Can be removed when new style magic words are used (introduced in r52503)
 104+$wgHooks['LanguageGetMagic'][] = 'SRFParserFunctions::languageGetMagic';
 105+
77106 /**
78107 * Autoload the query printer classes and associate them with their formats in the $smwgResultFormats array.
79108 *
@@ -81,32 +110,6 @@
82111 function srffInitFormats() {
83112 global $srfgFormats, $smwgResultFormats, $smwgResultAliases, $wgAutoloadClasses;
84113
85 - $formatDir = dirname( __FILE__ ) . '/';
86 -
87 - $wgAutoloadClasses['SRFTimeline'] = $formatDir . 'Timeline/SRF_Timeline.php';
88 - $wgAutoloadClasses['SRFvCard'] = $formatDir . 'vCard/SRF_vCard.php';
89 - $wgAutoloadClasses['SRFiCalendar'] = $formatDir . 'iCalendar/SRF_iCalendar.php';
90 - $wgAutoloadClasses['SRFBibTeX'] = $formatDir . 'BibTeX/SRF_BibTeX.php';
91 - $wgAutoloadClasses['SRFCalendar'] = $formatDir . 'Calendar/SRF_Calendar.php';
92 - $wgAutoloadClasses['SRFOutline'] = $formatDir . 'Outline/SRF_Outline.php';
93 - $wgAutoloadClasses['SRFMath'] = $formatDir . 'Math/SRF_Math.php';
94 - $wgAutoloadClasses['SRFExhibit'] = $formatDir . 'Exhibit/SRF_Exhibit.php';
95 - $wgAutoloadClasses['SRFGoogleBar'] = $formatDir . 'GoogleCharts/SRF_GoogleBar.php';
96 - $wgAutoloadClasses['SRFGooglePie'] = $formatDir . 'GoogleCharts/SRF_GooglePie.php';
97 - $wgAutoloadClasses['SRFjqPlotPie'] = $formatDir . 'jqPlot/SRF_jqPlotPie.php';
98 - $wgAutoloadClasses['SRFjqPlotBar'] = $formatDir . 'jqPlot/SRF_jqPlotBar.php';
99 - $wgAutoloadClasses['SRFGraph'] = $formatDir . 'GraphViz/SRF_Graph.php';
100 - $wgAutoloadClasses['SRFProcess'] = $formatDir . 'GraphViz/SRF_Process.php';
101 - $wgAutoloadClasses['SRFPloticusVBar'] = $formatDir . 'Ploticus/SRF_PloticusVBar.php';
102 - $wgAutoloadClasses['SRFGallery'] = $formatDir . 'Gallery/SRF_Gallery.php';
103 - $wgAutoloadClasses['SRFTagCloud'] = $formatDir . 'TagCloud/SRF_TagCloud.php';
104 - $wgAutoloadClasses['SRFArray'] = $formatDir . 'Array/SRF_Array.php';
105 - $wgAutoloadClasses['SRFHash'] = $formatDir . 'Array/SRF_Array.php';
106 - $wgAutoloadClasses['SRFValueRank'] = $formatDir . 'ValueRank/SRF_ValueRank.php';
107 - $wgAutoloadClasses['SRFD3Line'] = $formatDir . 'D3/SRF_D3Line.php';
108 - $wgAutoloadClasses['SRFD3Bar'] = $formatDir . 'D3/SRF_D3Bar.php';
109 - $wgAutoloadClasses['SRFD3Treemap'] = $formatDir . 'D3/SRF_D3Treemap.php';
110 -
111114 $formatClasses = array(
112115 'timeline' => 'SRFTimeline',
113116 'eventline' => 'SRFTimeline',
@@ -148,11 +151,6 @@
149152 if ( array_key_exists( $format, $formatClasses ) ) {
150153 $smwgResultFormats[$format] = $formatClasses[$format];
151154
152 - // Register the resource loader modules for when they are supported.
153 - if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) && method_exists( $formatClasses[$format], 'registerResourceModules' ) ) {
154 - call_user_func( array( $formatClasses[$format], 'registerResourceModules' ) );
155 - }
156 -
157155 if ( isset( $smwgResultAliases ) && array_key_exists( $format, $formatAliases ) ) {
158156 $smwgResultAliases[$format] = $formatAliases[$format];
159157 }
@@ -160,23 +158,7 @@
161159 else {
162160 wfDebug( "There is not result format class associated with the format '$format'." );
163161 }
164 - }
 162+ }
165163 }
166164
167 -/**
168 - * Adds a link to Admin Links page.
169 - */
170 -function srffAddToAdminLinks( &$admin_links_tree ) {
171 - $displaying_data_section = $admin_links_tree->getSection( wfMsg( 'smw_adminlinks_displayingdata' ) );
172 -
173 - // Escape is SMW hasn't added links.
174 - if ( is_null( $displaying_data_section ) ) {
175 - return true;
176 - }
177 -
178 - $smw_docu_row = $displaying_data_section->getRow( 'smw' );
179 - $srf_docu_label = wfMsg( 'adminlinks_documentation', wfMsg( 'srf-name' ) );
180 - $smw_docu_row->addItem( AlItem::newFromExternalLink( 'http://www.mediawiki.org/wiki/Extension:Semantic_Result_Formats', $srf_docu_label ) );
181 -
182 - return true;
183 -}
 165+

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103331cleanup of stuff added in r103330 and a bunch of others things as welljeroendedauw15:57, 16 November 2011