當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Parser::setHook方法代碼示例

本文整理匯總了PHP中Parser::setHook方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parser::setHook方法的具體用法?PHP Parser::setHook怎麽用?PHP Parser::setHook使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parser的用法示例。


在下文中一共展示了Parser::setHook方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sbParserInit

function sbParserInit(Parser $parser)
{
    // Register <scratchblocks> tag
    $parser->setHook('scratchblocks', 'sbRenderTag');
    $parser->setHook('sb', 'sbRenderInlineTag');
    return true;
}
開發者ID:InternationalScratchWiki,項目名稱:Dutch-mw-Scratchblocks2,代碼行數:7,代碼來源:ScratchBlocks2.php

示例2: onParserFirstCallSetup

 static function onParserFirstCallSetup(Parser $parser)
 {
     if (!ExtensionRegistry::getInstance()->isLoaded('Math')) {
         die("The DMath extension requires the Math extension, please include it.");
     }
     $parser->setHook('dmath', 'DMathParse::dmathTagHook');
     $parser->setHook('math', 'DMathParse::mathTagHook');
 }
開發者ID:WikiToLearn,項目名稱:DMath,代碼行數:8,代碼來源:DMathHooks.php

示例3: onParserFirstCallInit

 /**
  * Set up our custom parser hooks when initializing parser.
  *
  * @param Parser $parser
  * @return boolean hook return value
  */
 public static function onParserFirstCallInit($parser)
 {
     $parser->setHook('pagelist', array(__CLASS__, 'renderPageList'));
     $parser->setHook('pages', array(__CLASS__, 'renderPages'));
     $parser->setHook('pagequality', array(__CLASS__, 'pageQuality'));
     return true;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:13,代碼來源:ProofreadPage_body.php

示例4: onParserFirstCallInit

 /**
  *
  * @param Parser $parser
  * @return boolean
  */
 public function onParserFirstCallInit(&$parser)
 {
     $parser->setHook('bs:countarticles', array(&$this, 'onMagicWordBsCountArticles'));
     $parser->setHook('bs:countusers', array(&$this, 'onMagicWordBsCountUsers'));
     $parser->setHook('bs:countcharacters', array(&$this, 'onMagicWordBsCountCharacters'));
     return true;
 }
開發者ID:hfroese,項目名稱:mediawiki-extensions-BlueSpiceExtensions,代碼行數:12,代碼來源:CountThings.class.php

示例5: parserInit

 public static function parserInit(Parser $parser)
 {
     Hooks::register('ParserBeforeStrip', self::class . '::markBlockMathTags');
     $parser->setHook('math', self::class . '::mathTag');
     $parser->setHook('nomathjax', self::class . '::noMathJaxTag');
     Hooks::register('ParserAfterTidy', self::class . '::afterTidy');
     Hooks::register('BeforePageDisplay', self::class . '::Inject_JS');
     return true;
 }
開發者ID:muwiki,項目名稱:mediawiki-mathjax,代碼行數:9,代碼來源:MathJax.php

示例6: register

 /**
  * @param Parser $parser
  * @return void
  */
 public static function register($parser)
 {
     global $wgRawHtml;
     $parser->setHook('pre', array(__CLASS__, 'pre'));
     $parser->setHook('nowiki', array(__CLASS__, 'nowiki'));
     $parser->setHook('gallery', array(__CLASS__, 'gallery'));
     if ($wgRawHtml) {
         $parser->setHook('html', array(__CLASS__, 'html'));
     }
 }
開發者ID:whysasse,項目名稱:kmwiki,代碼行數:14,代碼來源:CoreTagHooks.php

示例7: wfEventCountdownExtension

/**
 * @param Parser $parser
 * @return bool
 */
function wfEventCountdownExtension($parser)
{
    # register the extension with the WikiText parser
    # the first parameter is the name of the new tag.
    # In this case it defines the tag <example> ... </example>
    # the second parameter is the callback function for
    # processing the text between the tags
    $parser->setHook('daysuntil', 'runDaysUntil');
    $parser->setHook('eventcountdown', 'runShowEventCountdown');
    return true;
}
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:15,代碼來源:EventCountdown.php

示例8: register

 /**
  * @param Parser $parser
  * @return void
  */
 public static function register($parser)
 {
     global $wgRawHtml;
     $parser->setHook('pre', [__CLASS__, 'pre']);
     $parser->setHook('nowiki', [__CLASS__, 'nowiki']);
     $parser->setHook('gallery', [__CLASS__, 'gallery']);
     $parser->setHook('indicator', [__CLASS__, 'indicator']);
     if ($wgRawHtml) {
         $parser->setHook('html', [__CLASS__, 'html']);
     }
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:15,代碼來源:CoreTagHooks.php

示例9: wfSampleParserInit

function wfSampleParserInit(Parser &$parser)
{
    // This does <setprop>Some random text</setprop>
    // And then <getprop/> to retrieve a prop
    // Or <getprop page="somepage"> to retrieve for
    // something other than the current page.
    $parser->setHook('getprop', 'wfSampleGetProp');
    $parser->setHook('setprop', 'wfSampleSetProp');
    // Always return true from this function. The return value does not denote
    // success or otherwise have meaning - it just must always be true.
    return true;
}
開發者ID:saper,項目名稱:organic-extensions,代碼行數:12,代碼來源:page_props.example.php

示例10: onParserFirstCallInit

 public static function onParserFirstCallInit(Parser &$parser)
 {
     // When the parser sees the <sample> tag, it executes
     // the wfSampleRender function (see below)
     $parser->setHook('in', 'NumerAlpha::renderNumeralTag');
     $parser->setHook('ia', 'NumerAlpha::renderAlphaTag');
     $parser->setHook('ir', 'NumerAlpha::renderRomanTag');
     // Always return true from this function. The return value does not denote
     // success or otherwise have meaning - it just must always be true.
     self::$listTypes = array(wfMessage('ext-numeralpha-list-type-numeral')->text() => "numeral", wfMessage('ext-numeralpha-list-type-alpha')->text() => "alpha", wfMessage('ext-numeralpha-list-type-roman')->text() => "roman");
     $parser->setFunctionHook('counter', array('NumerAlpha', 'renderCounter'), SFH_OBJECT_ARGS);
     return true;
 }
開發者ID:emanspeaks,項目名稱:mediawiki-extensions-NumerAlpha,代碼行數:13,代碼來源:NumerAlpha.class.php

示例11: onParserFirstCallInit

 public static function onParserFirstCallInit(Parser &$parser)
 {
     // Register the hook with the parser
     $parser->setHook('searchbox', array('SearchBoxesHooks', 'render'));
     // Continue
     return true;
 }
開發者ID:kolzchut,項目名稱:mediawiki-extensions-SearchBoxes,代碼行數:7,代碼來源:SearchBoxes.hooks.php

示例12: onParserFirstCallInit

 /**
  * @brief This function set parseTag hook
  */
 public static function onParserFirstCallInit(Parser &$parser)
 {
     wfProfileIn(__METHOD__);
     $parser->setHook(CHAT_TAG, array(__CLASS__, "parseTag"));
     wfProfileOut(__METHOD__);
     return true;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:10,代碼來源:ChatEntryPoint.class.php

示例13: onParserFirstCallInit

 /**
  * @brief This function set renderTag hook
  * @param Parser parser
  * @return true
  */
 public function onParserFirstCallInit(Parser $parser)
 {
     wfProfileIn(__METHOD__);
     $parser->setHook('hubspopularvideos', array($this, 'renderTag'));
     wfProfileOut(__METHOD__);
     return true;
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:12,代碼來源:WikiaHubsHook.class.php

示例14: onParserFirstCallInit

 /**
  * Sets up this extensions parser functions.
  *
  * @access	public
  * @param	object	Parser object passed as a reference.
  * @return	boolean	true
  */
 public static function onParserFirstCallInit(Parser &$parser)
 {
     foreach (self::$tags as $hook => $method) {
         $parser->setHook($hook, array(__CLASS__, $method));
     }
     return true;
 }
開發者ID:HydraWiki,項目名稱:CharacterEscapes,代碼行數:14,代碼來源:CharacterEscapes.hooks.php

示例15: efWidgetTagSetup

/**
 * Setup parser hook
 *
 * @param Parser $parser
 * @return bool
 */
function efWidgetTagSetup(Parser $parser)
{
    global $wgHooks;
    $parser->setHook('widget', 'efWidgetTagRender');
    $wgHooks['ParserAfterTidy'][] = 'efWidgetTagReplaceMarkers';
    return true;
}
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:13,代碼來源:WidgetTag.php


注:本文中的Parser::setHook方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。