本文整理汇总了PHP中RevSliderOperations::updateStaticCss方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderOperations::updateStaticCss方法的具体用法?PHP RevSliderOperations::updateStaticCss怎么用?PHP RevSliderOperations::updateStaticCss使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderOperations
的用法示例。
在下文中一共展示了RevSliderOperations::updateStaticCss方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importSliderFromPost
//.........这里部分代码省略.........
if (!empty($exist)) {
//update the animation, get the ID
if ($updateAnim == "true") {
//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_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));
示例2: onAjaxAction
//.........这里部分代码省略.........
self::ajaxResponseSuccess(__("CSS saved", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
}
RevSliderFunctions::throwError(__('CSS could not be saved', 'revslider'));
exit;
break;
case "rename_captions_css":
//rename all captions in all sliders with new handle if success
$arrCaptions = $operations->renameCaption($data);
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
$custom_css = RevSliderOperations::getStaticCss();
$custom_css = RevSliderCssParser::compress_css($custom_css);
$arrCSS = $operations->getCaptionsContentArray();
$arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
$arrCssStyles = $arrCSS;
self::ajaxResponseSuccess(__("Class name renamed", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
break;
case "delete_captions_css":
$arrCaptions = $operations->deleteCaptionsContentData($data);
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
$custom_css = RevSliderOperations::getStaticCss();
$custom_css = RevSliderCssParser::compress_css($custom_css);
$arrCSS = $operations->getCaptionsContentArray();
$arrCssStyles = RevSliderFunctions::jsonEncodeForClientSide($arrCSS);
$arrCssStyles = $arrCSS;
self::ajaxResponseSuccess(__("Style deleted!", 'revslider'), array("arrCaptions" => $arrCaptions, 'compressed_css' => $styles . $custom_css, 'initstyles' => $arrCssStyles));
break;
case "update_static_css":
$staticCss = $operations->updateStaticCss($data);
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
$custom_css = RevSliderOperations::getStaticCss();
$custom_css = RevSliderCssParser::compress_css($custom_css);
self::ajaxResponseSuccess(__("CSS saved", 'revslider'), array("css" => $staticCss, 'compressed_css' => $styles . $custom_css));
break;
case "insert_custom_anim":
$arrAnims = $operations->insertCustomAnim($data);
//$arrCaptions =
self::ajaxResponseSuccess(__("Animation saved", 'revslider'), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_custom_anim":
$arrAnims = $operations->updateCustomAnim($data);
self::ajaxResponseSuccess(__("Animation saved", 'revslider'), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_custom_anim_name":
$arrAnims = $operations->updateCustomAnimName($data);
self::ajaxResponseSuccess(__("Animation saved", 'revslider'), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "delete_custom_anim":
$arrAnims = $operations->deleteCustomAnim($data);
self::ajaxResponseSuccess(__("Animation deleted", 'revslider'), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess(__("Order updated", 'revslider'));
示例3: importSliderFromPost
//.........这里部分代码省略.........
//$animation['id'], $animation['handle'], $animation['params']
$exist = $db->fetch(RevSliderGlobals::$table_layer_anims, $db->prepare("handle = %s", array($animation['handle'])));
if (!empty($exist)) {
//update the animation, get the ID
if ($updateAnim == "true") {
//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));