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


PHP RevSliderFunctions::getPostVariable方法代码示例

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


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

示例1: importSliderTemplateHandle

 /**
  *
  * import slider handle (not ajax response)
  */
 private static function importSliderTemplateHandle($viewBack = null, $updateAnim = true, $updateStatic = true, $single_slide = false)
 {
     dmp(__("importing template slider settings and data...", 'revslider'));
     $uid = esc_attr(RevSliderFunctions::getPostVariable('uid'));
     if ($uid == '') {
         dmp(__("ID missing, something went wrong. Please try again!", 'revslider'));
         echo RevSliderFunctions::getHtmlLink($viewBack, __("Go Back", 'revslider'));
         exit;
     }
     //check if the filename is correct
     //import to templates, then duplicate Slider
     $slider = new RevSlider();
     $response = $slider->importSliderFromPost($updateAnim, $updateStatic, false, $uid, $single_slide);
     if ($single_slide === false) {
         if (empty($viewBack)) {
             $sliderID = $response["sliderID"];
             $viewBack = self::getViewUrl(self::VIEW_SLIDER, "id=" . $sliderID);
             if (empty($sliderID)) {
                 $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
             }
         }
     }
     //handle error
     if ($response["success"] == false) {
         $message = $response["error"];
         dmp("<b>Error: " . $message . "</b>");
         echo RevSliderFunctions::getHtmlLink($viewBack, __("Go Back", 'revslider'));
     } else {
         //handle success, js redirect.
         dmp(__("Slider Import Success, redirecting...", 'revslider'));
         echo "<script>location.href='{$viewBack}'</script>";
     }
     exit;
 }
开发者ID:zruiz,项目名称:NG,代码行数:38,代码来源:revslider-admin.class.php

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

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

示例4: onSavePost

 /**
  * 
  * on save post meta. Update metaboxes data from post, add it to the post meta 
  */
 public static function onSavePost()
 {
     //protection against autosave
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         $postID = RevSliderFunctions::getPostVariable("ID");
         return $postID;
     }
     $postID = RevSliderFunctions::getPostVariable("ID");
     if (empty($postID)) {
         return false;
     }
     foreach (self::$arrMetaBoxes as $box) {
         $arrSettingNames = array('slide_template');
         foreach ($arrSettingNames as $name) {
             $value = RevSliderFunctions::getPostVariable($name);
             update_post_meta($postID, $name, $value);
         }
         //end foreach settings
     }
     //end foreach meta
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:25,代码来源:base-admin.class.php


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