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


PHP PMXI_Plugin::session方法代码示例

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


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

示例1: pmxi_wp_ajax_nested_merge

function pmxi_wp_ajax_nested_merge()
{
    if (!check_ajax_referer('wp_all_import_secure', 'security', false)) {
        exit(json_encode(array('success' => false, 'msg' => __('Security check', 'wp_all_import_plugin'))));
    }
    if (!current_user_can(PMXI_Plugin::$capabilities)) {
        exit(json_encode(array('success' => false, 'msg' => __('Security check', 'wp_all_import_plugin'))));
    }
    $input = new PMXI_Input();
    $post = $input->post(array('filePath' => ''));
    PMXI_Plugin::$session = PMXI_Session::get_instance();
    /*$nested_file = array(
    		'file' => $filePath,
    		'source' => $realPath,
    		'xpath' => $customXpath,
    		'root_element' => $root_element,
    		'main_xml_field' => $main_xml_field,
    		'child_xml_field' => $child_xml_field
    	);		*/
    $nested_files = empty(PMXI_Plugin::$session->options['nested_files']) ? array() : json_decode(PMXI_Plugin::$session->options['nested_files'], true);
    $nested_files[] = $post['filePath'];
    $options = PMXI_Plugin::$session->options;
    $options['nested_files'] = json_encode($nested_files);
    PMXI_Plugin::$session->set('options', $options);
    PMXI_Plugin::$session->save_data();
    exit(json_encode(array('success' => true, 'nested_files' => $nested_files)));
    die;
}
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:28,代码来源:wp_ajax_nested_merge.php

示例2: init

 protected function init()
 {
     parent::init();
     error_reporting(0);
     PMXI_Plugin::$session = PMXI_Session::get_instance();
     PMXI_Plugin::$session->session_started();
     if ('PMXI_Admin_Manage' == PMXI_Plugin::getInstance()->getAdminCurrentScreen()->base) {
         // prereqisites are not checked when flow control is deligated
         $id = $this->input->get('id');
         $this->data['import'] = $import = new PMXI_Import_Record();
         if (!$id or $import->getById($id)->isEmpty()) {
             // specified import is not found
             wp_redirect(add_query_arg('page', 'pmxi-admin-manage', admin_url('admin.php')));
             die;
         }
         $this->isWizard = false;
     } else {
         $action = PMXI_Plugin::getInstance()->getAdminCurrentScreen()->action;
         $this->_step_ready($action);
         $this->isInline = 'process' == $action;
     }
     XmlImportConfig::getInstance()->setCacheDirectory(sys_get_temp_dir());
     // preserve id parameter as part of baseUrl
     $id = $this->input->get('id') and $this->baseUrl = add_query_arg('id', $id, $this->baseUrl);
     $this->baseUrl = apply_filters('pmxi_base_url', $this->baseUrl);
 }
开发者ID:thabofletcher,项目名称:tc-site,代码行数:26,代码来源:import.php

示例3: pmxi_wp_ajax_unmerge_file

function pmxi_wp_ajax_unmerge_file()
{
    extract($_POST);
    PMXI_Plugin::$session = PMXI_Session::get_instance();
    if (!empty(PMXI_Plugin::$session->options['nested_files'])) {
        $nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
        unset($nested_files[$source]);
        $options = PMXI_Plugin::$session->options;
        $options['nested_files'] = json_encode($nested_files);
        PMXI_Plugin::$session->set('options', $options);
        PMXI_Plugin::$session->save_data();
        exit(json_encode(array('success' => true, 'nested_files' => $nested_files)));
        die;
    }
    exit(json_encode(array('success' => false)));
    die;
}
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:17,代码来源:wp_ajax_unmerge_file.php

示例4: pmxi_wp_ajax_nested_merge

