當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。