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


PHP RevSliderDB::update方法代码示例

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


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

示例1: update_css_styles

 /**
  * update the styles to meet requirements for version 5.0
  * @since 5.0
  */
 public static function update_css_styles()
 {
     $css = new RevSliderCssParser();
     $db = new RevSliderDB();
     $styles = $db->fetch(RevSliderGlobals::$table_css);
     $default_classes = RevSliderCssParser::default_css_classes();
     $cs = array('background-color' => 'backgroundColor', 'border-color' => 'borderColor', 'border-radius' => 'borderRadius', 'border-style' => 'borderStyle', 'border-width' => 'borderWidth', 'color' => 'color', 'font-family' => 'fontFamily', 'font-size' => 'fontSize', 'font-style' => 'fontStyle', 'font-weight' => 'fontWeight', 'line-height' => 'lineHeight', 'opacity' => 'opacity', 'padding' => 'padding', 'text-decoration' => 'textDecoration', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'skewx' => 'skewx', 'skewy' => 'skewy', 'scalex' => 'scalex', 'scaley' => 'scaley', 'opacity' => 'opacity', 'xrotate' => 'xrotate', 'yrotate' => 'yrotate', '2d_rotation' => '2d_rotation', 'layer_2d_origin_x' => 'layer_2d_origin_x', 'layer_2d_origin_y' => 'layer_2d_origin_y', '2d_origin_x' => '2d_origin_x', '2d_origin_y' => '2d_origin_y', 'pers' => 'pers', 'color-transparency' => 'color-transparency', 'background-transparency' => 'background-transparency', 'border-transparency' => 'border-transparency', 'css_cursor' => 'css_cursor', 'speed' => 'speed', 'easing' => 'easing', 'corner_left' => 'corner_left', 'corner_right' => 'corner_right', 'parallax' => 'parallax');
     foreach ($styles as $key => $attr) {
         if (isset($attr['advanced'])) {
             $adv = json_decode($attr['advanced'], true);
             // = array('idle' => array(), 'hover' => '');
         } else {
             $adv = array('idle' => array(), 'hover' => '');
         }
         if (!isset($adv['idle'])) {
             $adv['idle'] = array();
         }
         if (!isset($adv['hover'])) {
             $adv['hover'] = array();
         }
         //only do this to styles prior 5.0
         $settings = json_decode($attr['settings'], true);
         if (!empty($settings) && isset($settings['translated'])) {
             if (version_compare($settings['translated'], 5.0, '>=')) {
                 continue;
             }
         }
         $idle = json_decode($attr['params'], true);
         $hover = json_decode($attr['hover'], true);
         //check if in styles, there is type, then change the type text to something else
         $the_type = 'text';
         if (!empty($idle)) {
             foreach ($idle as $style => $value) {
                 if ($style == 'type') {
                     $the_type = $value;
                 }
                 if (!isset($cs[$style])) {
                     $adv['idle'][$style] = $value;
                     unset($idle[$style]);
                 }
             }
         }
         if (!empty($hover)) {
             foreach ($hover as $style => $value) {
                 if (!isset($cs[$style])) {
                     $adv['hover'][$style] = $value;
                     unset($hover[$style]);
                 }
             }
         }
         $settings['translated'] = 5.0;
         //set the style version to 5.0
         $settings['type'] = $the_type;
         //set the type version to text, since 5.0 we also have buttons and shapes, so we need to differentiate from now on
         if (!isset($settings['version'])) {
             if (isset($default_classes[$styles[$key]['handle']])) {
                 $settings['version'] = $default_classes[$styles[$key]['handle']];
             } else {
                 $settings['version'] = 'custom';
                 //set the version to custom as its not in the defaults
             }
         }
         $styles[$key]['params'] = json_encode($idle);
         $styles[$key]['hover'] = json_encode($hover);
         $styles[$key]['advanced'] = json_encode($adv);
         $styles[$key]['settings'] = json_encode($settings);
     }
     //save now all styles back to database
     foreach ($styles as $key => $attr) {
         $ret = $db->update(RevSliderGlobals::$table_css, array('settings' => $styles[$key]['settings'], 'params' => $styles[$key]['params'], 'hover' => $styles[$key]['hover'], 'advanced' => $styles[$key]['advanced']), array('id' => $attr['id']));
     }
 }
开发者ID:dawnthemes,项目名称:tkb,代码行数:76,代码来源:plugin-update.class.php

示例2: importSliderFromPost

 /**
  * 
  * import slider from multipart form
  */
 public function importSliderFromPost($updateAnim = true, $updateStatic = true, $exactfilepath = false, $is_template = false, $single_slide = false)
 {
     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_TEXTDOMAIN));
                 case UPLOAD_ERR_INI_SIZE:
                 case UPLOAD_ERR_FORM_SIZE:
                     RevSliderFunctions::throwError(__('Exceeded filesize limit.', REVSLIDER_TEXTDOMAIN));
                 default:
                     break;
             }
             $filepath = $_FILES["import_file"]["tmp_name"];
         }
         if (file_exists($filepath) == false) {
             RevSliderFunctions::throwError("Import file not found!!!");
         }
         //check if zip file or fallback to old, if zip, check if all files exist
         if (!class_exists("ZipArchive")) {
             $importZip = false;
         } else {
             $zip = new ZipArchive();
             $importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
         }
         // Added by ThemeFuzz ( Stefan )
         if ($importZip === 0 || !$zip->getStream('slider_export.txt')) {
             if (!$zip->getStream('slider_export.txt')) {
                 $upload_dir = wp_upload_dir();
                 $new_path = $upload_dir['basedir'] . '/' . $_FILES['import_file']['name'];
                 move_uploaded_file($_FILES["import_file"]["tmp_name"], $new_path);
                 $importZip = $zip->open($new_path, ZIPARCHIVE::CREATE);
             }
         }
         if ($is_template !== false && $importZip !== true) {
             return array("success" => false, "error" => __('Please select the correct zip file', REVSLIDER_TEXTDOMAIN));
         }
         if ($importZip === true) {
             //true or integer. If integer, its not a correct zip file
             //check if files all exist in zip
             $slider_export = $zip->getStream('slider_export.txt');
             $custom_animations = $zip->getStream('custom_animations.txt');
             $dynamic_captions = $zip->getStream('dynamic-captions.css');
             $static_captions = $zip->getStream('static-captions.css');
             $uid_file = $zip->getStream('info.cfg');
             $uid_check = '';
             if ($uid_file) {
                 while (!feof($uid_file)) {
                     $uid_check .= fread($uid_file, 1024);
                 }
             }
             if ($is_template !== false) {
                 if ($uid_check != $is_template) {
                     return array("success" => false, "error" => __('Please select the correct zip file, checksum failed!', REVSLIDER_TEXTDOMAIN));
                 }
             } 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;
                         }
                     }
                 }
             }
             if (!$slider_export) {
                 RevSliderFunctions::throwError("slider_export.txt does not exist!");
             }
             $content = '';
             $animations = '';
             $dynamic = '';
             $static = '';
             while (!feof($slider_export)) {
                 $content .= fread($slider_export, 1024);
             }
             if ($custom_animations) {
                 while (!feof($custom_animations)) {
                     $animations .= fread($custom_animations, 1024);
                 }
             }
             if ($dynamic_captions) {
//.........这里部分代码省略.........
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:101,代码来源: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

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