本文整理匯總了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");
}