本文整理汇总了PHP中RevSlider::duplicateSliderFromData方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlider::duplicateSliderFromData方法的具体用法?PHP RevSlider::duplicateSliderFromData怎么用?PHP RevSlider::duplicateSliderFromData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlider
的用法示例。
在下文中一共展示了RevSlider::duplicateSliderFromData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAjaxAction
//.........这里部分代码省略.........
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle($viewBack, $updateAnim, $updateStatic);
break;
case "create_slider":
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
//var_dump($settingsMain);
$newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
if ($newSliderID > 0) {
self::ajaxResponseSuccessRedirect(__("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
}
break;
case "update_slider":
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$slider->updateSliderFromOptions($data, $settingsMain, $settingsParams);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
$isDeleted = $slider->deleteSliderFromData($data);
if (is_array($isDeleted)) {
$isDeleted = implode(', ', $isDeleted);
self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted);
} else {
self::ajaxResponseSuccessRedirect(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
}
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
$numSlides = $slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
if ($numSlides == 1) {
$responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN);
} else {
$responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN);
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "add_slide_fromslideview":
$slideID = $slider->createSlideFromData($data, true);
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "update_slide":
require self::getSettingsFilePath("slide_settings");
$slide->updateSlideFromData($data, $slideSettings);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN));
break;
case "update_static_slide":
$slide->updateStaticSlideFromData($data);
sdsconfig::getgeneratecssfile();
self::ajaxResponseSuccess(__("Static Layers updated", REVSLIDER_TEXTDOMAIN));
break;
示例2: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$actionIndicator = self::getPostGetVar("action");
if ($actionIndicator != "uniterevolution_ajax_action") {
return false;
}
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
$nonce = self::getPostGetVar("nonce");
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
try {
//verify the nonce
$isVerified = wp_verify_nonce($nonce, "revslider_actions");
if ($isVerified == false) {
UniteFunctionsRev::throwError("Wrong request");
}
switch ($action) {
case "export_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$sliderID = self::getGetVar("sliderid");
$dummy = self::getGetVar("dummy");
$slider->initByID($sliderID);
$slider->exportSlider($dummy);
break;
case "import_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle(null, $updateAnim, $updateStatic);
break;
case "import_slider_slidersview":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle($viewBack, $updateAnim, $updateStatic);
break;
case "create_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
self::ajaxResponseSuccessRedirect(__ug("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
break;
case "update_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_SETTINGS);
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$slider->updateSliderFromOptions($data, $settingsMain, $settingsParams);
self::ajaxResponseSuccess(__ug("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$isDeleted = $slider->deleteSliderFromData($data);
if (is_array($isDeleted)) {
$isDeleted = implode(', ', $isDeleted);
self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted);
} else {
self::ajaxResponseSuccessRedirect(__ug("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
}
break;
case "duplicate_slider":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__ug("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$numSlides = $slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
if ($numSlides == 1) {
$responseText = __ug("Slide Created", REVSLIDER_TEXTDOMAIN);
} else {
$responseText = $numSlides . " " . __ug("Slides Created", REVSLIDER_TEXTDOMAIN);
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "add_slide_fromslideview":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
$slideID = $slider->createSlideFromData($data, true);
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __ug("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "update_slide":
RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_EDIT_SLIDE);
require self::getSettingsFilePath("slide_settings");
$slide->updateSlideFromData($data, $slideSettings);
self::ajaxResponseSuccess(__ug("Slide updated", REVSLIDER_TEXTDOMAIN));
//.........这里部分代码省略.........
示例3: onAjaxAction
//.........这里部分代码省略.........
$viewBack = self::getViewUrl(self::VIEW_SLIDE, "id={$redirect_id}");
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
$slidenum = intval(self::getPostGetVar("slidenum"));
$sliderid = intval(self::getPostGetVar("slider_id"));
self::importSliderTemplateHandle($viewBack, $updateAnim, $updateStatic, array('slider_id' => $sliderid, 'slide_id' => $slidenum));
break;
case "create_slider":
$data = $operations->modifyCustomSliderParams($data);
$newSliderID = $slider->createSliderFromOptions($data);
self::ajaxResponseSuccessRedirect(__("Slider created", 'revslider'), self::getViewUrl(self::VIEW_SLIDE, 'id=new&slider=' . esc_attr($newSliderID)));
//redirect to slide now
break;
case "update_slider":
$data = $operations->modifyCustomSliderParams($data);
$slider->updateSliderFromOptions($data);
self::ajaxResponseSuccess(__("Slider updated", 'revslider'));
break;
case "delete_slider":
case "delete_slider_stay":
$isDeleted = $slider->deleteSliderFromData($data);
if (is_array($isDeleted)) {
$isDeleted = implode(', ', $isDeleted);
self::ajaxResponseError(__("Template can't be deleted, it is still being used by the following Sliders: ", 'revslider') . $isDeleted);
} else {
if ($action == 'delete_slider_stay') {
self::ajaxResponseSuccess(__("Slider deleted", 'revslider'));
} else {
self::ajaxResponseSuccessRedirect(__("Slider deleted", 'revslider'), self::getViewUrl(self::VIEW_SLIDERS));
}
}
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("Success! Refreshing page...", 'revslider'), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
case "add_bulk_slide":
$numSlides = $slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
if ($numSlides == 1) {
$responseText = __("Slide Created", 'revslider');
} else {
$responseText = $numSlides . " " . __("Slides Created", 'revslider');
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id=new&slider={$sliderID}");
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "add_slide_fromslideview":
$slideID = $slider->createSlideFromData($data, true);
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __("Slide Created, redirecting...", 'revslider');
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case 'copy_slide_to_slider':
$slideID = isset($data['redirect_id']) ? $data['redirect_id'] : -1;
if ($slideID === -1) {
RevSliderFunctions::throwError(__('Missing redirect ID!', 'revslider'));
}
$return = $slider->copySlideToSlider($data);
if ($return !== true) {
RevSliderFunctions::throwError($return);
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __("Slide copied to current Slider, redirecting...", 'revslider');
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
示例4: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
try {
switch ($action) {
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$slider->initByID($sliderID);
$slider->exportSlider();
break;
case "import_slider":
self::importSliderHandle();
break;
case "create_slider":
$newSliderID = $slider->createSliderFromOptions($data);
self::ajaxResponseSuccessRedirect("The slider successfully created", self::getViewUrl("sliders"));
break;
case "update_slider":
$slider->updateSliderFromOptions($data);
self::ajaxResponseSuccess("Slider updated");
break;
case "delete_slider":
$slider->deleteSliderFromData($data);
self::ajaxResponseSuccessRedirect("The slider deleted", self::getViewUrl(self::VIEW_SLIDERS));
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect("The duplicate successfully, refreshing page...", self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
$slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
self::ajaxResponseSuccessRedirect("Slide Created", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "update_slide":
$slide->updateSlideFromData($data);
self::ajaxResponseSuccess("Slide updated");
break;
case "delete_slide":
$slide->deleteSlideFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
self::ajaxResponseSuccessRedirect("Slide Deleted Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "duplicate_slide":
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect("Slide Duplicated Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_captions_css":
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess("CSS file saved succesfully!", array("arrCaptions" => $arrCaptions));
break;
case "restore_captions_css":
$operations->restoreCaptionsCss();
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess("Order updated successfully");
break;
case "change_slide_image":
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect("Slide Changed Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
case "preview_slider":
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$operations->previewOutput($sliderID);
break;
default:
self::ajaxResponseError("wrong ajax action: {$action} ");
break;
}
} catch (Exception $e) {
$message = $e->getMessage();
self::ajaxResponseError($message);
}
//it's an ajax action, so exit
self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
exit;
}
示例5: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
$nonce = self::getPostGetVar("nonce");
try {
//verify the nonce
$isVerified = wp_verify_nonce($nonce, "revslider_actions");
if ($isVerified == false) {
UniteFunctionsRev::throwError("Wrong request");
}
switch ($action) {
case 'add_google_fonts':
$f = new ThemePunch_Fonts();
$result = $f->add_new_font($data);
if ($result === true) {
self::ajaxResponseSuccess(__("Font successfully created!", REVSLIDER_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getFontsUrl()));
} else {
self::ajaxResponseError($result, false);
}
break;
case 'remove_google_fonts':
if (!isset($data['handle'])) {
self::ajaxResponseError(__('Font not found', REVSLIDER_TEXTDOMAIN), false);
}
$f = new ThemePunch_Fonts();
$result = $f->remove_font_by_handle($data['handle']);
if ($result === true) {
self::ajaxResponseSuccess(__("Font successfully removed!", REVSLIDER_TEXTDOMAIN), array('data' => $result));
} else {
self::ajaxResponseError($result, false);
}
break;
case 'edit_google_fonts':
if (!isset($data['handle'])) {
self::ajaxResponseError(__('No handle given', REVSLIDER_TEXTDOMAIN), false);
}
if (!isset($data['url'])) {
self::ajaxResponseError(__('No parameters given', REVSLIDER_TEXTDOMAIN), false);
}
$f = new ThemePunch_Fonts();
$result = $f->edit_font_by_handle($data);
if ($result === true) {
self::ajaxResponseSuccess(__("Font successfully changed!", REVSLIDER_TEXTDOMAIN), array('data' => $result));
} else {
self::ajaxResponseError($result, false);
}
break;
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$dummy = self::getGetVar("dummy");
$slider->initByID($sliderID);
$slider->exportSlider($dummy);
break;
case "import_slider":
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle(null, $updateAnim, $updateStatic);
break;
case "import_slider_slidersview":
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle($viewBack, $updateAnim, $updateStatic);
break;
case "create_slider":
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
self::ajaxResponseSuccessRedirect(__("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
break;
case "update_slider":
self::requireSettings("slider_settings");
$settingsMain = self::getSettings("slider_main");
$settingsParams = self::getSettings("slider_params");
$data = $operations->modifyCustomSliderParams($data);
$slider->updateSliderFromOptions($data, $settingsMain, $settingsParams);
self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
$isDeleted = $slider->deleteSliderFromData($data);
if (is_array($isDeleted)) {
$isDeleted = implode(', ', $isDeleted);
self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted);
} else {
self::ajaxResponseSuccessRedirect(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
}
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
//.........这里部分代码省略.........
示例6: importSliderFromPost
//.........这里部分代码省略.........
$layer['layer_action']->action = array('a' => 'jumpto');
$layer['layer_action']->jump_to_slide = array('a' => $slider_map[$link_slide]);
break;
}
$layer['layer_action']->tooltip_event = array('a' => 'click');
unset($layer['link_slide']);
$did_change = true;
}
$layers[$key] = $layer;
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$my_layers = json_encode($layers);
if (empty($my_layers)) {
$my_layers = stripslashes(json_encode($layers));
}
$my_params = json_encode($params);
if (empty($my_params)) {
$my_params = stripslashes(json_encode($params));
}
$my_settings = json_encode($settings);
if (empty($my_settings)) {
$my_settings = stripslashes(json_encode($settings));
}
$arrCreate["layers"] = $my_layers;
$arrCreate["params"] = $my_params;
$arrCreate["settings"] = $my_settings;
if ($sliderExists) {
unset($arrCreate["slider_id"]);
$this->db->update(RevSliderGlobals::$table_static_slides, $arrCreate, array("slider_id" => $sliderID));
} else {
$this->db->insert(RevSliderGlobals::$table_static_slides, $arrCreate);
}
}
}
$c_slider = new RevSliderSlider();
$c_slider->initByID($sliderID);
//check to convert styles to latest versions
RevSliderPluginUpdate::update_css_styles();
//set to version 5
RevSliderPluginUpdate::add_animation_settings_to_layer($c_slider);
//set to version 5
RevSliderPluginUpdate::add_style_settings_to_layer($c_slider);
//set to version 5
RevSliderPluginUpdate::change_settings_on_layers($c_slider);
//set to version 5
RevSliderPluginUpdate::add_general_settings($c_slider);
//set to version 5
$cus_js = $c_slider->getParam('custom_javascript', '');
if (strpos($cus_js, 'revapi') !== false) {
if (preg_match_all('/revapi[0-9]*./', $cus_js, $results)) {
if (isset($results[0]) && !empty($results[0])) {
foreach ($results[0] as $replace) {
$cus_js = str_replace($replace, 'revapi' . $sliderID . '.', $cus_js);
}
}
$c_slider->updateParam(array('custom_javascript' => $cus_js));
}
}
if ($is_template !== false) {
//duplicate the slider now, as we just imported the "template"
if ($single_slide !== false) {
//add now one Slide to the current Slider
$mslider = new RevSlider();
//change slide_id to correct, as it currently is just a number beginning from 0 as we did not have a correct slide ID yet.
$i = 0;
$changed = false;
foreach ($slider_map as $value) {
if ($i == $single_slide['slide_id']) {
$single_slide['slide_id'] = $value;
$changed = true;
break;
}
$i++;
}
if ($changed) {
$return = $mslider->copySlideToSlider($single_slide);
} else {
return array("success" => false, "error" => __('could not find correct Slide to copy, please try again.', REVSLIDER_TEXTDOMAIN), "sliderID" => $sliderID);
}
} else {
$mslider = new RevSlider();
$title = RevSliderFunctions::getVal($sliderParams, 'title', 'slider1');
$talias = $title;
$ti = 1;
while ($this->isAliasExistsInDB($talias)) {
//set a new alias and title if its existing in database
$talias = $title . $ti;
$ti++;
}
$mslider->duplicateSliderFromData(array('sliderid' => $sliderID, 'title' => $talias));
}
}
} catch (Exception $e) {
$errorMessage = $e->getMessage();
return array("success" => false, "error" => $errorMessage, "sliderID" => $sliderID);
}
return array("success" => true, "sliderID" => $sliderID);
}
示例7: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
try {
switch ($action) {
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$slider->initByID($sliderID);
$slider->exportSlider();
break;
case "import_slider":
self::importSliderHandle();
break;
case "import_slider_slidersview":
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
self::importSliderHandle($viewBack);
break;
case "create_slider":
$newSliderID = $slider->createSliderFromOptions($data);
self::ajaxResponseSuccessRedirect(__("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
break;
case "update_slider":
$slider->updateSliderFromOptions($data);
self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
$slider->deleteSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
$numSlides = $slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
if ($numSlides == 1) {
$responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN);
} else {
$responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN);
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "add_slide_fromslideview":
$slideID = $slider->createSlideFromData($data, true);
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "update_slide":
$slide->updateSlideFromData($data);
self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slide":
$slide->deleteSlideFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
self::ajaxResponseSuccessRedirect(__("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN), 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_captions_css":
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess(__("CSS file saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "restore_captions_css":
$operations->restoreCaptionsCss();
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
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;
//.........这里部分代码省略.........
示例8: importSliderFromPost
//.........这里部分代码省略.........
$layers[$key] = $layer;
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$my_layers = json_encode($layers);
if (empty($my_layers)) {
$my_layers = stripslashes(json_encode($layers));
}
$my_params = json_encode($params);
if (empty($my_params)) {
$my_params = stripslashes(json_encode($params));
}
$my_settings = json_encode($settings);
if (empty($my_settings)) {
$my_settings = stripslashes(json_encode($settings));
}
$arrCreate["layers"] = $my_layers;
$arrCreate["params"] = $my_params;
$arrCreate["settings"] = $my_settings;
if ($sliderExists) {
unset($arrCreate["slider_id"]);
$this->db->update(RevSliderGlobals::$table_static_slides, $arrCreate, array("slider_id" => $sliderID));
} else {
$this->db->insert(RevSliderGlobals::$table_static_slides, $arrCreate);
}
}
}
$c_slider = new RevSliderSlider();
$c_slider->initByID($sliderID);
//check to convert styles to latest versions
RevSliderPluginUpdate::update_css_styles();
//set to version 5
RevSliderPluginUpdate::add_animation_settings_to_layer($c_slider);
//set to version 5
RevSliderPluginUpdate::add_style_settings_to_layer($c_slider);
//set to version 5
RevSliderPluginUpdate::change_settings_on_layers($c_slider);
//set to version 5
RevSliderPluginUpdate::add_general_settings($c_slider);
//set to version 5
RevSliderPluginUpdate::change_general_settings_5_0_7($c_slider);
//set to version 5.0.7
RevSliderPluginUpdate::change_layers_svg_5_2_5_4($c_slider);
//set to version 5.2.5.4
$cus_js = $c_slider->getParam('custom_javascript', '');
if (strpos($cus_js, 'revapi') !== false) {
if (preg_match_all('/revapi[0-9]*/', $cus_js, $results)) {
if (isset($results[0]) && !empty($results[0])) {
foreach ($results[0] as $replace) {
$cus_js = str_replace($replace, 'revapi' . $sliderID, $cus_js);
}
}
$c_slider->updateParam(array('custom_javascript' => $cus_js));
}
}
if ($is_template !== false) {
//duplicate the slider now, as we just imported the "template"
if ($single_slide !== false) {
//add now one Slide to the current Slider
$mslider = new RevSlider();
//change slide_id to correct, as it currently is just a number beginning from 0 as we did not have a correct slide ID yet.
$i = 0;
$changed = false;
foreach ($slider_map as $value) {
if ($i == $single_slide['slide_id']) {
$single_slide['slide_id'] = $value;
$changed = true;
break;
}
$i++;
}
if ($changed) {
$return = $mslider->copySlideToSlider($single_slide);
} else {
return array("success" => false, "error" => __('could not find correct Slide to copy, please try again.', 'revslider'), "sliderID" => $sliderID);
}
} else {
$mslider = new RevSlider();
$title = RevSliderFunctions::getVal($sliderParams, 'title', 'slider1');
$talias = $title;
$ti = 1;
while ($this->isAliasExistsInDB($talias)) {
//set a new alias and title if its existing in database
$talias = $title . $ti;
$ti++;
}
$mslider->duplicateSliderFromData(array('sliderid' => $sliderID, 'title' => $talias));
}
}
$wp_filesystem->delete($d_path, true);
} catch (Exception $e) {
$errorMessage = $e->getMessage();
if (isset($d_path)) {
$wp_filesystem->delete($d_path, true);
}
return array("success" => false, "error" => $errorMessage, "sliderID" => $sliderID);
}
return array("success" => true, "sliderID" => $sliderID);
}