当前位置: 首页>>代码示例>>PHP>>正文


PHP RevSlider::copySlideToSlider方法代码示例

本文整理汇总了PHP中RevSlider::copySlideToSlider方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlider::copySlideToSlider方法的具体用法?PHP RevSlider::copySlideToSlider怎么用?PHP RevSlider::copySlideToSlider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RevSlider的用法示例。


在下文中一共展示了RevSlider::copySlideToSlider方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:101,代码来源:slider.class.php

示例2: onAjaxAction


//.........这里部分代码省略.........
                         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);
                 break;
             case "update_slide":
                 $slide->updateSlideFromData($data);
                 self::ajaxResponseSuccess(__("Slide updated", 'revslider'));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 self::ajaxResponseSuccess(__("Static Global Layers updated", 'revslider'));
                 break;
             case "delete_slide":
             case "delete_slide_stay":
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __("Post deleted", 'revslider');
                 } else {
                     $message = __("Slide deleted", 'revslider');
                 }
                 $sliderID = RevSliderFunctions::getVal($data, "sliderID");
                 if ($action == 'delete_slide_stay') {
                     self::ajaxResponseSuccess($message);
                 } else {
                     self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDE, "id=new&slider={$sliderID}"));
                 }
                 break;
             case "duplicate_slide":
             case "duplicate_slide_stay":
开发者ID:zruiz,项目名称:NG,代码行数:67,代码来源:revslider-admin.class.php

示例3: 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);
 }
开发者ID:ksan5835,项目名称:maadithottam,代码行数:101,代码来源:slider.class.php


注:本文中的RevSlider::copySlideToSlider方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。