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


PHP RevSliderFunctionsWP::isAdminUser方法代码示例

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


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

示例1: onAjaxAction

 /**
  *
  * onAjax action handler
  */
 public static function onAjaxAction()
 {
     $role = self::getMenuRole();
     //add additional security check and allow for example import only for admin
     $slider = new RevSlider();
     $slide = new RevSlide();
     $operations = new RevSliderOperations();
     $action = self::getPostGetVar("client_action");
     $data = self::getPostGetVar("data");
     $nonce = self::getPostGetVar("nonce");
     if (empty($nonce)) {
         $nonce = self::getPostGetVar("rs-nonce");
     }
     try {
         if (RS_DEMO) {
             switch ($action) {
                 case 'import_slider_online_template_slidersview':
                 case 'duplicate_slider':
                 case 'preview_slider':
                 case 'get_static_css':
                 case 'get_dynamic_css':
                 case 'preview_slide':
                     //these are all okay in demo mode
                     break;
                 default:
                     RevSliderFunctions::throwError(__('Function Not Available in Demo Mode', 'revslider'));
                     exit;
                     break;
             }
         }
         if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
             switch ($action) {
                 case 'change_specific_navigation':
                 case 'change_navigations':
                 case 'update_static_css':
                 case 'add_new_preset':
                 case 'update_preset':
                 case 'import_slider':
                 case 'import_slider_slidersview':
                 case 'import_slider_template_slidersview':
                 case 'import_slide_template_slidersview':
                     RevSliderFunctions::throwError(__('Function Only Available for Adminstrators', 'revslider'));
                     exit;
                     break;
             }
         }
         //verify the nonce
         $isVerified = wp_verify_nonce($nonce, "revslider_actions");
         if ($isVerified == false) {
             RevSliderFunctions::throwError("Wrong request");
         }
         switch ($action) {
             case 'add_new_preset':
                 if (!isset($data['settings']) || !isset($data['values'])) {
                     self::ajaxResponseError(__('Missing values to add preset', 'revslider'), false);
                 }
                 $result = $operations->add_preset_setting($data);
                 if ($result === true) {
                     $presets = $operations->get_preset_settings();
                     self::ajaxResponseSuccess(__('Preset created', 'revslider'), array('data' => $presets));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 exit;
                 break;
             case 'update_preset':
                 if (!isset($data['name']) || !isset($data['values'])) {
                     self::ajaxResponseError(__('Missing values to update preset', 'revslider'), false);
                 }
                 $result = $operations->update_preset_setting($data);
                 if ($result === true) {
                     $presets = $operations->get_preset_settings();
                     self::ajaxResponseSuccess(__('Preset created', 'revslider'), array('data' => $presets));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 exit;
                 break;
             case 'remove_preset':
                 if (!isset($data['name'])) {
                     self::ajaxResponseError(__('Missing values to remove preset', 'revslider'), false);
                 }
                 $result = $operations->remove_preset_setting($data);
                 if ($result === true) {
                     $presets = $operations->get_preset_settings();
                     self::ajaxResponseSuccess(__('Preset deleted', 'revslider'), array('data' => $presets));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 exit;
                 break;
             case "export_slider":
                 $sliderID = self::getGetVar("sliderid");
                 $dummy = self::getGetVar("dummy");
                 $slider->initByID($sliderID);
                 $slider->exportSlider($dummy);
//.........这里部分代码省略.........
开发者ID:fredpaw,项目名称:chuguo,代码行数:101,代码来源:revslider-admin.class.php

示例2: _e

        _e('Import', 'revslider');
        ?>
</li>
									<li data-content="#import-export" class=""><?php 
        _e('Export', 'revslider');
        ?>
</li>
									<li data-content="#import-replace" class=""><?php 
        _e('Replace URL', 'revslider');
        ?>
</li>
								</ul>
								
								<div id="import-import">
									<?php 
        if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
            _e('Import only available for Administrators', 'revslider');
        } else {
            ?>
										<form name="import_slider_form" id="rs_import_slider_form" action="<?php 
            echo RevSliderBase::$url_ajax;
            ?>
" enctype="multipart/form-data" method="post">
											<input type="hidden" name="action" value="revslider_ajax_action">
											<input type="hidden" name="client_action" value="import_slider">
											<input type="hidden" name="sliderid" value="<?php 
            echo $sliderID;
            ?>
">
											<input type="hidden" name="nonce" value="<?php 
            echo wp_create_nonce("revslider_actions");
开发者ID:SayenkoDesign,项目名称:gogo-racing.com,代码行数:31,代码来源:slider-main-options.php

示例3: createUpdateSliderFromOptions

 /**
  * 
  * create / update slider from options
  */
 private function createUpdateSliderFromOptions($options, $sliderID = null)
 {
     $arrMain = RevSliderFunctions::getVal($options, "main");
     $params = RevSliderFunctions::getVal($options, "params");
     //trim all input data
     $arrMain = RevSliderFunctions::trimArrayItems($arrMain);
     $params = RevSliderFunctions::trimArrayItems($params);
     $params = array_merge($arrMain, $params);
     $title = sanitize_text_field(RevSliderFunctions::getVal($arrMain, "title"));
     $alias = sanitize_text_field(RevSliderFunctions::getVal($arrMain, "alias"));
     //params css and js check
     if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
         //dont allow css and javascript from users other than administrator
         unset($params['custom_css']);
         unset($params['custom_javascript']);
     }
     if (!empty($sliderID)) {
         $this->initByID($sliderID);
         if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
             //check for js and css, add it to $params
             $params['custom_css'] = $this->getParam('custom_css', '');
             $params['custom_javascript'] = $this->getParam('custom_javascript', '');
         }
     }
     $this->validateInputSettings($title, $alias, $params);
     $jsonParams = json_encode($params);
     //insert slider to database
     $arrData = array();
     $arrData["title"] = $title;
     $arrData["alias"] = $alias;
     $arrData["params"] = $jsonParams;
     $arrData["type"] = '';
     if (empty($sliderID)) {
         //create slider
         $arrData['settings'] = json_encode(array('version' => 5.0));
         $sliderID = $this->db->insert(RevSliderGlobals::$table_sliders, $arrData);
         return $sliderID;
     } else {
         //update slider
         $this->initByID($sliderID);
         $settings = $this->getSettings();
         $settings['version'] = 5.0;
         $arrData['settings'] = json_encode($settings);
         $sliderID = $this->db->update(RevSliderGlobals::$table_sliders, $arrData, array("id" => $sliderID));
     }
 }
开发者ID:ksan5835,项目名称:maadithottam,代码行数:50,代码来源:slider.class.php


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