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


PHP PMXI_Plugin::csv_path方法代码示例

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


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

示例1: __construct

 /**
  * data load initialize
  *
  * @param mixed $filename please look at the load() method
  *
  * @access public
  * @see load()
  * @return void
  */
 public function __construct($filename = null, $large_import = false, $xpath = '', $delimiter = '', $encoding = '', $xml_path = '')
 {
     PMXI_Plugin::$csv_path = $filename;
     $this->large_import = $large_import;
     $this->xpath = !empty($xpath) ? $xpath : (!empty($_POST['xpath']) ? $_POST['xpath'] : '/node');
     $this->delimiter = $delimiter;
     if ('' != $encoding) {
         $this->csv_encoding = $encoding;
         $this->auto_encoding = false;
     }
     if ('' != $xml_path) {
         $this->xml_path = $xml_path;
     }
     @ini_set("display_errors", 0);
     @ini_set('auto_detect_line_endings', true);
     $file_params = self::analyse_file($filename, 1);
     $this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
     unset($file_params);
     //stream_filter_register('msaccessxml', 'MSAccessXmlFilter');
     $this->load($filename);
 }
开发者ID:thabofletcher,项目名称:tc-site,代码行数:30,代码来源:XmlImportCsvParse.php

示例2: __construct

 /**
  * data load initialize
  *
  * @param mixed $filename please look at the load() method
  *
  * @access public
  * @see load()
  * @return void
  */
 public function __construct($options = array('filename' => null, 'xpath' => '', 'delimiter' => '', 'encoding' => '', 'xml_path' => '', 'targetDir' => false))
 {
     PMXI_Plugin::$csv_path = $options['filename'];
     $this->xpath = !empty($options['xpath']) ? $options['xpath'] : (!empty($_POST['xpath']) ? $_POST['xpath'] : '/node');
     if (!empty($options['delimiter'])) {
         $this->delimiter = $options['delimiter'];
     } else {
         $input = new PMXI_Input();
         $id = $input->get('id', 0);
         if (!$id) {
             $id = $input->get('import_id', 0);
         }
         if ($id) {
             $import = new PMXI_Import_Record();
             $import->getbyId($id);
             if (!$import->isEmpty()) {
                 $this->delimiter = $import->options['delimiter'];
             }
         }
     }
     if (!empty($options['encoding'])) {
         $this->csv_encoding = $options['encoding'];
         $this->auto_encoding = false;
     }
     if (!empty($options['xml_path'])) {
         $this->xml_path = $options['xml_path'];
     }
     @ini_set("display_errors", 0);
     @ini_set('auto_detect_line_endings', true);
     $file_params = self::analyse_file($options['filename'], 1);
     $this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
     unset($file_params);
     $wp_uploads = wp_upload_dir();
     $this->targetDir = empty($options['targetDir']) ? wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY) : $options['targetDir'];
     $this->load($options['filename']);
 }
开发者ID:Kilbourne,项目名称:restart,代码行数:45,代码来源:XmlImportCsvParse.php

