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


PHP RevSliderDB::prepare方法代码示例

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


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

示例1: move_template_slider

 /**
  * move the template sliders and add the slides to corresponding post based slider or simply move them and change them to post based slider if no slider is using them
  * @since 5.0
  */
 public static function move_template_slider()
 {
     $db = new RevSliderDB();
     $used_templates = array();
     //will store all template IDs that are used by post based Sliders, these can be deleted after the progress.
     $sr = new RevSlider();
     $sl = new RevSliderSlide();
     $arrSliders = $sr->getArrSliders(false, false);
     $tempSliders = $sr->getArrSliders(false, true);
     if (empty($tempSliders) || !is_array($tempSliders)) {
         return true;
     }
     //as we do not have any template sliders, we do not need to run further here
     if (!empty($arrSliders) && is_array($arrSliders)) {
         foreach ($arrSliders as $slider) {
             if ($slider->getParam('source_type', 'gallery') !== 'posts') {
                 continue;
             }
             //only check Slider with type of posts
             $slider_id = $slider->getID();
             $template_id = $slider->getParam('slider_template_id', 0);
             if ($template_id > 0) {
                 //initialize slider to see if it exists. Then copy over the Template Sliders Slides to the Post Based Slider
                 foreach ($tempSliders as $t_slider) {
                     if ($t_slider->getID() === $template_id) {
                         //copy over the slides
                         //get all slides from template, then copy to Slider
                         $slides = $t_slider->getSlides();
                         if (!empty($slides) && is_array($slides)) {
                             foreach ($slides as $slide) {
                                 $slide_id = $slide->getID();
                                 $slider->copySlideToSlider(array('slider_id' => $slider_id, 'slide_id' => $slide_id));
                             }
                         }
                         $static_id = $sl->getStaticSlideID($template_id);
                         if ($static_id !== false) {
                             $record = $db->fetchSingle(RevSliderGlobals::$table_static_slides, $db->prepare("id = %s", array($static_id)));
                             unset($record['id']);
                             $record['slider_id'] = $slider_id;
                             $db->insert(RevSliderGlobals::$table_static_slides, $record);
                         }
                         $used_templates[$template_id] = $t_slider;
                         break;
                     }
                 }
             }
         }
     }
     if (!empty($used_templates)) {
         foreach ($used_templates as $tid => $t_slider) {
             $t_slider->deleteSlider();
         }
     }
     //translate all other template Sliders to normal sliders and set them to post based
     $temp_sliders = $sr->getArrSliders(false, true);
     if (!empty($temp_sliders) && is_array($temp_sliders)) {
         foreach ($temp_sliders as $slider) {
             $slider->updateParam(array('template' => 'false'));
             $slider->updateParam(array('source_type' => 'posts'));
         }
     }
 }
开发者ID:dawnthemes,项目名称:tkb,代码行数:66,代码来源:plugin-update.class.php

