当前位置: 首页>>代码示例>>PHP>>正文


PHP Parser::getRandomString方法代码示例

本文整理汇总了PHP中Parser::getRandomString方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::getRandomString方法的具体用法?PHP Parser::getRandomString怎么用?PHP Parser::getRandomString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Parser的用法示例。


在下文中一共展示了Parser::getRandomString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct($conf)
 {
     if (!isset($conf['parsers'])) {
         throw new MWException(__METHOD__ . ': no parsers specified');
     }
     $this->conf = $conf;
     $this->dtUniqPrefix = "UNIQ" . Parser::getRandomString();
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:8,代码来源:Parser_DiffTest.php

示例2: merge

 /**
  * Merge another StripState object into this one. The strip marker keys
  * will not be preserved. The strings in the $texts array will have their
  * strip markers rewritten, the resulting array of strings will be returned.
  *
  * @param $otherState StripState
  * @param $texts Array
  * @return Array
  */
 function merge($otherState, $texts)
 {
     $mergePrefix = Parser::getRandomString();
     foreach ($otherState->data as $type => $items) {
         foreach ($items as $key => $value) {
             $this->data[$type]["{$mergePrefix}-{$key}"] = $value;
         }
     }
     $this->tempMergePrefix = $mergePrefix;
     $texts = preg_replace_callback($otherState->regex, array($this, 'mergeCallback'), $texts);
     $this->tempMergePrefix = null;
     return $texts;
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:22,代码来源:StripState.php

示例3: clearState

 /**
  * Clear Parser state
  *
  * @private
  */
 function clearState()
 {
     wfProfileIn(__METHOD__);
     if ($this->mFirstCall) {
         $this->firstCallInit();
     }
     $this->mOutput = new ParserOutput();
     $this->mAutonumber = 0;
     $this->mLastSection = '';
     $this->mDTopen = false;
     $this->mIncludeCount = array();
     $this->mStripState = new StripState();
     $this->mArgStack = false;
     $this->mInPre = false;
     $this->mInterwikiLinkHolders = array('texts' => array(), 'titles' => array());
     $this->mLinkHolders = array('namespaces' => array(), 'dbkeys' => array(), 'queries' => array(), 'texts' => array(), 'titles' => array());
     $this->mRevisionTimestamp = $this->mRevisionId = null;
     /**
      * Prefix for temporary replacement strings for the multipass parser.
      * \x07 should never appear in input as it's disallowed in XML.
      * Using it at the front also gives us a little extra robustness
      * since it shouldn't match when butted up against identifier-like
      * string constructs.
      *
      * Must not consist of all title characters, or else it will change 
      * the behaviour of <nowiki> in a link.
      */
     #$this->mUniqPrefix = "\x07UNIQ" . Parser::getRandomString();
     # Changed to \x7f to allow XML double-parsing -- TS
     $this->mUniqPrefix = "UNIQ" . Parser::getRandomString();
     # Clear these on every parse, bug 4549
     $this->mTplExpandCache = $this->mTplRedirCache = $this->mTplDomCache = array();
     $this->mShowToc = true;
     $this->mForceTocPosition = false;
     $this->mIncludeSizes = array('post-expand' => 0, 'arg' => 0);
     $this->mPPNodeCount = 0;
     $this->mDefaultSort = false;
     $this->mHeadings = array();
     # Fix cloning
     if (isset($this->mPreprocessor) && $this->mPreprocessor->parser !== $this) {
         $this->mPreprocessor = null;
     }
     wfRunHooks('ParserClearState', array(&$this));
     wfProfileOut(__METHOD__);
 }
开发者ID:renemilk,项目名称:spring-website,代码行数:50,代码来源:Parser.php

示例4: insertStripItem

 /**
  * Add an item to the strip state
  * Returns the unique tag which must be inserted into the stripped text
  * The tag will be replaced with the original text in unstrip()
  *
  * @private
  */
 function insertStripItem($text, &$state)
 {
     $rnd = $this->mUniqPrefix . '-item' . Parser::getRandomString();
     if (!$state) {
         $state = array();
     }
     $state['general'][$rnd] = $text;
     return $rnd;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:16,代码来源:Parser.php

示例5: insertStripItem

 /**
  * Add an item to the strip state
  * Returns the unique tag which must be inserted into the stripped text
  * The tag will be replaced with the original text in unstrip()
  *
  * @private
  */
 function insertStripItem($text, &$state)
 {
     $rnd = $this->mUniqPrefix . '-item' . Parser::getRandomString();
     $state->general->setPair($rnd, $text);
     return $rnd;
 }
开发者ID:negabaro,项目名称:alfresco,代码行数:13,代码来源:Parser.php

示例6: getFormDefinition

 /**
  * Parse the form definition and return it
  */
 public static function getFormDefinition(Parser $parser, $form_def = null, $form_id = null)
 {
     if ($form_id !== null) {
         $cachedDef = self::getFormDefinitionFromCache($form_id, $parser);
         if ($cachedDef !== null) {
             return $cachedDef;
         }
     }
     if ($form_id !== null) {
         $form_title = Title::newFromID($form_id);
         $form_def = SFUtils::getPageText($form_title);
     } elseif ($form_def == null) {
         // No id, no text -> nothing to do
         return '';
     }
     // Remove <noinclude> sections and <includeonly> tags from form definition
     $form_def = StringUtils::delimiterReplace('<noinclude>', '</noinclude>', '', $form_def);
     $form_def = strtr($form_def, array('<includeonly>' => '', '</includeonly>' => ''));
     // We need to replace all SF tags in the form definition by strip items. But we can not just use
     // the Parser strip state because the Parser would during parsing replace all strip items and then
     // mangle them into HTML code. So we have to use our own. Which means we also can not just use
     // Parser::insertStripItem() (see below).
     $prefix = "UNIQ" . Parser::getRandomString();
     $stripState = new StripState($prefix);
     // This regexp will find any SF triple braced tags (including correct handling of contained braces), i.e.
     // {{{field|foo|default={{Bar}}}}} is not a problem. When used with preg_match and friends, $matches[0] will
     // contain the whole SF tag, $matches[1] will contain the tag without the enclosing triple braces.
     $regexp = '#\\{\\{\\{((?>[^\\{\\}]+)|(\\{((?>[^\\{\\}]+)|(?-2))*\\}))*\\}\\}\\}#';
     // replace all SF tags by strip markers
     $form_def = preg_replace_callback($regexp, function (array $matches) use($stripState, $prefix) {
         static $markerIndex = 0;
         $rnd = "{$prefix}-item-{$markerIndex}-" . Parser::MARKER_SUFFIX;
         $markerIndex++;
         $stripState->addGeneral($rnd, $matches[0]);
         return $rnd;
     }, $form_def);
     $title = is_object($parser->getTitle()) ? $parser->getTitle() : new Title();
     // parse wiki-text
     $output = $parser->parse($form_def, $title, $parser->getOptions());
     $form_def = $stripState->unstripGeneral($output->getText());
     if ($output->getCacheTime() == -1) {
         $form_article = Article::newFromID($form_id);
         self::purgeCache($form_article);
         wfDebug("Caching disabled for form definition {$form_id}\n");
     } elseif ($form_id !== null) {
         self::cacheFormDefinition($form_id, $form_def, $parser);
     }
     return $form_def;
 }
开发者ID:roland2025,项目名称:mediawiki-extensions-SemanticForms,代码行数:52,代码来源:SF_FormUtils.php


注:本文中的Parser::getRandomString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。