示例3: index

 /**
  * Step #1: Choose File
  */
 public function index()
 {
     PMXI_Plugin::$session->clean_session();
     $this->data['reimported_import'] = $import = new PMXI_Import_Record();
     $this->data['id'] = $id = $this->input->get('id');
     $this->data['parent_import'] = $parent_import = $this->input->get('parent_import', 0);
     $parent_import_record = new PMXI_Import_Record();
     $default = array('type' => 'upload', 'wizard_type' => 'new', 'custom_type' => 'post', 'show_hidden_cpt' => 0, 'feed_type' => '', 'url' => '', 'ftp' => array('url' => 'ftp://'), 'file' => '', 'reimport' => '', 'is_update_previous' => $id ? 1 : 0, 'update_previous' => $id, 'xpath' => '/', 'filepath' => '', 'root_element' => '', 'downloaded' => '', 'auto_generate' => 0, 'template' => false);
     if ($parent_import and !$parent_import_record->getById($parent_import)->isEmpty()) {
         $default['custom_type'] = $parent_import_record->options['custom_type'];
     }
     if ($id) {
         // update requested but corresponding import is not found
         if ($import->getById($id)->isEmpty()) {
             if (!empty($_GET['deligate']) and $_GET['deligate'] == 'wpallexport') {
                 wp_redirect(add_query_arg('pmxi_nt', array('error' => urlencode(__('The import associated with this export has been deleted.', 'wp_all_import_plugin')), 'updated' => urlencode(__('Please re-run your export by clicking Run Export on the All Export -> Manage Exports page. Then try your import again.', 'wp_all_import_plugin'))), remove_query_arg('id', $this->baseUrl)));
                 die;
             } else {
                 wp_redirect(add_query_arg('pmxi_nt', array('error' => urlencode(__('This import has been deleted.', 'wp_all_import_plugin'))), remove_query_arg('id', $this->baseUrl)));
                 die;
             }
         } else {
             $default['custom_type'] = $import->options['custom_type'];
         }
     }
     $this->data['post'] = $post = $this->input->post($default);
     if (!class_exists('DOMDocument') or !class_exists('XMLReader')) {
         $this->errors->add('form-validation', __('Required PHP components are missing.<br/><br/>WP All Import requires DOMDocument, XMLReader, and XMLWriter PHP modules to be installed.<br/>These are standard features of PHP, and are necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the DOMDocument, XMLReader, and XMLWriter PHP modules.', 'wp_all_import_plugin'));
     }
     if ($this->input->post('is_submitted') and !$this->errors->get_error_codes()) {
         check_admin_referer('choose-file', '_wpnonce_choose-file');
         if ('upload' == $this->input->post('type')) {
             $uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
             $upload_result = $uploader->upload();
             if ($upload_result instanceof WP_Error) {
                 $this->errors = $upload_result;
             } else {
                 $source = $upload_result['source'];
                 $filePath = $upload_result['filePath'];
                 $post['template'] = $upload_result['template'];
                 PMXI_Plugin::$is_csv = $upload_result['is_csv'];
                 if (!empty($upload_result['root_element'])) {
                     $post['root_element'] = $upload_result['root_element'];
                 }
             }
         } elseif ('url' == $this->input->post('type')) {
             if (!empty($post['downloaded'])) {
                 $downloaded = json_decode($post['downloaded'], true);
                 $source = $downloaded['source'];
                 $filePath = $downloaded['filePath'];
                 $post['template'] = $downloaded['template'];
                 PMXI_Plugin::$csv_path = $downloaded['csv_path'];
                 PMXI_Plugin::$is_csv = $downloaded['is_csv'];
                 if (!empty($downloaded['root_element'])) {
                     $post['root_element'] = $downloaded['root_element'];
                 }
                 $post['feed_type'] = $downloaded['feed_type'];
             } else {
                 $uploader = new PMXI_Upload($post['url'], $this->errors);
                 $upload_result = $uploader->url($post['feed_type']);
                 if ($upload_result instanceof WP_Error) {
                     $this->errors = $upload_result;
                 } else {
                     $source = $upload_result['source'];
                     $filePath = $upload_result['filePath'];
                     $post['template'] = $upload_result['template'];
                     PMXI_Plugin::$csv_path = $upload_result['csv_path'];
                     PMXI_Plugin::$is_csv = $upload_result['is_csv'];
                     if (!empty($upload_result['root_element'])) {
                         $post['root_element'] = $upload_result['root_element'];
                     }
                     $post['feed_type'] = $upload_result['feed_type'];
                 }
             }
         } elseif ('file' == $this->input->post('type')) {
             $uploader = new PMXI_Upload($post['file'], $this->errors);
             $upload_result = $uploader->file();
             if ($upload_result instanceof WP_Error) {
                 $this->errors = $upload_result;
             } else {
                 $source = $upload_result['source'];
                 $filePath = $upload_result['filePath'];
                 $post['template'] = $upload_result['template'];
                 PMXI_Plugin::$is_csv = $upload_result['is_csv'];
                 if (!empty($upload_result['root_element'])) {
                     $post['root_element'] = $upload_result['root_element'];
                 }
             }
         }
         if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
             $this->errors->add('form-validation', __('Select an item type to import the data', 'wp_all_import_plugin'));
         }
         if ($post['is_update_previous'] and empty($post['update_previous'])) {
             $this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'wp_all_import_plugin'));
         }
         $this->data['detection_feed_extension'] = false;
         $elements_cloud = array();
//.........这里部分代码省略.........
开发者ID:hikaram,项目名称:wee,代码行数:101,代码来源:import.php

