本文整理汇总了PHP中RevSliderCssParser::compress_css方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderCssParser::compress_css方法的具体用法?PHP RevSliderCssParser::compress_css怎么用?PHP RevSliderCssParser::compress_css使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderCssParser
的用法示例。
在下文中一共展示了RevSliderCssParser::compress_css方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAddScripts
/**
*
* a must function. you can not use it, but the function must stay there!
*/
public static function onAddScripts()
{
global $wp_version;
$slver = apply_filters('revslider_remove_version', RevSliderGlobals::SLIDER_REVISION);
$style_pre = '';
$style_post = '';
if ($wp_version < 3.7) {
$style_pre = '<style type="text/css">';
$style_post = '</style>';
}
$operations = new RevSliderOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = RevSliderFunctions::getVal($arrValues, "includes_globally", "on");
$includesFooter = RevSliderFunctions::getVal($arrValues, "js_to_footer", "off");
$strPutIn = RevSliderFunctions::getVal($arrValues, "pages_for_includes");
$isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
//put the includes only on pages with active widget or shortcode
// if the put in match, then include them always (ignore this if)
if ($isPutIn == false && $includesGlobally == "off") {
$isWidgetActive = is_active_widget(false, false, "rev-slider-widget", true);
$hasShortcode = RevSliderFunctionsWP::hasShortcode("rev_slider");
if ($isWidgetActive == false && $hasShortcode == false) {
return false;
}
}
wp_enqueue_style('rs-plugin-settings', RS_PLUGIN_URL . 'public/assets/css/settings.css', array(), $slver);
$custom_css = RevSliderOperations::getStaticCss();
$custom_css = RevSliderCssParser::compress_css($custom_css);
if (trim($custom_css) == '') {
$custom_css = '#rs-demo-id {}';
}
wp_add_inline_style('rs-plugin-settings', $style_pre . $custom_css . $style_post);
$setBase = is_ssl() ? "https://" : "http://";
wp_enqueue_script(array('jquery'));
//add icon sets
//wp_register_style('rs-icon-set-fa-icon-', RS_PLUGIN_URL .'public/assets/fonts/font-awesome/css/font-awesome.css', array(), $slver);
//wp_register_style('rs-icon-set-pe-7s-', RS_PLUGIN_URL .'public/assets/fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css', array(), $slver);
if ($includesFooter == "off") {
$waitfor = array('jquery');
$enable_logs = RevSliderFunctions::getVal($arrValues, "enable_logs", 'off');
if ($enable_logs == 'on') {
wp_enqueue_script('enable-logs', RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.enablelog.js', $waitfor, $slver);
$waitfor[] = 'enable-logs';
}
wp_enqueue_script('tp-tools', RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.tools.min.js', $waitfor, $slver);
wp_enqueue_script('revmin', RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.revolution.min.js', 'tp-tools', $slver);
} else {
//put javascript to footer
add_action('wp_footer', array('RevSliderFront', 'putJavascript'));
}
add_action('wp_head', array('RevSliderFront', 'add_meta_generator'));
add_action("wp_footer", array('RevSliderFront', "load_icon_fonts"));
// Async JS Loading
$js_defer = RevSliderBase::getVar($arrValues, 'js_defer', 'off');
if ($js_defer != 'off') {
add_filter('clean_url', array('RevSliderFront', 'add_defer_forscript'), 11, 1);
}
add_action('wp_before_admin_bar_render', array('RevSliderFront', 'add_admin_menu_nodes'));
add_action('wp_footer', array('RevSliderFront', 'putAdminBarMenus'));
}
示例2: onFrontAjaxAction
/**
* onAjax action handler
*/
public static function onFrontAjaxAction()
{
$db = new RevSliderDB();
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevSliderOperations();
$token = self::getPostVar("token", false);
//verify the token
$isVerified = wp_verify_nonce($token, 'RevSlider_Front');
$error = false;
if ($isVerified) {
$data = self::getPostVar('data', false);
switch (self::getPostVar('client_action', false)) {
case 'get_slider_html':
$id = intval(self::getPostVar('id', 0));
if ($id > 0) {
$html = '';
add_filter('revslider_add_js_delay', array('RevSliderAdmin', 'rev_set_js_delay'));
ob_start();
$slider_class = RevSliderOutput::putSlider($id);
$html = ob_get_contents();
//add styling
$custom_css = RevSliderOperations::getStaticCss();
$custom_css = RevSliderCssParser::compress_css($custom_css);
$styles = $db->fetch(RevSliderGlobals::$table_css);
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
$html .= '<style type="text/css">' . $custom_css . '</style>';
$html .= '<style type="text/css">' . $styles . '</style>';
ob_clean();
ob_end_clean();
$result = !empty($slider_class) && $html !== '' ? true : false;
if (!$result) {
$error = __('Slider not found', 'revslider');
} else {
if ($html !== false) {
self::ajaxResponseData($html);
} else {
$error = __('Slider not found', 'revslider');
}
}
} else {
$error = __('No Data Received', 'revslider');
}
break;
}
} else {
$error = true;
}
if ($error !== false) {
$showError = __('Loading Error', 'revslider');
if ($error !== true) {
$showError = __('Loading Error: ', 'revslider') . $error;
}
self::ajaxResponseError($showError, false);
}
exit;
}
示例3: get_slider_speed
//.........这里部分代码省略.........
?>
</span></span>
</span>
<span class="tp-clearfix" style="height:15px"></span>
<?php
//get css files
echo '<ul class="tp-monitor-list" id="monitor-CSS-details" style="margin-bottom:15px;display:none;">';
if (file_exists(RS_PLUGIN_PATH . '/public/assets/css/settings.css')) {
$fs = filesize(RS_PLUGIN_PATH . '/public/assets/css/settings.css');
$_li = '<li class="tp-monitor-listli">';
if ($fs < 60000) {
$_li .= '<span class="tp-monitor-good"></span>';
} else {
if ($fs < 100000) {
$_li .= '<span class="tp-monitor-well"></span>';
} else {
$_li .= '<span class="tp-monitor-warning"></span>';
}
}
$_li .= '<span class="tp-monitor-size">' . size_format($fs, 0) . '</span>';
$_li .= '<span class="tp-monitor-file">';
$_li .= __('css/settings.css', REVSLIDER_TEXTDOMAIN);
$_li .= '</span>';
$_li .= '</li>';
if ($fs > 99999) {
$issues .= $_li;
}
echo $_li;
$total_size += $fs;
$css_size += $fs;
}
$custom_css = RevSliderOperations::getStaticCss();
$custom_css = RevSliderCssParser::compress_css($custom_css);
$_li = '<li class="tp-monitor-listli">';
if (strlen($custom_css) < 50000) {
$_li .= '<span class="tp-monitor-good"></span>';
} else {
if (strlen($custom_css) < 100000) {
$_li .= '<span class="tp-monitor-well"></span>';
} else {
$_li .= '<span class="tp-monitor-warning"></span>';
}
}
$_li .= '<span class="tp-monitor-size">' . size_format(strlen($custom_css), 0) . '</span>';
$_li .= '<span class="tp-monitor-file">';
$_li .= __('Static Styles', REVSLIDER_TEXTDOMAIN);
$_li .= '</span>';
$_li .= '</li>';
if (strlen($custom_css) > 49999) {
$issues .= $_li;
}
echo $_li;
$total_size += strlen($custom_css);
$css_size += strlen($custom_css);
if (!empty($used_captions)) {
$captions = array();
foreach ($used_captions as $class => $val) {
$cap = RevSliderOperations::getCaptionsContentArray($class);
if (!empty($cap)) {
$captions[] = $cap;
}
}
$styles = RevSliderCssParser::parseArrayToCss($captions, "\n");
$styles = RevSliderCssParser::compress_css($styles);
$_li = '<li class="tp-monitor-listli">';
示例4: add_custom_navigation_css
public function add_custom_navigation_css($slides)
{
$rs_nav = new RevSliderNavigation();
$all_navs = $rs_nav->get_all_navigations();
$slider_type = $this->slider->getParam('slider-type');
$enable_arrows = $this->slider->getParam('enable_arrows', 'off');
$enable_bullets = $this->slider->getParam('enable_bullets', 'off');
$enable_tabs = $this->slider->getParam('enable_tabs', 'off');
$enable_thumbnails = $this->slider->getParam('enable_thumbnails', 'off');
if ($slider_type !== 'hero' && ($enable_arrows == 'on' || $enable_bullets == 'on' || $enable_tabs == 'on' || $enable_thumbnails == 'on')) {
if (!empty($slides)) {
foreach ($slides as $slide) {
$navigation_arrow_style = $this->slider->getParam('navigation_arrow_style', 'round');
$navigation_bullets_style = $this->slider->getParam('navigation_bullets_style', 'round');
$tabs_style = $this->slider->getParam('tabs_style', 'round');
$thumbnails_style = $this->slider->getParam('thumbnails_style', 'round');
if (!empty($all_navs)) {
foreach ($all_navs as $cur_nav) {
//get modifications out, wrap the class with slide class to be specific
if ($enable_arrows == 'on' && $cur_nav['handle'] == $navigation_arrow_style) {
$this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['arrows'], $cur_nav['handle'], 'arrows', $cur_nav['settings'], $slide, $this) . "\n";
}
if ($enable_bullets == 'on' && $cur_nav['handle'] == $navigation_bullets_style) {
$this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['bullets'], $cur_nav['handle'], 'bullets', $cur_nav['settings'], $slide, $this) . "\n";
}
if ($enable_tabs == 'on' && $cur_nav['handle'] == $tabs_style) {
$this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['tabs'], $cur_nav['handle'], 'tabs', $cur_nav['settings'], $slide, $this) . "\n";
}
if ($enable_thumbnails == 'on' && $cur_nav['handle'] == $thumbnails_style) {
$this->rev_custom_navigation_css .= $rs_nav->add_placeholder_sub_modifications($cur_nav['css']['thumbs'], $cur_nav['handle'], 'thumbs', $cur_nav['settings'], $slide, $this) . "\n";
}
}
}
}
if ($this->markup_export === true) {
echo '<!-- STYLE -->';
}
if (!is_admin()) {
echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="';
} else {
echo "<style>";
}
if (!is_admin()) {
echo addslashes(RevSliderCssParser::compress_css($this->rev_custom_navigation_css)) . '";
if(htmlDiv) {
htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
}else{
var htmlDiv = document.createElement("div");
htmlDiv.innerHTML = "<style>" + htmlDivCss + "</style>";
document.getElementsByTagName("head")[0].appendChild(htmlDiv.childNodes[0]);
}
</script>' . "\n";
} else {
echo $this->rev_custom_navigation_css . '</style>';
}
if ($this->markup_export === true) {
echo '<!-- /STYLE -->';
}
}
}
}
示例5: add_inline_styles
/**
* Output Dynamic Inline Styles
*/
public function add_inline_styles()
{
if (!is_admin()) {
echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="';
} else {
echo "<style>";
}
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
foreach ($styles as $key => $style) {
$handle = str_replace('.tp-caption', '', $style['handle']);
if (!isset($this->class_include[$handle])) {
unset($styles[$key]);
}
}
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
if (!is_admin()) {
echo addslashes($styles) . '";
if(htmlDiv) {
htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
}
else{
var htmlDiv = document.createElement("div");
htmlDiv.innerHTML = "<style>" + htmlDivCss + "</style>";
document.getElementsByTagName("head")[0].appendChild(htmlDiv.childNodes[0]);
}
</script>' . "\n";
} else {
echo $styles . '</style>';
}
}
示例6: add_inline_styles
/**
* Output Dynamic Inline Styles
*/
public function add_inline_styles()
{
if (!is_admin()) {
echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css");htmlDiv.innerHTML = htmlDiv.innerHTML + unescape("';
} else {
echo "<style>";
}
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
foreach ($styles as $key => $style) {
$handle = str_replace('.tp-caption', '', $style['handle']);
if (!isset($this->class_include[$handle])) {
unset($styles[$key]);
}
}
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
if (!is_admin()) {
echo addslashes($styles) . '");</script>' . "\n";
} else {
echo $styles . '</style>';
}
}
示例7: add_inline_styles
/**
* Output Dynamic Inline Styles
*/
public function add_inline_styles()
{
if (!is_admin()) {
echo '<script>document.write("<style type=\\"text/css\\">';
} else {
echo "<style>";
}
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
foreach ($styles as $key => $style) {
$handle = str_replace('.tp-caption', '', $style['handle']);
if (!isset($this->class_include[$handle])) {
unset($styles[$key]);
}
}
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
if (!is_admin()) {
echo addslashes($styles) . '</style>");</script>' . "\n";
} else {
echo $styles . '</style>';
}
}