示例2: isSlideByID

 /**
  * Check if Slide Exists with given ID
  * @since: 5.0
  */
 public static function isSlideByID($slideid)
 {
     $db = new RevSliderDB();
     try {
         if (strpos($slideid, 'static_') !== false) {
             $sliderID = str_replace('static_', '', $slideid);
             RevSliderFunctions::validateNumeric($sliderID, "Slider ID");
             $record = $db->fetch(RevSliderGlobals::$table_static_slides, $db->prepare("slider_id = %s", array($sliderID)));
             if (empty($record)) {
                 return false;
             }
             return true;
         } else {
             $record = $db->fetchSingle(RevSliderGlobals::$table_slides, $db->prepare("id = %s", array($slideid)));
             if (empty($record)) {
                 return false;
             }
             return true;
         }
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:ksan5835,项目名称:maadithottam,代码行数:27,代码来源:slide.class.php

示例3: importCaptionsCssContentArray

 /**
  *
  * import contents of the css file
  */
 public static function importCaptionsCssContentArray()
 {
     $db = new RevSliderDB();
     $css = self::getCaptionsCssContentArray();
     $static = array();
     if (is_array($css) && $css !== false && count($css) > 0) {
         foreach ($css 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
                 $static[$class] = $styles;
                 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(RevSliderGlobals::$table_css, $db->prepare("handle = %s", array($class)));
             if (!empty($result)) {
                 //update
                 $db->update(RevSliderGlobals::$table_css, $arrInsert, array('handle' => $class));
             } else {
                 //insert
                 $arrInsert["handle"] = $class;
                 $db->insert(RevSliderGlobals::$table_css, $arrInsert);
             }
         }
     }
     if (!empty($static)) {
         //save static into static-captions.css
         $css = RevSliderCssParser::parseStaticArrayToCss($static);
         $static_cur = RevSliderOperations::getStaticCss();
         //get the open sans line!
         $css = $static_cur . "\n" . $css;
         self::updateStaticCss($css);
     }
 }
开发者ID:SayenkoDesign,项目名称:gogo-racing.com,代码行数:49,代码来源:operations.class.php

示例4: importSliderFromPost

 /**
  * 
  * import slider from multipart form
  */
 public function importSliderFromPost($updateAnim = true, $updateStatic = true, $exactfilepath = false, $is_template = false, $single_slide = false, $updateNavigation = true)
 {
     try {
         $sliderID = RevSliderFunctions::getPostVariable("sliderid");
         $sliderExists = !empty($sliderID);
         if ($sliderExists) {
             $this->initByID($sliderID);
         }
         if ($exactfilepath !== false) {
             $filepath = $exactfilepath;
         } else {
             switch ($_FILES['import_file']['error']) {
                 case UPLOAD_ERR_OK:
                     break;
                 case UPLOAD_ERR_NO_FILE:
                     RevSliderFunctions::throwError(__('No file sent.', 'revslider'));
                 case UPLOAD_ERR_INI_SIZE:
                 case UPLOAD_ERR_FORM_SIZE:
                     RevSliderFunctions::throwError(__('Exceeded filesize limit.', 'revslider'));
                 default:
                     break;
             }
             $filepath = $_FILES["import_file"]["tmp_name"];
         }
         if (file_exists($filepath) == false) {
             RevSliderFunctions::throwError(__('Import file not found!!!', 'revslider'));
         }
         $importZip = false;
         WP_Filesystem();
         global $wp_filesystem;
         $upload_dir = wp_upload_dir();
         $d_path = $upload_dir['basedir'] . '/rstemp/';
         $unzipfile = unzip_file($filepath, $d_path);
         if (is_wp_error($unzipfile)) {
             define('FS_METHOD', 'direct');
             //lets try direct.
             WP_Filesystem();
             //WP_Filesystem() needs to be called again since now we use direct !
             //@chmod($filepath, 0775);
             $unzipfile = unzip_file($filepath, $d_path);
             if (is_wp_error($unzipfile)) {
                 $d_path = RS_PLUGIN_PATH . 'rstemp/';
                 $unzipfile = unzip_file($filepath, $d_path);
                 if (is_wp_error($unzipfile)) {
                     $f = basename($filepath);
                     $d_path = str_replace($f, '', $filepath);
                     $unzipfile = unzip_file($filepath, $d_path);
                 }
             }
         }
         if (!is_wp_error($unzipfile)) {
             $importZip = true;
             //raus damit..
             //read all files needed
             $content = $wp_filesystem->exists($d_path . 'slider_export.txt') ? $wp_filesystem->get_contents($d_path . 'slider_export.txt') : '';
             if ($content == '') {
                 RevSliderFunctions::throwError(__('slider_export.txt does not exist!', 'revslider'));
             }
             $animations = $wp_filesystem->exists($d_path . 'custom_animations.txt') ? $wp_filesystem->get_contents($d_path . 'custom_animations.txt') : '';
             $dynamic = $wp_filesystem->exists($d_path . 'dynamic-captions.css') ? $wp_filesystem->get_contents($d_path . 'dynamic-captions.css') : '';
             $static = $wp_filesystem->exists($d_path . 'static-captions.css') ? $wp_filesystem->get_contents($d_path . 'static-captions.css') : '';
             $navigations = $wp_filesystem->exists($d_path . 'navigation.txt') ? $wp_filesystem->get_contents($d_path . 'navigation.txt') : '';
             $uid_check = $wp_filesystem->exists($d_path . 'info.cfg') ? $wp_filesystem->get_contents($d_path . 'info.cfg') : '';
             $version_check = $wp_filesystem->exists($d_path . 'version.cfg') ? $wp_filesystem->get_contents($d_path . 'version.cfg') : '';
             if ($is_template !== false) {
                 if ($uid_check != $is_template) {
                     return array("success" => false, "error" => __('Please select the correct zip file, checksum failed!', 'revslider'));
                 }
             } else {
                 //someone imported a template base Slider, check if it is existing in Base Sliders, if yes, check if it was imported
                 if ($uid_check !== '') {
                     $tmpl = new RevSliderTemplate();
                     $tmpl_slider = $tmpl->getThemePunchTemplateSliders();
                     foreach ($tmpl_slider as $tp_slider) {
                         if (!isset($tp_slider['installed'])) {
                             continue;
                         }
                         if ($tp_slider['uid'] == $uid_check) {
                             $is_template = $uid_check;
                             break;
                         }
                     }
                 }
             }
             $db = new RevSliderDB();
             //update/insert custom animations
             $animations = @unserialize($animations);
             if (!empty($animations)) {
                 foreach ($animations as $key => $animation) {
                     //$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();
//.........这里部分代码省略.........
开发者ID:ksan5835,项目名称:maadithottam,代码行数:101,代码来源:slider.class.php


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