本文整理汇总了PHP中ParserOutput::addWarning方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::addWarning方法的具体用法?PHP ParserOutput::addWarning怎么用?PHP ParserOutput::addWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::addWarning方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: limitationWarn
/**
* Warn the user when a parser limitation is reached
* Will warn at most once the user per limitation type
*
* The results are shown during preview and run through the Parser (See EditPage.php)
*
* @param string $limitationType Should be one of:
* 'expensive-parserfunction' (corresponding messages:
* 'expensive-parserfunction-warning',
* 'expensive-parserfunction-category')
* 'post-expand-template-argument' (corresponding messages:
* 'post-expand-template-argument-warning',
* 'post-expand-template-argument-category')
* 'post-expand-template-inclusion' (corresponding messages:
* 'post-expand-template-inclusion-warning',
* 'post-expand-template-inclusion-category')
* 'node-count-exceeded' (corresponding messages:
* 'node-count-exceeded-warning',
* 'node-count-exceeded-category')
* 'expansion-depth-exceeded' (corresponding messages:
* 'expansion-depth-exceeded-warning',
* 'expansion-depth-exceeded-category')
* @param string|int|null $current Current value
* @param string|int|null $max Maximum allowed, when an explicit limit has been
* exceeded, provide the values (optional)
*/
public function limitationWarn($limitationType, $current = '', $max = '')
{
# does no harm if $current and $max are present but are unnecessary for the message
# Not doing ->inLanguage( $this->mOptions->getUserLangObj() ), since this is shown
# only during preview, and that would split the parser cache unnecessarily.
$warning = wfMessage("{$limitationType}-warning")->numParams($current, $max)->text();
$this->mOutput->addWarning($warning);
$this->addTrackingCategory("{$limitationType}-category");
}
示例2: limitationWarn
/**
* Warn the user when a parser limitation is reached
* Will warn at most once the user per limitation type
*
* @param string $limitationType should be one of:
* 'expensive-parserfunction' (corresponding messages:
* 'expensive-parserfunction-warning',
* 'expensive-parserfunction-category')
* 'post-expand-template-argument' (corresponding messages:
* 'post-expand-template-argument-warning',
* 'post-expand-template-argument-category')
* 'post-expand-template-inclusion' (corresponding messages:
* 'post-expand-template-inclusion-warning',
* 'post-expand-template-inclusion-category')
* 'node-count-exceeded' (corresponding messages:
* 'node-count-exceeded-warning',
* 'node-count-exceeded-category')
* 'expansion-depth-exceeded' (corresponding messages:
* 'expansion-depth-exceeded-warning',
* 'expansion-depth-exceeded-category')
* @param int|null $current Current value
* @param int|null $max Maximum allowed, when an explicit limit has been
* exceeded, provide the values (optional)
*/
function limitationWarn($limitationType, $current = '', $max = '')
{
# does no harm if $current and $max are present but are unnecessary for the message
$warning = wfMessage("{$limitationType}-warning")->numParams($current, $max)->inLanguage($this->mOptions->getUserLangObj())->text();
$this->mOutput->addWarning($warning);
$this->addTrackingCategory("{$limitationType}-category");
}
示例3: limitationWarn
/**
* Warn the user when a parser limitation is reached
* Will warn at most once the user per limitation type
*
* @param $limitationType String: should be one of:
* 'expensive-parserfunction' (corresponding messages:
* 'expensive-parserfunction-warning',
* 'expensive-parserfunction-category')
* 'post-expand-template-argument' (corresponding messages:
* 'post-expand-template-argument-warning',
* 'post-expand-template-argument-category')
* 'post-expand-template-inclusion' (corresponding messages:
* 'post-expand-template-inclusion-warning',
* 'post-expand-template-inclusion-category')
* @param $current Current value
* @param $max Maximum allowed, when an explicit limit has been
* exceeded, provide the values (optional)
*/
function limitationWarn($limitationType, $current = null, $max = null)
{
# does no harm if $current and $max are present but are unnecessary for the message
$warning = wfMsgExt("{$limitationType}-warning", array('parsemag', 'escape'), $current, $max);
$this->mOutput->addWarning($warning);
$this->addTrackingCategory("{$limitationType}-category");
}