PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
wp-all-import-pro
/
helpers
<?php if ( ! function_exists('wp_all_import_get_gz')){ function wp_all_import_get_gz($filename, $use_include_path = 0, $targetDir = false, $headers = false) { $type = 'csv'; if (!empty($headers['Content-Type']) && preg_match('%(csv|xml|json|sql|txt|xls|xlsx)$%i', $headers['Content-Type'])) { $type = $headers['Content-Type']; } $uploads = wp_upload_dir(); $targetDir = ( ! $targetDir ) ? wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY ) : $targetDir; $tmpname = wp_unique_filename($targetDir, (strlen(basename($filename)) < 30) ? basename($filename) : time() ); $localPath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname)); // Ensure we don't have a .php extension as it's often blocked on hosts in the uploads folder. $localPath = str_replace('.php','.tmp', $localPath); $fp = @fopen($localPath, 'w'); $file = @gzopen($filename, 'rb', $use_include_path); if ($file) { $first_chunk = true; while (!gzeof($file)) { $chunk = gzread($file, 1024); if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) { $type = 'xml'; $first_chunk = false; $chunk = substr($chunk, strpos($chunk, "<?")); } // if it's a 1st chunk, then chunk <? symbols to detect XML file @fwrite($fp, $chunk); } gzclose($file); } else{ $tmpname = wp_unique_filename($targetDir, (strlen(basename($filename)) < 30) ? basename($filename) : time() ); $localGZpath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname)); $request = get_file_curl($filename, $localGZpath, false, true); if ( ! is_wp_error($request) ){ $file = @gzopen($localGZpath, 'rb', $use_include_path); if ($file) { $first_chunk = true; while (!gzeof($file)) { $chunk = gzread($file, 1024); if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) { $type = 'xml'; $first_chunk = false; $chunk = substr($chunk, strpos($chunk, "<?")); } // if it's a 1st chunk, then chunk <? symbols to detect XML file @fwrite($fp, $chunk); } gzclose($file); } @unlink($localGZpath); } else return $request; } @fclose($fp); if (isset($headers['Content-Disposition']) && strpos($headers['Content-Disposition'], 'tar.gz') !== false && class_exists('PharData')) { rename($localPath, $localPath . '.tar'); $phar = new PharData($localPath . '.tar'); $phar->extractTo($targetDir); @unlink($localPath . '.tar'); $scanned_files = @scandir($targetDir); if (!empty($scanned_files) and is_array($scanned_files)){ $files = array_diff($scanned_files, array('.','..')); if (!empty($files)){ foreach ($files as $file) { if (preg_match('%\W(csv|xml|json|sql|txt|xls|xlsx)$%i', basename($file))) { $localPath = $targetDir . DIRECTORY_SEPARATOR . $file; break; } } } } } if (preg_match('%\W(gz)$%i', basename($localPath))){ if (@rename($localPath, str_replace('.gz', '.' . $type, $localPath))) $localPath = str_replace('.gz', '.' . $type, $localPath); } else{ if (@rename($localPath, $localPath . '.' . $type)) $localPath = $localPath . '.' . $type; } return array('type' => $type, 'localPath' => $localPath); } }
[-] wp_all_import_get_import_post_type.php
[edit]
[-] wp_all_import_addon_notifications.php
[edit]
[-] wp_all_import_get_parent_terms.php
[edit]
[-] wp_all_import_is_base64_encoded.php
[edit]
[-] wp_all_import_sanitize_scheduling_times.php
[edit]
[-] get_file_curl.php
[edit]
[-] wpai_preview_cleanup.php
[edit]
[-] wp_all_import_filter_html_kses.php
[edit]
[-] is_exists_term.php
[edit]
[-] wp_all_import_get_url.php
[edit]
[-] wp_all_import_remove_source.php
[edit]
[-] wp_all_import_xml2array.php
[edit]
[-] wp_all_import_get_reader_engine.php
[edit]
[-] wp_redirect_or_javascript.php
[edit]
[-] str_getcsv.php
[edit]
[-] pmxi_recursion_taxes.php
[edit]
[-] wp_all_import_sanitize_svg.php
[edit]
[-] wp_all_import_custom_type.php
[edit]
[-] functions.php
[edit]
[-] wp_all_import_base64_decode_image.php
[edit]
[-] wp_all_import_get_gz.php
[edit]
[-] wp_all_import_is_update_cf.php
[edit]
[-] wp_all_import_rand_char.php
[edit]
[-] pmxi_findDuplicates.php
[edit]
[-] wp_all_import_template_notifications.php
[edit]
[-] wp_all_import_get_image_from_gallery.php
[edit]
[-] wp_all_import_is_json.php
[edit]
[-] wp_all_import_json_to_xml.php
[edit]
[-] wp_all_import_sanitize_filename.php
[edit]
[-] wp_all_import_ctx_mapping.php
[edit]
[-] wp_all_import_clear_directory.php
[edit]
[-] wp_all_import_get_import_id.php
[edit]
[-] wp_delete_attachments.php
[edit]
[-] import_custom_meta_box.php
[edit]
[-] wp_all_import_get_page_by_title.php
[edit]
[-] class-pmxi-template-processor.php
[edit]
[-] wp_all_import_get_parent_post.php
[edit]
[-] wp_all_import_get_pmxi_post_query.php
[edit]
[-] wp_all_import_is_title_required.php
[edit]
[-] wpai_util_map.php
[edit]
[-] get_taxonomies_by_object_type.php
[edit]
[+]
..
[-] reverse_taxonomies_html.php
[edit]
[-] wp_all_import_sanitize_url.php
[edit]
[-] wp_all_import_strip_tags_content.php
[edit]
[-] wp_all_import_rmdir.php
[edit]
[-] wp_all_import_secure_file.php
[edit]
[-] wp_all_import_get_feed_type.php
[edit]
[-] wp_all_import_url_title.php
[edit]
[-] backward.php
[edit]