function pmxi_wp_ajax_nested_merge()
{
    extract($_POST);
    PMXI_Plugin::$session = PMXI_Session::get_instance();
    /*$nested_file = array(
    		'file' => $filePath,
    		'source' => $realPath,
    		'xpath' => $customXpath,
    		'root_element' => $root_element,
    		'main_xml_field' => $main_xml_field,
    		'child_xml_field' => $child_xml_field
    	);		*/
    $nested_files = empty(PMXI_Plugin::$session->options['nested_files']) ? array() : json_decode(PMXI_Plugin::$session->options['nested_files'], true);
    $nested_files[] = $filePath;
    $options = PMXI_Plugin::$session->options;
    $options['nested_files'] = json_encode($nested_files);
    PMXI_Plugin::$session->set('options', $options);
    PMXI_Plugin::$session->save_data();
    exit(json_encode(array('success' => true, 'nested_files' => $nested_files)));
    die;
}
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:21,代码来源:wp_ajax_nested_merge.php

示例5: pmxi_wp_ajax_unmerge_file

function pmxi_wp_ajax_unmerge_file()
{
    if (!check_ajax_referer('wp_all_import_secure', 'security', false)) {
        exit(json_encode(array('success' => false, 'msg' => __('Security check', 'wp_all_import_plugin'))));
    }
    if (!current_user_can('manage_options')) {
        exit(json_encode(array('success' => false, 'msg' => __('Security check', 'wp_all_import_plugin'))));
    }
    $input = new PMXI_Input();
    $post = $input->post(array('source' => ''));
    PMXI_Plugin::$session = PMXI_Session::get_instance();
    if (!empty(PMXI_Plugin::$session->options['nested_files']) and !empty($post['source'])) {
        $nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
        unset($nested_files[$post['source']]);
        $options = PMXI_Plugin::$session->options;
        $options['nested_files'] = json_encode($nested_files);
        PMXI_Plugin::$session->set('options', $options);
        PMXI_Plugin::$session->save_data();
        exit(json_encode(array('success' => true, 'nested_files' => $nested_files)));
        die;
    }
    exit(json_encode(array('success' => false)));
    die;
}
开发者ID:lizbur10,项目名称:js_finalproject,代码行数:24,代码来源:wp_ajax_unmerge_file.php

示例6: __adminInit

 /**
  * pre-dispatching logic for admin page controllers
  */
 public function __adminInit()
 {
     // create history folder
     $uploads = wp_upload_dir();
     $wpallimportDirs = array(WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY, self::LOGS_DIRECTORY, self::FILES_DIRECTORY, self::TEMP_DIRECTORY, self::UPLOADS_DIRECTORY, self::HISTORY_DIRECTORY);
     foreach ($wpallimportDirs as $destination) {
         $dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . $destination;
         if (!is_dir($dir)) {
             wp_mkdir_p($dir);
         }
         if (!@file_exists($dir . DIRECTORY_SEPARATOR . 'index.php')) {
             @touch($dir . DIRECTORY_SEPARATOR . 'index.php');
         }
     }
     self::$session = new PMXI_Handler();
     $input = new PMXI_Input();
     $page = strtolower($input->getpost('page', ''));
     if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\\w-]+)$%', $page)) {
         //$this->adminDispatcher($page, strtolower($input->getpost('action', 'index')));
         $action = strtolower($input->getpost('action', 'index'));
         // capitalize prefix and first letters of class name parts
         if (function_exists('preg_replace_callback')) {
             $controllerName = preg_replace_callback('%(^' . preg_quote(self::PREFIX, '%') . '|_).%', array($this, "replace_callback"), str_replace('-', '_', $page));
         } else {
             $controllerName = preg_replace('%(^' . preg_quote(self::PREFIX, '%') . '|_).%e', 'strtoupper("$0")', str_replace('-', '_', $page));
         }
         $actionName = str_replace('-', '_', $action);
         if (method_exists($controllerName, $actionName)) {
             @ini_set("max_input_time", PMXI_Plugin::getInstance()->getOption('max_input_time'));
             @ini_set("max_execution_time", PMXI_Plugin::getInstance()->getOption('max_execution_time'));
             if (!get_current_user_id() or !current_user_can('manage_options')) {
                 // This nonce is not valid.
                 die('Security check');
             } else {
                 $this->_admin_current_screen = (object) array('id' => $controllerName, 'base' => $controllerName, 'action' => $actionName, 'is_ajax' => strpos($_SERVER["HTTP_ACCEPT"], 'json') !== false, 'is_network' => is_network_admin(), 'is_user' => is_user_admin());
                 add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
                 add_filter('admin_body_class', create_function('', 'return "' . 'wpallimport-plugin";'));
                 $controller = new $controllerName();
                 if (!$controller instanceof PMXI_Controller_Admin) {
                     throw new Exception("Administration page `{$page}` matches to a wrong controller type.");
                 }
                 if ($this->_admin_current_screen->is_ajax) {
                     // ajax request
                     $controller->{$action}();
                     do_action('pmxi_action_after');
                     die;
                     // stop processing since we want to output only what controller is randered, nothing in addition
                 } elseif (!$controller->isInline) {
                     @ob_start();
                     $controller->{$action}();
                     self::$buffer = @ob_get_clean();
                 } else {
                     self::$buffer_callback = array($controller, $action);
                 }
             }
         } else {
             // redirect to dashboard if requested page and/or action don't exist
             wp_redirect(admin_url());
             die;
         }
     }
 }
