• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_all_import_get_absolute_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wp_all_import_get_absolute_path函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_all_import_get_absolute_path函数的具体用法?PHP wp_all_import_get_absolute_path怎么用?PHP wp_all_import_get_absolute_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: delete

 public function delete($unlink = true)
 {
     $import_file_path = wp_all_import_get_absolute_path($this->path);
     if (@file_exists($import_file_path) and $unlink) {
         wp_all_import_remove_source($import_file_path);
     }
     return parent::delete();
 }
开发者ID:lizbur10,项目名称:js_finalproject,代码行数:8,代码来源:record.php


示例2: delete_source

 public function delete_source($logger = false)
 {
     if ($this->options['is_delete_source']) {
         $uploads = wp_upload_dir();
         $logger and call_user_func($logger, __('Deleting source XML file...', 'wp_all_import_plugin'));
         // Delete chunks
         foreach (PMXI_Helper::safe_glob($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'pmxi_chunk_*', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
             $logger and call_user_func($logger, __('Deleting chunks files...', 'wp_all_import_plugin'));
             @file_exists($filePath) and wp_all_import_remove_source($filePath, false);
         }
         if ($this->type != "ftp") {
             $apath = wp_all_import_get_absolute_path($this->path);
             if (!@unlink($apath)) {
                 $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', 'wp_all_import_plugin'), $apath));
             }
         } else {
             $file_path_array = PMXI_Helper::safe_glob($this->path, PMXI_Helper::GLOB_NODIR | PMXI_Helper::GLOB_PATH);
             if (!empty($file_path_array)) {
                 foreach ($file_path_array as $path) {
                     $apath = wp_all_import_get_absolute_path($path);
                     if (!@unlink($apath)) {
                         $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', 'wp_all_import_plugin'), $apath));
                     }
                 }
             }
         }
     }
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:28,代码来源:record.php


示例3: feed

 public function feed()
 {
     $nonce = !empty($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : '';
     if (!wp_verify_nonce($nonce, '_wpnonce-download_feed')) {
         die(__('Security check', 'wp_all_import_plugin'));
     } else {
         $import_id = $this->input->get('id');
         $path = '';
         $import = new PMXI_Import_Record();
         $import->getbyId($import_id);
         if (!$import->isEmpty()) {
             $path = wp_all_import_get_absolute_path($import->path);
         }
         if (file_exists($path)) {
             if (preg_match('%\\W(zip)$%i', trim(basename($path)))) {
                 PMXI_download::zip($path);
             } elseif (preg_match('%\\W(xml)$%i', trim(basename($path)))) {
                 PMXI_download::xml($path);
             } else {
                 PMXI_download::csv($path);
             }
         } else {
             wp_redirect(add_query_arg(array('pmxi_nt' => urlencode(__('File does not exists.', 'wp_all_import_plugin'))), $this->baseUrl));
             die;
         }
     }
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:27,代码来源:manage.php


示例4: get_xml

 protected function get_xml($tagno = 0, $debug = false)
 {
     $xml = '';
     $update_previous = new PMXI_Import_Record();
     if (!empty(PMXI_Plugin::$session->update_previous)) {
         $update_previous->getById(PMXI_Plugin::$session->update_previous);
     }
     $local_paths = empty(PMXI_Plugin::$session->local_paths) ? array() : PMXI_Plugin::$session->local_paths;
     if (empty($local_paths) and !$update_previous->isEmpty()) {
         $history_file = new PMXI_File_Record();
         $history_file->getBy(array('import_id' => $update_previous->id), 'id DESC');
         $local_paths = !$history_file->isEmpty() ? array(wp_all_import_get_absolute_path($history_file->path)) : array();
     }
     if (!empty($local_paths)) {
         $loop = 0;
         foreach ($local_paths as $key => $path) {
             if (@file_exists($path)) {
                 $root_element = !$update_previous->isEmpty() ? $update_previous->root_element : PMXI_Plugin::$session->source['root_element'];
                 $file = new PMXI_Chunk($path, array('element' => $root_element, 'encoding' => PMXI_Plugin::$session->encoding));
                 while ($xml = $file->read()) {
                     if (!empty($xml)) {
                         PMXI_Import_Record::preprocessXml($xml);
                         $xml = "<?xml version=\"1.0\" encoding=\"" . PMXI_Plugin::$session->encoding . "\"?>" . "\n" . $xml;
                         if (PMXI_Plugin::$session->xpath) {
                             $dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
                             $old = libxml_use_internal_errors(true);
                             $dom->loadXML($xml);
                             libxml_use_internal_errors($old);
                             $xpath = new DOMXPath($dom);
                             if ($elements = $xpath->query(PMXI_Plugin::$session->xpath) and $elements->length) {
                                 $this->data['dom'] = $dom;
                                 $loop++;
                                 if (!$tagno or $loop == $tagno) {
                                     break;
                                 }
                             }
                         } else {
                             break;
                         }
                     }
                 }
                 unset($file);
             }
         }
     }
     return $xml;
 }
开发者ID:hikaram,项目名称:wee,代码行数:47,代码来源:import.php


示例5: add_query_arg

                            ?>
											<em><a href="<?php 
                            echo add_query_arg(array('id' => $item['id'], 'action' => 'feed', '_wpnonce' => wp_create_nonce('_wpnonce-download_feed')), $this->baseUrl);
                            ?>
" class="wp_all_import_show_path" rel="<?php 
                            echo $item['path'];
                            ?>
"><?php 
                            echo preg_replace('%.*wp-content/%', 'wp-content/', $path);
                            ?>
</a></em>
										<?php 
                        } elseif (in_array($item['type'], array('file'))) {
                            ?>
											<?php 
                            $item['path'] = wp_all_import_get_absolute_path($item['path']);
                            ?>
											<em><a href="<?php 
                            echo add_query_arg(array('id' => $item['id'], 'action' => 'feed', '_wpnonce' => wp_create_nonce('_wpnonce-download_feed')), $this->baseUrl);
                            ?>
" class="wp_all_import_show_path" rel="<?php 
                            echo $item['path'];
                            ?>
"><?php 
                            echo preg_replace('%.*wp-content/%', 'wp-content/', $item['path']);
                            ?>
</a></em>
										<?php 
                        } else {
                            ?>
										<em><?php 
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:31,代码来源:index.php


示例6: cleanup

 public function cleanup()
 {
     $removedFiles = 0;
     $wp_uploads = wp_upload_dir();
     $dir = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY;
     $cacheDir = PMXI_Plugin::ROOT_DIR . '/libraries/cache';
     $files = array_diff(@scandir($dir), array('.', '..'));
     $cacheFiles = @array_diff(@scandir($cacheDir), array('.', '..'));
     $msg = __('Files not found', 'wp_all_import_plugin');
     if (count($files) or count($cacheFiles)) {
         wp_all_import_clear_directory($dir);
         wp_all_import_clear_directory($cacheDir);
         $msg = __('Clean Up has been successfully completed.', 'wp_all_import_plugin');
     }
     // clean logs files
     $table = PMXI_Plugin::getInstance()->getTablePrefix() . 'history';
     global $wpdb;
     $histories = $wpdb->get_results("SELECT * FROM {$table}", ARRAY_A);
     if (!empty($histories)) {
         $importRecord = new PMXI_Import_Record();
         $importRecord->clear();
         foreach ($histories as $history) {
             $importRecord->getById($history['import_id']);
             if ($importRecord->isEmpty()) {
                 $historyRecord = new PMXI_History_Record();
                 $historyRecord->getById($history['id']);
                 if (!$historyRecord->isEmpty()) {
                     $historyRecord->delete();
                 }
             }
             $importRecord->clear();
         }
     }
     // clean uploads folder
     $table = PMXI_Plugin::getInstance()->getTablePrefix() . 'files';
     $files = $wpdb->get_results("SELECT * FROM {$table}", ARRAY_A);
     $required_dirs = array();
     if (!empty($files)) {
         $importRecord = new PMXI_Import_Record();
         $importRecord->clear();
         foreach ($files as $file) {
             $importRecord->getById($file['import_id']);
             if ($importRecord->isEmpty()) {
                 $fileRecord = new PMXI_File_Record();
                 $fileRecord->getById($file['id']);
                 if (!$fileRecord->isEmpty()) {
                     $fileRecord->delete();
                 }
             } else {
                 $path_parts = pathinfo(wp_all_import_get_absolute_path($file['path']));
                 if (!empty($path_parts['dirname'])) {
                     $path_all_parts = explode('/', $path_parts['dirname']);
                     $dirname = array_pop($path_all_parts);
                     if (wp_all_import_isValidMd5($dirname)) {
                         $required_dirs[] = $path_parts['dirname'];
                     }
                 }
             }
             $importRecord->clear();
         }
     }
     $uploads_dir = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY;
     if (($dir = @opendir($uploads_dir . DIRECTORY_SEPARATOR)) !== false or ($dir = @opendir($uploads_dir)) !== false) {
         while (($file = @readdir($dir)) !== false) {
             $filePath = $uploads_dir . DIRECTORY_SEPARATOR . $file;
             if (is_dir($filePath) and !in_array($filePath, $required_dirs) and !in_array($file, array('.', '..'))) {
                 wp_all_import_rmdir($filePath);
             }
         }
     }
     wp_redirect(add_query_arg('pmxi_nt', urlencode($msg), $this->baseUrl));
     die;
 }
开发者ID:lizbur10,项目名称:js_finalproject,代码行数:73,代码来源:settings.php


示例7: upload

 public function upload()
 {
     $uploads = wp_upload_dir();
     $this->file = wp_all_import_get_absolute_path($this->file);
     $template = false;
     if (empty($this->file)) {
         $this->errors->add('form-validation', __('Please specify a file to import.<br/><br/>If you are uploading the file from your computer, please wait for it to finish uploading (progress bar at 100%), before trying to continue.', 'wp_all_import_plugin'));
     } elseif (!is_file($this->file)) {
         $this->errors->add('form-validation', __('Uploaded file is empty', 'wp_all_import_plugin'));
     } elseif (!preg_match('%\\W(xml|gzip|zip|csv|gz|json|txt|dat|psv|sql|xls|xlsx)$%i', trim(basename($this->file)))) {
         $this->errors->add('form-validation', __('Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV', 'wp_all_import_plugin'));
     } elseif (preg_match('%\\W(zip)$%i', trim(basename($this->file)))) {
         if (!class_exists('PclZip')) {
             include_once PMXI_Plugin::ROOT_DIR . '/libraries/pclzip.lib.php';
         }
         $archive = new PclZip($this->file);
         if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
             $this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of  XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
         } else {
             $filePath = '';
             if (!empty($v_result_list)) {
                 foreach ($v_result_list as $unzipped_file) {
                     if ($unzipped_file['status'] == 'ok' and preg_match('%\\W(xml|csv|txt|dat|psv|json|xls|xlsx)$%i', trim($unzipped_file['stored_filename'])) and strpos($unzipped_file['stored_filename'], 'readme.txt') === false) {
                         if (strpos(basename($unzipped_file['stored_filename']), 'WP All Import Template') === 0 || strpos(basename($unzipped_file['stored_filename']), 'templates_') === 0) {
                             $template = file_get_contents($unzipped_file['filename']);
                         } elseif ($filePath == '') {
                             $filePath = $unzipped_file['filename'];
                         }
                     }
                 }
             }
             if ($this->uploadsPath === false) {
                 $this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
             }
             if (empty($filePath)) {
                 $zip = zip_open(trim($this->file));
                 if (is_resource($zip)) {
                     while ($zip_entry = zip_read($zip)) {
                         $filePath = zip_entry_name($zip_entry);
                         $fp = fopen($this->uploadsPath . "/" . $filePath, "w");
                         if (zip_entry_open($zip, $zip_entry, "r")) {
                             $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
                             fwrite($fp, "{$buf}");
                             zip_entry_close($zip_entry);
                             fclose($fp);
                         }
                         break;
                     }
                     zip_close($zip);
                 } else {
                     $this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of  XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'wp_all_import_plugin'));
                 }
             }
             // Detect if file is very large
             $source = array('name' => basename($this->file), 'type' => 'upload', 'path' => $this->file);
             if (preg_match('%\\W(csv|txt|dat|psv)$%i', trim($filePath))) {
                 // If CSV file found in archieve
                 if ($this->uploadsPath === false) {
                     $this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
                 }
                 include_once PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportCsvParse.php';
                 $csv = new PMXI_CsvParser(array('filename' => $filePath, 'targetDir' => $this->uploadsPath));
                 // create chunks
                 //wp_all_import_remove_source($filePath, false);
                 $filePath = $csv->xml_path;
                 $this->is_csv = $csv->is_csv;
                 $this->root_element = 'node';
             } elseif (preg_match('%\\W(json)$%i', trim($filePath))) {
                 $json_str = file_get_contents($filePath);
                 $is_json = wp_all_import_is_json($json_str);
                 if (is_wp_error($is_json)) {
                     $this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
                 } else {
                     $xml_data = wp_all_import_json_to_xml(json_decode($json_str, true));
                     if (empty($xml_data)) {
                         $this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'wp_all_import_plugin'));
                     } else {
                         $jsontmpname = $this->uploadsPath . '/' . wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
                         file_put_contents($jsontmpname, $xml_data);
                         wp_all_import_remove_source($filePath, false);
                         $filePath = $jsontmpname;
                     }
                 }
             } elseif (preg_match('%\\W(sql)$%i', trim($filePath))) {
                 include_once PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php';
                 $localSQLPath = $filePath;
                 $sql = new PMXI_SQLParser($localSQLPath, $this->uploadsPath);
                 $filePath = $sql->parse();
                 wp_all_import_remove_source($localSQLPath, false);
             } elseif (preg_match('%\\W(xls|xlsx)$%i', trim($filePath))) {
                 include_once PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportXLSParse.php';
                 $localXLSPath = $filePath;
                 $xls = new PMXI_XLSParser($localXLSPath, $this->uploadsPath);
                 $filePath = $xls->parse();
                 wp_all_import_remove_source($localXLSPath, false);
             }
         }
     } elseif (preg_match('%\\W(csv|txt|dat|psv)$%i', trim($this->file))) {
         // If CSV file uploaded
         if ($this->uploadsPath === false) {
//.........这里部分代码省略.........
开发者ID:lizbur10,项目名称:js_finalproject,代码行数:101,代码来源:upload.php


示例8: printf

        ?>
			
						<p><?php 
        printf(__('Your max_execution_time is %s seconds', 'wp_all_import_plugin'), $max_execution_time);
        ?>
</p>
						<?php 
    }
    ?>
						
						<!-- General -->
						<?php 
    $import_type = !empty($source['type']) ? $source['type'] : $import['type'];
    $path = $source['path'];
    if (in_array($import_type, array('upload', 'file'))) {
        $path = wp_all_import_get_absolute_path($source['path']);
    }
    if (in_array($import_type, array('upload'))) {
        $path_parts = pathinfo($source['path']);
        if (!empty($path_parts['dirname'])) {
            $path_all_parts = explode('/', $path_parts['dirname']);
            $dirname = array_pop($path_all_parts);
            if (wp_all_import_isValidMd5($dirname)) {
                $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $path));
            }
        }
    } else {
        $path = str_replace("\\", '/', preg_replace('%^(\\w+://[^:]+:)[^@]+@%', '$1*****@', $path));
    }
    if (in_array($import_type, array('upload', 'file'))) {
        $path = preg_replace('%.*wp-content/%', 'wp-content/', $path);
开发者ID:estrategasdigitales,项目名称:rufiatta,代码行数:31,代码来源:confirm.php


示例9: wp_all_import_get_absolute_path

<h4>
	<?php 
if ($import->path) {
    ?>
		<?php 
    $path = wp_all_import_get_absolute_path($import->path);
    ?>
		<?php 
    if (in_array($import->type, array('upload'))) {
        ?>
			<?php 
        //$path = $import->path;
        $path_parts = pathinfo($import->path);
        if (!empty($path_parts['dirname'])) {
            $path_all_parts = explode('/', $path_parts['dirname']);
            $dirname = array_pop($path_all_parts);
            if (wp_all_import_isValidMd5($dirname)) {
                $path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $path));
            }
        }
        ?>
			<em><?php 
        printf(__('%s - Import History', 'wp_all_import_plugin'), str_replace("\\", '/', preg_replace('%^(\\w+://[^:]+:)[^@]+@%', '$1*****@', preg_replace('%.*wp-content/%', 'wp-content/', $path))));
        ?>
</em>
		<?php 
    } elseif (in_array($import->type, array('file'))) {
        ?>
			<em><?php 
        printf(__('%s - Import History', 'wp_all_import_plugin'), str_replace("\\", '/', preg_replace('%^(\\w+://[^:]+:)[^@]+@%', '$1*****@', preg_replace('%.*wp-content/%', 'wp-content/', $path))));
        ?>
开发者ID:Darkers54,项目名称:eLEGO,代码行数:31,代码来源:index.php


示例10: execute

 /**
  * Import all files matched by path
  * @param callback[optional] $logger Method where progress messages are submmitted
  * @return PMXI_Import_Record
  * @chainable
  */
 public function execute($logger = NULL, $cron = true, $history_log_id = false)
 {
     $uploads = wp_upload_dir();
     if ($this->path) {
         $files = array($this->path);
         foreach ($files as $ind => $path) {
             $filePath = '';
             if ($this->queue_chunk_number == 0 and $this->processing == 0) {
                 $this->set(array('processing' => 1))->update();
                 // lock cron requests
                 if ($this->type == 'ftp') {
                     $this->set(array('processing' => 0))->update();
                     return array('status' => 500, 'message' => sprintf(__('This import appears to be using FTP. Unfortunately WP All Import no longer supports the FTP protocol. Please contact <a href="mailto:[email protected]">%s</a> if you have any questions.', 'wp_all_import_plugin'), '[email protected]'));
                     //$logger and call_user_func($logger, sprintf(__('This import appears to be using FTP. Unfortunately WP All Import no longer supports the FTP protocol. Please contact <a href="mailto:[email protected]">%s</a> if you have any questions.', 'wp_all_import_plugin'), '[email protected]'));
                     die;
                 } elseif ($this->type == 'url') {
                     $filesXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<data><node></node></data>";
                     $filePaths = XmlImportParser::factory($filesXML, '/data/node', $this->path, $file)->parse();
                     $tmp_files[] = $file;
                     foreach ($tmp_files as $tmp_file) {
                         // remove all temporary files created
                         @unlink($tmp_file);
                     }
                     $file_to_import = $this->path;
                     if (!empty($filePaths) and is_array($filePaths)) {
                         $file_to_import = array_shift($filePaths);
                     }
                     $uploader = new PMXI_Upload(trim($file_to_import), $this->errors);
                     $upload_result = $uploader->url($this->feed_type, $this->path);
                     if ($upload_result instanceof WP_Error) {
                         $this->errors = $upload_result;
                     } else {
                         $filePath = $upload_result['filePath'];
                     }
                 } elseif ($this->type == 'file') {
                     $uploader = new PMXI_Upload(trim(basename($this->path)), $this->errors);
                     $upload_result = $uploader->file();
                     if ($upload_result instanceof WP_Error) {
                         $this->errors = $upload_result;
                     } else {
                         $filePath = $upload_result['filePath'];
                     }
                 } elseif (!in_array($this->type, array('ftp'))) {
                     // retrieve already uploaded file
                     $uploader = new PMXI_Upload(trim($this->path), $this->errors, rtrim(str_replace(basename($this->path), '', $this->path), '/'));
                     $upload_result = $uploader->upload();
                     if ($upload_result instanceof WP_Error) {
                         $this->errors = $upload_result;
                     } else {
                         $filePath = $upload_result['filePath'];
                     }
                 }
                 if (!$this->errors->get_error_codes() and "" != $filePath) {
                     $this->set(array('queue_chunk_number' => 1))->update();
                 } elseif ($this->errors->get_error_codes()) {
                     $msgs = $this->errors->get_error_messages();
                     if (!is_array($msgs)) {
                         $msgs = array($msgs);
                     }
                     // foreach ($msgs as $msg){
                     // 	$logger and call_user_func($logger, sprintf(__('ERROR: %s', 'wp_all_import_plugin'), $msg));
                     // }
                     $this->set(array('processing' => 0))->update();
                     return array('status' => 500, 'message' => $msgs);
                     die;
                 }
                 $this->set(array('processing' => 0))->update();
                 // unlock cron requests
             }
             // if empty file path, than it's mean feed in cron process. Take feed path from history.
             if (empty($filePath)) {
                 $history = new PMXI_File_List();
                 $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $this->id), 'id DESC');
                 if ($history->count()) {
                     $history_file = new PMXI_File_Record();
                     $history_file->getBy('id', $history[0]['id']);
                     $filePath = wp_all_import_get_absolute_path($history_file->path);
                 }
             }
             // if feed path found
             if (!empty($filePath) and @file_exists($filePath)) {
                 if ($this->queue_chunk_number === 1 and $this->processing == 0) {
                     // import first cron request
                     $this->set(array('processing' => 1))->update();
                     // lock cron requests
                     if (empty($this->options['encoding'])) {
                         $currentOptions = $this->options;
                         $currentOptions['encoding'] = 'UTF-8';
                         $this->set(array('options' => $currentOptions))->update();
                     }
                     set_time_limit(0);
                     $file = new PMXI_Chunk($filePath, array('element' => $this->root_element, 'encoding' => $this->options['encoding']));
                     // chunks counting
                     $chunks = 0;
//.........这里部分代码省略.........
开发者ID:seoduda,项目名称:Patua,代码行数:101,代码来源:record.php


示例11: deleteFiles

 /**
  * Delete associated files
  * @return PMXI_Import_Record
  * @chainable
  */
 public function deleteFiles()
 {
     $fileList = new PMXI_File_List();
     foreach ($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {
         $import_file_path = wp_all_import_get_absolute_path($f->path);
         if (@file_exists($import_file_path)) {
             wp_all_import_remove_source($import_file_path);
         }
         $f->delete();
     }
     return $this;
 }
开发者ID:ryan2407,项目名称:Vision,代码行数:17,代码来源:record.php


示例12: process


//.........这里部分代码省略.........
                         if (method_exists($addons[$class], 'saved_post')) {
                             $addons[$class]->saved_post($importData);
                         }
                     } else {
                         if (!empty($saved_functions[$class])) {
                             if (is_array($saved_functions[$class]) and is_callable($saved_functions[$class]) or !is_array($saved_functions[$class]) and function_exists($saved_functions[$class])) {
                                 call_user_func($saved_functions[$class], $importData);
                             }
                         }
                     }
                 }
                 // [/addons import]
                 $logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', 'wp_all_import_plugin'));
                 do_action('pmxi_saved_post', $pid, $rootNodes[$i]);
                 // hook that was triggered immediately after post saved
                 if (empty($articleData['ID'])) {
                     $created++;
                 } else {
                     $updated++;
                 }
                 if (!$is_cron and "default" == $this->options['import_processing']) {
                     $processed_records = $created + $updated + $skipped;
                     $logger and call_user_func($logger, sprintf(__('<span class="processing_info"><span class="created_count">%s</span><span class="updated_count">%s</span><span class="percents_count">%s</span></span>', 'wp_all_import_plugin'), $created, $updated, ceil($processed_records / $this->count * 100)));
                 }
             }
             $logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_after_post_import', 'wp_all_import_plugin'));
             do_action('pmxi_after_post_import', $this->id);
             $logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
         }
         wp_cache_flush();
         $this->set(array('imported' => $created + $updated, 'created' => $created, 'updated' => $updated, 'skipped' => $skipped, 'last_activity' => date('Y-m-d H:i:s')))->update();
         if (!$is_cron) {
             PMXI_Plugin::$session->save_data();
             $records_count = $this->created + $this->updated + $this->skipped;
             $is_import_complete = $records_count == $this->count;
             // Delete posts that are no longer present in your file
             // if ( $is_import_complete and ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') {
             // 	$this->delete_missing_records($logger);
             // }
             // Set out of stock status for missing records [Woocommerce add-on option]
             if ($is_import_complete and empty($this->options['is_delete_missing']) and $post_type[$i] == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status'])) {
                 $logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
                 $postList = new PMXI_Post_List();
                 $missingPosts = $postList->getBy(array('import_id' => $this->id, 'iteration !=' => $this->iteration));
                 if (!$missingPosts->isEmpty()) {
                     foreach ($missingPosts as $missingPost) {
                         update_post_meta($missingPost['post_id'], '_stock_status', 'outofstock');
                         update_post_meta($missingPost['post_id'], '_stock', 0);
                         $missingPostRecord = new PMXI_Post_Record();
                         $missingPostRecord->getBy('id', $missingPost['id']);
                         if (!$missingPostRecord->isEmpty()) {
                             $missingPostRecord->set(array('iteration' => $this->iteration))->update();
                         }
                         unset($missingPostRecord);
                     }
                 }
             }
         }
     } catch (XmlImportException $e) {
         $logger and call_user_func($logger, __('<b>ERROR</b>', 'wp_all_import_plugin') . ': ' . $e->getMessage());
         $logger and !$is_cron and PMXI_Plugin::$session->errors++;
     }
     $logger and $is_import_complete and call_user_func($logger, __('Cleaning temporary data...', 'wp_all_import_plugin'));
     foreach ($tmp_files as $file) {
         // remove all temporary files created
         @unlink($file);
     }
     if (($is_cron or $is_import_complete) and $this->options['is_delete_source']) {
         $logger and call_user_func($logger, __('Deleting source XML file...', 'wp_all_import_plugin'));
         // Delete chunks
         foreach (PMXI_Helper::safe_glob($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'pmxi_chunk_*', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
             $logger and call_user_func($logger, __('Deleting chunks files...', 'wp_all_import_plugin'));
             @file_exists($filePath) and wp_all_import_remove_source($filePath, false);
         }
         if ($this->type != "ftp") {
             $apath = wp_all_import_get_absolute_path($this->path);
             if (!@unlink($apath)) {
                 $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', 'wp_all_import_plugin'), $apath));
             }
         } else {
             $file_path_array = PMXI_Helper::safe_glob($this->path, PMXI_Helper::GLOB_NODIR | PMXI_Helper::GLOB_PATH);
             if (!empty($file_path_array)) {
                 foreach ($file_path_array as $path) {
                     $apath = wp_all_import_get_absolute_path($path);
                     if (!@unlink($apath)) {
                         $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', 'wp_all_import_plugin'), $apath));
                     }
                 }
             }
         }
     }
     if (!$is_cron and $is_import_complete) {
         $this->set(array('processing' => 0, 'triggered' => 0, 'queue_chunk_number' => 0, 'registered_on' => date('Y-m-d H:i:s'), 'iteration' => ++$this->iteration))->update();
         $logger and call_user_func($logger, 'Done');
     }
     remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html'));
     kses_init();
     // return any filtering rules back if they has been disabled for import procedure
     return $this;
 }
开发者ID:lizbur10,项目名称:js_finalproject,代码行数:101,代码来源:record.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_all_import_remove_source函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_ajax_trash_post函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap