本文整理汇总了PHP中RevOperations::updateStaticCss方法的典型用法代码示例。如果您正苦于以下问题:PHP RevOperations::updateStaticCss方法的具体用法?PHP RevOperations::updateStaticCss怎么用?PHP RevOperations::updateStaticCss使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevOperations
的用法示例。
在下文中一共展示了RevOperations::updateStaticCss方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAjaxAction
//.........这里部分代码省略.........
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "copy_move_slide":
$sliderID = $slider->copyMoveSlideFromData($data);
self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_static_css":
sdsconfig::getgeneratecssfile();
$contentCSS = $operations->getStaticCss();
self::ajaxResponseData($contentCSS);
break;
case "get_dynamic_css":
sdsconfig::getgeneratecssfile();
$contentCSS = $operations->getDynamicCss();
self::ajaxResponseData($contentCSS);
break;
case "insert_captions_css":
$arrCaptions = $operations->insertCaptionsContentData($data);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "delete_captions_css":
$arrCaptions = $operations->deleteCaptionsContentData($data);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "update_static_css":
$staticCss = $operations->updateStaticCss($data);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
break;
case "insert_custom_anim":
$arrAnims = $operations->insertCustomAnim($data);
//$arrCaptions =
self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_custom_anim":
$arrAnims = $operations->updateCustomAnim($data);
self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "delete_custom_anim":
$arrAnims = $operations->deleteCustomAnim($data);
self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN));
break;
case "change_slide_image":
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
// case "preview_slider":
示例2: onAjaxAction
//.........这里部分代码省略.........
self::ajaxResponseSuccess(__ug("Static Global Layers updated", REVSLIDER_TEXTDOMAIN));
break;
case "duplicate_slide":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect(__ug("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "copy_move_slide":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$sliderID = $slider->copyMoveSlideFromData($data);
self::ajaxResponseSuccessRedirect(__ug("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_static_css":
$contentCSS = $operations->getStaticCss();
self::ajaxResponseData($contentCSS);
break;
case "get_dynamic_css":
$contentCSS = $operations->getDynamicCss();
self::ajaxResponseData($contentCSS);
break;
case "insert_captions_css":
$arrCaptions = $operations->insertCaptionsContentData($data);
self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "delete_captions_css":
$arrCaptions = $operations->deleteCaptionsContentData($data);
self::ajaxResponseSuccess(__ug("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "update_static_css":
$staticCss = $operations->updateStaticCss($data);
self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
break;
case "insert_custom_anim":
$arrAnims = $operations->insertCustomAnim($data);
//$arrCaptions =
self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_custom_anim":
$arrAnims = $operations->updateCustomAnim($data);
self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "delete_custom_anim":
$arrAnims = $operations->deleteCustomAnim($data);
self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_slides_order":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess(__ug("Order updated successfully", REVSLIDER_TEXTDOMAIN));
break;
case "change_slide_image":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect(__ug("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
示例3: 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(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$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'])));
$id = $db->insert(GlobalsRevSlider::$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'])));
$id = $db->insert(GlobalsRevSlider::$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-' . $id, 'customout-' . $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
RevOperations::updateStaticCss($static);
} else {
//append
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = UniteCssParserRev::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, ':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();
$arrInsert["params"] = json_encode($styles);
}
//check if class exists
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
示例4: cmo_import_sliders_ajax
function cmo_import_sliders_ajax()
{
global $wpdb;
if (!class_exists('UniteFunctionsRev')) {
ajax_finish(false, __('Revolution Slider plugin is not installed or activated.', 'cumulo'));
} else {
$rev_directory = CMO_FRAMEWORK_PATH . '/demo/sliders/';
if (!empty($_POST['demo'])) {
if ($_POST['demo'] != 'default') {
$rev_directory .= $_POST['demo'] . '/';
}
}
foreach (glob($rev_directory . '*.zip') as $filename) {
$filename = basename($filename);
$rev_files[] = $rev_directory . $filename;
}
foreach ($rev_files as $rev_file) {
$filepath = $rev_file;
$zip = new ZipArchive();
$importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
if ($importZip === true) {
$slider_export = $zip->getStream('slider_export.txt');
$custom_animations = $zip->getStream('custom_animations.txt');
$dynamic_captions = $zip->getStream('dynamic-captions.css');
$static_captions = $zip->getStream('static-captions.css');
$content = '';
$animations = '';
$dynamic = '';
$static = '';
while (!feof($slider_export)) {
$content .= fread($slider_export, 1024);
}
if ($custom_animations) {
while (!feof($custom_animations)) {
$animations .= fread($custom_animations, 1024);
}
}
if ($dynamic_captions) {
while (!feof($dynamic_captions)) {
$dynamic .= fread($dynamic_captions, 1024);
}
}
if ($static_captions) {
while (!feof($static_captions)) {
$static .= fread($static_captions, 1024);
}
}
fclose($slider_export);
if ($custom_animations) {
fclose($custom_animations);
}
if ($dynamic_captions) {
fclose($dynamic_captions);
}
if ($static_captions) {
fclose($static_captions);
}
//check for images!
} else {
$content = @file_get_contents($filepath);
}
if ($importZip === true) {
//we have a zip
$db = new UniteDBRev();
//update/insert custom animations
$animations = @unserialize($animations);
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
if ($updateAnim == "true") {
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
} else {
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
$content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content);
}
} else {
}
//overwrite/append static-captions.css
if (!empty($static)) {
if (isset($updateStatic) && $updateStatic == "true") {
RevOperations::updateStaticCss($static);
} else {
//append
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
//.........这里部分代码省略.........
示例5: onAjaxAction
//.........这里部分代码省略.........
}
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "duplicate_slide":
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "copy_move_slide":
$sliderID = $slider->copyMoveSlideFromData($data);
self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_static_css":
$contentCSS = $operations->getStaticCss();
self::ajaxResponseData($contentCSS);
break;
case "get_dynamic_css":
$contentCSS = $operations->getDynamicCss();
self::ajaxResponseData($contentCSS);
break;
case "insert_captions_css":
$arrCaptions = $operations->insertCaptionsContentData($data);
self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "delete_captions_css":
$arrCaptions = $operations->deleteCaptionsContentData($data);
self::ajaxResponseSuccess(__("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "update_static_css":
$staticCss = $operations->updateStaticCss($data);
self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
break;
case "insert_custom_anim":
$arrAnims = $operations->insertCustomAnim($data);
//$arrCaptions =
self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_custom_anim":
$arrAnims = $operations->updateCustomAnim($data);
self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "delete_custom_anim":
$arrAnims = $operations->deleteCustomAnim($data);
self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
//,array("arrCaptions"=>$arrCaptions)
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN));
break;
case "change_slide_image":
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
case "preview_slider":
$sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
示例6: fusion_importer
//.........这里部分代码省略.........
//$animation['id'], $animation['handle'], $animation['params']
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $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(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$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'])));
$id = $db->insert(GlobalsRevSlider::$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'])));
$id = $db->insert(GlobalsRevSlider::$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-' . $id, 'customout-' . $id), $content);
}
} else {
}
//overwrite/append static-captions.css
if (!empty($static)) {
if (isset($updateStatic) && $updateStatic == "true") {
//overwrite file
RevOperations::updateStaticCss($static);
} else {
//append
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = UniteCssParserRev::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, ':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();
$arrInsert["params"] = json_encode($styles);
}
//check if class exists
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
示例7: hb_importer
//.........这里部分代码省略.........
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(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$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'])));
$id = $db->insert(GlobalsRevSlider::$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'])));
$id = $db->insert(GlobalsRevSlider::$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-' . $id, 'customout-' . $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
RevOperations::updateStaticCss($static);
} else {
//append
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = UniteCssParserRev::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, ':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();
$arrInsert["params"] = json_encode($styles);
}
//check if class exists
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
示例8: royal_revslider_import
function royal_revslider_import($revslider_path)
{
if (!file_exists($revslider_path)) {
return;
}
global $wpdb;
if (class_exists('UniteFunctionsRev')) {
// get zip files
foreach (glob($revslider_path . '*.zip') as $filename) {
$filename = basename($filename);
$revslider_archives[] = $revslider_path . $filename;
}
foreach ($revslider_archives as $revslider_archive) {
// finally import rev slider data files
$filepath = $revslider_archive;
// check if zip file or fallback to old, if zip, check if all files exist
if (!class_exists("ZipArchive")) {
$importZip = false;
} else {
$zip = new ZipArchive();
$importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
}
if ($importZip === true) {
// true or integer. If integer, its not a correct zip file
// check if files all exist in zip
$slider_export = $zip->getStream('slider_export.txt');
$custom_animations = $zip->getStream('custom_animations.txt');
$dynamic_captions = $zip->getStream('dynamic-captions.css');
$static_captions = $zip->getStream('static-captions.css');
$content = '';
$animations = '';
$dynamic = '';
$static = '';
while (!feof($slider_export)) {
$content .= fread($slider_export, 1024);
}
if ($custom_animations) {
while (!feof($custom_animations)) {
$animations .= fread($custom_animations, 1024);
}
}
if ($dynamic_captions) {
while (!feof($dynamic_captions)) {
$dynamic .= fread($dynamic_captions, 1024);
}
}
if ($static_captions) {
while (!feof($static_captions)) {
$static .= fread($static_captions, 1024);
}
}
fclose($slider_export);
if ($custom_animations) {
fclose($custom_animations);
}
if ($dynamic_captions) {
fclose($dynamic_captions);
}
if ($static_captions) {
fclose($static_captions);
}
} else {
//check if fallback
//get content array
$content = @file_get_contents($filepath);
}
if ($importZip === true) {
//we have a zip
$db = new UniteDBRev();
//update/insert custom animations
$animations = @unserialize($animations);
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
//$animation['id'], $animation['handle'], $animation['params']
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
//update the animation, get the ID
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$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-' . $id, 'customout-' . $id), $content);
}
}
//overwrite/append static-captions.css
if (!empty($static)) {
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
//overwrite/create dynamic-captions.css
//parse css to classes
//.........这里部分代码省略.........
示例9: tt_revo_importer
function tt_revo_importer()
{
if (class_exists('UniteFunctionsRev')) {
global $wpdb;
$revo_directory = get_stylesheet_directory() . '/framework/addons/wordpress-importer/files/revsliders/';
$revo_files = array();
$db = new UniteDBRev();
$revo_obj = new RevSlider();
$aliases = $revo_obj->getAllSliderAliases();
foreach (glob($revo_directory . '*.txt') as $filename) {
$filename = basename($filename);
$revo_files[] = get_stylesheet_directory_uri() . '/framework/addons/wordpress-importer/files/revsliders/' . $filename;
}
foreach ($revo_files as $rev_file) {
$get_revo_file = wp_remote_get($rev_file);
$ncd = $get_revo_file['body'];
if (base64_decode($ncd, true)) {
$slider_data = @unserialize(base64_decode($ncd));
} else {
ob_start();
$ncd = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", trim($ncd));
//clear errors in string
ob_end_clean();
$slider_data = @unserialize($ncd);
}
if (empty($slider_data)) {
continue;
}
$slider_params = $slider_data["params"];
if (in_array($slider_params['alias'], $aliases)) {
continue;
}
$serialized_content = serialize($slider_data);
/* Detecting Animations and Styles */
$animations = isset($slider_data["custom_animations"]) ? $slider_data["custom_animations"] : array();
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
//$animation['id'], $animation['handle'], $animation['params']
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
//update the animation, get the ID
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
$serialized_content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $serialized_content);
}
}
// Static Captions
$static = isset($slider_data["static_captions"]) ? $slider_data["static_captions"] : "";
if (!empty($static)) {
RevOperations::updateStaticCss($static);
}
//overwrite/create dynamic-captions.css
//parse css to classes
if (isset($slider_data["dynamic_captions"]) && !empty($slider_data["dynamic_captions"])) {
$dynamicCss = UniteCssParserRev::parseCssToArray($slider_data["dynamic_captions"]);
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, ':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();
$arrInsert["params"] = json_encode($styles);
}
//check if class exists
$result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
if (!empty($result)) {
//update
$db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
} else {
//insert
$arrInsert["handle"] = $class;
$db->insert(GlobalsRevSlider::$table_css, $arrInsert);
}
}
}
}
$slider_data = unserialize($serialized_content);
$slider_params = $slider_data["params"];
/*
if(isset($slider_params["background_image"])) {
$slider_params["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($slider_params["background_image"]);
//.........这里部分代码省略.........
示例10: str_replace
}
//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-' . $id, 'customout-' . $id), $content);
}
} else {
}
//overwrite/append static-captions.css
if (!empty($static)) {
if (isset($updateStatic) && $updateStatic == "true") {
//overwrite file
RevOperations::updateStaticCss($static);
} else {
//append
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
//overwrite/create dynamic-captions.css
//parse css to classes
$dynamicCss = UniteCssParserRev::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, ':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) {
示例11: importSliderFromPost
public function importSliderFromPost($updateAnim = true, $updateStatic = true)
{
try {
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$sliderExists = !empty($sliderID);
if ($sliderExists) {
$this->initByID($sliderID);
}
$filepath = $_FILES["import_file"]["tmp_name"];
if (file_exists($filepath) == false) {
UniteFunctionsRev::throwError("Import file not found!!!");
}
if (!class_exists("ZipArchive")) {
$importZip = false;
} else {
$zip = new ZipArchive();
$importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
}
if ($importZip === true) {
$slider_export = $zip->getStream('slider_export.txt');
$custom_animations = $zip->getStream('custom_animations.txt');
$dynamic_captions = $zip->getStream('dynamic-captions.css');
$static_captions = $zip->getStream('static-captions.css');
if (!$slider_export) {
UniteFunctionsRev::throwError("slider_export.txt does not exist!");
}
$content = '';
$animations = '';
$dynamic = '';
$static = '';
while (!feof($slider_export)) {
$content .= fread($slider_export, 1024);
}
if ($custom_animations) {
while (!feof($custom_animations)) {
$animations .= fread($custom_animations, 1024);
}
}
if ($dynamic_captions) {
while (!feof($dynamic_captions)) {
$dynamic .= fread($dynamic_captions, 1024);
}
}
if ($static_captions) {
while (!feof($static_captions)) {
$static .= fread($static_captions, 1024);
}
}
fclose($slider_export);
if ($custom_animations) {
fclose($custom_animations);
}
if ($dynamic_captions) {
fclose($dynamic_captions);
}
if ($static_captions) {
fclose($static_captions);
}
} else {
$content = @file_get_contents($filepath);
}
if ($importZip === true) {
$db = new UniteDBRev();
$animations = @unserialize($animations);
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
if ($updateAnim == "true") {
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
} else {
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
$content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $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));
}
if (!empty($static)) {
if ($updateStatic == "true") {
RevOperations::updateStaticCss($static);
} else {
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
//.........这里部分代码省略.........
示例12: import_revolution_slider
function import_revolution_slider()
{
if (class_exists('UniteFunctionsRev') && class_exists('ZipArchive')) {
global $wpdb;
$updateAnim = true;
$updateStatic = true;
$rev_directory = get_template_directory() . '/framework/importer/data/revsliders/';
foreach (glob($rev_directory . '*.zip') as $filename) {
$filename = basename($filename);
$rev_files[] = get_template_directory() . '/framework/importer/data/revsliders/' . $filename;
}
foreach ($rev_files as $rev_file) {
$filepath = $rev_file;
$zip = new ZipArchive();
$importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
if ($importZip === true) {
$slider_export = $zip->getStream('slider_export.txt');
$custom_animations = $zip->getStream('custom_animations.txt');
$dynamic_captions = $zip->getStream('dynamic-captions.css');
$static_captions = $zip->getStream('static-captions.css');
$content = '';
$animations = '';
$dynamic = '';
$static = '';
while (!feof($slider_export)) {
$content .= fread($slider_export, 1024);
}
if ($custom_animations) {
while (!feof($custom_animations)) {
$animations .= fread($custom_animations, 1024);
}
}
if ($dynamic_captions) {
while (!feof($dynamic_captions)) {
$dynamic .= fread($dynamic_captions, 1024);
}
}
if ($static_captions) {
while (!feof($static_captions)) {
$static .= fread($static_captions, 1024);
}
}
fclose($slider_export);
if ($custom_animations) {
fclose($custom_animations);
}
if ($dynamic_captions) {
fclose($dynamic_captions);
}
if ($static_captions) {
fclose($static_captions);
}
} else {
$content = @file_get_contents($filepath);
}
if ($importZip === true) {
$db = new UniteDBRev();
$animations = @unserialize($animations);
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
if ($updateAnim == 'true') {
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
} else {
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
$content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content);
}
} else {
}
if (!empty($static)) {
if (isset($updateStatic) && $updateStatic == 'true') {
RevOperations::updateStaticCss($static);
} else {
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
$dynamicCss = UniteCssParserRev::parseCssToArray($dynamic);
if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
foreach ($dynamicCss as $class => $styles) {
$class = trim($class);
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) {
continue;
}
if (strpos($class, ':hover') !== false) {
//.........这里部分代码省略.........