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


PHP self::parse方法代碼示例

本文整理匯總了PHP中self::parse方法的典型用法代碼示例。如果您正苦於以下問題:PHP self::parse方法的具體用法?PHP self::parse怎麽用?PHP self::parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在self的用法示例。


在下文中一共展示了self::parse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: cssToXpath

 /**
  * @throws SyntaxError When got None for xpath expression
  */
 public static function cssToXpath($cssExpr, $prefix = 'descendant-or-self::')
 {
     if (is_string($cssExpr)) {
         if (preg_match('#^\\w+\\s*$#u', $cssExpr, $match)) {
             return $prefix . trim($match[0]);
         }
         if (preg_match('~^(\\w*)#(\\w+)\\s*$~u', $cssExpr, $match)) {
             return sprintf("%s%s[@id = '%s']", $prefix, $match[1] ? $match[1] : '*', $match[2]);
         }
         if (preg_match('#^(\\w*)\\.(\\w+)\\s*$#u', $cssExpr, $match)) {
             return sprintf("%s%s[contains(concat(' ', normalize-space(@class), ' '), ' %s ')]", $prefix, $match[1] ? $match[1] : '*', $match[2]);
         }
         $parser = new self();
         $cssExpr = $parser->parse($cssExpr);
     }
     $expr = $cssExpr->toXpath();
     // @codeCoverageIgnoreStart
     if (!$expr) {
         throw new SyntaxError(sprintf('Got None for xpath expression from %s.', $cssExpr));
     }
     // @codeCoverageIgnoreEnd
     if ($prefix) {
         $expr->addPrefix($prefix);
     }
     return (string) $expr;
 }
開發者ID:skoop,項目名稱:symfony-sandbox,代碼行數:29,代碼來源:Parser.php

示例2: Render

 /**
  * Returns a preview of given Text
  * 
  * @param type $foo
  * @return type
  */
 public static function Render($markdown)
 {
     $markdown = CHtml::encode($markdown);
     $parser = new self();
     $text = $parser->parse($markdown);
     return $text;
 }
開發者ID:skapl,項目名稱:design,代碼行數:13,代碼來源:HMarkdownPreview.php

示例3: getAtts

 public static function getAtts(&$source)
 {
     $p = new self();
     $res = $p->parse($source);
     $source = !empty($p->modifiers) ? ' |' . $p->modifiers : '';
     return $res;
 }
開發者ID:floxim,項目名稱:floxim,代碼行數:7,代碼來源:TokenAttParser.php

示例4: style

 /**
  * Creates a stylesheet link with LESS support
  *
  * @param   string  $style       file name
  * @param   array   $attributes  default attributes
  * @param   bool    $index       include the index page
  * @param   array   $imports     compare file date for these too, CSS and LESS in style @import
  * @return  string
  */
 public static function style($file, array $attributes = null, $index = false, $imports = null)
 {
     $imports = (array) $imports;
     // Compile only .less files
     if (substr_compare($file, '.less', -5, 5, false) === 0) {
         $css = substr_replace($file, 'css', -4);
         $compiled = is_file($css) ? filemtime($css) : 0;
         try {
             // Check if imported files have changed
             $compile = filemtime($file) > $compiled;
             if (!$compile && !empty($imports)) {
                 foreach ($imports as $import) {
                     if (filemtime($import) > $compiled) {
                         $compile = true;
                         break;
                     }
                 }
             }
             // Compile LESS
             if ($compile) {
                 $compiler = new self($file);
                 file_put_contents($css, $compiler->parse());
             }
             $file = $css;
         } catch (Exception $e) {
             Kohana::$log->add(Kohana::ERROR, __METHOD__ . ': Error compiling LESS file ' . $file . ', ' . $e->getMessage());
         }
     }
     return HTML::style($file . '?' . filemtime($file), $attributes, $index);
 }
開發者ID:netbiel,項目名稱:core,代碼行數:39,代碼來源:less.php

示例5: match

 public static function match($method)
 {
     if (Strings::startsWith($method, 'findBy')) {
         $dynamicFinder = new self($method);
         $dynamicFinder->parse();
         return $dynamicFinder;
     }
     return null;
 }
開發者ID:neogenro,項目名稱:sugarcrm-rest-client,代碼行數:9,代碼來源:DynamicFinder.php

示例6: test

 /**
  * Simple entry point for command-line testing
  */
 static function test($text)
 {
     try {
         $ce = new self($text);
         $ce->parse();
     } catch (ConfEditorParseError $e) {
         return $e->getMessage() . "\n" . $e->highlight($text);
     }
     return "OK";
 }
開發者ID:GodelDesign,項目名稱:Godel,代碼行數:13,代碼來源:ConfEditor.php

