当前位置: 首页>>代码示例>>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;未经允许,请勿转载。