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


PHP Frame::lookup_counter_frame方法代码示例

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


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

示例1: _parse_content

 /**
  * Parses the CSS "content" property
  *
  * @return string|null The resulting string
  */
 protected function _parse_content()
 {
     // Matches generated content
     $re = "/\n" . "\\s(counters?\\([^)]*\\))|\n" . "\\A(counters?\\([^)]*\\))|\n" . "\\s([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\3|\n" . "\\A([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\5|\n" . "\\s([^\\s\"']+)|\n" . "\\A([^\\s\"']+)\n" . "/xi";
     $content = $this->_frame->get_style()->content;
     $quotes = $this->_parse_quotes();
     // split on spaces, except within quotes
     if (!preg_match_all($re, $content, $matches, PREG_SET_ORDER)) {
         return null;
     }
     $text = "";
     foreach ($matches as $match) {
         if (isset($match[2]) && $match[2] !== "") {
             $match[1] = $match[2];
         }
         if (isset($match[6]) && $match[6] !== "") {
             $match[4] = $match[6];
         }
         if (isset($match[8]) && $match[8] !== "") {
             $match[7] = $match[8];
         }
         if (isset($match[1]) && $match[1] !== "") {
             // counters?(...)
             $match[1] = mb_strtolower(trim($match[1]));
             // Handle counter() references:
             // http://www.w3.org/TR/CSS21/generate.html#content
             $i = mb_strpos($match[1], ")");
             if ($i === false) {
                 continue;
             }
             preg_match('/(counters?)(^\\()*?\\(\\s*([^\\s,]+)\\s*(,\\s*["\']?([^"\'\\)]+)["\']?\\s*(,\\s*([^\\s)]+)\\s*)?)?\\)/i', $match[1], $args);
             $counter_id = $args[3];
             if (strtolower($args[1]) == 'counter') {
                 // counter(name [,style])
                 if (isset($args[5])) {
                     $type = trim($args[5]);
                 } else {
                     $type = null;
                 }
                 $p = $this->_frame->lookup_counter_frame($counter_id);
                 $text .= $p->counter_value($counter_id, $type);
             } else {
                 if (strtolower($args[1]) == 'counters') {
                     // counters(name, string [,style])
                     if (isset($args[5])) {
                         $string = $this->_parse_string($args[5]);
                     } else {
                         $string = "";
                     }
                     if (isset($args[7])) {
                         $type = trim($args[7]);
                     } else {
                         $type = null;
                     }
                     $p = $this->_frame->lookup_counter_frame($counter_id);
                     $tmp = array();
                     while ($p) {
                         // We only want to use the counter values when they actually increment the counter
                         if (array_key_exists($counter_id, $p->_counters)) {
                             array_unshift($tmp, $p->counter_value($counter_id, $type));
                         }
                         $p = $p->lookup_counter_frame($counter_id);
                     }
                     $text .= implode($string, $tmp);
                 } else {
                     // countertops?
                     continue;
                 }
             }
         } else {
             if (isset($match[4]) && $match[4] !== "") {
                 // String match
                 $text .= $this->_parse_string($match[4]);
             } else {
                 if (isset($match[7]) && $match[7] !== "") {
                     // Directive match
                     if ($match[7] === "open-quote") {
                         // FIXME: do something here
                         $text .= $quotes[0][0];
                     } else {
                         if ($match[7] === "close-quote") {
                             // FIXME: do something else here
                             $text .= $quotes[0][1];
                         } else {
                             if ($match[7] === "no-open-quote") {
                                 // FIXME:
                             } else {
                                 if ($match[7] === "no-close-quote") {
                                     // FIXME:
                                 } else {
                                     if (mb_strpos($match[7], "attr(") === 0) {
                                         $i = mb_strpos($match[7], ")");
                                         if ($i === false) {
                                             continue;
                                         }
//.........这里部分代码省略.........
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:101,代码来源:frame_reflower.cls.php

示例2: _parse_content

 /**
  * Parses the CSS "content" property
  *
  * @return string The resulting string
  */
 protected function _parse_content()
 {
     // Matches generated content
     $re = "/\n" . "\\s(counters?\\([^)]*\\))|\n" . "\\A(counters?\\([^)]*\\))|\n" . "\\s([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\3|\n" . "\\A([\"']) ( (?:[^\"']|\\\\[\"'])+ )(?<!\\\\)\\5|\n" . "\\s([^\\s\"']+)|\n" . "\\A([^\\s\"']+)\n" . "/xi";
     $content = $this->_frame->get_style()->content;
     $quotes = $this->_parse_quotes();
     // split on spaces, except within quotes
     if (!preg_match_all($re, $content, $matches, PREG_SET_ORDER)) {
         return;
     }
     $text = "";
     foreach ($matches as $match) {
         if (isset($match[2]) && $match[2] !== "") {
             $match[1] = $match[2];
         }
         if (isset($match[6]) && $match[6] !== "") {
             $match[4] = $match[6];
         }
         if (isset($match[8]) && $match[8] !== "") {
             $match[7] = $match[8];
         }
         if (isset($match[1]) && $match[1] !== "") {
             // counters?(...)
             $match[1] = mb_strtolower(trim($match[1]));
             // Handle counter() references:
             // http://www.w3.org/TR/CSS21/generate.html#content
             $i = mb_strpos($match[1], ")");
             if ($i === false) {
                 continue;
             }
             $args = explode(",", mb_substr($match[1], 8, $i - 8));
             $counter_id = $args[0];
             if ($match[1][7] === "(") {
                 // counter(name [,style])
                 if (isset($args[1])) {
                     $type = trim($args[1]);
                 } else {
                     $type = null;
                 }
                 $p = $this->_frame->lookup_counter_frame($counter_id);
                 $text .= $p->counter_value($counter_id, $type);
             } else {
                 if ($match[1][7] === "s") {
                     // counters(name, string [,style])
                     if (isset($args[1])) {
                         $string = $this->_parse_string(trim($args[1]));
                     } else {
                         $string = "";
                     }
                     if (isset($args[2])) {
                         $type = $args[2];
                     } else {
                         $type = null;
                     }
                     $p = $this->_frame->lookup_counter_frame($counter_id);
                     $tmp = "";
                     while ($p) {
                         $tmp = $p->counter_value($counter_id, $type) . $string . $tmp;
                         $p = $p->lookup_counter_frame($counter_id);
                     }
                     $text .= $tmp;
                 } else {
                     // countertops?
                     continue;
                 }
             }
         } else {
             if (isset($match[4]) && $match[4] !== "") {
                 // String match
                 $text .= $this->_parse_string($match[4]);
             } else {
                 if (isset($match[7]) && $match[7] !== "") {
                     // Directive match
                     if ($match[7] === "open-quote") {
                         $text .= $quotes[0][0];
                     } else {
                         if ($match[7] === "close-quote") {
                             $text .= $quotes[0][1];
                         } else {
                             if ($match[7] === "no-open-quote") {
                                 // Fixme-note:
                             } else {
                                 if ($match[7] === "no-close-quote") {
                                     // Fixme-note:
                                 } else {
                                     if (mb_strpos($match[7], "attr(") === 0) {
                                         $i = mb_strpos($match[7], ")");
                                         if ($i === false) {
                                             continue;
                                         }
                                         $attr = mb_substr($match[7], 5, $i - 5);
                                         if ($attr == "") {
                                             continue;
                                         }
                                         $text .= $this->_frame->get_parent()->get_node()->getAttribute($attr);
//.........这里部分代码省略.........
开发者ID:bukastudio,项目名称:themes-2016,代码行数:101,代码来源:frame_reflower.cls.php


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