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


PHP CSS::pretty方法代码示例

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


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

示例1: check

 public static function check()
 {
     if (!IN_PRODUCTION) {
         # Clean it up so we can use the line numbers
         CSS::pretty();
         # Get the validator options from the config
         $validator_options = CSScaffold::config('Validate');
         # Add our options
         $validator_options['text'] = CSS::$css;
         $validator_options['output'] = 'soap12';
         # Encode them
         $validator_options = http_build_query($validator_options);
         $url = "http://jigsaw.w3.org/css-validator/validator?{$validator_options}";
         # The Curl options
         $options = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => 1);
         # Start CURL
         $handle = curl_init();
         # Set the CURL options
         curl_setopt_array($handle, $options);
         # Store the response in a buffer
         $buffer = curl_exec($handle);
         # Close it
         curl_close($handle);
         # If something was returned
         if (!empty($buffer)) {
             # Simplexml doesn't like colons
             $buffer = preg_replace("/(<\\/?)(\\w+):([^>]*>)/", "\$1\$2\$3", $buffer);
             # Let it be xml!
             $results = simplexml_load_string($buffer);
             # Is it valid?
             $is_valid = (string) $results->envBody->mcssvalidationresponse->mvalidity;
             # Oh noes! Display the errors
             if ($is_valid == "false") {
                 # Lets get the errors into a nice array
                 $errors = $results->envBody->mcssvalidationresponse->mresult->merrors;
                 # Number of errors
                 $count = (int) $errors->merrorcount;
                 # Start creating the output message
                 $message = "<ol>";
                 foreach ($errors->merrorlist->merror as $key => $error) {
                     $message .= "<li><strong>" . trim((string) $error->mmessage) . "</strong> line " . (string) $error->mline . " near " . (string) $error->mcontext . "</li>";
                 }
                 $message .= "</ol>";
                 # Throw an error
                 throw new Scaffold_User_Exception("CSS is not valid - {$count} errors", $message);
             }
         }
     }
 }
开发者ID:Keukendeur,项目名称:csscaffold,代码行数:49,代码来源:Validate.php

示例2: parse_css

 /**
  * Parse the CSS
  *
  * @return string - The processes css file as a string
  * @author Anthony Short
  **/
 public static function parse_css()
 {
     # If the cache is stale or doesn't exist
     if (self::config('core.cache.mod_time') <= self::config('core.request.mod_time')) {
         # Start the timer
         Benchmark::start("parse_css");
         # Compress it before parsing
         CSS::compress(CSS::$css);
         # Import CSS files
         Import::parse();
         if (self::config('core.auto_include_mixins') === true) {
             # Import the mixins in the plugin/module folders
             Mixins::import_mixins('framework/mixins');
         }
         # Parse our css through the plugins
         foreach (self::$plugins as $plugin) {
             call_user_func(array($plugin, 'import_process'));
         }
         # Compress it before parsing
         CSS::compress(CSS::$css);
         # Parse the constants
         Constants::parse();
         foreach (self::$plugins as $plugin) {
             call_user_func(array($plugin, 'pre_process'));
         }
         # Parse the @grid
         Layout::parse_grid();
         # Replace the constants
         Constants::replace();
         # Parse @for loops
         Iteration::parse();
         foreach (self::$plugins as $plugin) {
             call_user_func(array($plugin, 'process'));
         }
         # Compress it before parsing
         CSS::compress(CSS::$css);
         # Parse the mixins
         Mixins::parse();
         # Find missing constants
         Constants::replace();
         # Compress it before parsing
         CSS::compress(CSS::$css);
         foreach (self::$plugins as $plugin) {
             call_user_func(array($plugin, 'post_process'));
         }
         # Parse the expressions
         Expression::parse();
         # Parse the nested selectors
         NestedSelectors::parse();
         # Convert all url()'s to absolute paths if required
         if (self::config('core.absolute_urls') === true) {
             CSS::convert_to_absolute_urls();
         }
         # Replaces url()'s that start with ~ to lead to the CSS directory
         CSS::replace_css_urls();
         # Add the extra string we've been storing
         CSS::$css .= CSS::$append;
         # If they want to minify it
         if (self::config('core.minify_css') === true) {
             Minify::compress();
         } else {
             CSS::pretty();
         }
         # Formatting hook
         foreach (self::$plugins as $plugin) {
             call_user_func(array($plugin, 'formatting_process'));
         }
         # Validate the CSS
         if (self::config('core.validate') === true) {
             Validate::check();
         }
         # Stop the timer...
         Benchmark::stop("parse_css");
         if (self::config('core.show_header') === TRUE) {
             CSS::$css = "/* Processed by CSScaffold on " . gmdate('r') . " in " . Benchmark::get("parse_css", "time") . " seconds */\n\n" . CSS::$css;
         }
         # Write the css file to the cache
         self::cache_write(CSS::$css);
         # Output process hook for plugins to display views.
         # Doesn't run in production mode.
         if (!IN_PRODUCTION) {
             foreach (array_merge(self::$plugins, self::$modules) as $plugin) {
                 call_user_func(array($plugin, 'output'));
             }
         }
     }
 }
开发者ID:Keukendeur,项目名称:csscaffold,代码行数:93,代码来源:CSScaffold.php

示例3:

</code></pre>
		<?php 
}
?>
	</div>
	
	<div class="content">
		<?php 
if (isset($trace)) {
    echo "<h2>Back Trace</h2>";
    echo $trace;
}
?>
	</div>
	
	<?php 
if (CSS::$css != "") {
    ?>
	<div class="content">
		<h2>CSS</h2>
		
		<pre><code><?php 
    echo CSS::pretty(true);
    ?>
</code></pre>
	</div>
	<?php 
}
?>
</body>
</html>
开发者ID:pdclark,项目名称:csscaffold,代码行数:31,代码来源:Scaffold_Exception.php


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