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


PHP csstidy::parse_string_list方法代碼示例

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


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

示例1: quote_font_format

 /**
  * format() in font-face needs quoted values for somes browser (FF at least)
  *
  * @param $value
  * @return string
  */
 function quote_font_format($value)
 {
     if (strncmp($value, 'format', 6) == 0) {
         $p = strrpos($value, ")");
         $end = substr($value, $p);
         $format_strings = csstidy::parse_string_list(substr($value, 7, $p - 7));
         if (!$format_strings) {
             $value = "";
         } else {
             $value = "format(";
             foreach ($format_strings as $format_string) {
                 $value .= '"' . str_replace('"', '\\"', $format_string) . '",';
             }
             $value = substr($value, 0, -1) . $end;
         }
     }
     return $value;
 }
開發者ID:nicolasembleton,項目名稱:CSSTidy,代碼行數:24,代碼來源:class.csstidy.php

示例2: parse


//.........這裏部分代碼省略.........
                                         // Quote URLs in imports only if they're not already inside url() and not already quoted.
                                         if (substr($this->sub_value, 0, 4) != 'url(') {
                                             if (!($this->sub_value[0] == substr($this->sub_value, -1) && in_array($this->sub_value[0], array("'", '"')))) {
                                                 $this->sub_value = '"' . $this->sub_value . '"';
                                             }
                                         }
                                     }
                                     $this->sub_value_arr[] = $this->sub_value;
                                     $this->import[] = implode(' ', $this->sub_value_arr);
                                     break;
                             }
                             $this->sub_value_arr = array();
                             $this->sub_value = '';
                             $this->selector = '';
                             $this->sel_separate = array();
                         } else {
                             $this->status = 'ip';
                         }
                     } elseif ($string[$i] !== '}') {
                         $this->sub_value .= $string[$i];
                     }
                     if (($string[$i] === '}' || $string[$i] === ';' || $pn) && !empty($this->selector)) {
                         if ($this->at == '') {
                             $this->at = $this->css_new_media_section(DEFAULT_AT);
                         }
                         // case settings
                         if ($this->get_cfg('lowercase_s')) {
                             $this->selector = strtolower($this->selector);
                         }
                         $this->property = strtolower($this->property);
                         $this->optimise->subvalue();
                         if ($this->sub_value != '') {
                             if (substr($this->sub_value, 0, 6) == 'format') {
                                 $format_strings = csstidy::parse_string_list(substr($this->sub_value, 7, -1));
                                 if (!$format_strings) {
                                     $this->sub_value = "";
                                 } else {
                                     $this->sub_value = "format(";
                                     foreach ($format_strings as $format_string) {
                                         $this->sub_value .= '"' . str_replace('"', '\\"', $format_string) . '",';
                                     }
                                     $this->sub_value = substr($this->sub_value, 0, -1) . ")";
                                 }
                             }
                             if ($this->sub_value != '') {
                                 $this->sub_value_arr[] = $this->sub_value;
                             }
                             $this->sub_value = '';
                         }
                         $this->value = array_shift($this->sub_value_arr);
                         while (count($this->sub_value_arr)) {
                             //$this->value .= (substr($this->value,-1,1)==','?'':' ').array_shift($this->sub_value_arr);
                             $this->value .= ' ' . array_shift($this->sub_value_arr);
                         }
                         $this->optimise->value();
                         $valid = csstidy::property_is_valid($this->property);
                         if ((!$this->invalid_at || $this->get_cfg('preserve_css')) && (!$this->get_cfg('discard_invalid_properties') || $valid)) {
                             $this->css_add_property($this->at, $this->selector, $this->property, $this->value);
                             $this->_add_token(VALUE, $this->value);
                             $this->optimise->shorthands();
                         }
                         if (!$valid) {
                             if ($this->get_cfg('discard_invalid_properties')) {
                                 $this->log('Removed invalid property: ' . $this->property, 'Warning');
                             } else {
                                 $this->log('Invalid property in ' . strtoupper($this->get_cfg('css_level')) . ': ' . $this->property, 'Warning');
開發者ID:moushegh,項目名稱:blog-source-configs,代碼行數:67,代碼來源:class.csstidy.php


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