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


PHP RevSliderDB::fetchSingle方法代码示例

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


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

示例1: 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");
             $sliderID = $db->escape($sliderID);
             $record = $db->fetch(RevSliderGlobals::$table_static_slides, "slider_id={$sliderID}");
             if (empty($record)) {
                 return false;
             }
             return true;
         } else {
             $slideid = $db->escape($slideid);
             $record = $db->fetchSingle(RevSliderGlobals::$table_slides, "id={$slideid}");
             if (empty($record)) {
                 return false;
             }
             return true;
         }
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:hathbanger,项目名称:squab,代码行数:29,代码来源:slide.class.php

示例2: 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

示例3: updateAdvancedCssData

 /**
  * update captions advanced css
  * @return: new captions html select
  * @since: 5.0
  */
 public function updateAdvancedCssData($data)
 {
     if (!isset($data['handle']) || !isset($data['styles']) || !isset($data['type'])) {
         return false;
     }
     if ($data['type'] !== 'idle' && $data['type'] !== 'hover') {
         return false;
     }
     $db = new RevSliderDB();
     //get current styles
     $styles = $db->fetchSingle(RevSliderGlobals::$table_css, '`handle` = "' . $db->escape($data['handle']) . '"');
     if (!empty($styles)) {
         if (!isset($styles['advanced'])) {
             $styles['advanced'] = '';
         }
         $adv = json_decode(str_replace("'", '"', $styles['advanced']), true);
         if (!isset($adv['idle'])) {
             $adv['idle'] = array();
         }
         if (!isset($adv['hover'])) {
             $adv['hover'] = array();
         }
         $adv[$data['type']] = $data['styles'];
         $arrUpdate = array();
         $arrUpdate['advanced'] = json_encode(str_replace("'", '"', $adv));
         $result = $db->update(RevSliderGlobals::$table_css, $arrUpdate, array('handle' => $data['handle']));
         //output captions array
         $arrCaptions = RevSliderCssParser::get_captions_sorted();
         return $arrCaptions;
     } else {
         return false;
     }
 }
开发者ID:hathbanger,项目名称:squab,代码行数:38,代码来源:operations.class.php


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