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


PHP ParserOutput::addWarning方法代碼示例

本文整理匯總了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");
 }
開發者ID:rrameshs,項目名稱:mediawiki,代碼行數:35,代碼來源:Parser.php

示例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");
 }
開發者ID:Tarendai,項目名稱:spring-website,代碼行數:31,代碼來源:Parser.php

示例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");
 }
開發者ID:eFFemeer,項目名稱:seizamcore,代碼行數:25,代碼來源:Parser.php


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