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


PHP CSS::replace方法代码示例

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


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

示例1: post_process

 /**
  * The second last process, should only be getting everything
  * syntaxically correct, rather than doing any heavy processing
  *
  * @author Anthony Short
  * @return $css string
  */
 public static function post_process()
 {
     if ($found = CSS::find_properties_with_value('image-replace', 'url\\([\'\\"]?([^)]+)[\'\\"]?\\)')) {
         foreach ($found[4] as $key => $value) {
             $path = $url = str_replace("\\", "/", unquote($value));
             # If they're getting an absolute file
             if ($path[0] == "/") {
                 $path = DOCROOT . ltrim($path, "/");
             }
             # Check if it exists
             if (!file_exists($path)) {
                 FB::log("ImageReplace - Image doesn't exist " . $path);
             }
             # Make sure it's an image
             if (!is_image($path)) {
                 FB::log("ImageReplace - File is not an image: {$path}");
             }
             // Get the size of the image file
             $size = GetImageSize($path);
             $width = $size[0];
             $height = $size[1];
             // Make sure theres a value so it doesn't break the css
             if (!$width && !$height) {
                 $width = $height = 0;
             }
             // Build the selector
             $properties = "\n\t\t\t\t\tbackground:url({$url}) no-repeat 0 0;\n\t\t\t\t\theight:{$height}px;\n\t\t\t\t\twidth:{$width}px;\n\t\t\t\t\tdisplay:block;\n\t\t\t\t\ttext-indent:-9999px;\n\t\t\t\t\toverflow:hidden;\n\t\t\t\t";
             CSS::replace($found[2][$key], $properties);
         }
         # Remove any left overs
         CSS::replace($found[1], '');
     }
 }
开发者ID:Keukendeur,项目名称:csscaffold,代码行数:40,代码来源:ImageReplace.php

示例2: parse_fors

 /**
  * Parses @fors within the css
  *
  * @author Anthony Short
  * @param $string
  * @return string
  */
 public static function parse_fors($string)
 {
     if ($found = self::find_fors($string)) {
         foreach ($found[0] as $key => $value) {
             $s = "";
             $from = $found[2][$key];
             $to = $found[3][$key];
             $var = $found[1][$key];
             for ($i = $from; $i <= $to; $i++) {
                 $s .= str_replace("!{$var}", $i, $found[5][$key]);
             }
             CSS::replace($found[0][$key], $s);
         }
     }
 }
开发者ID:pdclark,项目名称:csscaffold,代码行数:22,代码来源:Iteration.php

示例3: parse

 /**
  * The main processing function called by Scaffold. MUST return $css!
  *
  * @author Anthony Short
  * @return $css string
  */
 public static function parse()
 {
     global $bases;
     # This will store our nicely formated bases array
     # This lets us loop through all the of +mixins and just
     # pull in the properties of that mixin and then parse it individually
     # based on the parameters
     $bases = array();
     # Finds any selectors starting with =mixin-name
     if ($found = CSS::find_selectors('\\=(?P<name>[0-9a-zA-Z_-]*)(\\((?P<args>.*?)\\))?', 5)) {
         # Just to make life a little easier
         $full_base = $found[0];
         $base_names = $found['name'];
         $base_args = $found['args'];
         $base_props = $found['properties'];
         # Clean up memory
         unset($found);
         # Puts the mixin bases into a more suitable array
         foreach ($base_names as $key => $value) {
             $bases[$value]['properties'] = $base_props[$key];
             # If there are mixin arguments, add them
             $bases[$value]['params'] = $base_args[$key] != "" ? explode(',', $base_args[$key]) : array();
         }
         # Store this away for debugging
         self::$mixins = $bases;
         # Remove all of the mixin bases
         CSS::remove($full_base);
         # Clean up memory
         unset($full_base, $base_names, $base_args, $base_props);
         # Find the mixins
         if ($mixins = self::find_mixins(CSS::$css)) {
             # Loop through each of the found +mixins
             foreach ($mixins[2] as $mixin_key => $mixin_name) {
                 CSS::replace($mixins[0][$mixin_key], self::build_mixins($mixin_key, $mixins));
             }
             # Remove all of the +mixins (if they still exist)
             CSS::replace($mixins[0], '');
         }
         # Clean up
         unset($bases, $mixins);
     }
 }
开发者ID:robbenmu,项目名称:csscaffold,代码行数:48,代码来源:Mixins.php

示例4: round_to_baseline

 /**
  * Finds any round(n) and rounds the number 
  * to the nearest multiple of the baseline
  *
  * @author Anthony Short
  * @param $css
  */
 private static function round_to_baseline($baseline)
 {
     if ($found = CSS::find_functions('round')) {
         foreach ($found[0] as $key => $match) {
             CSS::replace($match, round($found[1][$key] / $baseline) * $baseline . "px");
         }
     }
 }
开发者ID:pdclark,项目名称:csscaffold,代码行数:15,代码来源:Layout.php

示例5: replace

 /**
  * Replace constants
  *
  * @author Anthony Short
  * @param $
  * @return return type
  */
 public static function replace()
 {
     if (!empty(self::$constants)) {
         foreach (self::$constants as $key => $value) {
             if ($value != "") {
                 if (CSScaffold::config('core.use_css_constants') === true) {
                     CSS::replace("const({$key})", unquote($value));
                 } else {
                     CSS::replace("!{$key}", unquote($value));
                 }
             }
         }
         self::$constants = array();
     } else {
         if (preg_match_all('/![a-zA-Z0-9-_]+/', CSS::$css, $matches)) {
             $missing = array_values(array_unique($matches[0]));
             # Remove !important
             unset($missing[array_search('!important', $missing)]);
             if (!empty($missing)) {
                 $missing = "<ul><li>" . implode("</li><li>", $missing) . "</li></ul>";
                 throw new Scaffold_Exception('Constants.missing_constants', $missing);
             }
         }
     }
 }
开发者ID:Keukendeur,项目名称:csscaffold,代码行数:32,代码来源:Constants.php


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