示例4: index

 /**
  * Step #1: Choose File
  */
 public function index()
 {
     PMXI_Plugin::$session->clean_session();
     $this->data['reimported_import'] = $import = new PMXI_Import_Record();
     $this->data['id'] = $id = $this->input->get('id');
     $this->data['parent_import'] = $parent_import = $this->input->get('parent_import', 0);
     $parent_import_record = new PMXI_Import_Record();
     $default = array('type' => 'upload', 'wizard_type' => 'new', 'custom_type' => 'post', 'show_hidden_cpt' => 0, 'feed_type' => '', 'url' => '', 'ftp' => array('url' => 'ftp://'), 'file' => '', 'reimport' => '', 'is_update_previous' => $id ? 1 : 0, 'update_previous' => $id, 'xpath' => '/', 'filepath' => '', 'root_element' => '', 'downloaded' => '');
     if ($parent_import and !$parent_import_record->getById($parent_import)->isEmpty()) {
         $default['custom_type'] = $parent_import_record->options['custom_type'];
     }
     if ($id and $import->getById($id)->isEmpty()) {
         // update requested but corresponding import is not found
         wp_redirect(remove_query_arg('id', $this->baseUrl));
         die;
     }
     $this->data['post'] = $post = $this->input->post($default);
     if ($this->input->post('is_submitted_continue')) {
         if (!empty(PMXI_Plugin::$session->local_paths)) {
             wp_redirect(add_query_arg('action', 'element', $this->baseUrl));
             die;
         }
     } elseif ('upload' == $this->input->post('type')) {
         $uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
         $upload_result = $uploader->upload();
         if ($upload_result instanceof WP_Error) {
             $this->errors = $upload_result;
         } else {
             $source = $upload_result['source'];
             $filePath = $upload_result['filePath'];
             PMXI_Plugin::$is_csv = $upload_result['is_csv'];
             if (!empty($upload_result['root_element'])) {
                 $post['root_element'] = $upload_result['root_element'];
             }
         }
     } elseif ('url' == $this->input->post('type')) {
         if (!empty($post['downloaded'])) {
             $downloaded = json_decode($post['downloaded'], true);
             $source = $downloaded['source'];
             $filePath = $downloaded['filePath'];
             PMXI_Plugin::$csv_path = $downloaded['csv_path'];
             PMXI_Plugin::$is_csv = $downloaded['is_csv'];
             if (!empty($downloaded['root_element'])) {
                 $post['root_element'] = $downloaded['root_element'];
             }
             $post['feed_type'] = $downloaded['feed_type'];
         } else {
             $uploader = new PMXI_Upload($post['url'], $this->errors);
             $upload_result = $uploader->url($post['feed_type']);
             if ($upload_result instanceof WP_Error) {
                 $this->errors = $upload_result;
             } else {
                 $source = $upload_result['source'];
                 $filePath = $upload_result['filePath'];
                 PMXI_Plugin::$csv_path = $upload_result['csv_path'];
                 PMXI_Plugin::$is_csv = $upload_result['is_csv'];
                 if (!empty($upload_result['root_element'])) {
                     $post['root_element'] = $upload_result['root_element'];
                 }
                 $post['feed_type'] = $upload_result['feed_type'];
             }
         }
     } elseif ('file' == $this->input->post('type')) {
         $uploader = new PMXI_Upload($post['file'], $this->errors);
         $upload_result = $uploader->file();
         if ($upload_result instanceof WP_Error) {
             $this->errors = $upload_result;
         } else {
             $source = $upload_result['source'];
             $filePath = $upload_result['filePath'];
             PMXI_Plugin::$is_csv = $upload_result['is_csv'];
             if (!empty($upload_result['root_element'])) {
                 $post['root_element'] = $upload_result['root_element'];
             }
         }
     }
     if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
         $this->errors->add('form-validation', __('Select an item type to import the data', 'pmxi_plugin'));
     }
     if ($post['is_update_previous'] and empty($post['update_previous'])) {
         $this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'pmxi_plugin'));
     }
     $this->data['detection_feed_extension'] = false;
     if (!class_exists('DOMDocument') or !class_exists('XMLReader')) {
         $this->errors->add('form-validation', __('Required PHP components are missing.<br/><br/>WP All Import requires DOMDocument and XMLReader PHP classes to be installed.<br/>These are standard features of PHP, and are necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the DOMDocument and XMLReader PHP classes.', 'pmxi_plugin'));
     }
     if ($this->input->post('is_submitted') and !$this->errors->get_error_codes()) {
         check_admin_referer('choose-file', '_wpnonce_choose-file');
         $elements_cloud = array();
         @set_time_limit(0);
         $local_paths = !empty($local_paths) ? $local_paths : array($filePath);
         foreach ($local_paths as $key => $path) {
             if (@file_exists($path)) {
                 $file = new PMXI_Chunk($path, array('element' => $post['root_element']));
                 if (!empty($file->options['element'])) {
                     $xpath = "/" . $file->options['element'];
                     $elements_cloud = $file->cloud;
//.........这里部分代码省略.........
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:101,代码来源:import.php


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