MediaWiki REL1_31
ExtParserFunctions.php
Go to the documentation of this file.
1<?php
2
4 public static $mExprParser;
5 public static $mTimeCache = [];
6 public static $mTimeChars = 0;
7 public static $mMaxTimeChars = 6000; # ~10 seconds
8
13 public static function clearState( $parser ) {
14 self::$mTimeChars = 0;
15 return true;
16 }
17
23 public static function registerClearHook() {
24 static $done = false;
25 if ( !$done ) {
26 global $wgHooks;
27 $wgHooks['ParserClearState'][] = __CLASS__ . '::clearState';
28 $done = true;
29 }
30 }
31
35 public static function &getExprParser() {
36 if ( !isset( self::$mExprParser ) ) {
37 self::$mExprParser = new ExprParser;
38 }
39 return self::$mExprParser;
40 }
41
47 public static function expr( $parser, $expr = '' ) {
48 try {
49 return self::getExprParser()->doExpression( $expr );
50 } catch ( ExprError $e ) {
51 return '<strong class="error">' . htmlspecialchars( $e->getMessage() ) . '</strong>';
52 }
53 }
54
62 public static function ifexpr( $parser, $expr = '', $then = '', $else = '' ) {
63 try {
64 $ret = self::getExprParser()->doExpression( $expr );
65 if ( is_numeric( $ret ) ) {
66 $ret = (float)$ret;
67 }
68 if ( $ret ) {
69 return $then;
70 } else {
71 return $else;
72 }
73 } catch ( ExprError $e ) {
74 return '<strong class="error">' . htmlspecialchars( $e->getMessage() ) . '</strong>';
75 }
76 }
77
84 public static function ifexprObj( $parser, $frame, $args ) {
85 $expr = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
86 $then = isset( $args[1] ) ? $args[1] : '';
87 $else = isset( $args[2] ) ? $args[2] : '';
88 $result = self::ifexpr( $parser, $expr, $then, $else );
89 if ( is_object( $result ) ) {
90 $result = trim( $frame->expand( $result ) );
91 }
92 return $result;
93 }
94
101 public static function ifObj( $parser, $frame, $args ) {
102 $test = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
103 if ( $test !== '' ) {
104 return isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : '';
105 } else {
106 return isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : '';
107 }
108 }
109
116 public static function ifeqObj( $parser, $frame, $args ) {
117 $left = isset( $args[0] ) ? self::decodeTrimExpand( $args[0], $frame ) : '';
118 $right = isset( $args[1] ) ? self::decodeTrimExpand( $args[1], $frame ) : '';
119
120 // Strict compare is not possible here. 01 should equal 1 for example.
122 if ( $left == $right ) {
123 return isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : '';
124 } else {
125 return isset( $args[3] ) ? trim( $frame->expand( $args[3] ) ) : '';
126 }
127 }
128
136 public static function iferror( $parser, $test = '', $then = '', $else = false ) {
137 if ( preg_match(
138 '/<(?:strong|span|p|div)\s(?:[^\s>]*\s+)*?class="(?:[^"\s>]*\s+)*?error(?:\s[^">]*)?"/',
139 $test )
140 ) {
141 return $then;
142 } elseif ( $else === false ) {
143 return $test;
144 } else {
145 return $else;
146 }
147 }
148
155 public static function iferrorObj( $parser, $frame, $args ) {
156 $test = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
157 $then = isset( $args[1] ) ? $args[1] : false;
158 $else = isset( $args[2] ) ? $args[2] : false;
159 $result = self::iferror( $parser, $test, $then, $else );
160 if ( $result === false ) {
161 return '';
162 } else {
163 return trim( $frame->expand( $result ) );
164 }
165 }
166
173 public static function switchObj( $parser, $frame, $args ) {
174 if ( count( $args ) === 0 ) {
175 return '';
176 }
177 $primary = self::decodeTrimExpand( array_shift( $args ), $frame );
178 $found = $defaultFound = false;
179 $default = null;
180 $lastItemHadNoEquals = false;
181 $lastItem = '';
182 $mwDefault =& MagicWord::get( 'default' );
183 foreach ( $args as $arg ) {
184 $bits = $arg->splitArg();
185 $nameNode = $bits['name'];
186 $index = $bits['index'];
187 $valueNode = $bits['value'];
188
189 if ( $index === '' ) {
190 # Found "="
191 $lastItemHadNoEquals = false;
192 if ( $found ) {
193 # Multiple input match
194 return trim( $frame->expand( $valueNode ) );
195 } else {
196 $test = self::decodeTrimExpand( $nameNode, $frame );
198 if ( $test == $primary ) {
199 # Found a match, return now
200 return trim( $frame->expand( $valueNode ) );
201 } elseif ( $defaultFound || $mwDefault->matchStartToEnd( $test ) ) {
202 $default = $valueNode;
203 $defaultFound = false;
204 } # else wrong case, continue
205 }
206 } else {
207 # Multiple input, single output
208 # If the value matches, set a flag and continue
209 $lastItemHadNoEquals = true;
210 // $lastItem is an "out" variable
211 $decodedTest = self::decodeTrimExpand( $valueNode, $frame, $lastItem );
213 if ( $decodedTest == $primary ) {
214 $found = true;
215 } elseif ( $mwDefault->matchStartToEnd( $decodedTest ) ) {
216 $defaultFound = true;
217 }
218 }
219 }
220 # Default case
221 # Check if the last item had no = sign, thus specifying the default case
222 if ( $lastItemHadNoEquals ) {
223 return $lastItem;
224 } elseif ( !is_null( $default ) ) {
225 return trim( $frame->expand( $default ) );
226 } else {
227 return '';
228 }
229 }
230
244 public static function rel2abs( $parser , $to = '' , $from = '' ) {
245 $from = trim( $from );
246 if ( $from === '' ) {
247 $from = $parser->getTitle()->getPrefixedText();
248 }
249
250 $to = rtrim( $to, ' /' );
251
252 // if we have an empty path, or just one containing a dot
253 if ( $to === '' || $to === '.' ) {
254 return $from;
255 }
256
257 // if the path isn't relative
258 if ( substr( $to, 0, 1 ) !== '/' &&
259 substr( $to, 0, 2 ) !== './' &&
260 substr( $to, 0, 3 ) !== '../' &&
261 $to !== '..'
262 ) {
263 $from = '';
264 }
265 // Make a long path, containing both, enclose it in /.../
266 $fullPath = '/' . $from . '/' . $to . '/';
267
268 // remove redundant current path dots
269 $fullPath = preg_replace( '!/(\./)+!', '/', $fullPath );
270
271 // remove double slashes
272 $fullPath = preg_replace( '!/{2,}!', '/', $fullPath );
273
274 // remove the enclosing slashes now
275 $fullPath = trim( $fullPath, '/' );
276 $exploded = explode( '/', $fullPath );
277 $newExploded = [];
278
279 foreach ( $exploded as $current ) {
280 if ( $current === '..' ) { // removing one level
281 if ( !count( $newExploded ) ) {
282 // attempted to access a node above root node
283 $msg = wfMessage( 'pfunc_rel2abs_invalid_depth', $fullPath )
284 ->inContentLanguage()->escaped();
285 return '<strong class="error">' . $msg . '</strong>';
286 }
287 // remove last level from the stack
288 array_pop( $newExploded );
289 } else {
290 // add the current level to the stack
291 $newExploded[] = $current;
292 }
293 }
294
295 // we can now join it again
296 return implode( '/', $newExploded );
297 }
298
308 public static function ifexistCommon(
309 $parser, $frame, $titletext = '', $then = '', $else = ''
310 ) {
311 global $wgContLang;
312 $title = Title::newFromText( $titletext );
313 $wgContLang->findVariantLink( $titletext, $title, true );
314 if ( $title ) {
315 if ( $title->getNamespace() === NS_MEDIA ) {
316 /* If namespace is specified as NS_MEDIA, then we want to
317 * check the physical file, not the "description" page.
318 */
319 if ( !$parser->incrementExpensiveFunctionCount() ) {
320 return $else;
321 }
322 $file = wfFindFile( $title );
323 if ( !$file ) {
324 return $else;
325 }
326 $parser->mOutput->addImage(
327 $file->getName(), $file->getTimestamp(), $file->getSha1() );
328 return $file->exists() ? $then : $else;
329 } elseif ( $title->getNamespace() === NS_SPECIAL ) {
330 /* Don't bother with the count for special pages,
331 * since their existence can be checked without
332 * accessing the database.
333 */
334 return SpecialPageFactory::exists( $title->getDBkey() ) ? $then : $else;
335 } elseif ( $title->isExternal() ) {
336 /* Can't check the existence of pages on other sites,
337 * so just return $else. Makes a sort of sense, since
338 * they don't exist _locally_.
339 */
340 return $else;
341 } else {
342 $pdbk = $title->getPrefixedDBkey();
343 $lc = LinkCache::singleton();
344 $id = $lc->getGoodLinkID( $pdbk );
345 if ( $id !== 0 ) {
346 $parser->mOutput->addLink( $title, $id );
347 return $then;
348 } elseif ( $lc->isBadLink( $pdbk ) ) {
349 $parser->mOutput->addLink( $title, 0 );
350 return $else;
351 }
352 if ( !$parser->incrementExpensiveFunctionCount() ) {
353 return $else;
354 }
355 $id = $title->getArticleID();
356 $parser->mOutput->addLink( $title, $id );
357
358 // bug 70495: don't just check whether the ID != 0
359 if ( $title->exists() ) {
360 return $then;
361 }
362 }
363 }
364 return $else;
365 }
366
373 public static function ifexistObj( $parser, $frame, $args ) {
374 $title = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
375 $then = isset( $args[1] ) ? $args[1] : null;
376 $else = isset( $args[2] ) ? $args[2] : null;
377
378 $result = self::ifexistCommon( $parser, $frame, $title, $then, $else );
379 if ( $result === null ) {
380 return '';
381 } else {
382 return trim( $frame->expand( $result ) );
383 }
384 }
385
395 public static function timeCommon(
396 $parser, $frame = null, $format = '', $date = '', $language = '', $local = false
397 ) {
398 global $wgLocaltimezone;
400 if ( $date === '' ) {
401 $cacheKey = $parser->getOptions()->getTimestamp();
402 $timestamp = new MWTimestamp( $cacheKey );
403 $date = $timestamp->getTimestamp( TS_ISO_8601 );
404 $useTTL = true;
405 } else {
406 $cacheKey = $date;
407 $useTTL = false;
408 }
409 if ( isset( self::$mTimeCache[$format][$cacheKey][$language][$local] ) ) {
410 $cachedVal = self::$mTimeCache[$format][$cacheKey][$language][$local];
411 if ( $useTTL
412 && $cachedVal[1] !== null && $frame && is_callable( [ $frame, 'setTTL' ] )
413 ) {
414 $frame->setTTL( $cachedVal[1] );
415 }
416 return $cachedVal[0];
417 }
418
419 # compute the timestamp string $ts
420 # PHP >= 5.2 can handle dates before 1970 or after 2038 using the DateTime object
421
422 $invalidTime = false;
423
424 # the DateTime constructor must be used because it throws exceptions
425 # when errors occur, whereas date_create appears to just output a warning
426 # that can't really be detected from within the code
427 try {
428
429 # Default input timezone is UTC.
430 $utc = new DateTimeZone( 'UTC' );
431
432 # Correct for DateTime interpreting 'XXXX' as XX:XX o'clock
433 if ( preg_match( '/^[0-9]{4}$/', $date ) ) {
434 $date = '00:00 '.$date;
435 }
436
437 # Parse date
438 # UTC is a default input timezone.
439 $dateObject = new DateTime( $date, $utc );
440
441 # Set output timezone.
442 if ( $local ) {
443 if ( isset( $wgLocaltimezone ) ) {
444 $tz = new DateTimeZone( $wgLocaltimezone );
445 } else {
446 $tz = new DateTimeZone( date_default_timezone_get() );
447 }
448 } else {
449 $tz = $utc;
450 }
451 $dateObject->setTimezone( $tz );
452 # Generate timestamp
453 $ts = $dateObject->format( 'YmdHis' );
454
455 } catch ( Exception $ex ) {
456 $invalidTime = true;
457 }
458
459 $ttl = null;
460 # format the timestamp and return the result
461 if ( $invalidTime ) {
462 $result = '<strong class="error">' .
463 wfMessage( 'pfunc_time_error' )->inContentLanguage()->escaped() .
464 '</strong>';
465 } else {
466 self::$mTimeChars += strlen( $format );
467 if ( self::$mTimeChars > self::$mMaxTimeChars ) {
468 return '<strong class="error">' .
469 wfMessage( 'pfunc_time_too_long' )->inContentLanguage()->escaped() .
470 '</strong>';
471 } else {
472 if ( $ts < 0 ) { // Language can't deal with BC years
473 return '<strong class="error">' .
474 wfMessage( 'pfunc_time_too_small' )->inContentLanguage()->escaped() .
475 '</strong>';
476 } elseif ( $ts < 100000000000000 ) { // Language can't deal with years after 9999
477 if ( $language !== '' && Language::isValidBuiltInCode( $language ) ) {
478 // use whatever language is passed as a parameter
479 $langObject = Language::factory( $language );
480 } else {
481 // use wiki's content language
482 $langObject = $parser->getFunctionLang();
483 // $ttl is passed by reference, which doesn't work right on stub objects
484 StubObject::unstub( $langObject );
485 }
486 $result = $langObject->sprintfDate( $format, $ts, $tz, $ttl );
487 } else {
488 return '<strong class="error">' .
489 wfMessage( 'pfunc_time_too_big' )->inContentLanguage()->escaped() .
490 '</strong>';
491 }
492 }
493 }
494 self::$mTimeCache[$format][$cacheKey][$language][$local] = [ $result, $ttl ];
495 if ( $useTTL && $ttl !== null && $frame && is_callable( [ $frame, 'setTTL' ] ) ) {
496 $frame->setTTL( $ttl );
497 }
498 return $result;
499 }
500
509 public static function time(
510 $parser, $format = '', $date = '', $language = '', $local = false
511 ) {
512 return self::timeCommon( $parser, null, $format, $date, $language, $local );
513 }
514
521 public static function timeObj( $parser, $frame, $args ) {
522 $format = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
523 $date = isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : '';
524 $language = isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : '';
525 $local = isset( $args[3] ) && trim( $frame->expand( $args[3] ) );
526 return self::timeCommon( $parser, $frame, $format, $date, $language, $local );
527 }
528
536 public static function localTime( $parser, $format = '', $date = '', $language = '' ) {
537 return self::timeCommon( $parser, null, $format, $date, $language, true );
538 }
539
546 public static function localTimeObj( $parser, $frame, $args ) {
547 $format = isset( $args[0] ) ? trim( $frame->expand( $args[0] ) ) : '';
548 $date = isset( $args[1] ) ? trim( $frame->expand( $args[1] ) ) : '';
549 $language = isset( $args[2] ) ? trim( $frame->expand( $args[2] ) ) : '';
550 return self::timeCommon( $parser, $frame, $format, $date, $language, true );
551 }
552
563 public static function titleparts( $parser, $title = '', $parts = 0, $offset = 0 ) {
564 $parts = (int)$parts;
565 $offset = (int)$offset;
566 $ntitle = Title::newFromText( $title );
567 if ( $ntitle instanceof Title ) {
568 $bits = explode( '/', $ntitle->getPrefixedText(), 25 );
569 if ( count( $bits ) <= 0 ) {
570 return $ntitle->getPrefixedText();
571 } else {
572 if ( $offset > 0 ) {
573 --$offset;
574 }
575 if ( $parts === 0 ) {
576 return implode( '/', array_slice( $bits, $offset ) );
577 } else {
578 return implode( '/', array_slice( $bits, $offset, $parts ) );
579 }
580 }
581 } else {
582 return $title;
583 }
584 }
585
591 private static function checkLength( $text ) {
592 global $wgPFStringLengthLimit;
593 return ( mb_strlen( $text ) < $wgPFStringLengthLimit );
594 }
595
600 private static function tooLongError() {
601 global $wgPFStringLengthLimit;
602 $msg = wfMessage( 'pfunc_string_too_long' )->numParams( $wgPFStringLengthLimit );
603 return '<strong class="error">' . $msg->inContentLanguage()->escaped() . '</strong>';
604 }
605
614 public static function runLen( $parser, $inStr = '' ) {
615 $inStr = $parser->killMarkers( (string)$inStr );
616 return mb_strlen( $inStr );
617 }
618
632 public static function runPos( $parser, $inStr = '', $inNeedle = '', $inOffset = 0 ) {
633 $inStr = $parser->killMarkers( (string)$inStr );
634 $inNeedle = $parser->killMarkers( (string)$inNeedle );
635
636 if ( !self::checkLength( $inStr ) ||
637 !self::checkLength( $inNeedle ) ) {
638 return self::tooLongError();
639 }
640
641 if ( $inNeedle === '' ) {
642 $inNeedle = ' ';
643 }
644
645 $pos = mb_strpos( $inStr, $inNeedle, min( (int)$inOffset, mb_strlen( $inStr ) ) );
646 if ( $pos === false ) {
647 $pos = '';
648 }
649
650 return $pos;
651 }
652
665 public static function runRPos( $parser, $inStr = '', $inNeedle = '' ) {
666 $inStr = $parser->killMarkers( (string)$inStr );
667 $inNeedle = $parser->killMarkers( (string)$inNeedle );
668
669 if ( !self::checkLength( $inStr ) ||
670 !self::checkLength( $inNeedle ) ) {
671 return self::tooLongError();
672 }
673
674 if ( $inNeedle === '' ) {
675 $inNeedle = ' ';
676 }
677
678 $pos = mb_strrpos( $inStr, $inNeedle );
679 if ( $pos === false ) {
680 $pos = -1;
681 }
682
683 return $pos;
684 }
685
704 public static function runSub( $parser, $inStr = '', $inStart = 0, $inLength = 0 ) {
705 $inStr = $parser->killMarkers( (string)$inStr );
706
707 if ( !self::checkLength( $inStr ) ) {
708 return self::tooLongError();
709 }
710
711 if ( (int)$inLength === 0 ) {
712 $result = mb_substr( $inStr, (int)$inStart );
713 } else {
714 $result = mb_substr( $inStr, (int)$inStart, (int)$inLength );
715 }
716
717 return $result;
718 }
719
731 public static function runCount( $parser, $inStr = '', $inSubStr = '' ) {
732 $inStr = $parser->killMarkers( (string)$inStr );
733 $inSubStr = $parser->killMarkers( (string)$inSubStr );
734
735 if ( !self::checkLength( $inStr ) ||
736 !self::checkLength( $inSubStr ) ) {
737 return self::tooLongError();
738 }
739
740 if ( $inSubStr === '' ) {
741 $inSubStr = ' ';
742 }
743
744 $result = mb_substr_count( $inStr, $inSubStr );
745
746 return $result;
747 }
748
764 public static function runReplace( $parser, $inStr = '',
765 $inReplaceFrom = '', $inReplaceTo = '', $inLimit = -1 ) {
766 global $wgPFStringLengthLimit;
767
768 $inStr = $parser->killMarkers( (string)$inStr );
769 $inReplaceFrom = $parser->killMarkers( (string)$inReplaceFrom );
770 $inReplaceTo = $parser->killMarkers( (string)$inReplaceTo );
771
772 if ( !self::checkLength( $inStr ) ||
773 !self::checkLength( $inReplaceFrom ) ||
774 !self::checkLength( $inReplaceTo ) ) {
775 return self::tooLongError();
776 }
777
778 if ( $inReplaceFrom === '' ) {
779 $inReplaceFrom = ' ';
780 }
781
782 // Precompute limit to avoid generating enormous string:
783 $diff = mb_strlen( $inReplaceTo ) - mb_strlen( $inReplaceFrom );
784 if ( $diff > 0 ) {
785 $limit = ( ( $wgPFStringLengthLimit - mb_strlen( $inStr ) ) / $diff ) + 1;
786 } else {
787 $limit = -1;
788 }
789
790 $inLimit = (int)$inLimit;
791 if ( $inLimit >= 0 ) {
792 if ( $limit > $inLimit || $limit == -1 ) {
793 $limit = $inLimit;
794 }
795 }
796
797 // Use regex to allow limit and handle UTF-8 correctly.
798 $inReplaceFrom = preg_quote( $inReplaceFrom, '/' );
799 $inReplaceTo = StringUtils::escapeRegexReplacement( $inReplaceTo );
800
801 $result = preg_replace( '/' . $inReplaceFrom . '/u',
802 $inReplaceTo, $inStr, $limit );
803
804 if ( !self::checkLength( $result ) ) {
805 return self::tooLongError();
806 }
807
808 return $result;
809 }
810
827 public static function runExplode(
828 $parser, $inStr = '', $inDiv = '', $inPos = 0, $inLim = null
829 ) {
830 $inStr = $parser->killMarkers( (string)$inStr );
831 $inDiv = $parser->killMarkers( (string)$inDiv );
832
833 if ( $inDiv === '' ) {
834 $inDiv = ' ';
835 }
836
837 if ( !self::checkLength( $inStr ) ||
838 !self::checkLength( $inDiv ) ) {
839 return self::tooLongError();
840 }
841
842 $inDiv = preg_quote( $inDiv, '/' );
843
844 $matches = preg_split( '/' . $inDiv . '/u', $inStr, $inLim );
845
846 if ( $inPos >= 0 && isset( $matches[$inPos] ) ) {
847 $result = $matches[$inPos];
848 } elseif ( $inPos < 0 && isset( $matches[count( $matches ) + $inPos] ) ) {
849 $result = $matches[count( $matches ) + $inPos];
850 } else {
851 $result = '';
852 }
853
854 return $result;
855 }
856
865 public static function runUrlDecode( $parser, $inStr = '' ) {
866 $inStr = $parser->killMarkers( (string)$inStr );
867 if ( !self::checkLength( $inStr ) ) {
868 return self::tooLongError();
869 }
870
871 return urldecode( $inStr );
872 }
873
886 private static function decodeTrimExpand( $obj, $frame, &$trimExpanded = null ) {
887 $expanded = $frame->expand( $obj );
888 $trimExpanded = trim( $expanded );
889 return trim( Sanitizer::decodeCharReferences( $expanded ) );
890 }
891}
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
wfFindFile( $title, $options=[])
Find a file.
if( $line===false) $args
Definition cdb.php:64
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition ExprError.php:19
static ifeqObj( $parser, $frame, $args)
static runUrlDecode( $parser, $inStr='')
{{#urldecode:string}}
static runRPos( $parser, $inStr='', $inNeedle='')
{{#rpos: string | needle}}
static checkLength( $text)
Verifies parameter is less than max string length.
static ifexistCommon( $parser, $frame, $titletext='', $then='', $else='')
static iferrorObj( $parser, $frame, $args)
static expr( $parser, $expr='')
static titleparts( $parser, $title='', $parts=0, $offset=0)
Obtain a specified number of slash-separated parts of a title, e.g.
static ifObj( $parser, $frame, $args)
static runReplace( $parser, $inStr='', $inReplaceFrom='', $inReplaceTo='', $inLimit=-1)
{{replace:string | from | to | limit }}
static switchObj( $parser, $frame, $args)
static runPos( $parser, $inStr='', $inNeedle='', $inOffset=0)
{{#pos: string | needle | offset}}
static tooLongError()
Generates error message.
static runSub( $parser, $inStr='', $inStart=0, $inLength=0)
{{#sub: string | start | length }}
static localTime( $parser, $format='', $date='', $language='')
static rel2abs( $parser, $to='', $from='')
Returns the absolute path to a subpage, relative to the current article title.
static time( $parser, $format='', $date='', $language='', $local=false)
static runLen( $parser, $inStr='')
{{#len:string}}
static runExplode( $parser, $inStr='', $inDiv='', $inPos=0, $inLim=null)
{{#explode:string | delimiter | position | limit}}
static registerClearHook()
Register ParserClearState hook.
static decodeTrimExpand( $obj, $frame, &$trimExpanded=null)
Take a PPNode (-ish thing), expand it, remove entities, and trim.
static timeObj( $parser, $frame, $args)
static runCount( $parser, $inStr='', $inSubStr='')
{{#count: string | substr }}
static ifexpr( $parser, $expr='', $then='', $else='')
static localTimeObj( $parser, $frame, $args)
static iferror( $parser, $test='', $then='', $else=false)
static clearState( $parser)
static ifexistObj( $parser, $frame, $args)
static ifexprObj( $parser, $frame, $args)
static timeCommon( $parser, $frame=null, $format='', $date='', $language='', $local=false)
Library for creating and parsing MW-style timestamps.
static & get( $id)
Factory: creates an object representing an ID.
static exists( $name)
Check if a given name exist as a special page or as a special page alias.
static escapeRegexReplacement( $string)
Escape a string to make it suitable for inclusion in a preg_replace() replacement parameter.
static unstub(&$obj)
Unstubs an object, if it is a stub object.
Represents a title within MediaWiki.
Definition Title.php:39
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57
namespace being checked & $result
Definition hooks.txt:2323
do that in ParserLimitReportFormat instead $parser
Definition hooks.txt:2603
namespace and then decline to actually register it file or subcat img or subcat $title
Definition hooks.txt:964
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition hooks.txt:2005
$wgHooks['ArticleShow'][]
Definition hooks.txt:108
returning false will NOT prevent logging $e
Definition hooks.txt:2176
const NS_SPECIAL
Definition Defines.php:63
const NS_MEDIA
Definition Defines.php:62