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


PHP csstidy::is_important方法代码示例

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


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

示例1: gvw_important

 /**
  * Returns a value without !important
  * @param string $value
  * @return string
  * @access public
  * @version 1.0
  */
 function gvw_important($value)
 {
     // Apenas para evitar o erro por passar a referencia do objeto diretamente a função
     // Maikon.Will - 21/06/2012
     $value0 = $value;
     if (csstidy::is_important($value0)) {
         $value = trim($value);
         $value = substr($value, 0, -9);
         $value = trim($value);
         $value = substr($value, 0, -1);
         $value = trim($value);
         return $value;
     }
     return $value;
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:22,代码来源:class.csstidy.php

示例2: gvw_important

 /**
  * Returns a value without !important
  * @param string $value
  * @return string
  * @access public
  * @version 1.0
  */
 static function gvw_important($value)
 {
     if (csstidy::is_important($value)) {
         $value = trim($value);
         $value = substr($value, 0, -9);
         $value = trim($value);
         $value = substr($value, 0, -1);
         $value = trim($value);
         return $value;
     }
     return $value;
 }
开发者ID:nicolasembleton,项目名称:CSSTidy,代码行数:19,代码来源:class.csstidy.php

示例3: merge_font

 /**
  * Merges all fonts properties
  * @param array $input_css
  * @return array
  * @version 1.3
  * @see dissolve_short_font()
  */
 function merge_font($input_css)
 {
     $font_prop_default =& $GLOBALS['csstidy']['font_prop_default'];
     $new_font_value = '';
     $important = '';
     // Skip if not font-family and font-size set
     if (isset($input_css['font-family']) && isset($input_css['font-size'])) {
         // fix several words in font-family - add quotes
         if (isset($input_css['font-family'])) {
             $families = explode(",", $input_css['font-family']);
             $result_families = array();
             foreach ($families as $family) {
                 $family = trim($family);
                 $len = strlen($family);
                 if (strpos($family, " ") && !($family[0] == '"' && $family[$len - 1] == '"' || $family[0] == "'" && $family[$len - 1] == "'")) {
                     $family = '"' . $family . '"';
                 }
                 $result_families[] = $family;
             }
             $input_css['font-family'] = implode(",", $result_families);
         }
         foreach ($font_prop_default as $font_property => $default_value) {
             // Skip if property does not exist
             if (!isset($input_css[$font_property])) {
                 continue;
             }
             $cur_value = $input_css[$font_property];
             // Skip if default value is used
             if ($cur_value === $default_value) {
                 continue;
             }
             // Remove !important
             if (csstidy::is_important($cur_value)) {
                 $important = '!important';
                 $cur_value = csstidy::gvw_important($cur_value);
             }
             $new_font_value .= $cur_value;
             // Add delimiter
             $new_font_value .= $font_property === 'font-size' && isset($input_css['line-height']) ? '/' : ' ';
         }
         $new_font_value = trim($new_font_value);
         // Delete all font-properties
         foreach ($font_prop_default as $font_property => $default_value) {
             if ($font_property !== 'font' or !$new_font_value) {
                 unset($input_css[$font_property]);
             }
         }
         // Add new font property
         if ($new_font_value !== '') {
             $input_css['font'] = $new_font_value . $important;
         }
     }
     return $input_css;
 }
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:61,代码来源:class.csstidy_optimise.php

示例4: merge_bg

 /**
  * Merges all background properties
  * @param array $input_css
  * @return array
  * @version 1.0
  * @see dissolve_short_bg()
  * @todo full CSS 3 compliance
  */
 function merge_bg($input_css)
 {
     $background_prop_default =& $GLOBALS['csstidy']['background_prop_default'];
     // Max number of background images. CSS3 not yet fully implemented
     $number_of_values = @max(count(csstidy_optimise::explode_ws(',', $input_css['background-image'])), count(csstidy_optimise::explode_ws(',', $input_css['background-color'])), 1);
     // Array with background images to check if BG image exists
     $bg_img_array = @csstidy_optimise::explode_ws(',', csstidy::gvw_important($input_css['background-image']));
     $new_bg_value = '';
     $important = '';
     for ($i = 0; $i < $number_of_values; $i++) {
         foreach ($background_prop_default as $bg_property => $default_value) {
             // Skip if property does not exist
             if (!isset($input_css[$bg_property])) {
                 continue;
             }
             $cur_value = $input_css[$bg_property];
             // Skip some properties if there is no background image
             if ((!isset($bg_img_array[$i]) || $bg_img_array[$i] === 'none') && ($bg_property === 'background-size' || $bg_property === 'background-position' || $bg_property === 'background-attachment' || $bg_property === 'background-repeat')) {
                 continue;
             }
             // Remove !important
             if (csstidy::is_important($cur_value)) {
                 $important = ' !important';
                 $cur_value = csstidy::gvw_important($cur_value);
             }
             // Do not add default values
             if ($cur_value === $default_value) {
                 continue;
             }
             $temp = csstidy_optimise::explode_ws(',', $cur_value);
             if (isset($temp[$i])) {
                 if ($bg_property == 'background-size') {
                     $new_bg_value .= '(' . $temp[$i] . ') ';
                 } else {
                     $new_bg_value .= $temp[$i] . ' ';
                 }
             }
         }
         $new_bg_value = trim($new_bg_value);
         if ($i != $number_of_values - 1) {
             $new_bg_value .= ',';
         }
     }
     // Delete all background-properties
     foreach ($background_prop_default as $bg_property => $default_value) {
         unset($input_css[$bg_property]);
     }
     // Add new background property
     if ($new_bg_value !== '') {
         $input_css['background'] = $new_bg_value . $important;
     }
     return $input_css;
 }
开发者ID:robertsonmello,项目名称:projetos,代码行数:61,代码来源:class.csstidy_optimise.php

示例5: merge_font

 /**
  * Merges all fonts properties
  * @param array $input_css
  * @return array
  * @version 1.3
  * @see dissolve_short_font()
  */
 function merge_font($input_css)
 {
     $font_prop_default =& $GLOBALS['csstidy']['font_prop_default'];
     $new_font_value = '';
     $important = '';
     // Skip if not font-family and font-size set
     if (isset($input_css['font-family']) && isset($input_css['font-size'])) {
         foreach ($font_prop_default as $font_property => $default_value) {
             // Skip if property does not exist
             if (!isset($input_css[$font_property])) {
                 continue;
             }
             $cur_value = $input_css[$font_property];
             // Skip if default value is used
             if ($cur_value === $default_value) {
                 continue;
             }
             // Remove !important
             if (csstidy::is_important($cur_value)) {
                 $important = '!important';
                 $cur_value = csstidy::gvw_important($cur_value);
             }
             $new_font_value .= $cur_value;
             // Add delimiter
             $new_font_value .= $font_property === 'font-size' && isset($input_css['line-height']) ? '/' : ' ';
         }
         $new_font_value = trim($new_font_value);
         // Delete all font-properties
         foreach ($font_prop_default as $font_property => $default_value) {
             unset($input_css[$font_property]);
         }
         // Add new font property
         if ($new_font_value !== '') {
             $input_css['font'] = $new_font_value . $important;
         }
     }
     return $input_css;
 }
开发者ID:harrylongworth,项目名称:tv-bb,代码行数:45,代码来源:class.csstidy_optimise.php

示例6: compress_important

 /**
  * Removes unnecessary whitespace in ! important
  * @param string $string
  * @return string
  * @access public
  * @version 1.1
  */
 function compress_important(&$string)
 {
     if (csstidy::is_important($string)) {
         $string = csstidy::gvw_important($string) . '!important';
     }
     return $string;
 }
开发者ID:nico-izo,项目名称:CSSTidy-fork,代码行数:14,代码来源:csstidy.class.php


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