diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-28 09:50:25 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-01-28 09:50:25 -0500 |
commit | 5744df39e15f85c6cc8a9faf8924d77e76d2b216 (patch) | |
tree | a8c8dd40a94d1fa0d5377566aa5548ae55a163da /includes/parser/CoreParserFunctions.php | |
parent | 4bb2aeca1d198391ca856aa16c40b8559c68daec (diff) | |
parent | 224b22a051051f6c2e494c3a2fb4adb42898e2d1 (diff) |
Merge branch 'archwiki'
Conflicts:
extensions/FluxBBAuthPlugin.php
extensions/SyntaxHighlight_GeSHi/README
extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.class.php
extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.i18n.php
extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php
extensions/SyntaxHighlight_GeSHi/geshi/docs/CHANGES
extensions/SyntaxHighlight_GeSHi/geshi/docs/THANKS
extensions/SyntaxHighlight_GeSHi/geshi/docs/TODO
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractClass.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractClass_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateClass.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateClass_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/AbstractPrivateMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Class.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Class_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Constant.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Constructor.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Destructor.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Function.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Global.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/I.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Index.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Interface.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Interface_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/L.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Lminus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Lplus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Method.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Page.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Page_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateClass.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateClass_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/PrivateVariable.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/StaticMethod.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/StaticVariable.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/T.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Tminus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Tplus.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/Variable.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/blank.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/class_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/file.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/function_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/next_button.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/next_button_disabled.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/package.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/package_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/previous_button.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/previous_button_disabled.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/private_class_logo.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/tutorial.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/tutorial_folder.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/api/media/images/up_button.png
extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.html
extensions/SyntaxHighlight_GeSHi/geshi/docs/geshi-doc.txt
extensions/SyntaxHighlight_GeSHi/geshi/geshi.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/4cs.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502acme.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502kickass.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/6502tasm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/68000devpac.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/abap.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/actionscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/actionscript3.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ada.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/algol68.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/apache.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/applescript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/apt_sources.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/asm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/asp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/autoconf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/autohotkey.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/autoit.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/avisynth.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/awk.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bascomavr.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bash.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/basic4gl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bibtex.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/blitzbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/bnf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/boo.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/c.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/c_loadrunner.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/c_mac.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/caddcl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cadlisp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cfdg.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cfm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/chaiscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cil.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/clojure.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cmake.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cobol.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/coffeescript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cpp-qt.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cpp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/csharp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/css.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/cuesheet.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/d.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/dcs.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/delphi.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/diff.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/div.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/dos.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/dot.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/e.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ecmascript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/eiffel.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/email.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/epc.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/erlang.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/euphoria.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/f1.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/falcon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/fo.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/fortran.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/freebasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/fsharp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gambas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gdb.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/genero.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/genie.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gettext.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/glsl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gnuplot.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/go.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/groovy.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/gwbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/haskell.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/hicest.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/hq9plus.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/html4strict.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/html5.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/icon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/idl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ini.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/inno.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/intercal.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/io.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/j.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/java.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/java5.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/javascript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/jquery.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/kixtart.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/klonec.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/klonecpp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/latex.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lb.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lisp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/llvm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/locobasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/logtalk.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lolcode.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lotusformulas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lotusscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lsl2.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/lua.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/m68k.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/magiksf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/make.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mapbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/matlab.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mirc.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mmix.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/modula2.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/modula3.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mpasm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mxml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/mysql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/newlisp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/nsis.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oberon2.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/objc.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/objeck.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ocaml-brief.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ocaml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oobas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oracle11.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oracle8.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oxygene.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/oz.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pascal.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pcre.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/per.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/perl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/perl6.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/php-brief.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/php.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pic16.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pike.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pixelbender.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pli.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/plsql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/postgresql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/povray.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/powerbuilder.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/powershell.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/proftpd.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/progress.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/prolog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/properties.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/providex.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/purebasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/pycon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/python.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/q.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/qbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rails.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rebol.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/reg.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/robots.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rpmspec.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/rsplus.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/ruby.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/sas.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/scala.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/scheme.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/scilab.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/sdlbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/smalltalk.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/smarty.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/sql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/systemverilog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/tcl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/teraterm.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/text.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/thinbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/tsql.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/typoscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/unicon.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/uscript.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vala.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vb.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vbnet.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/verilog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vhdl.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/vim.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/visualfoxpro.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/visualprolog.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/whitespace.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/whois.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/winbatch.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xbasic.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xorg_conf.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/xpp.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/yaml.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/z80.php
extensions/SyntaxHighlight_GeSHi/geshi/geshi/zxbasic.php
Diffstat (limited to 'includes/parser/CoreParserFunctions.php')
-rw-r--r-- | includes/parser/CoreParserFunctions.php | 267 |
1 files changed, 174 insertions, 93 deletions
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 8917b6d0..4b6eeca2 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -88,6 +88,8 @@ class CoreParserFunctions { $parser->setFunctionHook( 'pagenamee', array( __CLASS__, 'pagenamee' ), SFH_NO_HASH ); $parser->setFunctionHook( 'fullpagename', array( __CLASS__, 'fullpagename' ), SFH_NO_HASH ); $parser->setFunctionHook( 'fullpagenamee', array( __CLASS__, 'fullpagenamee' ), SFH_NO_HASH ); + $parser->setFunctionHook( 'rootpagename', array( __CLASS__, 'rootpagename' ), SFH_NO_HASH ); + $parser->setFunctionHook( 'rootpagenamee', array( __CLASS__, 'rootpagenamee' ), SFH_NO_HASH ); $parser->setFunctionHook( 'basepagename', array( __CLASS__, 'basepagename' ), SFH_NO_HASH ); $parser->setFunctionHook( 'basepagenamee', array( __CLASS__, 'basepagenamee' ), SFH_NO_HASH ); $parser->setFunctionHook( 'subpagename', array( __CLASS__, 'subpagename' ), SFH_NO_HASH ); @@ -137,9 +139,10 @@ class CoreParserFunctions { $pref = $parser->getOptions()->getDateFormat(); // Specify a different default date format other than the the normal default - // iff the user has 'default' for their setting - if ( $pref == 'default' && $defaultPref ) + // if the user has 'default' for their setting + if ( $pref == 'default' && $defaultPref ) { $pref = $defaultPref; + } $date = $df->reformat( $pref, $date, array( 'match-whole' ) ); return $date; @@ -175,8 +178,8 @@ class CoreParserFunctions { * For links to "wiki"s, or similar software, spaces are encoded as '_', * * @param $parser Parser object - * @param $s String: The text to encode. - * @param $arg String (optional): The type of encoding. + * @param string $s The text to encode. + * @param string $arg (optional): The type of encoding. * @return string */ static function urlencode( $parser, $s = '', $arg = null ) { @@ -184,7 +187,7 @@ class CoreParserFunctions { if ( is_null( $magicWords ) ) { $magicWords = new MagicWordArray( array( 'url_path', 'url_query', 'url_wiki' ) ); } - switch( $magicWords->matchStartToEnd( $arg ) ) { + switch ( $magicWords->matchStartToEnd( $arg ) ) { // Encode as though it's a wiki page, '_' for ' '. case 'url_wiki': @@ -248,14 +251,15 @@ class CoreParserFunctions { # before arriving here; if that's true, then the title can't be created # and the variable will fail. If we can't get a decent title from the first # attempt, url-decode and try for a second. - if( is_null( $title ) ) + if ( is_null( $title ) ) { $title = Title::newFromURL( urldecode( $s ) ); - if( !is_null( $title ) ) { + } + if ( !is_null( $title ) ) { # Convert NS_MEDIA -> NS_FILE - if( $title->getNamespace() == NS_MEDIA ) { + if ( $title->getNamespace() == NS_MEDIA ) { $title = Title::makeTitle( NS_FILE, $title->getDBkey() ); } - if( !is_null( $arg ) ) { + if ( !is_null( $arg ) ) { $text = $title->$func( $arg ); } else { $text = $title->$func(); @@ -269,12 +273,14 @@ class CoreParserFunctions { /** * @param $parser Parser * @param string $num - * @param null $raw - * @return + * @param string $arg + * @return string */ - static function formatnum( $parser, $num = '', $raw = null) { - if ( self::isRaw( $raw ) ) { + static function formatnum( $parser, $num = '', $arg = null ) { + if ( self::matchAgainstMagicword( 'rawsuffix', $arg ) ) { $func = array( $parser->getFunctionLang(), 'parseFormattedNumber' ); + } elseif ( self::matchAgainstMagicword( 'nocommafysuffix', $arg ) ) { + $func = array( $parser->getFunctionLang(), 'formatNumNoSeparators' ); } else { $func = array( $parser->getFunctionLang(), 'formatNum' ); } @@ -351,55 +357,77 @@ class CoreParserFunctions { * title which will normalise to the canonical title * * @param $parser Parser: parent parser - * @param $text String: desired title text + * @param string $text desired title text * @return String */ static function displaytitle( $parser, $text = '' ) { global $wgRestrictDisplayTitle; - #parse a limited subset of wiki markup (just the single quote items) + // parse a limited subset of wiki markup (just the single quote items) $text = $parser->doQuotes( $text ); - #remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever + // remove stripped text (e.g. the UNIQ-QINU stuff) that was generated by tag extensions/whatever $text = preg_replace( '/' . preg_quote( $parser->uniqPrefix(), '/' ) . '.*?' . preg_quote( Parser::MARKER_SUFFIX, '/' ) . '/', '', $text ); - #list of disallowed tags for DISPLAYTITLE - #these will be escaped even though they are allowed in normal wiki text + // list of disallowed tags for DISPLAYTITLE + // these will be escaped even though they are allowed in normal wiki text $bad = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'div', 'blockquote', 'ol', 'ul', 'li', 'hr', 'table', 'tr', 'th', 'td', 'dl', 'dd', 'caption', 'p', 'ruby', 'rb', 'rt', 'rp', 'br' ); - #only requested titles that normalize to the actual title are allowed through - #if $wgRestrictDisplayTitle is true (it is by default) - #mimic the escaping process that occurs in OutputPage::setPageTitle - $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $text, null, array(), array(), $bad ) ); + // disallow some styles that could be used to bypass $wgRestrictDisplayTitle + if ( $wgRestrictDisplayTitle ) { + $htmlTagsCallback = function ( &$params ) { + $decoded = Sanitizer::decodeTagAttributes( $params ); + + if ( isset( $decoded['style'] ) ) { + // this is called later anyway, but we need it right now for the regexes below to be safe + // calling it twice doesn't hurt + $decoded['style'] = Sanitizer::checkCss( $decoded['style'] ); + + if ( preg_match( '/(display|user-select|visibility)\s*:/i', $decoded['style'] ) ) { + $decoded['style'] = '/* attempt to bypass $wgRestrictDisplayTitle */'; + } + } + + $params = Sanitizer::safeEncodeTagAttributes( $decoded ); + }; + } else { + $htmlTagsCallback = null; + } + + // only requested titles that normalize to the actual title are allowed through + // if $wgRestrictDisplayTitle is true (it is by default) + // mimic the escaping process that occurs in OutputPage::setPageTitle + $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $text, $htmlTagsCallback, array(), array(), $bad ) ); $title = Title::newFromText( Sanitizer::stripAllTags( $text ) ); - if( !$wgRestrictDisplayTitle ) { + if ( !$wgRestrictDisplayTitle ) { + $parser->mOutput->setDisplayTitle( $text ); + } elseif ( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) { $parser->mOutput->setDisplayTitle( $text ); - } else { - if ( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) { - $parser->mOutput->setDisplayTitle( $text ); - } } return ''; } - static function isRaw( $param ) { - static $mwRaw; - if ( !$mwRaw ) { - $mwRaw =& MagicWord::get( 'rawsuffix' ); - } - if ( is_null( $param ) ) { + /** + * Matches the given value against the value of given magic word + * + * @param string $magicword magic word key + * @param mixed $value value to match + * @return boolean true on successful match + */ + static private function matchAgainstMagicword( $magicword, $value ) { + if ( strval( $value ) === '' ) { return false; - } else { - return $mwRaw->match( $param ); } + $mwObject = MagicWord::get( $magicword ); + return $mwObject->match( $value ); } static function formatRaw( $num, $raw ) { - if( self::isRaw( $raw ) ) { + if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) { return $num; } else { global $wgContLang; @@ -422,22 +450,22 @@ class CoreParserFunctions { return self::formatRaw( SiteStats::images(), $raw ); } static function numberofadmins( $parser, $raw = null ) { - return self::formatRaw( SiteStats::numberingroup('sysop'), $raw ); + return self::formatRaw( SiteStats::numberingroup( 'sysop' ), $raw ); } static function numberofedits( $parser, $raw = null ) { return self::formatRaw( SiteStats::edits(), $raw ); } static function numberofviews( $parser, $raw = null ) { - return self::formatRaw( SiteStats::views(), $raw ); + global $wgDisableCounters; + return !$wgDisableCounters ? self::formatRaw( SiteStats::views(), $raw ) : ''; } static function pagesinnamespace( $parser, $namespace = 0, $raw = null ) { return self::formatRaw( SiteStats::pagesInNs( intval( $namespace ) ), $raw ); } - static function numberingroup( $parser, $name = '', $raw = null) { + static function numberingroup( $parser, $name = '', $raw = null ) { return self::formatRaw( SiteStats::numberingroup( strtolower( $name ) ), $raw ); } - /** * Given a title, return the namespace name that would be given by the * corresponding magic word @@ -447,44 +475,51 @@ class CoreParserFunctions { */ static function mwnamespace( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return str_replace( '_', ' ', $t->getNsText() ); } static function namespacee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfUrlencode( $t->getNsText() ); } static function namespacenumber( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return $t->getNamespace(); } static function talkspace( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) || !$t->canTalk() ) + if ( is_null( $t ) || !$t->canTalk() ) { return ''; + } return str_replace( '_', ' ', $t->getTalkNsText() ); } static function talkspacee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) || !$t->canTalk() ) + if ( is_null( $t ) || !$t->canTalk() ) { return ''; + } return wfUrlencode( $t->getTalkNsText() ); } static function subjectspace( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return str_replace( '_', ' ', $t->getSubjectNsText() ); } static function subjectspacee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfUrlencode( $t->getSubjectNsText() ); } @@ -495,75 +530,101 @@ class CoreParserFunctions { */ static function pagename( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( $t->getText() ); } static function pagenamee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( $t->getPartialURL() ); } static function fullpagename( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) || !$t->canTalk() ) + if ( is_null( $t ) || !$t->canTalk() ) { return ''; + } return wfEscapeWikiText( $t->getPrefixedText() ); } static function fullpagenamee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) || !$t->canTalk() ) + if ( is_null( $t ) || !$t->canTalk() ) { return ''; + } return wfEscapeWikiText( $t->getPrefixedURL() ); } static function subpagename( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( $t->getSubpageText() ); } static function subpagenamee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( $t->getSubpageUrlForm() ); } + static function rootpagename( $parser, $title = null ) { + $t = Title::newFromText( $title ); + if ( is_null( $t ) ) { + return ''; + } + return wfEscapeWikiText( $t->getRootText() ); + } + static function rootpagenamee( $parser, $title = null ) { + $t = Title::newFromText( $title ); + if ( is_null( $t ) ) { + return ''; + } + return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getRootText() ) ) ); + } static function basepagename( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( $t->getBaseText() ); } static function basepagenamee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) ); } static function talkpagename( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) || !$t->canTalk() ) + if ( is_null( $t ) || !$t->canTalk() ) { return ''; + } return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() ); } static function talkpagenamee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) || !$t->canTalk() ) + if ( is_null( $t ) || !$t->canTalk() ) { return ''; - return wfEscapeWikiText( $t->getTalkPage()->getPrefixedUrl() ); + } + return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() ); } static function subjectpagename( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; + } return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() ); } static function subjectpagenamee( $parser, $title = null ) { $t = Title::newFromText( $title ); - if ( is_null( $t ) ) + if ( is_null( $t ) ) { return ''; - return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedUrl() ); + } + return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedURL() ); } /** @@ -573,6 +634,7 @@ class CoreParserFunctions { * @return string */ static function pagesincategory( $parser, $name = '', $arg1 = null, $arg2 = null ) { + global $wgContLang; static $magicWords = null; if ( is_null( $magicWords ) ) { $magicWords = new MagicWordArray( array( @@ -585,7 +647,7 @@ class CoreParserFunctions { static $cache = array(); // split the given option to its variable - if( self::isRaw( $arg1 ) ) { + if ( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) { //{{pagesincategory:|raw[|type]}} $raw = $arg1; $type = $magicWords->matchStartToEnd( $arg2 ); @@ -594,23 +656,24 @@ class CoreParserFunctions { $type = $magicWords->matchStartToEnd( $arg1 ); $raw = $arg2; } - if( !$type ) { //backward compatibility + if ( !$type ) { //backward compatibility $type = 'pagesincategory_all'; } $title = Title::makeTitleSafe( NS_CATEGORY, $name ); - if( !$title ) { # invalid title + if ( !$title ) { # invalid title return self::formatRaw( 0, $raw ); } + $wgContLang->findVariantLink( $name, $title, true ); // Normalize name for cache $name = $title->getDBkey(); - if( !isset( $cache[$name] ) ) { + if ( !isset( $cache[$name] ) ) { $category = Category::newFromTitle( $title ); $allCount = $subcatCount = $fileCount = $pagesCount = 0; - if( $parser->incrementExpensiveFunctionCount() ) { + if ( $parser->incrementExpensiveFunctionCount() ) { // $allCount is the total number of cat members, // not the count of how many members are normal pages. $allCount = (int)$category->getPageCount(); @@ -632,8 +695,6 @@ class CoreParserFunctions { * Return the size of the given page, or 0 if it's nonexistent. This is an * expensive parser function and can't be called too many times per page. * - * @todo FIXME: This doesn't work correctly on preview for getting the size - * of the current page. * @todo FIXME: Title::getLength() documentation claims that it adds things * to the link cache, so the local cache here should be unnecessary, but * in fact calling getLength() repeatedly for the same $page does seem to @@ -641,15 +702,15 @@ class CoreParserFunctions { * @todo Document parameters * * @param $parser Parser - * @param $page String TODO DOCUMENT (Default: empty string) - * @param $raw TODO DOCUMENT (Default: null) + * @param $page String Name of page to check (Default: empty string) + * @param $raw String Should number be human readable with commas or just number * @return string */ static function pagesize( $parser, $page = '', $raw = null ) { static $cache = array(); $title = Title::newFromText( $page ); - if( !is_object( $title ) ) { + if ( !is_object( $title ) ) { $cache[$page] = 0; return self::formatRaw( 0, $raw ); } @@ -658,25 +719,35 @@ class CoreParserFunctions { $page = $title->getPrefixedText(); $length = 0; - if( isset( $cache[$page] ) ) { + if ( isset( $cache[$page] ) ) { $length = $cache[$page]; - } elseif( $parser->incrementExpensiveFunctionCount() ) { + } elseif ( $parser->incrementExpensiveFunctionCount() ) { $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); - $id = $rev ? $rev->getPage() : 0; + $pageID = $rev ? $rev->getPage() : 0; + $revID = $rev ? $rev->getId() : 0; $length = $cache[$page] = $rev ? $rev->getSize() : 0; // Register dependency in templatelinks - $parser->mOutput->addTemplate( $title, $id, $rev ? $rev->getId() : 0 ); + $parser->mOutput->addTemplate( $title, $pageID, $revID ); } return self::formatRaw( $length, $raw ); } /** - * Returns the requested protection level for the current page + * Returns the requested protection level for the current page + * + * @param Parser $parser + * @param string $type + * @param string $title + * * @return string */ - static function protectionlevel( $parser, $type = '' ) { - $restrictions = $parser->mTitle->getRestrictions( strtolower( $type ) ); + static function protectionlevel( $parser, $type = '', $title = '' ) { + $titleObject = Title::newFromText( $title ); + if ( !( $titleObject instanceof Title ) ) { + $titleObject = $parser->mTitle; + } + $restrictions = $titleObject->getRestrictions( strtolower( $type ) ); # Title::getRestrictions returns an array, its possible it may have # multiple values in the future return implode( $restrictions, ',' ); @@ -685,8 +756,8 @@ class CoreParserFunctions { /** * Gives language names. * @param $parser Parser - * @param $code String Language code (of which to get name) - * @param $inLanguage String Language code (in which to get name) + * @param string $code Language code (of which to get name) + * @param string $inLanguage Language code (in which to get name) * @return String */ static function language( $parser, $code = '', $inLanguage = '' ) { @@ -703,7 +774,9 @@ class CoreParserFunctions { static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) { $padding = $parser->killMarkers( $padding ); $lengthOfPadding = mb_strlen( $padding ); - if ( $lengthOfPadding == 0 ) return $string; + if ( $lengthOfPadding == 0 ) { + return $string; + } # The remaining length to add counts down to 0 as padding is added $length = min( $length, 500 ) - mb_strlen( $string ); @@ -739,7 +812,7 @@ class CoreParserFunctions { */ static function anchorencode( $parser, $text ) { $text = $parser->killMarkers( $text ); - return substr( $parser->guessSectionNameFromWikiText( $text ), 1); + return (string)substr( $parser->guessSectionNameFromWikiText( $text ), 1 ); } static function special( $parser, $text ) { @@ -748,7 +821,9 @@ class CoreParserFunctions { $title = SpecialPage::getTitleFor( $page, $subpage ); return $title->getPrefixedText(); } else { - return wfMessage( 'nosuchspecialpage' )->inContentLanguage()->text(); + // unknown special page, just use the given text as its title, if at all possible + $title = Title::makeTitleSafe( NS_SPECIAL, $text ); + return $title ? $title->getPrefixedText() : self::special( $parser, 'Badtitle' ); } } @@ -758,8 +833,8 @@ class CoreParserFunctions { /** * @param $parser Parser - * @param $text String The sortkey to use - * @param $uarg String Either "noreplace" or "noerror" (in en) + * @param string $text The sortkey to use + * @param string $uarg Either "noreplace" or "noerror" (in en) * both suppress errors, and noreplace does nothing if * a default sortkey already exists. * @return string @@ -772,35 +847,41 @@ class CoreParserFunctions { $arg = $magicWords->matchStartToEnd( $uarg ); $text = trim( $text ); - if( strlen( $text ) == 0 ) + if ( strlen( $text ) == 0 ) { return ''; + } $old = $parser->getCustomDefaultSort(); if ( $old === false || $arg !== 'defaultsort_noreplace' ) { $parser->setDefaultSort( $text ); } - if( $old === false || $old == $text || $arg ) { + if ( $old === false || $old == $text || $arg ) { return ''; } else { - return( '<span class="error">' . - wfMessage( 'duplicate-defaultsort', $old, $text )->inContentLanguage()->escaped() . - '</span>' ); + $converter = $parser->getConverterLanguage()->getConverter(); + return '<span class="error">' . + wfMessage( 'duplicate-defaultsort', + // Message should be parsed, but these params should only be escaped. + $converter->markNoConversion( wfEscapeWikiText( $old ) ), + $converter->markNoConversion( wfEscapeWikiText( $text ) ) + )->inContentLanguage()->text() . + '</span>'; } } // Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} or {{filepath|300|nowiki}} // or {{filepath|300px}}, {{filepath|200x300px}}, {{filepath|nowiki|200x300px}}, {{filepath|200x300px|nowiki}} - public static function filepath( $parser, $name='', $argA='', $argB='' ) { + public static function filepath( $parser, $name = '', $argA = '', $argB = '' ) { $file = wfFindFile( $name ); - if( $argA == 'nowiki' ) { + if ( $argA == 'nowiki' ) { // {{filepath: | option [| size] }} $isNowiki = true; $parsedWidthParam = $parser->parseWidthParam( $argB ); } else { // {{filepath: [| size [|option]] }} $parsedWidthParam = $parser->parseWidthParam( $argA ); - $isNowiki = ($argB == 'nowiki'); + $isNowiki = ( $argB == 'nowiki' ); } if ( $file ) { |