本文整理汇总了PHP中RevSliderOperations::getStaticCss方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderOperations::getStaticCss方法的具体用法?PHP RevSliderOperations::getStaticCss怎么用?PHP RevSliderOperations::getStaticCss使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderOperations
的用法示例。
在下文中一共展示了RevSliderOperations::getStaticCss方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
//.........这里部分代码省略.........
echo __("Show Details", REVSLIDER_TEXTDOMAIN);
?>
</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);
示例4: importSliderFromPost
//.........这里部分代码省略.........
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(RevSliderGlobals::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$anim_id = $exist['0']['id'];
} else {
//insert with new handle
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
//and set the current customin-oldID and customout-oldID in slider params to new ID from $id
$content = str_replace(array('customin-' . $animation['id'] . '"', 'customout-' . $animation['id'] . '"'), array('customin-' . $anim_id . '"', 'customout-' . $anim_id . '"'), $content);
}
dmp(__("animations imported!", REVSLIDER_TEXTDOMAIN));
} else {
dmp(__("no custom animations found, if slider uses custom animations, the provided export may be broken...", REVSLIDER_TEXTDOMAIN));
}
//overwrite/append static-captions.css
if (!empty($static)) {
if ($updateStatic == "true") {
//overwrite file
RevSliderOperations::updateStaticCss($static);
} elseif ($updateStatic == 'none') {
//do nothing
} else {
//append
$static_cur = RevSliderOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevSliderOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = RevSliderCssParser::parseCssToArray($dynamic);
if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
foreach ($dynamicCss as $class => $styles) {
//check if static style or dynamic style
$class = trim($class);
if (strpos($class, ',') !== false && strpos($class, '.tp-caption') !== false) {
//we have something like .tp-caption.redclass, .redclass
$class_t = explode(',', $class);
foreach ($class_t as $k => $cl) {
if (strpos($cl, '.tp-caption') !== false) {
$class = $cl;
}
}
}
if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
//.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
continue;
}
//is a dynamic style
if (strpos($class, ':hover') !== false) {
$class = trim(str_replace(':hover', '', $class));
$arrInsert = array();
$arrInsert["hover"] = json_encode($styles);
$arrInsert["settings"] = json_encode(array('hover' => 'true'));
} else {
$arrInsert = array();
示例5: importSliderFromPost
//.........这里部分代码省略.........
//overwrite animation if exists
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(RevSliderGlobals::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$anim_id = $exist['0']['id'];
} else {
//insert with new handle
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$anim_id = $db->insert(RevSliderGlobals::$table_layer_anims, $arrInsert);
}
//and set the current customin-oldID and customout-oldID in slider params to new ID from $id
$content = str_replace(array('customin-' . $animation['id'] . '"', 'customout-' . $animation['id'] . '"'), array('customin-' . $anim_id . '"', 'customout-' . $anim_id . '"'), $content);
}
dmp(__("animations imported!", 'revslider'));
}
//overwrite/append static-captions.css
if (!empty($static)) {
if ($updateStatic == "true") {
//overwrite file
RevSliderOperations::updateStaticCss($static);
} elseif ($updateStatic == 'none') {
//do nothing
} else {
//append
$static_cur = RevSliderOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevSliderOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = RevSliderCssParser::parseCssToArray($dynamic);
if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
foreach ($dynamicCss as $class => $styles) {
//check if static style or dynamic style
$class = trim($class);
if (strpos($class, ',') !== false && strpos($class, '.tp-caption') !== false) {
//we have something like .tp-caption.redclass, .redclass
$class_t = explode(',', $class);
foreach ($class_t as $k => $cl) {
if (strpos($cl, '.tp-caption') !== false) {
$class = $cl;
}
}
}
if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
//.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
continue;
}
//is a dynamic style
if (strpos($class, ':hover') !== false) {
$class = trim(str_replace(':hover', '', $class));
$arrInsert = array();
$arrInsert["hover"] = json_encode($styles);
$arrInsert["settings"] = json_encode(array('hover' => 'true'));
} else {
$arrInsert = array();