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


PHP safecss_class函数代码示例

本文整理汇总了PHP中safecss_class函数的典型用法代码示例。如果您正苦于以下问题:PHP safecss_class函数的具体用法?PHP safecss_class怎么用?PHP safecss_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: filter_attr

 static function filter_attr($css, $element = 'div')
 {
     safecss_class();
     $css = $element . ' {' . $css . '}';
     $csstidy = new csstidy();
     $csstidy->optimise = new safecss($csstidy);
     $csstidy->set_cfg('remove_bslash', false);
     $csstidy->set_cfg('compress_colors', false);
     $csstidy->set_cfg('compress_font-weight', false);
     $csstidy->set_cfg('discard_invalid_properties', true);
     $csstidy->set_cfg('merge_selectors', false);
     $csstidy->set_cfg('remove_last_;', false);
     $csstidy->set_cfg('css_level', 'CSS3.0');
     $css = preg_replace('/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $css);
     $css = wp_kses_split($css, array(), array());
     $csstidy->parse($css);
     $css = $csstidy->print->plain();
     $css = str_replace(array("\n", "\r", "\t"), '', $css);
     preg_match("/^{$element}\\s*{(.*)}\\s*\$/", $css, $matches);
     if (empty($matches[1])) {
         return '';
     }
     return $matches[1];
 }
开发者ID:pcuervo,项目名称:wp-carnival,代码行数:24,代码来源:custom-css.php

示例2: custom_css_minify

function custom_css_minify($css)
{
    if (!$css) {
        return '';
    }
    safecss_class();
    $csstidy = new csstidy();
    $csstidy->optimise = new safecss($csstidy);
    $csstidy->set_cfg('remove_bslash', false);
    $csstidy->set_cfg('compress_colors', true);
    $csstidy->set_cfg('compress_font-weight', true);
    $csstidy->set_cfg('remove_last_;', true);
    $csstidy->set_cfg('case_properties', true);
    $csstidy->set_cfg('discard_invalid_properties', true);
    $csstidy->set_cfg('css_level', 'CSS3.0');
    $csstidy->set_cfg('template', 'highest');
    $csstidy->parse($css);
    return $csstidy->print->plain();
}
开发者ID:burbridge,项目名称:thesis2013website,代码行数:19,代码来源:custom-css.php

示例3: sanitize_css

 static function sanitize_css($css)
 {
     $css = stripslashes($css);
     $css = wp_strip_all_tags($css);
     if (function_exists('safecss_class')) {
         // Stolen from the Custom CSS plugin. Sanitize and clean using CSS tidy if available.
         safecss_class();
         $csstidy = new csstidy();
         $csstidy->optimise = new safecss($csstidy);
         $csstidy->set_cfg('remove_bslash', false);
         $csstidy->set_cfg('compress_colors', false);
         $csstidy->set_cfg('compress_font-weight', false);
         $csstidy->set_cfg('discard_invalid_properties', true);
         $csstidy->set_cfg('merge_selectors', false);
         $csstidy->set_cfg('remove_last_;', false);
         $csstidy->set_cfg('css_level', 'CSS3.0');
         $css = preg_replace('/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $css);
         $csstidy->parse($css);
         $css = $csstidy->print->plain();
     }
     return $css;
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:22,代码来源:art-direction-redux.php

示例4: inst_css_parser

 /**
  * If we're not running JetPack, instantiate a custom CSS parser
  */
 function inst_css_parser($css = null)
 {
     if (empty($css)) {
         return '';
     }
     $css = $this->compile_scss($css);
     if (!class_exists('safecss_class')) {
         require_once plugin_dir_path(dirname(__FILE__)) . '/classes/class-safecss-class.php';
     }
     safecss_class();
     $csstidy = new csstidy();
     $csstidy->optimise = new safecss($csstidy);
     $csstidy->set_cfg('remove_bslash', false);
     $csstidy->set_cfg('compress_colors', true);
     $csstidy->set_cfg('compress_font-weight', true);
     $csstidy->set_cfg('remove_last_;', true);
     $csstidy->set_cfg('case_properties', true);
     $csstidy->set_cfg('discard_invalid_properties', true);
     $csstidy->set_cfg('css_level', 'CSS3.0');
     $csstidy->set_cfg('template', 'highest');
     $csstidy->set_cfg('preserve_css', false);
     $csstidy->parse($css);
     return $csstidy->print->plain();
 }
开发者ID:hwdsbcommons,项目名称:reveal-js-presentations,代码行数:27,代码来源:class-reveal-presentations.php

示例5: sanitize_css

 /**
  * Sanitize the CSS for users without `unfiltered_html`.
  *
  * @param string $css  Input CSS.
  * @param array  $args Array of CSS options.
  *
  * @return mixed|string
  */
 public static function sanitize_css($css, $args = array())
 {
     $args = wp_parse_args($args, array('force' => false, 'preprocessor' => null));
     if ($args['force'] || !current_user_can('unfiltered_html')) {
         $warnings = array();
         safecss_class();
         $csstidy = new csstidy();
         $csstidy->optimise = new safecss($csstidy);
         $csstidy->set_cfg('remove_bslash', false);
         $csstidy->set_cfg('compress_colors', false);
         $csstidy->set_cfg('compress_font-weight', false);
         $csstidy->set_cfg('optimise_shorthands', 0);
         $csstidy->set_cfg('remove_last_;', false);
         $csstidy->set_cfg('case_properties', false);
         $csstidy->set_cfg('discard_invalid_properties', true);
         $csstidy->set_cfg('css_level', 'CSS3.0');
         $csstidy->set_cfg('preserve_css', true);
         $csstidy->set_cfg('template', dirname(__FILE__) . '/csstidy/wordpress-standard.tpl');
         $prev = $css;
         $css = preg_replace('/\\\\([0-9a-fA-F]{4})/', '\\\\\\\\$1', $css);
         // prevent content: '\3434' from turning into '\\3434'.
         $css = str_replace(array('\'\\\\', '"\\\\'), array('\'\\', '"\\'), $css);
         if ($css !== $prev) {
             $warnings[] = 'preg_replace found stuff';
         }
         // Some people put weird stuff in their CSS, KSES tends to be greedy.
         $css = str_replace('<=', '&lt;=', $css);
         $prev = $css;
         // Why KSES instead of strip_tags?  Who knows?
         $css = wp_kses_split($css, array(), array());
         $css = str_replace('&gt;', '>', $css);
         // kses replaces lone '>' with &gt;
         // Why both KSES and strip_tags?  Because we just added some '>'.
         $css = strip_tags($css);
         if ($css != $prev) {
             $warnings[] = 'kses found stuff';
         }
         // if we're not using a preprocessor.
         if (!$args['preprocessor']) {
             /** This action is documented in modules/custom-css/custom-css.php */
             do_action('safecss_parse_pre', $csstidy, $css, $args);
             $csstidy->parse($css);
             /** This action is documented in modules/custom-css/custom-css.php */
             do_action('safecss_parse_post', $csstidy, $warnings, $args);
             $css = $csstidy->print->plain();
         }
     }
     return $css;
 }
开发者ID:Automattic,项目名称:vip-mu-plugins-public,代码行数:57,代码来源:custom-css-4.7.php

示例6: pixopoint_initiate_safecss

/**
 * Initiate SafeCSS
 * @since 0.9
 */
function pixopoint_initiate_safecss()
{
    safecss_class();
}
开发者ID:pemiu01,项目名称:wppaintbrush,代码行数:8,代码来源:csstidy.php


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