r84342 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84341‎ | r84342 | r84343 >
Date:19:10, 19 March 2011
Author:raylton.sousa
Status:deferred (Comments)
Tags:
Comment:
*Fix Bug 28115 (BookManager should process the list of chapters only one time per page)
*Fix Bug 28116 (Optimize function addText to avoid unecessary processing)
*Reorganizing and commenting code
*by the way, thanks for your last contribution iAlex!
Modified paths:
  • /trunk/extensions/BookManager/BookManager.body.php (modified) (history)
  • /trunk/extensions/BookManager/BookManager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BookManager/BookManager.body.php
@@ -1,77 +1,13 @@
22 <?php
3 -/**** All the BookManager Variables Functions ****/
43 class BookManagerFunctions {
 4+/**
 5+* BookManager private functions [Core]
 6+*/
57 const VERSION = "0.1.6 ";
6 -
7 - static function register( $parser ) {
8 - # optional SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
9 - # instead of {{#int:...}})
10 - $parser->setFunctionHook( 'prevpagename', array( __CLASS__, 'prevpagename' ), SFH_NO_HASH );
11 - $parser->setFunctionHook( 'prevpagenamee', array( __CLASS__, 'prevpagenamee' ), SFH_NO_HASH );
12 - $parser->setFunctionHook( 'nextpagename', array( __CLASS__, 'nextpagename' ), SFH_NO_HASH );
13 - $parser->setFunctionHook( 'nextpagenamee', array( __CLASS__, 'nextpagenamee' ), SFH_NO_HASH );
14 - $parser->setFunctionHook( 'rootpagename', array( __CLASS__, 'rootpagename' ), SFH_NO_HASH );
15 - $parser->setFunctionHook( 'rootpagenamee', array( __CLASS__, 'rootpagenamee' ), SFH_NO_HASH );
16 - $parser->setFunctionHook( 'chaptername', array( __CLASS__, 'chaptername' ), SFH_NO_HASH );
17 - $parser->setFunctionHook( 'chapternamee', array( __CLASS__, 'chapternamee' ), SFH_NO_HASH );
18 -
19 - return true;
20 - }
21 - /**** All the BookManager functions to declare magicword id ****/
22 - static function DeclareVarIds( &$aCustomVariableIds ) {
23 - # aCustomVariableIds is where MediaWiki wants to store its
24 - # list of custom variable ids. We oblige by adding ours:
25 - $aCustomVariableIds[] = 'prevpagename';
26 - $aCustomVariableIds[] = 'prevpagenamee';
27 - $aCustomVariableIds[] = 'nextpagename';
28 - $aCustomVariableIds[] = 'nextpagenamee';
29 - $aCustomVariableIds[] = 'rootpagename';
30 - $aCustomVariableIds[] = 'rootpagenamee';
31 - $aCustomVariableIds[] = 'chaptername';
32 - $aCustomVariableIds[] = 'chapternamee';
33 - return true;
34 - }
35 - /**** All the BookManager functions to declare magicwords ****/
36 - static function LanguageGetMagic( &$magicWords, $langCode = "en" ) {
37 - # PREVPAGENAME
38 - $magicWords['prevpagename'] = array ( 0, 'PREVPAGENAME' );
39 - # PREVPAGENAME
40 - $magicWords['prevpagenamee'] = array ( 0, 'PREVPAGENAMEE' );
41 - # NEXTPAGENAME
42 - $magicWords['nextpagename'] = array ( 0, 'NEXTPAGENAME' );
43 - # NEXTPAGENAMEE
44 - $magicWords['nextpagenamee'] = array ( 0, 'NEXTPAGENAMEE' );
45 - # ROOTPAGENAME
46 - $magicWords['rootpagename'] = array ( 0, 'ROOTPAGENAME' , 'BOOKNAME' );
47 - # ROOTPAGENAMEE
48 - $magicWords['rootpagenamee'] = array ( 0, 'ROOTPAGENAMEE' , 'BOOKNAMEE' );
49 - # CHAPTERNAME
50 - $magicWords['chaptername'] = array ( 0, 'CHAPTERNAME' );
51 - # CHAPTERNAMEE
52 - $magicWords['chapternamee'] = array ( 0, 'CHAPTERNAMEE' );
53 -
54 - return true;
55 - }
56 -/**** All the BookManager private functions ****/
57 -
58 -
59 - /*
60 - * Check if action is suported
61 - * @return Bool
62 - */
63 - private static function isViewAction() {
64 - global $wgRequest;
65 - $action = $wgRequest->getVal( 'action', 'view' );
66 - if( $action == 'view' || $action == 'purge' ){
67 - return true;
68 - }
69 - else{
70 - return false;
71 - }
72 - }
73 -
74 - /*
 8+ private static $chapterList;
 9+ /**
7510 * Get Title
 11+ * @return Object
7612 */
7713 private static function newTitleObject( &$parser, $text = null ) {
7814 $t = Title::newFromText( $text );
@@ -82,7 +18,7 @@
8319 }
8420
8521
86 - /*
 22+ /**
8723 * Adaptation of the function "getBookPagePrefixes" from collection extension
8824 * (http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Collection/Collection.body.php?revision=79895&view=markup#l440)
8925 */
@@ -115,7 +51,7 @@
11652 return $result;
11753 }
11854
119 - /*
 55+ /**
12056 * Simplification of the function "parseCollectionLine" from collection extension
12157 * (http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Collection/Collection.body.php?revision=79895&view=markup#l709)
12258 */
@@ -142,7 +78,7 @@
14379 return null;
14480 }
14581
146 - /*
 82+ /**
14783 * Adaptation of the function "loadCollection" from collection extension
14884 * (http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/Collection/Collection.body.php?revision=79895&view=markup#l780)
14985 */
@@ -162,19 +98,20 @@
16399 }
164100 return $caps;
165101 }
166 -
167 - #Get the book or chapter name
168 - private static function bookparts( &$parser, $text = null, $part = 1) {
 102+ /**
 103+ * Get the book or chapter name
 104+ */
 105+ private static function bookparts( &$parser, $text = null, $part = 1 ) {
169106 $t = self::newTitleObject( $parser, $text );
170107 // No book should have '/' in it's name, so...
171108 $book = explode( "/", $t->getText(), 2 ); // ...given a page with title like 'Foo/Bar/Baz'...
172 - if ( count($book) > 1 ) {
173 - return $book[$part];//... $book[0] is Foo, the book name, and $book[1] is Bar/Baz, the chapter name.
 109+ if ( count( $book ) > 1 ) {
 110+ return $book[$part];// ... $book[0] is Foo, the book name, and $book[1] is Bar/Baz, the chapter name.
174111 }
175 - else{
 112+ else {
176113 return $t;
177114 }
178 -
 115+
179116 }
180117 /**
181118 * Get the prefixed title of a page near the given page.
@@ -186,26 +123,77 @@
187124 private static function pageText( &$parser, $text = null, $n = 0 ) {
188125 $pagetitle = self::newTitleObject( $parser, $text );
189126 $prefixes = self::getBookPagePrefixes();
190 - $booktitle = Title::newFromText( $prefixes['community-prefix'] . self::bookparts( $parser, $text, 0) ); // ...the book name will be 'Foo'.
 127+ $booktitle = Title::newFromText( $prefixes['community-prefix'] . self::bookparts( $parser, $text, 0 ) ); // ...the book name will be 'Foo'.
191128
192 - $cap = self::loadListFromCollection( $booktitle );
193 - if ( $cap === false ) {
 129+ if ( !self::$chapterList ) {
 130+ self::$chapterList = self::loadListFromCollection( $booktitle );
 131+ }
 132+ if ( self::$chapterList === false ) {
194133 return '';
195134 }
196 - $current = array_search( $pagetitle, $cap );
197 - if ( $current === false || !isset( $cap[ $current + $n ] ) ) {
 135+ $current = array_search( $pagetitle, self::$chapterList );
 136+ if ( $current === false || !isset( self::$chapterList[ $current + $n ] ) ) {
198137 return '';
199138 }
200 - $otherpagetitle = Title::newFromText( $cap[ $current + $n ] );
 139+ $otherpagetitle = Title::newFromText( self::$chapterList[ $current + $n ] );
201140 if ( is_null( $otherpagetitle ) ) {
202141 return '';
203142 }
204143 return wfEscapeWikiText( $otherpagetitle->getText() );
205144 }
 145+/**
 146+* BookManager Functions [Variables]
 147+*/
 148+ static function register( $parser ) {
 149+ # optional SFH_NO_HASH to omit the hash from calls (e.g. {{int:...}}
 150+ # instead of {{#int:...}})
 151+ $parser->setFunctionHook( 'prevpagename', array( __CLASS__, 'prevpagename' ), SFH_NO_HASH );
 152+ $parser->setFunctionHook( 'prevpagenamee', array( __CLASS__, 'prevpagenamee' ), SFH_NO_HASH );
 153+ $parser->setFunctionHook( 'nextpagename', array( __CLASS__, 'nextpagename' ), SFH_NO_HASH );
 154+ $parser->setFunctionHook( 'nextpagenamee', array( __CLASS__, 'nextpagenamee' ), SFH_NO_HASH );
 155+ $parser->setFunctionHook( 'rootpagename', array( __CLASS__, 'rootpagename' ), SFH_NO_HASH );
 156+ $parser->setFunctionHook( 'rootpagenamee', array( __CLASS__, 'rootpagenamee' ), SFH_NO_HASH );
 157+ $parser->setFunctionHook( 'chaptername', array( __CLASS__, 'chaptername' ), SFH_NO_HASH );
 158+ $parser->setFunctionHook( 'chapternamee', array( __CLASS__, 'chapternamee' ), SFH_NO_HASH );
206159
207 -/**** All the BookManager values functions ****/
 160+ return true;
 161+ }
 162+ # Function to declare magicword id
 163+ static function DeclareVarIds( &$aCustomVariableIds ) {
 164+ # aCustomVariableIds is where MediaWiki wants to store its
 165+ # list of custom variable ids. We oblige by adding ours:
 166+ $aCustomVariableIds[] = 'prevpagename';
 167+ $aCustomVariableIds[] = 'prevpagenamee';
 168+ $aCustomVariableIds[] = 'nextpagename';
 169+ $aCustomVariableIds[] = 'nextpagenamee';
 170+ $aCustomVariableIds[] = 'rootpagename';
 171+ $aCustomVariableIds[] = 'rootpagenamee';
 172+ $aCustomVariableIds[] = 'chaptername';
 173+ $aCustomVariableIds[] = 'chapternamee';
 174+ return true;
 175+ }
 176+ # Function to declare magicwords
 177+ static function LanguageGetMagic( &$magicWords, $langCode = "en" ) {
 178+ # PREVPAGENAME
 179+ $magicWords['prevpagename'] = array ( 0, 'PREVPAGENAME' );
 180+ # PREVPAGENAME
 181+ $magicWords['prevpagenamee'] = array ( 0, 'PREVPAGENAMEE' );
 182+ # NEXTPAGENAME
 183+ $magicWords['nextpagename'] = array ( 0, 'NEXTPAGENAME' );
 184+ # NEXTPAGENAMEE
 185+ $magicWords['nextpagenamee'] = array ( 0, 'NEXTPAGENAMEE' );
 186+ # ROOTPAGENAME
 187+ $magicWords['rootpagename'] = array ( 0, 'ROOTPAGENAME' , 'BOOKNAME' );
 188+ # ROOTPAGENAMEE
 189+ $magicWords['rootpagenamee'] = array ( 0, 'ROOTPAGENAMEE' , 'BOOKNAMEE' );
 190+ # CHAPTERNAME
 191+ $magicWords['chaptername'] = array ( 0, 'CHAPTERNAME' );
 192+ # CHAPTERNAMEE
 193+ $magicWords['chapternamee'] = array ( 0, 'CHAPTERNAMEE' );
208194
209 -
 195+ return true;
 196+ }
 197+ # Values functions
210198 static function prevpagename( &$parser, $text = null ) {
211199 $t = self::pageText( $parser, $text, - 1 );
212200 return $t;
@@ -217,7 +205,7 @@
218206 }
219207
220208 static function nextpagename( &$parser, $text = null ) {
221 -
 209+
222210 $t = self::pageText( $parser, $text, + 1 );
223211 return $t;
224212 }
@@ -227,24 +215,23 @@
228216 return wfUrlEncode( $t );
229217 }
230218 static function rootpagename( &$parser, $text = null ) {
231 - $t = self::bookparts( $parser, $text, 0);
 219+ $t = self::bookparts( $parser, $text, 0 );
232220 return $t;
233221 }
234222 static function rootpagenamee( &$parser, $text = null ) {
235 - $t = self::bookparts( $parser, $text, 0);
 223+ $t = self::bookparts( $parser, $text, 0 );
236224 return wfUrlEncode( $t );
237225 }
238226 static function chaptername( &$parser, $text = null ) {
239 - $t = self::bookparts( $parser, $text, 1);
 227+ $t = self::bookparts( $parser, $text, 1 );
240228 return $t;
241229 }
242230 static function chapternamee( &$parser, $text = null ) {
243 - $t = self::bookparts( $parser, $text, 1);
 231+ $t = self::bookparts( $parser, $text, 1 );
244232 return wfUrlEncode( $t );
245233 }
246234
247 -/**** All the BookManagerFunctions for use with MW Variables on the current page ****/
248 -
 235+ # Function for use with MW Variables on the current page
249236 static function AssignAValue( &$parser, &$cache, &$magicWordId, &$ret ) {
250237 switch( $magicWordId ) {
251238 case 'prevpagename':
@@ -274,75 +261,91 @@
275262 }
276263 return false;
277264 }
278 -
279 -
 265+
280266 /**
281 -* Function that adds navigation bar
 267+* BookManager Functions [Navigation Bar]
282268 * inspired by PageNotice extension
283 -* (http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/PageNotice/PageNotice.php)
 269+* (http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/PageNotice/PageNotice.php&view=markup)
284270 */
285271
 272+
286273 static function addText( &$out, &$text ) {
287 - global $wgParser, $wgBookManagerNamespaces, $wgBookManagerNavbar;
 274+ global $wgRequest, $wgBookManagerNamespaces, $wgBookManagerNavBar;
288275 $ns = $out->getTitle()->getNamespace();
 276+ # Return True if action is suported
 277+ $action = $wgRequest->getVal( 'action', 'view' );
 278+ $isViewAction = ( $action == 'view' || $action == 'purge' );
 279+ if ( !$wgBookManagerNavBar || !in_array( $ns, $wgBookManagerNamespaces ) || !$isViewAction ) {
 280+ return true;
 281+ }
289282 $opt = array(
290283 'parseinline',
291284 );
 285+ # Get $out title
292286 $currenttitletext = $out->getTitle()->getText();
293 - $prev = self::pageText( $wgParser, $currenttitletext, - 1 );
294 - $base = Title::newFromText($currenttitletext)->getBaseText();
295 - $next = self::pageText( $wgParser, $currenttitletext, + 1 );
296 - $prevtext = ( $prev !== '' ) ? Title::newFromText( $prev )->getSubpageText(): '' ;
297 - $basetext = Title::newFromText( $base )->getSubpageText();
298 - $nexttext = ( $next !== '' ) ? Title::newFromText( $next )->getSubpageText(): '' ;
299 - $prevlink = ( $prev !== '' ) ? Title::newFromText( $prev )->getLocalURL(): '' ;
300 - $baselink = Title::newFromText( $base )->getLocalURL();
301 - $nextlink = ( $next !== '' ) ? Title::newFromText( $next )->getLocalURL(): '' ;
302 - $bar = Xml::openElement('ul',array('class'=>'mw-book-navigation') );
303 - $bar .= ( $prev !== '' ) ? Xml::openElement('li',array('class'=>'mw-prev') ): '' ;
304 - $bar .= ( $prev !== '' ) ? Xml::element('a',array('href'=>$prevlink,'title'=>$prev ),$prevtext): '' ;
305 - $bar .= ( $prev !== '' ) ? Xml::closeElement('li'): '' ;
306 - $bar .= Xml::openElement('li',array('class'=>'mw-index') );
307 - $bar .= Xml::element('a',array('href'=>$baselink,'title'=>$base ),$basetext);
308 - $bar .= Xml::closeElement('li');
309 - $bar .= ( $next !== '' ) ? Xml::openElement('li',array('class'=>'mw-next') ): '' ;
310 - $bar .= ( $next !== '' ) ? Xml::element('a',array('href'=>$nextlink,'title'=>$next ),$nexttext): '' ;
311 - $bar .= ( $next !== '' ) ? Xml::closeElement('li'): '' ;
312 - $bar .= Xml::closeElement('ul');
313 - $is_inBookList = ( $prev !== '' || $next !== '' ) ? true : false ;
314 - #adds system messages or html
315 - if ( $wgBookManagerNavbar && in_array($ns,$wgBookManagerNamespaces) && self::isViewAction() && $is_inBookList ) {
316 - $BookManager = wfMsgExt( "BookManager", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext);
317 - $BookManagerTop = wfMsgExt( "BookManager-top", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
318 - $BookManagerBottom = wfMsgExt( "BookManager-bottom", $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
319 - if ( !wfEmptyMsg( "BookManager-top", $BookManagerTop ) ) {
320 - $text = "<div>$BookManagerTop</div>\n$text";
 287+ # Get: prev, next and base chapter from the list
 288+ $prev = self::pageText( $parser, $currenttitletext, - 1 );
 289+
 290+ $next = self::pageText( $parser, $currenttitletext, + 1 );
 291+ if ( $prev === '' && $next === '' ) {
 292+ return true;
 293+ }
 294+ # Return True if page exists in the chapter list
 295+ $is_inChapterList = ( $prev !== '' || $next !== '' );
 296+ # Return True if Message is non empty
 297+ $MsgIsEmpty = ( wfEmptyMsg( "BookManager" )
 298+ && wfEmptyMsg( "BookManager-top" )
 299+ && wfEmptyMsg( "BookManager-bottom" ));
 300+ # Generate HTML or system messages values( $1 for $prev, $2 for $prevtext, $3 for $base, $4 for $basetext, $5 for $next and $6 for $nexttext ).
 301+ $prevtext = ( $prev !== '' ) ? Title::newFromText( $prev )->getSubpageText(): '' ;
 302+ $nexttext = ( $next !== '' ) ? Title::newFromText( $next )->getSubpageText(): '' ;
 303+ if ( $MsgIsEmpty ) {
 304+ $defaultBar = Xml::openElement( 'ul', array( 'class' => 'mw-book-navigation' ) );
 305+ if ( $prev !== '' ) {
 306+ $prevlink = Title::newFromText( $prev )->getLocalURL();
 307+ $defaultBar .= Xml::openElement( 'li', array( 'class' => 'mw-prev' ) );
 308+ $defaultBar .= Xml::element( 'a', array( 'href' => $prevlink, 'title' => $prev ), $prevtext );
 309+ $defaultBar .= Xml::closeElement( 'li' );
321310 }
322 - elseif ( !wfEmptyMsg( "BookManager", $BookManager ) ) {
323 - $text = "<div>$BookManager</div>\n$text";
 311+ $base = Title::newFromText( $currenttitletext )->getBaseText();
 312+ $basetext = Title::newFromText( $base )->getSubpageText();
 313+ $baselink = Title::newFromText( $base )->getLocalURL();
 314+ $defaultBar .= Xml::openElement( 'li', array( 'class' => 'mw-index' ) );
 315+ $defaultBar .= Xml::element( 'a', array( 'href' => $baselink, 'title' => $base ), $basetext );
 316+ $defaultBar .= Xml::closeElement( 'li' );
 317+ if ( $next !== '' ) {
 318+ $nextlink = Title::newFromText( $next )->getLocalURL();
 319+ $defaultBar .= Xml::openElement( 'li', array( 'class' => 'mw-next' ) );
 320+ $defaultBar .= Xml::element( 'a', array( 'href' => $nextlink, 'title' => $next ), $nexttext );
 321+ $defaultBar .= Xml::closeElement( 'li' );
324322 }
325 - #This part adds directly to the html by default when the messages are not defined ...
326 - else {
327 - $text = "$bar\n$text";
328 - }
329 - if ( !wfEmptyMsg( "BookManager-bottom", $BookManagerBottom ) ) {
330 - $text = "$text\n<div>$BookManagerBottom</div>";
331 - }
332 - elseif ( !wfEmptyMsg( "BookManager", $BookManager ) ) {
333 - $text = "$text\n<div>$BookManager</div>";
334 - }
335 - #This part adds directly to the html by default when the messages are not defined ...
336 - else {
337 - $text = "$text\n$bar";
338 - }
339 - }
340 - return true;
341 - }
342 - #adds CSS and JS to navigation bar
 323+ $defaultBar .= Xml::closeElement( 'ul' );
 324+ }
 325+ # Gets navigation bar from custom system messages or from default defined above
 326+ $customBoth = wfEmptyMsg( 'BookManager' ) ? false : 'BookManager';
 327+ $customTop = wfEmptyMsg( 'BookManager-top' ) ? $customBoth : 'BookManager-top';
 328+ $customBottom = wfEmptyMsg( 'BookManager-bottom' ) ? $customBoth : 'BookManager-bottom';
 329+ $opt = array(
 330+ 'parseinline',
 331+ );
 332+ if ( $customTop ) {
 333+ $top = wfMsgExt( $customTop, $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
 334+ } else {
 335+ $top = $defaultBar;
 336+ }
 337+ if ( $customBottom ) {
 338+ $bottom = wfMsgExt( $customBottom, $opt, $prev, $prevtext, $base, $basetext, $next, $nexttext );
 339+ } else {
 340+ $bottom = $defaultBar;
 341+ }
 342+ # Adds navigation before and after the page text
 343+ $text = "<div>$top</div>\n$text\n<div>$bottom</div>";
 344+ return true;
 345+ }
 346+ # adds CSS and JS to navigation bar
343347 static function injectStyleAndJS( &$out, &$sk ) {
344 - $out->addModuleStyles('ext.BookManager');
345 - $out->addModules( 'ext.BookManager');
 348+ $out->addModuleStyles( 'ext.BookManager' );
 349+ $out->addModules( 'ext.BookManager' );
346350 return true;
347351 }
348352 }
349 -
Index: trunk/extensions/BookManager/BookManager.php
@@ -35,7 +35,7 @@
3636 if ( !defined( 'MEDIAWIKI' ) ) {
3737 die( 'This file is a MediaWiki extension, it is not a valid entry point' );
3838 }
39 -$dir = dirname( __FILE__ );
 39+$dir = dirname( __FILE__ );
4040 $wgAutoloadClasses['BookManagerFunctions'] = $dir . '/BookManager.body.php';
4141
4242 /**** extension basics ****/
@@ -43,7 +43,7 @@
4444 'path' => __FILE__,
4545 'name' => 'BookManager',
4646 'version' => BookManagerFunctions::VERSION,
47 - 'author' => array('Raylton P. Sousa', 'Helder.wiki'),
 47+ 'author' => array( 'Raylton P. Sousa', 'Helder.wiki' ),
4848 'url' => 'http://www.mediawiki.org/wiki/Extension:BookManager',
4949 'description' => 'Tools for books',
5050 );
@@ -52,12 +52,12 @@
5353 'scripts' => 'bookmanager.js',
5454 'styles' => 'bookmanager.css',
5555 'messages' => array( 'BookManager', 'BookManager-top', 'BookManager-bottom' ),
56 - 'dependencies' => array( 'jquery', 'mediawiki.util'),
 56+ 'dependencies' => array( 'jquery', 'mediawiki.util' ),
5757 'localBasePath' => $dir,
5858 'remoteExtPath' => 'BookManager'
5959 );
60 -$wgBookManagerNamespaces = array( NS_MAIN );
61 -$wgBookManagerNavbar = true;
 60+$wgBookManagerNamespaces = array( NS_MAIN );
 61+$wgBookManagerNavBar = true;
6262 /* Copyied from extensions/Collection/Collection.php */
6363 /** Namespace for "community books" */
6464 $wgCommunityCollectionNamespace = NS_PROJECT;
@@ -75,3 +75,4 @@
7676
7777 $wgHooks['BeforePageDisplay'][] = 'BookManagerFunctions::injectStyleAndJS';
7878
 79+

Comments

#Comment by He7d3r (talk | contribs)   20:22, 19 March 2011

If $wgParser is not to be used (is it?), it should be replaced by something that is defined. There is no $parser defined in the escope of addText function[1], so it shouldn't be passed to the function pageText.

[1] You can check this adding

$testing = $parser;

to the line before

$prev = self::pageText( $parser, $currenttitletext, - 1 );

There will be an error like this:

Notice: Undefined variable: parser in /var/www/wikilocal/extensions/BookManager/BookManager.body.php on line 287

Status & tagging log