本文整理汇总了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;
}
示例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');
}
示例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;
}
示例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;
}
示例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;
}
示例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'));
}
}
示例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;
}
示例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']);
}
}
示例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;
}
示例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;
}
示例11: onParserFirstCallInit
public static function onParserFirstCallInit(Parser &$parser)
{
// Register the hook with the parser
$parser->setHook('searchbox', array('SearchBoxesHooks', 'render'));
// Continue
return true;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}