开发者ID:GolgoSoft,项目名称:KeenerWP,代码行数:65,代码来源:plugin.php

示例7: pmxi_session_commit

/**
 * Alias of wp_session_write_close()
 */
function pmxi_session_commit()
{
    PMXI_Plugin::$session = PMXI_Session::get_instance();
    PMXI_Plugin::$session->write_data();
    do_action('pmxi_session_commit');
}
开发者ID:thabofletcher,项目名称:tc-site,代码行数:9,代码来源:pmxi_functions.php

示例8: __adminInit

 /**
  * pre-dispatching logic for admin page controllers
  */
 public function __adminInit()
 {
     self::$session = new PMXI_Handler();
     $input = new PMXI_Input();
     $page = strtolower($input->getpost('page', ''));
     if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\\w-]+)$%', $page)) {
         //$this->adminDispatcher($page, strtolower($input->getpost('action', 'index')));
         $action = strtolower($input->getpost('action', 'index'));
         // capitalize prefix and first letters of class name parts
         if (function_exists('preg_replace_callback')) {
             $controllerName = preg_replace_callback('%(^' . preg_quote(self::PREFIX, '%') . '|_).%', array($this, "replace_callback"), str_replace('-', '_', $page));
         } else {
             $controllerName = preg_replace('%(^' . preg_quote(self::PREFIX, '%') . '|_).%e', 'strtoupper("$0")', str_replace('-', '_', $page));
         }
         $actionName = str_replace('-', '_', $action);
         if (method_exists($controllerName, $actionName)) {
             $this->_admin_current_screen = (object) array('id' => $controllerName, 'base' => $controllerName, 'action' => $actionName, 'is_ajax' => strpos($_SERVER["HTTP_ACCEPT"], 'json') !== false, 'is_network' => is_network_admin(), 'is_user' => is_user_admin());
             add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
             add_filter('admin_body_class', create_function('', 'return "' . 'wpallimport-plugin";'));
             $controller = new $controllerName();
             if (!$controller instanceof PMXI_Controller_Admin) {
                 throw new Exception("Administration page `{$page}` matches to a wrong controller type.");
             }
             if ($this->_admin_current_screen->is_ajax) {
                 // ajax request
                 $controller->{$action}();
                 do_action('pmxi_action_after');
                 die;
                 // stop processing since we want to output only what controller is randered, nothing in addition
             } elseif (!$controller->isInline) {
                 @ob_start();
                 $controller->{$action}();
                 self::$buffer = @ob_get_clean();
             } else {
                 self::$buffer_callback = array($controller, $action);
             }
         } else {
             // redirect to dashboard if requested page and/or action don't exist
             wp_redirect(admin_url());
             die;
         }
     }
 }
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:46,代码来源:wp-all-import-pro.php


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