Beispiel #1
0
function wfSetupParserFunctions()
{
    global $wgParser, $wgExtParserFunctions, $wgHooks;
    $wgExtParserFunctions = new ExtParserFunctions();
    // Check for SFH_OBJECT_ARGS capability
    if (defined('MW_SUPPORTS_PARSERFIRSTCALLINIT')) {
        $wgHooks['ParserFirstCallInit'][] = array(&$wgExtParserFunctions, 'registerParser');
    } else {
        if (class_exists('StubObject') && !StubObject::isRealObject($wgParser)) {
            $wgParser->_unstub();
        }
        $wgExtParserFunctions->registerParser($wgParser);
    }
    $wgHooks['ParserClearState'][] = array(&$wgExtParserFunctions, 'clearState');
}
 /**
  * @return ExprParser
  */
 public static function &getExprParser()
 {
     if (!isset(self::$mExprParser)) {
         self::$mExprParser = new ExprParser();
     }
     return self::$mExprParser;
 }
 public function __construct()
 {
     if (!class_exists('ExtParserFunctions')) {
         throw new ParserFunctionsNotFoundException();
     }
     # FIXME: Strict Standards: Non-static method ExtParserFunctions::getExprParser() should not be called statically, assuming $this from incompatible context in MathStatFunctions.php on line 34
     $this->exprParser = ExtParserFunctions::getExprParser();
 }
 public function expr($expression = null)
 {
     $this->checkType('mw.ext.ParserFunctions.expr', 1, $expression, 'string');
     try {
         return array(ExtParserFunctions::getExprParser()->doExpression($expression));
     } catch (ExprError $e) {
         throw new Scribunto_LuaError($e->getMessage());
     }
 }
function wfSetupParserFunctions()
{
    global $wgParser, $wgExtParserFunctions, $wgHooks;
    $wgExtParserFunctions = new ExtParserFunctions();
    // Check for SFH_OBJECT_ARGS capability
    /* DISABLED FOR GREAT S***E (DOESN'T F*****G WERK!!!) --Misza
    	if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
    		$wgHooks['ParserFirstCallInit'][] = array( &$wgExtParserFunctions, 'registerParser' );
    	} else {
    	*/
    if (class_exists('StubObject') && !StubObject::isRealObject($wgParser)) {
        $wgParser->_unstub();
    }
    $wgExtParserFunctions->registerParser($wgParser);
    //}
    $wgHooks['ParserClearState'][] = array(&$wgExtParserFunctions, 'clearState');
    $wgHooks['ParserAfterTidy'][] = array(&$wgExtParserFunctions, 'afterTidy');
}
 /**
  * Get a ConvertParser object
  * @return ConvertParser
  */
 protected static function &getConvertParser()
 {
     if (!isset(self::$mConvertParser)) {
         self::$mConvertParser = new ConvertParser();
     }
     return self::$mConvertParser;
 }