示例7: fromFile

 public static function fromFile($file)
 {
     if (!empty($file) && is_file($file)) {
         $basePath = pathinfo($file, PATHINFO_DIRNAME);
         $parser = new self($basePath);
         return $parser->parse(file_get_contents($file));
     } else {
         throw new RuntimeException('Could not load json schema ' . $file);
     }
 }
開發者ID:seytar,項目名稱:psx,代碼行數:10,代碼來源:JsonSchema.php

示例8: quickParse

 /**
  * Quick parse modules feed.
  *
  * @param	string	$url		XML feed URL
  * @param	string	$cache_dir	Cache directoy or null for no cache
  * @param	boolean	$force		Force query repository
  * @return	object	Self instance
  */
 public static function quickParse($url, $cache_dir = null, $force = false)
 {
     $parser = new self();
     if ($cache_dir) {
         $parser->setCacheDir($cache_dir);
     }
     if ($force) {
         $parser->setForce($force);
     }
     return $parser->parse($url);
 }
開發者ID:nikrou,項目名稱:dotclear,代碼行數:19,代碼來源:class.dc.store.reader.php

示例9: find_or_create_by_uastring

 public static function find_or_create_by_uastring($ua_string)
 {
     $ua_string = trim($ua_string);
     if (!strlen($ua_string)) {
         return NULL;
     }
     $agent = self::find_one_by_user_agent($ua_string);
     if (!$agent) {
         $agent = new self();
         $agent->user_agent = $ua_string;
         $agent->parse()->save();
     }
     return $agent;
 }
開發者ID:johannes-mueller,項目名稱:podlove-publisher,代碼行數:14,代碼來源:user_agent.php

示例10: getBlock

 protected function getBlock()
 {
     if (!$this->testCurrentString('[[')) {
         throw new \Exception('Block start expected!');
     }
     $this->nextChar();
     $this->nextChar();
     $blockSignature = $this->getBlockSignature();
     $block = $this->blockSignatureParser->parse($blockSignature);
     $position = $this->getNextNotWhiteSpacePosition($this->position);
     if ($this->testString($position, '{{')) {
         $this->skipWhiteSpace();
         $content = $this->getBlockContent();
         // todo: block can be parsed in one pass
         $clone = new self($this->blockSignatureParser);
         $result = $clone->parse($content);
         $block['markup'] = $result;
     }
     return $block;
 }
開發者ID:vitkovskii,項目名稱:jte,代碼行數:20,代碼來源:MarkupParser.php

示例11: parsePreToken

 private function parsePreToken($preToken)
 {
     $token = null;
     $matches = [];
     foreach ($this->regEx as $tokenName => $rgx) {
         if (preg_match($rgx, $preToken, $matches)) {
             $token = $this->createToken($tokenName, $matches['value']);
             break;
         }
     }
     if (is_null($token)) {
         $token = $this->createToken(self::ILEGAL, $preToken);
     } else {
         if (array_key_exists('inner', $matches)) {
             $this->addToken($token);
             $tokenizer = new self();
             $stream = $tokenizer->parse($matches['inner']);
             $this->addTokens($stream);
         } else {
             $this->addToken($token);
         }
     }
     return $this->currentToken;
 }
開發者ID:vojtabiberle,項目名稱:MediaStorage,代碼行數:24,代碼來源:SimpleQueryTokenizer.php

示例12: run

 /**
  * Shortcut to instantiate, tokenize, parse and evaluate
  *
  * @param string $expression
  * @param array $values
  * @return boolean
  */
 public static function run($expression, $values)
 {
     $evaluator = new self();
     $evaluator->parse($evaluator->tokenize($expression));
     return $evaluator->evaluate($values);
 }
開發者ID:pagemachine,項目名稱:t3x-contexts,代碼行數:13,代碼來源:LogicalExpressionEvaluator.php

示例13: fromString

 public static function fromString($s)
 {
     $parser = new self($s);
     return $parser->parse();
 }
開發者ID:bruensicke,項目名稱:radium,代碼行數:5,代碼來源:Toml.php

示例14: combine

 /**
  * @param $in
  * @param $root_url
  *
  * @return string
  */
 public static function combine($in, $root_url)
 {
     $css = new self($in, $root_url);
     return $css->parse();
 }
開發者ID:naka211,項目名稱:myloyal,代碼行數:11,代碼來源:CssAggregator.php

示例15: parseBlock

 private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap)
 {
     $skippedLineNumbers = $this->skippedLineNumbers;
     foreach ($this->locallySkippedLineNumbers as $lineNumber) {
         if ($lineNumber < $offset) {
             continue;
         }
         $skippedLineNumbers[] = $lineNumber;
     }
     $parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers);
     $parser->refs =& $this->refs;
     return $parser->parse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap);
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:13,代碼來源:Parser.php


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