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


PHP RevSliderDB::insert方法代码示例

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


在下文中一共展示了RevSliderDB::insert方法的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: importSliderFromPost


//.........这里部分代码省略.........
                 fclose($dynamic_captions);
             }
             if ($static_captions) {
                 fclose($static_captions);
             }
             //check for images!
         } else {
             //check if fallback
             //get content array
             $content = @file_get_contents($filepath);
         }
         if ($importZip === true) {
             //we have a zip
             $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, "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(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);
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:67,代码来源:slider.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, "handle = '" . $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:hathbanger,项目名称:squab,代码行数:49,代码来源:operations.class.php

示例4: importSliderFromPost


//.........这里部分代码省略.........
                     $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();
                             $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) {
开发者ID:ksan5835,项目名称:maadithottam,代码行数:67,代码来源:slider.class.php


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