Version Description
- improvement: skip to the first specified record when importing only part of a file
- new filter: wp_all_import_is_render_whole_xml_tree
- new filter: wp_all_import_images_uploads_dir (add-on api)
- bug fix: patch XSS exploit
- bug fix: conflict with InfiniteWP
- bug fix: update notification for Link Cloaking Add-On
- bug fix: load functions before pmxi_before_xml_import
- bug fix: do not re-count category terms when post imported as draft
- bug fix: import base64 encoded images in add-ons
- security fix - XSS exploit (Special thanks to Yuji Tounai for reporting)
Download this release
Release Info
Developer | soflyy |
Plugin | Import any XML or CSV File to WordPress |
Version | 3.4.7 |
Comparing to | |
See all releases |
Code changes from version 3.4.5 to 3.4.7
- actions/pmxi_after_xml_import.php +1 -1
- actions/wp_ajax_auto_detect_cf.php +9 -2
- actions/wp_ajax_test_images.php +1 -1
- classes/api.php +43 -3
- classes/arraytoxml.php +3 -1
- classes/render.php +28 -6
- controllers/admin/import.php +67 -22
- controllers/admin/settings.php +6 -1
- controllers/controller/admin.php +1 -3
- helpers/functions.php +4 -1
- helpers/get_file_curl.php +28 -15
- helpers/pmxi_recursion_taxes.php +12 -0
- helpers/wp_all_import_get_feed_type.php +7 -1
- helpers/wp_all_import_get_gz.php +41 -6
- helpers/wp_all_import_get_parent_post.php +1 -1
- helpers/wp_all_import_remove_source.php +4 -3
- libraries/XmlImportCsvParse.php +2 -1
- libraries/cache/xim1FpE2L +0 -3
- libraries/cache/xim1fvYCo +0 -3
- libraries/cache/xim4t2aKK +0 -3
- libraries/cache/xim6K6xIz +0 -3
- libraries/cache/xim7vp9E2 +0 -3
- libraries/cache/ximBujJiX +0 -3
- libraries/cache/ximFSsooW +0 -3
- libraries/cache/ximG1Tuc4 +0 -1
- libraries/cache/ximK8wkVg +0 -3
- libraries/cache/ximPiBjE6 +0 -1
- libraries/cache/ximRZO9Cn +0 -3
- libraries/cache/ximX7wHak +0 -3
- libraries/cache/ximaEqONq +0 -3
- libraries/cache/ximaYRd77 +0 -3
- libraries/cache/ximaqKlXP +0 -1
- libraries/cache/ximgAKNsa +0 -1
- libraries/cache/ximhpc0LZ +0 -1
- libraries/cache/ximiOWxoe +0 -3
- libraries/cache/ximjSZb0g +0 -3
- libraries/cache/ximmZzPlk +0 -3
- libraries/cache/ximouvW5A +0 -3
- libraries/cache/ximqEM4ZB +0 -3
- libraries/cache/ximqsviGB +0 -3
- libraries/cache/ximrhrhK7 +0 -3
- libraries/cache/ximyljbes +0 -3
- libraries/cache/ximzhCrHo +0 -3
- libraries/pclzip.lib.php +4 -2
- models/import/record.php +140 -77
- plugin.php +2 -2
- readme.txt +26 -2
- schema.php +14 -12
- static/css/admin.css +14 -0
- static/js/admin.js +0 -2
- static/js/jquery/browserplus-min.js +0 -8
- static/js/plupload/plupload.flash.swf +0 -0
- static/js/plupload/plupload.full.js +0 -2
- static/js/plupload/plupload.silverlight.xap +0 -0
- views/admin/import/index.php +4 -28
- views/admin/import/options/_import_file.php +0 -26
- views/admin/import/options/_reimport_options.php +6 -2
- views/admin/import/options/_reimport_template.php +1 -0
- views/admin/import/preview_taxonomies.php +6 -4
- views/admin/import/template.php +14 -3
- views/admin/import/template/_nested_template.php +0 -25
- views/admin/import/template/_other_template.php +1 -1
actions/pmxi_after_xml_import.php
CHANGED
@@ -11,7 +11,7 @@ function pmxi_pmxi_after_xml_import( $import_id, $import )
|
|
11 |
if (!empty($parent_post) && !is_wp_error($parent_post)){
|
12 |
wp_update_post(array(
|
13 |
'ID' => $pid,
|
14 |
-
'
|
15 |
));
|
16 |
}
|
17 |
}
|
11 |
if (!empty($parent_post) && !is_wp_error($parent_post)){
|
12 |
wp_update_post(array(
|
13 |
'ID' => $pid,
|
14 |
+
'post_parent' => $parent_post
|
15 |
));
|
16 |
}
|
17 |
}
|
actions/wp_ajax_auto_detect_cf.php
CHANGED
@@ -32,7 +32,8 @@ function pmxi_wp_ajax_auto_detect_cf(){
|
|
32 |
|
33 |
$ignoreFields = array(
|
34 |
'_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time', '_visibility', '_stock_status', '_downloadable', '_virtual', '_regular_price', '_sale_price', '_purchase_note', '_featured', '_weight', '_length',
|
35 |
-
'_width', '_height', '_sku', '_sale_price_dates_from', '_sale_price_dates_to', '_price', '_sold_individually', '_manage_stock', '_stock', '_upsell_ids', '_crosssell_ids','_downloadable_files', '_download_limit', '_download_expiry', '_download_type', '_product_url', '_button_text', '_backorders', '_tax_status', '_tax_class', '_product_image_gallery', '_default_attributes','total_sales', '_product_attributes', '_product_version', '_thumbnail_id', '_is_first_variation_created', '_regular_price_tmp', '_sale_price_tmp', '_price_tmp', '_stock_tmp'
|
|
|
36 |
);
|
37 |
|
38 |
$result = array();
|
@@ -66,7 +67,13 @@ function pmxi_wp_ajax_auto_detect_cf(){
|
|
66 |
|
67 |
if ( ! empty($values) ){
|
68 |
foreach ($values as $key => $value) {
|
69 |
-
if ( ! empty($value['meta_value'])
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
$result[] = array(
|
71 |
'key' => $field,
|
72 |
'val' => $value['meta_value'],
|
32 |
|
33 |
$ignoreFields = array(
|
34 |
'_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time', '_visibility', '_stock_status', '_downloadable', '_virtual', '_regular_price', '_sale_price', '_purchase_note', '_featured', '_weight', '_length',
|
35 |
+
'_width', '_height', '_sku', '_sale_price_dates_from', '_sale_price_dates_to', '_price', '_sold_individually', '_manage_stock', '_stock', '_upsell_ids', '_crosssell_ids','_downloadable_files', '_download_limit', '_download_expiry', '_download_type', '_product_url', '_button_text', '_backorders', '_tax_status', '_tax_class', '_product_image_gallery', '_default_attributes','total_sales', '_product_attributes', '_product_version', '_thumbnail_id', '_is_first_variation_created', '_regular_price_tmp', '_sale_price_tmp', '_price_tmp', '_stock_tmp',
|
36 |
+
'_order_total', '_order_version', '_order_tax', '_order_shipping_tax', '_order_shipping', '_cart_discount_tax', '_cart_discount', '_order_currency', '_order_key', '_prices_include_tax'
|
37 |
);
|
38 |
|
39 |
$result = array();
|
67 |
|
68 |
if ( ! empty($values) ){
|
69 |
foreach ($values as $key => $value) {
|
70 |
+
if ( ! empty($value['meta_value'])
|
71 |
+
and !empty($field)
|
72 |
+
and ! in_array($field, $ignoreFields)
|
73 |
+
and strpos($field, '_max_') !== 0
|
74 |
+
and strpos($field, '_min_') !== 0 and ! preg_match('%_[0-9]{1,}_%', $field)
|
75 |
+
and ($post_type != 'shop_order' or strpos($field, '_billing') !== 0 and strpos($field, '_shipping') !== 0)) {
|
76 |
+
|
77 |
$result[] = array(
|
78 |
'key' => $field,
|
79 |
'val' => $value['meta_value'],
|
actions/wp_ajax_test_images.php
CHANGED
@@ -133,7 +133,7 @@ function pmxi_wp_ajax_test_images(){
|
|
133 |
|
134 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($img, false, $get_ctx))) {
|
135 |
$failed_msgs[] = (is_wp_error($request)) ? $request->get_error_message() : sprintf(__('File `%s` cannot be saved locally', 'wp_all_import_plugin'), $img);
|
136 |
-
} elseif( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
137 |
$failed_msgs[] = sprintf(__('File `%s` is not a valid image.', 'wp_all_import_plugin'), $img);
|
138 |
} else {
|
139 |
$success_images++;
|
133 |
|
134 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($img, false, $get_ctx))) {
|
135 |
$failed_msgs[] = (is_wp_error($request)) ? $request->get_error_message() : sprintf(__('File `%s` cannot be saved locally', 'wp_all_import_plugin'), $img);
|
136 |
+
} elseif( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
137 |
$failed_msgs[] = sprintf(__('File `%s` is not a valid image.', 'wp_all_import_plugin'), $img);
|
138 |
} else {
|
139 |
$success_images++;
|
classes/api.php
CHANGED
@@ -377,6 +377,9 @@ class PMXI_API
|
|
377 |
}
|
378 |
|
379 |
$uploads = wp_upload_dir();
|
|
|
|
|
|
|
380 |
$targetDir = $uploads['path'];
|
381 |
$targetUrl = $uploads['url'];
|
382 |
$download_image = true;
|
@@ -398,6 +401,43 @@ class PMXI_API
|
|
398 |
|
399 |
$url = str_replace(" ", "%20", trim(pmxi_convert_encoding($img_url)));
|
400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
// do not download images
|
402 |
if ( "yes" != $download_images ){
|
403 |
|
@@ -424,7 +464,7 @@ class PMXI_API
|
|
424 |
}
|
425 |
// validate import images
|
426 |
elseif($file_type == 'images'){
|
427 |
-
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
428 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
429 |
@unlink($image_filepath);
|
430 |
} else {
|
@@ -451,7 +491,7 @@ class PMXI_API
|
|
451 |
} else{
|
452 |
|
453 |
if($file_type == 'images'){
|
454 |
-
if( ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
455 |
$result = true;
|
456 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
457 |
}
|
@@ -475,7 +515,7 @@ class PMXI_API
|
|
475 |
} else{
|
476 |
|
477 |
if($file_type == 'images'){
|
478 |
-
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
479 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $url));
|
480 |
@unlink($image_filepath);
|
481 |
} else {
|
377 |
}
|
378 |
|
379 |
$uploads = wp_upload_dir();
|
380 |
+
|
381 |
+
$uploads = apply_filters('wp_all_import_images_uploads_dir', $uploads, false, false, false);
|
382 |
+
|
383 |
$targetDir = $uploads['path'];
|
384 |
$targetUrl = $uploads['url'];
|
385 |
$download_image = true;
|
401 |
|
402 |
$url = str_replace(" ", "%20", trim(pmxi_convert_encoding($img_url)));
|
403 |
|
404 |
+
$is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, false);
|
405 |
+
|
406 |
+
if ( $file_type == 'images' and base64_encode(base64_decode($url)) == $url and $is_base64_images_allowed ){
|
407 |
+
|
408 |
+
$image_name = md5($url) . '.jpg';
|
409 |
+
|
410 |
+
// search existing attachment
|
411 |
+
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, $file_type);
|
412 |
+
|
413 |
+
if (empty($attch))
|
414 |
+
{
|
415 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Image %s not found in media gallery.', 'wp_all_import_plugin'), trim($image_name)));
|
416 |
+
}
|
417 |
+
else
|
418 |
+
{
|
419 |
+
$logger and call_user_func($logger, sprintf(__('- Using existing image `%s`...', 'wp_all_import_plugin'), trim($image_name)));
|
420 |
+
return $attch->ID;
|
421 |
+
}
|
422 |
+
|
423 |
+
if ("yes" == $download_images){
|
424 |
+
$img = @imagecreatefromstring(base64_decode($url));
|
425 |
+
if($img)
|
426 |
+
{
|
427 |
+
$image_filename = $image_name;
|
428 |
+
$logger and call_user_func($logger, __('- found base64_encoded image', 'wp_all_import_plugin'));
|
429 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
430 |
+
imagejpeg($img, $image_filepath);
|
431 |
+
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
432 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
433 |
+
} else {
|
434 |
+
$result = true;
|
435 |
+
$download_image = false;
|
436 |
+
}
|
437 |
+
}
|
438 |
+
}
|
439 |
+
}
|
440 |
+
|
441 |
// do not download images
|
442 |
if ( "yes" != $download_images ){
|
443 |
|
464 |
}
|
465 |
// validate import images
|
466 |
elseif($file_type == 'images'){
|
467 |
+
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
468 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
469 |
@unlink($image_filepath);
|
470 |
} else {
|
491 |
} else{
|
492 |
|
493 |
if($file_type == 'images'){
|
494 |
+
if( ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
495 |
$result = true;
|
496 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
497 |
}
|
515 |
} else{
|
516 |
|
517 |
if($file_type == 'images'){
|
518 |
+
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
519 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $url));
|
520 |
@unlink($image_filepath);
|
521 |
} else {
|
classes/arraytoxml.php
CHANGED
@@ -36,7 +36,9 @@ class PMXI_ArrayToXML
|
|
36 |
// replace anything not alpha numeric
|
37 |
// preg_replace('/^[0-9]+/i', '', preg_replace('/[^a-z0-9_]/i', '', $key))
|
38 |
$key = preg_replace('/[^a-z0-9_]/i', '', $key);
|
39 |
-
|
|
|
|
|
40 |
// if there is another array found recrusively call this function
|
41 |
if (is_array($value) or is_object($value))
|
42 |
{
|
36 |
// replace anything not alpha numeric
|
37 |
// preg_replace('/^[0-9]+/i', '', preg_replace('/[^a-z0-9_]/i', '', $key))
|
38 |
$key = preg_replace('/[^a-z0-9_]/i', '', $key);
|
39 |
+
|
40 |
+
if ($key && is_numeric($key[0])) $key = 'v' . $key;
|
41 |
+
|
42 |
// if there is another array found recrusively call this function
|
43 |
if (is_array($value) or is_object($value))
|
44 |
{
|
classes/render.php
CHANGED
@@ -52,7 +52,13 @@ if ( ! class_exists('PMXI_Render')){
|
|
52 |
$is_render_collapsed = $ind > 1;
|
53 |
if ($lvl) echo '<div class="csv-tag opening"><span class="csv-tag-name">' . $el->nodeName . '</span>'; echo '</div>';
|
54 |
if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) {
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
} else {
|
57 |
echo '<div class="csv-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
58 |
$indexes = array();
|
@@ -99,7 +105,8 @@ if ( ! class_exists('PMXI_Render')){
|
|
99 |
echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_render_collapsed ? ' collapsed' : '') . ' '. (is_numeric($text) ? 'is_numeric' : '') .'">' . $newtext . $more . '</div>';
|
100 |
}
|
101 |
public static $option_paths = array();
|
102 |
-
public static function render_xml_elements_for_filtring(DOMElement $el, $
|
|
|
103 |
if ("" != $path){
|
104 |
if ($lvl > 1) $path .= "->" . $el->nodeName; else $path = $el->nodeName;
|
105 |
if (empty(self::$option_paths[$path]))
|
@@ -111,7 +118,12 @@ if ( ! class_exists('PMXI_Render')){
|
|
111 |
else $path = $el->nodeName;
|
112 |
|
113 |
foreach ($el->attributes as $attr) {
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
if ($el->hasChildNodes()) {
|
117 |
foreach ($el->childNodes as $child) {
|
@@ -123,6 +135,8 @@ if ( ! class_exists('PMXI_Render')){
|
|
123 |
|
124 |
public static function render_xml_element(DOMElement $el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
|
125 |
{
|
|
|
|
|
126 |
$path .= $el->nodeName;
|
127 |
$alternativePath = $path;
|
128 |
if ( ! $el->parentNode instanceof DOMDocument and $ind > 0) {
|
@@ -140,14 +154,22 @@ if ( ! class_exists('PMXI_Render')){
|
|
140 |
}
|
141 |
echo '<div class="xml-tag opening"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; self::render_xml_attributes($el, $path . '/'); echo '></div>';
|
142 |
if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) {
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
} else {
|
145 |
echo '<div class="xml-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
146 |
-
$indexes = array();
|
147 |
foreach ($el->childNodes as $eli => $child) {
|
148 |
if ($child instanceof DOMElement) {
|
149 |
empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 0; $indexes[$child->nodeName]++;
|
150 |
-
|
|
|
|
|
151 |
} elseif ($child instanceof DOMCdataSection) {
|
152 |
self::render_xml_text(trim($child->wholeText), $shorten, false, true);
|
153 |
} elseif ($child instanceof DOMText) {
|
52 |
$is_render_collapsed = $ind > 1;
|
53 |
if ($lvl) echo '<div class="csv-tag opening"><span class="csv-tag-name">' . $el->nodeName . '</span>'; echo '</div>';
|
54 |
if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) {
|
55 |
+
$child = $el->childNodes->item(0);
|
56 |
+
if (!empty($child->wholeText)){
|
57 |
+
self::render_csv_text(trim($child->wholeText), $shorten, $is_render_collapsed);
|
58 |
+
}
|
59 |
+
elseif (is_callable(array($child, 'nodeValue'), true) && !empty($child->nodeValue)){
|
60 |
+
self::render_csv_text(trim($child->nodeValue), $shorten, $is_render_collapsed);
|
61 |
+
}
|
62 |
} else {
|
63 |
echo '<div class="csv-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
64 |
$indexes = array();
|
105 |
echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_render_collapsed ? ' collapsed' : '') . ' '. (is_numeric($text) ? 'is_numeric' : '') .'">' . $newtext . $more . '</div>';
|
106 |
}
|
107 |
public static $option_paths = array();
|
108 |
+
public static function render_xml_elements_for_filtring(DOMElement $el, $originPath ='', $lvl = 0){
|
109 |
+
$path = $originPath;
|
110 |
if ("" != $path){
|
111 |
if ($lvl > 1) $path .= "->" . $el->nodeName; else $path = $el->nodeName;
|
112 |
if (empty(self::$option_paths[$path]))
|
118 |
else $path = $el->nodeName;
|
119 |
|
120 |
foreach ($el->attributes as $attr) {
|
121 |
+
if (empty($originPath)){
|
122 |
+
echo '<option value="@' . $attr->nodeName.'">@' . $attr->nodeName . '</option>';
|
123 |
+
}
|
124 |
+
else{
|
125 |
+
echo '<option value="'.$path .'['. self::$option_paths[$path] .']'. '/@' . $attr->nodeName.'">'. $path .'['. self::$option_paths[$path] .']'. '@' . $attr->nodeName . '</option>';
|
126 |
+
}
|
127 |
}
|
128 |
if ($el->hasChildNodes()) {
|
129 |
foreach ($el->childNodes as $child) {
|
135 |
|
136 |
public static function render_xml_element(DOMElement $el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
|
137 |
{
|
138 |
+
$render_whole_tree = apply_filters('wp_all_import_is_render_whole_xml_tree', true);
|
139 |
+
|
140 |
$path .= $el->nodeName;
|
141 |
$alternativePath = $path;
|
142 |
if ( ! $el->parentNode instanceof DOMDocument and $ind > 0) {
|
154 |
}
|
155 |
echo '<div class="xml-tag opening"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; self::render_xml_attributes($el, $path . '/'); echo '></div>';
|
156 |
if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) {
|
157 |
+
$item = $el->childNodes->item(0);
|
158 |
+
if (!empty($item->wholeText)){
|
159 |
+
self::render_xml_text(trim($item->wholeText), $shorten, $is_render_collapsed);
|
160 |
+
}
|
161 |
+
else{
|
162 |
+
self::render_xml_text(trim($item->nodeValue), $shorten, $is_render_collapsed);
|
163 |
+
}
|
164 |
} else {
|
165 |
echo '<div class="xml-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
166 |
+
$indexes = array();
|
167 |
foreach ($el->childNodes as $eli => $child) {
|
168 |
if ($child instanceof DOMElement) {
|
169 |
empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 0; $indexes[$child->nodeName]++;
|
170 |
+
if ( $render_whole_tree || $indexes[$child->nodeName] === 1){
|
171 |
+
self::render_xml_element($child, $shorten, $path . '/', $indexes[$child->nodeName], $lvl + 1);
|
172 |
+
}
|
173 |
} elseif ($child instanceof DOMCdataSection) {
|
174 |
self::render_xml_text(trim($child->wholeText), $shorten, false, true);
|
175 |
} elseif ($child instanceof DOMText) {
|
controllers/admin/import.php
CHANGED
@@ -1452,6 +1452,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1452 |
if ($this->isWizard and $post['wizard_type'] == 'new') {
|
1453 |
$template_options['create_new_records'] = 1;
|
1454 |
}
|
|
|
|
|
|
|
1455 |
|
1456 |
$this->data['post'] = $template_options;
|
1457 |
PMXI_Plugin::$session->set('is_loaded_template', $load_template);
|
@@ -1507,13 +1510,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1507 |
$post['custom_value'] = array_intersect_key($post['custom_value'], $not_empty);
|
1508 |
|
1509 |
// validate
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
|
1518 |
if ( $post['type'] == "post" and $post['custom_type'] == "product" and class_exists('PMWI_Plugin')){
|
1519 |
// remove entires where both custom_name and custom_value are empty
|
@@ -1604,7 +1607,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1604 |
// Get all meta keys for requested post type
|
1605 |
$this->data['meta_keys'] = array();
|
1606 |
$hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
|
1607 |
-
$records = get_posts( array('post_type' => $post['custom_type']) );
|
1608 |
if ( ! empty($records)){
|
1609 |
foreach ($records as $record) {
|
1610 |
$record_meta = get_post_meta($record->ID, '');
|
@@ -1688,9 +1691,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1688 |
|
1689 |
if ( ! in_array(PMXI_Plugin::$session->options['custom_type'], array('import_users', 'shop_order')) ){
|
1690 |
if (empty(PMXI_Plugin::$session->options['title']))
|
1691 |
-
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1692 |
-
if (empty(PMXI_Plugin::$session->options['content']))
|
1693 |
-
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1694 |
}
|
1695 |
|
1696 |
if (empty(PMXI_Plugin::$session->options['unique_key'])){
|
@@ -1702,7 +1703,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1702 |
|
1703 |
// auto searching ID element
|
1704 |
if ( ! empty($this->data['dom']) and empty(PMXI_Plugin::$session->deligate) ){
|
1705 |
-
$this->
|
|
|
1706 |
if (!empty($this->_unique_key)){
|
1707 |
foreach ($keys_black_list as $key => $value) {
|
1708 |
$DefaultOptions['unique_key'] = str_replace('{' . $value . '[1]}', "", $DefaultOptions['unique_key']);
|
@@ -1730,8 +1732,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1730 |
}
|
1731 |
|
1732 |
if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
|
1733 |
-
$DefaultOptions['duplicate_indicator'] = 'custom field';
|
1734 |
-
$DefaultOptions['custom_duplicate_name'] = '_sku';
|
1735 |
}
|
1736 |
|
1737 |
$DefaultOptions['wizard_type'] = PMXI_Plugin::$session->wizard_type;
|
@@ -2326,7 +2328,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2326 |
|
2327 |
if ( $chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count ){
|
2328 |
$feed .= "</pmxi_records>";
|
2329 |
-
$chunk_file_path = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY) . DIRECTORY_SEPARATOR . "pmxi_chunk_" . count($chunk_files) . "_" . basename($path);
|
2330 |
file_put_contents($chunk_file_path, $feed);
|
2331 |
$chunk_files[] = $chunk_file_path;
|
2332 |
$chunk_records_count = 0;
|
@@ -2377,8 +2379,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2377 |
}
|
2378 |
|
2379 |
if ($ajax_processing)
|
2380 |
-
{
|
2381 |
-
|
2382 |
}
|
2383 |
else
|
2384 |
{
|
@@ -2387,7 +2389,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2387 |
|
2388 |
PMXI_Plugin::$session->set('start_time', (empty(PMXI_Plugin::$session->start_time)) ? time() : PMXI_Plugin::$session->start_time);
|
2389 |
|
2390 |
-
|
|
|
|
|
|
|
|
|
2391 |
|
2392 |
wp_defer_term_counting(true);
|
2393 |
wp_defer_comment_counting(true);
|
@@ -2438,6 +2444,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2438 |
|
2439 |
if ( ! empty(PMXI_Plugin::$session->local_paths) ) {
|
2440 |
|
|
|
|
|
|
|
|
|
2441 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
2442 |
|
2443 |
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
@@ -2445,11 +2455,46 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2445 |
$import_done = ($import->imported + $import->skipped == $records_to_import ) ? true : false;
|
2446 |
|
2447 |
if ( $import_done ) {
|
2448 |
-
|
2449 |
-
|
|
|
|
|
2450 |
PMXI_Plugin::$session->save_data();
|
2451 |
break;
|
2452 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2453 |
|
2454 |
$file = new PMXI_Chunk($path, array(
|
2455 |
'element' => $import->root_element,
|
@@ -2693,7 +2738,7 @@ COMPLETE;
|
|
2693 |
}
|
2694 |
|
2695 |
protected $_unique_key = array();
|
2696 |
-
protected function find_unique_key(
|
2697 |
if ($el->hasChildNodes()) {
|
2698 |
if ($el->childNodes->length) {
|
2699 |
foreach ($el->childNodes as $child) {
|
1452 |
if ($this->isWizard and $post['wizard_type'] == 'new') {
|
1453 |
$template_options['create_new_records'] = 1;
|
1454 |
}
|
1455 |
+
if ($this->isWizard) {
|
1456 |
+
$template_options['delimiter'] = PMXI_Plugin::$session->is_csv;
|
1457 |
+
}
|
1458 |
|
1459 |
$this->data['post'] = $template_options;
|
1460 |
PMXI_Plugin::$session->set('is_loaded_template', $load_template);
|
1510 |
$post['custom_value'] = array_intersect_key($post['custom_value'], $not_empty);
|
1511 |
|
1512 |
// validate
|
1513 |
+
foreach ($post['custom_name'] as $custom_name) {
|
1514 |
+
$this->_validate_template($custom_name, __('Custom Field Name', 'wp_all_import_plugin'));
|
1515 |
+
}
|
1516 |
+
foreach ($post['custom_value'] as $key => $custom_value) {
|
1517 |
+
if ( empty($post['custom_format'][$key]) )
|
1518 |
+
$this->_validate_template($custom_value, __('Custom Field Value', 'wp_all_import_plugin'));
|
1519 |
+
}
|
1520 |
|
1521 |
if ( $post['type'] == "post" and $post['custom_type'] == "product" and class_exists('PMWI_Plugin')){
|
1522 |
// remove entires where both custom_name and custom_value are empty
|
1607 |
// Get all meta keys for requested post type
|
1608 |
$this->data['meta_keys'] = array();
|
1609 |
$hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
|
1610 |
+
$records = get_posts( array('post_type' => $post['custom_type'], 'post_status' => 'any') );
|
1611 |
if ( ! empty($records)){
|
1612 |
foreach ($records as $record) {
|
1613 |
$record_meta = get_post_meta($record->ID, '');
|
1691 |
|
1692 |
if ( ! in_array(PMXI_Plugin::$session->options['custom_type'], array('import_users', 'shop_order')) ){
|
1693 |
if (empty(PMXI_Plugin::$session->options['title']))
|
1694 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
|
|
|
|
1695 |
}
|
1696 |
|
1697 |
if (empty(PMXI_Plugin::$session->options['unique_key'])){
|
1703 |
|
1704 |
// auto searching ID element
|
1705 |
if ( ! empty($this->data['dom']) and empty(PMXI_Plugin::$session->deligate) ){
|
1706 |
+
$dom = empty($this->data['dom']->documentElement) ? $this->data['dom'] : $this->data['dom']->documentElement;
|
1707 |
+
$this->find_unique_key($dom);
|
1708 |
if (!empty($this->_unique_key)){
|
1709 |
foreach ($keys_black_list as $key => $value) {
|
1710 |
$DefaultOptions['unique_key'] = str_replace('{' . $value . '[1]}', "", $DefaultOptions['unique_key']);
|
1732 |
}
|
1733 |
|
1734 |
if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
|
1735 |
+
$DefaultOptions['duplicate_indicator'] = empty($DefaultOptions['duplicate_indicator']) ? 'custom field' : $DefaultOptions['duplicate_indicator'];
|
1736 |
+
$DefaultOptions['custom_duplicate_name'] = empty($DefaultOptions['custom_duplicate_name']) ? '_sku' : $DefaultOptions['custom_duplicate_name'];
|
1737 |
}
|
1738 |
|
1739 |
$DefaultOptions['wizard_type'] = PMXI_Plugin::$session->wizard_type;
|
2328 |
|
2329 |
if ( $chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count ){
|
2330 |
$feed .= "</pmxi_records>";
|
2331 |
+
$chunk_file_path = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY, $import->id) . DIRECTORY_SEPARATOR . "pmxi_chunk_" . count($chunk_files) . "_" . basename($path);
|
2332 |
file_put_contents($chunk_file_path, $feed);
|
2333 |
$chunk_files[] = $chunk_file_path;
|
2334 |
$chunk_records_count = 0;
|
2379 |
}
|
2380 |
|
2381 |
if ($ajax_processing)
|
2382 |
+
{
|
2383 |
+
$logger = create_function('$m', 'printf("<div class=\\"progress-msg\\">[%s] $m</div>\\n", date("H:i:s")); flush();');
|
2384 |
}
|
2385 |
else
|
2386 |
{
|
2389 |
|
2390 |
PMXI_Plugin::$session->set('start_time', (empty(PMXI_Plugin::$session->start_time)) ? time() : PMXI_Plugin::$session->start_time);
|
2391 |
|
2392 |
+
$is_reset_cache = apply_filters('wp_all_import_reset_cache_before_import', true, $import_id);
|
2393 |
+
|
2394 |
+
if ($is_reset_cache){
|
2395 |
+
wp_cache_flush();
|
2396 |
+
}
|
2397 |
|
2398 |
wp_defer_term_counting(true);
|
2399 |
wp_defer_comment_counting(true);
|
2444 |
|
2445 |
if ( ! empty(PMXI_Plugin::$session->local_paths) ) {
|
2446 |
|
2447 |
+
if (!empty($records) && $import->queue_chunk_number < $records[0] && strpos($import->xpath, "[") === false) $pointer = $records[0];
|
2448 |
+
|
2449 |
+
$chunk_records_count = PMXI_Plugin::getInstance()->getOption('large_feed_limit');
|
2450 |
+
|
2451 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
2452 |
|
2453 |
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
2455 |
$import_done = ($import->imported + $import->skipped == $records_to_import ) ? true : false;
|
2456 |
|
2457 |
if ( $import_done ) {
|
2458 |
+
foreach (PMXI_Plugin::$session->local_paths as $chunk_file){
|
2459 |
+
if (strpos($chunk_file, "pmxi_chunk_") !== false and @file_exists($chunk_file)) wp_all_import_remove_source($chunk_file, false);
|
2460 |
+
}
|
2461 |
+
PMXI_Plugin::$session->set('local_paths', array());
|
2462 |
PMXI_Plugin::$session->save_data();
|
2463 |
break;
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
// set XMLReader pointer to first value of specified records option
|
2467 |
+
if ( ! empty($records) && $import->queue_chunk_number < $records[0] && strpos($import->xpath, "[") === false){
|
2468 |
+
|
2469 |
+
if ($import->options['chuncking'] && $pointer > $chunk_records_count)
|
2470 |
+
{
|
2471 |
+
$pointer -= $chunk_records_count;
|
2472 |
+
|
2473 |
+
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path)) @unlink($path);
|
2474 |
+
PMXI_Plugin::$session->set('chunk_number', $import->queue_chunk_number + $chunk_records_count);
|
2475 |
+
$lp = PMXI_Plugin::$session->local_paths;
|
2476 |
+
array_shift($lp);
|
2477 |
+
PMXI_Plugin::$session->set('local_paths', $lp);
|
2478 |
+
PMXI_Plugin::$session->save_data();
|
2479 |
+
|
2480 |
+
$import->set(array(
|
2481 |
+
'skipped' => $import->skipped + $chunk_records_count,
|
2482 |
+
'queue_chunk_number' => $import->queue_chunk_number + $chunk_records_count
|
2483 |
+
))->save();
|
2484 |
+
continue;
|
2485 |
+
}
|
2486 |
+
|
2487 |
+
PMXI_Plugin::$session->set('chunk_number', $import->queue_chunk_number + $pointer);
|
2488 |
+
PMXI_Plugin::$session->set('pointer', $pointer);
|
2489 |
+
PMXI_Plugin::$session->save_data();
|
2490 |
+
|
2491 |
+
$import->set(array(
|
2492 |
+
'skipped' => $import->skipped + $pointer - 1,
|
2493 |
+
'queue_chunk_number' => $import->queue_chunk_number + $pointer
|
2494 |
+
))->save();
|
2495 |
+
|
2496 |
+
$pointer = 0;
|
2497 |
+
}
|
2498 |
|
2499 |
$file = new PMXI_Chunk($path, array(
|
2500 |
'element' => $import->root_element,
|
2738 |
}
|
2739 |
|
2740 |
protected $_unique_key = array();
|
2741 |
+
protected function find_unique_key($el){
|
2742 |
if ($el->hasChildNodes()) {
|
2743 |
if ($el->childNodes->length) {
|
2744 |
foreach ($el->childNodes as $child) {
|
controllers/admin/settings.php
CHANGED
@@ -582,7 +582,12 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
582 |
// Check if file has been uploaded
|
583 |
if (!$chunks || $chunk == $chunks - 1) {
|
584 |
// Strip the temp .part suffix off
|
585 |
-
rename("{$filePath}.part", $filePath);
|
|
|
|
|
|
|
|
|
|
|
586 |
delete_transient( self::$upload_transient );
|
587 |
|
588 |
$errors = new WP_Error;
|
582 |
// Check if file has been uploaded
|
583 |
if (!$chunks || $chunk == $chunks - 1) {
|
584 |
// Strip the temp .part suffix off
|
585 |
+
$res = rename("{$filePath}.part", $filePath);
|
586 |
+
if (!$res){
|
587 |
+
@copy("{$filePath}.part", $filePath);
|
588 |
+
@unlink("{$filePath}.part");
|
589 |
+
}
|
590 |
+
chmod($filePath, 0755);
|
591 |
delete_transient( self::$upload_transient );
|
592 |
|
593 |
$errors = new WP_Error;
|
controllers/controller/admin.php
CHANGED
@@ -112,9 +112,7 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
112 |
wp_deregister_script('swfupload-handlers');
|
113 |
wp_enqueue_script('swfupload-handlers', site_url() . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
|
114 |
|
115 |
-
wp_enqueue_script('jquery-
|
116 |
-
wp_enqueue_script('full-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
|
117 |
-
wp_enqueue_script('jquery-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
|
118 |
|
119 |
wp_enqueue_script('pmxi-admin-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-autocomplete'), PMXI_VERSION);
|
120 |
|
112 |
wp_deregister_script('swfupload-handlers');
|
113 |
wp_enqueue_script('swfupload-handlers', site_url() . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
|
114 |
|
115 |
+
wp_enqueue_script('jquery-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/wplupload.js', array('plupload', 'jquery'));
|
|
|
|
|
116 |
|
117 |
wp_enqueue_script('pmxi-admin-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-autocomplete'), PMXI_VERSION);
|
118 |
|
helpers/functions.php
CHANGED
@@ -58,7 +58,10 @@
|
|
58 |
if ( ! function_exists('pmxi_getExtensionFromStr')){
|
59 |
function pmxi_getExtensionFromStr($str)
|
60 |
{
|
61 |
-
$filetype = wp_check_filetype($str);
|
|
|
|
|
|
|
62 |
return ($filetype['ext'] == "unknown") ? "" : $filetype['ext'];
|
63 |
}
|
64 |
}
|
58 |
if ( ! function_exists('pmxi_getExtensionFromStr')){
|
59 |
function pmxi_getExtensionFromStr($str)
|
60 |
{
|
61 |
+
$filetype = wp_check_filetype($str);
|
62 |
+
if (empty($filetype['ext'])){
|
63 |
+
$filetype = wp_check_filetype(strtok($str, "?"));
|
64 |
+
}
|
65 |
return ($filetype['ext'] == "unknown") ? "" : $filetype['ext'];
|
66 |
}
|
67 |
}
|
helpers/get_file_curl.php
CHANGED
@@ -6,12 +6,12 @@ if ( ! function_exists('get_file_curl') ):
|
|
6 |
|
7 |
if ( ! preg_match('%^(http|ftp)s?://%i', $url) ) return;
|
8 |
|
9 |
-
$response = wp_remote_get($url);
|
10 |
|
11 |
if ( ! is_wp_error($response) and ( ! isset($response['response']['code']) or isset($response['response']['code']) and ! in_array($response['response']['code'], array(401, 403, 404))) )
|
12 |
{
|
13 |
-
$rawdata = wp_remote_retrieve_body( $response );
|
14 |
-
|
15 |
if (empty($rawdata))
|
16 |
{
|
17 |
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
@@ -30,7 +30,7 @@ if ( ! function_exists('get_file_curl') ):
|
|
30 |
fclose($fp);
|
31 |
}
|
32 |
|
33 |
-
if ( preg_match('%\W(svg)$%i', basename($fullpath)) or preg_match('%\W(jpg|jpeg|gif|png)$%i', basename($fullpath)) and ( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($fullpath), $fullpath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) ) )
|
34 |
{
|
35 |
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
36 |
if ( ! $result and $iteration === false)
|
@@ -45,19 +45,24 @@ if ( ! function_exists('get_file_curl') ):
|
|
45 |
|
46 |
}
|
47 |
else
|
48 |
-
{
|
49 |
-
$curl = pmxi_curl_download($url, $fullpath, $to_variable);
|
50 |
|
51 |
-
|
52 |
-
{
|
53 |
-
$new_url = wp_all_import_translate_uri($url);
|
54 |
-
return ($new_url !== $url) ? get_file_curl($new_url, $fullpath, $to_variable, true) : ( is_wp_error($response) ? $response : false );
|
55 |
-
}
|
56 |
|
57 |
-
|
|
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
-
|
61 |
}
|
62 |
|
63 |
endif;
|
@@ -83,7 +88,11 @@ if ( ! function_exists('pmxi_curl_download') ) {
|
|
83 |
$fp = fopen($fullpath,'w');
|
84 |
fwrite($fp, $rawdata);
|
85 |
fclose($fp);
|
86 |
-
}
|
|
|
|
|
|
|
|
|
87 |
|
88 |
return ($result == 200) ? (($to_variable) ? $rawdata : true) : false;
|
89 |
}
|
@@ -117,7 +126,11 @@ if ( ! function_exists('curl_exec_follow') ):
|
|
117 |
if (!empty($url_data['user']) and !empty($url_data['pass'])){
|
118 |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
|
119 |
curl_setopt($ch, CURLOPT_USERPWD, $url_data['user']. ":" . $url_data['pass']);
|
120 |
-
$newurl = $url_data['scheme'] . '://' . $url_data['host']
|
|
|
|
|
|
|
|
|
121 |
if (!empty($url_data['query']))
|
122 |
{
|
123 |
$newurl .= '?' . $url_data['query'];
|
6 |
|
7 |
if ( ! preg_match('%^(http|ftp)s?://%i', $url) ) return;
|
8 |
|
9 |
+
$response = wp_remote_get($url);
|
10 |
|
11 |
if ( ! is_wp_error($response) and ( ! isset($response['response']['code']) or isset($response['response']['code']) and ! in_array($response['response']['code'], array(401, 403, 404))) )
|
12 |
{
|
13 |
+
$rawdata = wp_remote_retrieve_body( $response );
|
14 |
+
|
15 |
if (empty($rawdata))
|
16 |
{
|
17 |
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
30 |
fclose($fp);
|
31 |
}
|
32 |
|
33 |
+
if ( preg_match('%\W(svg)$%i', basename($fullpath)) or preg_match('%\W(jpg|jpeg|gif|png)$%i', basename($fullpath)) and ( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($fullpath), $fullpath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP)) ) )
|
34 |
{
|
35 |
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
36 |
if ( ! $result and $iteration === false)
|
45 |
|
46 |
}
|
47 |
else
|
48 |
+
{
|
|
|
49 |
|
50 |
+
$use_only_wp_http_api = apply_filters('wp_all_import_use_only_wp_http_api', false);
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
if ( false == $use_only_wp_http_api ){
|
53 |
+
$curl = pmxi_curl_download($url, $fullpath, $to_variable);
|
54 |
|
55 |
+
if ($curl === false and $iteration === false)
|
56 |
+
{
|
57 |
+
$new_url = wp_all_import_translate_uri($url);
|
58 |
+
return ($new_url !== $url) ? get_file_curl($new_url, $fullpath, $to_variable, true) : ( is_wp_error($response) ? $response : false );
|
59 |
+
}
|
60 |
+
|
61 |
+
return ($curl === false) ? ( is_wp_error($response) ? $response : false ) : $curl;
|
62 |
+
}
|
63 |
+
|
64 |
+
return $response;
|
65 |
}
|
|
|
66 |
}
|
67 |
|
68 |
endif;
|
88 |
$fp = fopen($fullpath,'w');
|
89 |
fwrite($fp, $rawdata);
|
90 |
fclose($fp);
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($fullpath), $fullpath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP)) ){
|
94 |
+
return false;
|
95 |
+
}
|
96 |
|
97 |
return ($result == 200) ? (($to_variable) ? $rawdata : true) : false;
|
98 |
}
|
126 |
if (!empty($url_data['user']) and !empty($url_data['pass'])){
|
127 |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
|
128 |
curl_setopt($ch, CURLOPT_USERPWD, $url_data['user']. ":" . $url_data['pass']);
|
129 |
+
$newurl = $url_data['scheme'] . '://' . $url_data['host'];
|
130 |
+
if (!empty($url_data['port'])){
|
131 |
+
$newurl .= ':' . $url_data['port'];
|
132 |
+
}
|
133 |
+
$newurl .= $url_data['path'];
|
134 |
if (!empty($url_data['query']))
|
135 |
{
|
136 |
$newurl .= '?' . $url_data['query'];
|
helpers/pmxi_recursion_taxes.php
CHANGED
@@ -1,4 +1,14 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
3 |
|
4 |
if ( is_array($parent) ){
|
@@ -24,6 +34,8 @@ function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
|
24 |
else{
|
25 |
|
26 |
$parent_id = pmxi_recursion_taxes($parent['parent'], $tx_name, $txes, $key);
|
|
|
|
|
27 |
|
28 |
$term = is_exists_term($parent['name'], $tx_name, (int)$parent_id);
|
29 |
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Get parent category term ID
|
5 |
+
*
|
6 |
+
* @param $parent
|
7 |
+
* @param $tx_name
|
8 |
+
* @param $txes
|
9 |
+
* @param $key
|
10 |
+
* @return int
|
11 |
+
*/
|
12 |
function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
13 |
|
14 |
if ( is_array($parent) ){
|
34 |
else{
|
35 |
|
36 |
$parent_id = pmxi_recursion_taxes($parent['parent'], $tx_name, $txes, $key);
|
37 |
+
|
38 |
+
if (empty($parent['name'])) return $parent_id;
|
39 |
|
40 |
$term = is_exists_term($parent['name'], $tx_name, (int)$parent_id);
|
41 |
|
helpers/wp_all_import_get_feed_type.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
if ( ! function_exists('wp_all_import_get_feed_type')){
|
4 |
function wp_all_import_get_feed_type($url){
|
5 |
|
6 |
-
$type = wp_all_import_get_remote_file_name($url);
|
7 |
|
8 |
if ($type !== false) {
|
9 |
|
@@ -15,6 +15,12 @@ if ( ! function_exists('wp_all_import_get_feed_type')){
|
|
15 |
}
|
16 |
|
17 |
$headers = @get_headers($url, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
$extensions = array('gzip', 'gz', 'xml', 'csv', 'json', 'sql');
|
19 |
$type = false;
|
20 |
|
3 |
if ( ! function_exists('wp_all_import_get_feed_type')){
|
4 |
function wp_all_import_get_feed_type($url){
|
5 |
|
6 |
+
$type = wp_all_import_get_remote_file_name($url);
|
7 |
|
8 |
if ($type !== false) {
|
9 |
|
15 |
}
|
16 |
|
17 |
$headers = @get_headers($url, 1);
|
18 |
+
|
19 |
+
if (empty($headers)){
|
20 |
+
$response = wp_remote_get($url);
|
21 |
+
$headers = wp_remote_retrieve_headers( $response );
|
22 |
+
}
|
23 |
+
|
24 |
$extensions = array('gzip', 'gz', 'xml', 'csv', 'json', 'sql');
|
25 |
$type = false;
|
26 |
|
helpers/wp_all_import_get_gz.php
CHANGED
@@ -1,8 +1,13 @@
|
|
1 |
<?php
|
2 |
if ( ! function_exists('wp_all_import_get_gz')){
|
3 |
-
|
|
|
4 |
|
5 |
$type = 'csv';
|
|
|
|
|
|
|
|
|
6 |
$uploads = wp_upload_dir();
|
7 |
$targetDir = ( ! $targetDir ) ? wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY ) : $targetDir;
|
8 |
|
@@ -11,12 +16,16 @@ if ( ! function_exists('wp_all_import_get_gz')){
|
|
11 |
|
12 |
$fp = @fopen($localPath, 'w');
|
13 |
$file = @gzopen($filename, 'rb', $use_include_path);
|
14 |
-
|
15 |
if ($file) {
|
16 |
$first_chunk = true;
|
17 |
while (!gzeof($file)) {
|
18 |
-
$chunk = gzread($file, 1024);
|
19 |
-
if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) {
|
|
|
|
|
|
|
|
|
20 |
@fwrite($fp, $chunk);
|
21 |
}
|
22 |
gzclose($file);
|
@@ -35,7 +44,11 @@ if ( ! function_exists('wp_all_import_get_gz')){
|
|
35 |
$first_chunk = true;
|
36 |
while (!gzeof($file)) {
|
37 |
$chunk = gzread($file, 1024);
|
38 |
-
if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) {
|
|
|
|
|
|
|
|
|
39 |
@fwrite($fp, $chunk);
|
40 |
}
|
41 |
gzclose($file);
|
@@ -47,7 +60,29 @@ if ( ! function_exists('wp_all_import_get_gz')){
|
|
47 |
else return $request;
|
48 |
|
49 |
}
|
50 |
-
@fclose($fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
if (preg_match('%\W(gz)$%i', basename($localPath))){
|
53 |
if (@rename($localPath, str_replace('.gz', '.' . $type, $localPath)))
|
1 |
<?php
|
2 |
if ( ! function_exists('wp_all_import_get_gz')){
|
3 |
+
|
4 |
+
function wp_all_import_get_gz($filename, $use_include_path = 0, $targetDir = false, $headers = false) {
|
5 |
|
6 |
$type = 'csv';
|
7 |
+
if (!empty($headers['Content-Type']) && preg_match('%(csv|xml|json|sql|txt|xls|xlsx)$%i', $headers['Content-Type'])) {
|
8 |
+
$type = $headers['Content-Type'];
|
9 |
+
}
|
10 |
+
|
11 |
$uploads = wp_upload_dir();
|
12 |
$targetDir = ( ! $targetDir ) ? wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY ) : $targetDir;
|
13 |
|
16 |
|
17 |
$fp = @fopen($localPath, 'w');
|
18 |
$file = @gzopen($filename, 'rb', $use_include_path);
|
19 |
+
|
20 |
if ($file) {
|
21 |
$first_chunk = true;
|
22 |
while (!gzeof($file)) {
|
23 |
+
$chunk = gzread($file, 1024);
|
24 |
+
if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) {
|
25 |
+
$type = 'xml';
|
26 |
+
$first_chunk = false;
|
27 |
+
$chunk = substr($chunk, strpos($chunk, "<?"));
|
28 |
+
} // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
29 |
@fwrite($fp, $chunk);
|
30 |
}
|
31 |
gzclose($file);
|
44 |
$first_chunk = true;
|
45 |
while (!gzeof($file)) {
|
46 |
$chunk = gzread($file, 1024);
|
47 |
+
if ($first_chunk and strpos($chunk, "<?") !== false and strpos($chunk, "</") !== false) {
|
48 |
+
$type = 'xml';
|
49 |
+
$first_chunk = false;
|
50 |
+
$chunk = substr($chunk, strpos($chunk, "<?"));
|
51 |
+
} // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
52 |
@fwrite($fp, $chunk);
|
53 |
}
|
54 |
gzclose($file);
|
60 |
else return $request;
|
61 |
|
62 |
}
|
63 |
+
@fclose($fp);
|
64 |
+
|
65 |
+
if (strpos($headers['Content-Disposition'], 'tar.gz') !== false && class_exists('PharData'))
|
66 |
+
{
|
67 |
+
rename($localPath, $localPath . '.tar');
|
68 |
+
$phar = new PharData($localPath . '.tar');
|
69 |
+
$phar->extractTo($targetDir);
|
70 |
+
@unlink($localPath . '.tar');
|
71 |
+
|
72 |
+
$scanned_files = @scandir($targetDir);
|
73 |
+
if (!empty($scanned_files) and is_array($scanned_files)){
|
74 |
+
$files = array_diff($scanned_files, array('.','..'));
|
75 |
+
if (!empty($files)){
|
76 |
+
foreach ($files as $file) {
|
77 |
+
if (preg_match('%\W(csv|xml|json|sql|txt|xls|xlsx)$%i', basename($file)))
|
78 |
+
{
|
79 |
+
$localPath = $targetDir . DIRECTORY_SEPARATOR . $file;
|
80 |
+
break;
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
+
}
|
85 |
+
}
|
86 |
|
87 |
if (preg_match('%\W(gz)$%i', basename($localPath))){
|
88 |
if (@rename($localPath, str_replace('.gz', '.' . $type, $localPath)))
|
helpers/wp_all_import_get_parent_post.php
CHANGED
@@ -9,7 +9,7 @@ function wp_all_import_get_parent_post($identity, $post_type, $import_type = 'po
|
|
9 |
}
|
10 |
else
|
11 |
{
|
12 |
-
$page = get_page_by_title($identity, OBJECT, $post_type);
|
13 |
|
14 |
if ( empty($page) ){
|
15 |
$args = array(
|
9 |
}
|
10 |
else
|
11 |
{
|
12 |
+
$page = get_page_by_title($identity, OBJECT, $post_type) or $page = get_page_by_path($identity, OBJECT, $post_type);
|
13 |
|
14 |
if ( empty($page) ){
|
15 |
$args = array(
|
helpers/wp_all_import_remove_source.php
CHANGED
@@ -11,11 +11,12 @@ if ( ! function_exists('wp_all_import_remove_source')){
|
|
11 |
$dirname = array_pop($path_all_parts);
|
12 |
|
13 |
if ( wp_all_import_isValidMd5($dirname)){
|
14 |
-
if ($remove_dir){
|
15 |
@unlink($path_parts['dirname'] . DIRECTORY_SEPARATOR . 'index.php' );
|
16 |
}
|
17 |
-
if ($remove_dir or count(@scandir($path_parts['dirname'])) == 2)
|
18 |
-
|
|
|
19 |
}
|
20 |
}
|
21 |
|
11 |
$dirname = array_pop($path_all_parts);
|
12 |
|
13 |
if ( wp_all_import_isValidMd5($dirname)){
|
14 |
+
if ($remove_dir or file_exists($path_parts['dirname'] . DIRECTORY_SEPARATOR . 'index.php') && count(@scandir($path_parts['dirname'])) == 3){
|
15 |
@unlink($path_parts['dirname'] . DIRECTORY_SEPARATOR . 'index.php' );
|
16 |
}
|
17 |
+
if ($remove_dir or count(@scandir($path_parts['dirname'])) == 2){
|
18 |
+
wp_all_import_rmdir($path_parts['dirname']);
|
19 |
+
}
|
20 |
}
|
21 |
}
|
22 |
|
libraries/XmlImportCsvParse.php
CHANGED
@@ -974,7 +974,7 @@ class PMXI_CsvParser
|
|
974 |
|
975 |
if ( ! empty($_GET['import_id']) ) $import_id = $_GET['import_id'];
|
976 |
|
977 |
-
$create_new_headers =
|
978 |
$skip_x_rows = apply_filters('wp_all_import_skip_x_csv_rows', false, $import_id);
|
979 |
$headers = array();
|
980 |
while ($keys = fgetcsv($res, $l, $d, $e)) {
|
@@ -1014,6 +1014,7 @@ class PMXI_CsvParser
|
|
1014 |
$keys[$key] = ($headers[$value] === 1) ? $value : $value . '_' . $headers[$value];
|
1015 |
}
|
1016 |
$this->headers = $keys;
|
|
|
1017 |
if ($create_new_headers){
|
1018 |
$this->createHeaders('column');
|
1019 |
$keys = $buf_keys;
|
974 |
|
975 |
if ( ! empty($_GET['import_id']) ) $import_id = $_GET['import_id'];
|
976 |
|
977 |
+
$create_new_headers = false;
|
978 |
$skip_x_rows = apply_filters('wp_all_import_skip_x_csv_rows', false, $import_id);
|
979 |
$headers = array();
|
980 |
while ($keys = fgetcsv($res, $l, $d, $e)) {
|
1014 |
$keys[$key] = ($headers[$value] === 1) ? $value : $value . '_' . $headers[$value];
|
1015 |
}
|
1016 |
$this->headers = $keys;
|
1017 |
+
$create_new_headers = apply_filters('wp_all_import_auto_create_csv_headers', $create_new_headers, $import_id);
|
1018 |
if ($create_new_headers){
|
1019 |
$this->createHeaders('column');
|
1020 |
$keys = $buf_keys;
|
libraries/cache/xim1FpE2L
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v1_0 = $x0->xpath("description[1]");
|
3 |
-
echo $this->getValue($v1_0);
|
|
|
|
|
|
libraries/cache/xim1fvYCo
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v3_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v3_0);
|
|
|
|
|
|
libraries/cache/xim4t2aKK
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v1_0 = $x0->xpath("description[1]");
|
3 |
-
echo $this->getValue($v1_0);
|
|
|
|
|
|
libraries/cache/xim6K6xIz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v3_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v3_0);
|
|
|
|
|
|
libraries/cache/xim7vp9E2
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v0_0 = $x0->xpath("title[1]");
|
3 |
-
echo $this->getValue($v0_0);
|
|
|
|
|
|
libraries/cache/ximBujJiX
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v3_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v3_0);
|
|
|
|
|
|
libraries/cache/ximFSsooW
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v5_0 = $x0->xpath("price[1]");
|
3 |
-
echo $this->getValue($v5_0);
|
|
|
|
|
|
libraries/cache/ximG1Tuc4
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
now
|
|
libraries/cache/ximK8wkVg
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v0_0 = $x0->xpath("title[1]");
|
3 |
-
echo $this->getValue($v0_0);
|
|
|
|
|
|
libraries/cache/ximPiBjE6
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
now
|
|
libraries/cache/ximRZO9Cn
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v1_0 = $x0->xpath("description[1]");
|
3 |
-
echo $this->getValue($v1_0);
|
|
|
|
|
|
libraries/cache/ximX7wHak
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v4_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v4_0);
|
|
|
|
|
|
libraries/cache/ximaEqONq
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v1_0 = $x0->xpath("description[1]");
|
3 |
-
echo $this->getValue($v1_0);
|
|
|
|
|
|
libraries/cache/ximaYRd77
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v4_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v4_0);
|
|
|
|
|
|
libraries/cache/ximaqKlXP
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
now
|
|
libraries/cache/ximgAKNsa
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
now
|
|
libraries/cache/ximhpc0LZ
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
now
|
|
libraries/cache/ximiOWxoe
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v0_0 = $x0->xpath("title[1]");
|
3 |
-
echo $this->getValue($v0_0);
|
|
|
|
|
|
libraries/cache/ximjSZb0g
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v0_0 = $x0->xpath("title[1]");
|
3 |
-
echo $this->getValue($v0_0);
|
|
|
|
|
|
libraries/cache/ximmZzPlk
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v3_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v3_0);
|
|
|
|
|
|
libraries/cache/ximouvW5A
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v0_0 = $x0->xpath("title[1]");
|
3 |
-
echo $this->getValue($v0_0);
|
|
|
|
|
|
libraries/cache/ximqEM4ZB
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v5_0 = $x0->xpath("price[1]");
|
3 |
-
echo $this->getValue($v5_0);
|
|
|
|
|
|
libraries/cache/ximqsviGB
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v1_0 = $x0->xpath("description[1]");
|
3 |
-
echo $this->getValue($v1_0);
|
|
|
|
|
|
libraries/cache/ximrhrhK7
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v3_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v3_0);
|
|
|
|
|
|
libraries/cache/ximyljbes
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v4_0 = $x0->xpath("sku[1]");
|
3 |
-
echo $this->getValue($v4_0);
|
|
|
|
|
|
libraries/cache/ximzhCrHo
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
<?php $x0 = $this->xml;
|
2 |
-
$v5_0 = $x0->xpath("price[1]");
|
3 |
-
echo $this->getValue($v5_0);
|
|
|
|
|
|
libraries/pclzip.lib.php
CHANGED
@@ -1727,8 +1727,10 @@ class PclZip
|
|
1727 |
// ----- Get 'memory_limit' configuration value
|
1728 |
$v_memory_limit = ini_get('memory_limit');
|
1729 |
$v_memory_limit = trim($v_memory_limit);
|
1730 |
-
$last =
|
1731 |
-
|
|
|
|
|
1732 |
if ($last == 'g') {
|
1733 |
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
|
1734 |
$v_memory_limit = $v_memory_limit*1073741824;
|
1727 |
// ----- Get 'memory_limit' configuration value
|
1728 |
$v_memory_limit = ini_get('memory_limit');
|
1729 |
$v_memory_limit = trim($v_memory_limit);
|
1730 |
+
$last = substr($v_memory_limit, -1);
|
1731 |
+
$v_memory_limit = trim($v_memory_limit, $last);
|
1732 |
+
$last = strtolower($last);
|
1733 |
+
|
1734 |
if ($last == 'g') {
|
1735 |
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
|
1736 |
$v_memory_limit = $v_memory_limit*1073741824;
|
models/import/record.php
CHANGED
@@ -19,8 +19,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
19 |
$is_preprocess_enabled = apply_filters('is_xml_preprocess_enabled', true);
|
20 |
|
21 |
if ($is_preprocess_enabled)
|
22 |
-
{
|
23 |
-
|
24 |
//$xml = preg_replace('/&(?![a-z#]+;)/i', '&', $xml);
|
25 |
$xml = preg_replace('/&([^amp;|^gt;|^lt;]+)/i', '&$1', $xml);
|
26 |
|
@@ -133,7 +133,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
133 |
|
134 |
$is_import_complete = false;
|
135 |
|
136 |
-
try {
|
|
|
|
|
137 |
|
138 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', 'wp_all_import_plugin'));
|
139 |
if ( ! empty($this->options['title'])){
|
@@ -479,21 +481,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
479 |
}
|
480 |
}
|
481 |
}
|
482 |
-
$delimeted_taxonomies = explode( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',', $_tx);
|
483 |
if ( ! empty($delimeted_taxonomies) ){
|
484 |
foreach ($delimeted_taxonomies as $j => $cc) {
|
485 |
$is_assign_term = (isset($this->options['tax_hierarchical_assing'][$tx_name][$k])) ? $this->options['tax_hierarchical_assing'][$tx_name][$k] : true;
|
486 |
if ( ! empty($this->options['tax_hierarchical_last_level_assign'][$tx_name]) ){
|
487 |
$is_assign_term = (count($delimeted_taxonomies) == $j + 1) ? 1 : 0;
|
488 |
}
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
$iterator[$i]++;
|
498 |
}
|
499 |
}
|
@@ -547,7 +549,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
547 |
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
548 |
'hierarchy_level' => 1,
|
549 |
'max_hierarchy_level' => 1
|
550 |
-
), $mapping_rules, $tx_name);
|
|
|
|
|
551 |
}
|
552 |
}
|
553 |
}
|
@@ -561,9 +565,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
561 |
'hierarchy_level' => 1,
|
562 |
'max_hierarchy_level' => 1
|
563 |
), $mapping_rules, $tx_name);
|
564 |
-
}
|
565 |
|
566 |
-
|
|
|
567 |
}
|
568 |
}
|
569 |
}
|
@@ -578,7 +582,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
578 |
}
|
579 |
endforeach;
|
580 |
endif;
|
581 |
-
// [/custom taxonomies]
|
582 |
|
583 |
// Composing featured images
|
584 |
$image_sections = apply_filters('wp_all_import_image_sections', array(
|
@@ -837,7 +841,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
837 |
wp_cache_flush();
|
838 |
|
839 |
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_before_post_import ...', 'wp_all_import_plugin'));
|
840 |
-
do_action('pmxi_before_post_import', $this->id);
|
|
|
|
|
|
|
|
|
|
|
841 |
|
842 |
if ( empty($titles[$i]) && $this->options['custom_type'] != 'shop_order') {
|
843 |
if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
|
@@ -1011,7 +1020,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1011 |
|
1012 |
$continue_import = true;
|
1013 |
|
1014 |
-
|
1015 |
|
1016 |
if ( ! $continue_import ){
|
1017 |
|
@@ -1033,7 +1042,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1033 |
|
1034 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
1035 |
|
1036 |
-
do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration);
|
1037 |
|
1038 |
$skipped++;
|
1039 |
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
@@ -1192,7 +1201,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1192 |
|
1193 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
1194 |
|
1195 |
-
$logger and call_user_func($logger, __('<b>SKIPPED</b>:
|
1196 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1197 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1198 |
$skipped++;
|
@@ -1288,7 +1297,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1288 |
if ( empty($articleData['ID']) )
|
1289 |
{
|
1290 |
$continue_import = true;
|
1291 |
-
|
1292 |
|
1293 |
if ( ! $continue_import ){
|
1294 |
$skipped++;
|
@@ -1654,13 +1663,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1654 |
$is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, $this->id);
|
1655 |
|
1656 |
if ( $bundle_data['type'] == 'images' and base64_encode(base64_decode($url)) == $url and $is_base64_images_allowed ){
|
1657 |
-
$image_name = empty($this->options[$option_slug . 'auto_rename_images']) ? md5(
|
1658 |
$image_name = apply_filters("wp_all_import_image_filename", $image_name, empty($img_titles[$k]) ? '' : $img_titles[$k], empty($img_captions[$k]) ? '' : $img_captions[$k], empty($img_alts[$k]) ? '' : $img_alts[$k], $articleData, $this->id, $img_url);
|
1659 |
|
1660 |
-
|
1661 |
-
if ($this->options[$option_slug . 'search_existing_images'] or "gallery" == $this->options[$option_slug . 'download_images']){
|
1662 |
|
1663 |
-
|
|
|
1664 |
|
1665 |
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, $bundle_data['type']);
|
1666 |
|
@@ -1688,7 +1697,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1688 |
//$image_filename = md5(time()) . '.jpg';
|
1689 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1690 |
imagejpeg($img, $image_filepath);
|
1691 |
-
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1692 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
1693 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1694 |
} else {
|
@@ -1768,7 +1777,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1768 |
$wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
1769 |
$wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
|
1770 |
|
1771 |
-
|
1772 |
|
1773 |
if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
|
1774 |
$download_image = false;
|
@@ -1812,7 +1821,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1812 |
} else{
|
1813 |
|
1814 |
if($bundle_data['type'] == 'images'){
|
1815 |
-
if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1816 |
$create_image = true;
|
1817 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
1818 |
}
|
@@ -1848,7 +1857,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1848 |
}
|
1849 |
else{
|
1850 |
if($bundle_data['type'] == 'images'){
|
1851 |
-
if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1852 |
$create_image = true;
|
1853 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
1854 |
} else {
|
@@ -1986,11 +1995,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1986 |
|
1987 |
if ($attch != null and empty($attch->post_parent))
|
1988 |
{
|
1989 |
-
|
1990 |
}
|
1991 |
elseif(empty($attch))
|
1992 |
{
|
1993 |
-
|
1994 |
}
|
1995 |
}
|
1996 |
}
|
@@ -2311,7 +2320,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2311 |
endif;
|
2312 |
|
2313 |
// associate taxes with post
|
2314 |
-
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger, $is_cron);
|
2315 |
|
2316 |
}
|
2317 |
else
|
@@ -2327,7 +2336,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2327 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
2328 |
|
2329 |
if (!empty($txes[$i]))
|
2330 |
-
$this->associate_terms($pid, $txes[$i], $tx_name, $logger, $is_cron);
|
2331 |
}
|
2332 |
}
|
2333 |
}
|
@@ -2456,6 +2465,18 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2456 |
return $this;
|
2457 |
}
|
2458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2459 |
public function delete_source($logger = false)
|
2460 |
{
|
2461 |
if ($this->options['is_delete_source'])
|
@@ -2521,10 +2542,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2521 |
$logger and call_user_func($logger, __('Deleting posts from database', 'wp_all_import_plugin'));
|
2522 |
|
2523 |
$missing_ids_arr = array_chunk($missing_ids, $this->options['records_per_request']);
|
2524 |
-
|
|
|
|
|
2525 |
foreach ($missing_ids_arr as $key => $missingPostRecords) {
|
2526 |
|
2527 |
-
if ( ! empty($missingPostRecords) ) {
|
2528 |
|
2529 |
foreach ( $missingPostRecords as $k => $missingPostRecord ) {
|
2530 |
|
@@ -2532,22 +2555,30 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2532 |
|
2533 |
// Instead of deletion, set Custom Field
|
2534 |
if ($this->options['is_update_missing_cf']){
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2542 |
}
|
|
|
2543 |
$to_delete = false;
|
2544 |
}
|
2545 |
|
2546 |
// Instead of deletion, change post status to Draft
|
2547 |
if ($this->options['set_missing_to_draft']){
|
2548 |
-
if ($final_post_type = get_post_type($missingPostRecord['post_id']) and $final_post_type != 'product_variation')
|
2549 |
{
|
2550 |
-
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $missingPostRecord['post_id']) );
|
|
|
2551 |
$logger and call_user_func($logger, sprintf(__('Instead of deletion, change post with ID `%s` status to Draft', 'wp_all_import_plugin'), $missingPostRecord['post_id']));
|
2552 |
}
|
2553 |
$to_delete = false;
|
@@ -2556,24 +2587,24 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2556 |
$to_delete = apply_filters('wp_all_import_is_post_to_delete', $to_delete, $missingPostRecord['post_id'], $this);
|
2557 |
|
2558 |
if ($to_delete){
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
}
|
2568 |
else
|
2569 |
-
{
|
2570 |
-
|
2571 |
$postRecord = new PMXI_Post_Record();
|
2572 |
$postRecord->getBy(array(
|
2573 |
'post_id' => $missingPostRecord['post_id'],
|
2574 |
'import_id' => $this->id,
|
2575 |
));
|
2576 |
-
|
2577 |
{
|
2578 |
$is_unlink_missing_posts = apply_filters('wp_all_import_is_unlink_missing_posts', false, $this->id, $missingPostRecord['post_id']);
|
2579 |
if ( $is_unlink_missing_posts ){
|
@@ -2587,32 +2618,43 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2587 |
}
|
2588 |
|
2589 |
do_action('pmxi_missing_post', $missingPostRecord['post_id']);
|
2590 |
-
|
2591 |
unset($missingPostRecords[$k]);
|
2592 |
}
|
2593 |
}
|
2594 |
|
|
|
|
|
2595 |
if ( ! empty($missingPostRecords) ){
|
2596 |
-
|
2597 |
foreach ($missingPostRecords as $k => $missingPostRecord) {
|
2598 |
$ids[] = $missingPostRecord['post_id'];
|
2599 |
}
|
2600 |
|
2601 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2602 |
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
2614 |
-
WHERE a.ID IN (" . implode(',', $ids) . ");";
|
2615 |
-
}
|
2616 |
|
2617 |
$this->wpdb->query( $sql );
|
2618 |
|
@@ -2629,7 +2671,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2629 |
}
|
2630 |
|
2631 |
if ( PMXI_Plugin::is_ajax() and "ajax" == $this->options['import_processing']) break;
|
2632 |
-
}
|
|
|
|
|
2633 |
|
2634 |
return (count($missing_ids_arr) > 1 and "ajax" == $this->options['import_processing']) ? false : true;
|
2635 |
}
|
@@ -2678,8 +2722,25 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2678 |
$caps['unfiltered_html'] = true;
|
2679 |
return $caps;
|
2680 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2681 |
|
2682 |
-
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger, $is_cron = false){
|
2683 |
wp_cache_flush();
|
2684 |
$terms = wp_get_object_terms( $pid, $tx_name );
|
2685 |
$term_ids = array();
|
@@ -2690,8 +2751,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2690 |
if ( ! is_wp_error( $terms ) ) {
|
2691 |
foreach ($terms as $term_info) {
|
2692 |
$term_ids[] = $term_info->term_taxonomy_id;
|
2693 |
-
|
2694 |
-
|
2695 |
$in_tt_ids = "'" . implode( "', '", $term_ids ) . "'";
|
2696 |
$this->wpdb->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $pid ) );
|
2697 |
}
|
@@ -2710,7 +2771,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2710 |
{
|
2711 |
do_action('wp_all_import_associate_term', $pid, $tt, $tx_name);
|
2712 |
$values[] = $this->wpdb->prepare( "(%d, %d, %d)", $pid, $tt, ++$term_order);
|
2713 |
-
|
|
|
|
|
2714 |
}
|
2715 |
|
2716 |
|
@@ -2824,7 +2887,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
2824 |
wp_delete_attachments($id, false, 'images');
|
2825 |
}
|
2826 |
|
2827 |
-
do_action('pmxi_delete_post', $id);
|
2828 |
|
2829 |
if ( $this->options['custom_type'] != 'import_users' ) wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
2830 |
}
|
19 |
$is_preprocess_enabled = apply_filters('is_xml_preprocess_enabled', true);
|
20 |
|
21 |
if ($is_preprocess_enabled)
|
22 |
+
{
|
23 |
+
$xml = preg_replace_callback('/<!\[CDATA\[.*?\]\]>/s', 'wp_all_import_cdata_filter', $xml );
|
24 |
//$xml = preg_replace('/&(?![a-z#]+;)/i', '&', $xml);
|
25 |
$xml = preg_replace('/&([^amp;|^gt;|^lt;]+)/i', '&$1', $xml);
|
26 |
|
133 |
|
134 |
$is_import_complete = false;
|
135 |
|
136 |
+
try {
|
137 |
+
|
138 |
+
$chunk == 1 and $logger and printf("<div class='progress-msg'>%s</div>\n", date("r")) and flush();
|
139 |
|
140 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', 'wp_all_import_plugin'));
|
141 |
if ( ! empty($this->options['title'])){
|
481 |
}
|
482 |
}
|
483 |
}
|
484 |
+
$delimeted_taxonomies = array_filter(array_filter(explode( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',', $_tx)));
|
485 |
if ( ! empty($delimeted_taxonomies) ){
|
486 |
foreach ($delimeted_taxonomies as $j => $cc) {
|
487 |
$is_assign_term = (isset($this->options['tax_hierarchical_assing'][$tx_name][$k])) ? $this->options['tax_hierarchical_assing'][$tx_name][$k] : true;
|
488 |
if ( ! empty($this->options['tax_hierarchical_last_level_assign'][$tx_name]) ){
|
489 |
$is_assign_term = (count($delimeted_taxonomies) == $j + 1) ? 1 : 0;
|
490 |
}
|
491 |
+
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
|
492 |
+
'name' => $cc,
|
493 |
+
'parent' => (!empty($taxonomies[$tx_name][$i][$iterator[$i] - 1]) and $j) ? $taxonomies[$tx_name][$i][$iterator[$i] - 1] : false,
|
494 |
+
'assign' => $is_assign_term,
|
495 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
496 |
+
'hierarchy_level' => $j + 1,
|
497 |
+
'max_hierarchy_level' => count($delimeted_taxonomies)
|
498 |
+
), $mapping_rules, $tx_name);
|
499 |
$iterator[$i]++;
|
500 |
}
|
501 |
}
|
549 |
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
550 |
'hierarchy_level' => 1,
|
551 |
'max_hierarchy_level' => 1
|
552 |
+
), $mapping_rules, $tx_name);
|
553 |
+
|
554 |
+
$taxonomies_hierarchy[$k]['txn_names'][$i][] = $taxonomies[$tx_name][$i][count($taxonomies[$tx_name][$i]) - 1];
|
555 |
}
|
556 |
}
|
557 |
}
|
565 |
'hierarchy_level' => 1,
|
566 |
'max_hierarchy_level' => 1
|
567 |
), $mapping_rules, $tx_name);
|
|
|
568 |
|
569 |
+
$taxonomies_hierarchy[$k]['txn_names'][$i][] = $taxonomies[$tx_name][$i][count($taxonomies[$tx_name][$i]) - 1];
|
570 |
+
}
|
571 |
}
|
572 |
}
|
573 |
}
|
582 |
}
|
583 |
endforeach;
|
584 |
endif;
|
585 |
+
// [/custom taxonomies]
|
586 |
|
587 |
// Composing featured images
|
588 |
$image_sections = apply_filters('wp_all_import_image_sections', array(
|
841 |
wp_cache_flush();
|
842 |
|
843 |
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_before_post_import ...', 'wp_all_import_plugin'));
|
844 |
+
do_action('pmxi_before_post_import', $this->id);
|
845 |
+
|
846 |
+
// One new action per addon:
|
847 |
+
foreach ( $addons_data as $addon => $data ) {
|
848 |
+
do_action( "pmxi_before_post_import_{$addon}", $data, $i, $this->id );
|
849 |
+
}
|
850 |
|
851 |
if ( empty($titles[$i]) && $this->options['custom_type'] != 'shop_order') {
|
852 |
if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
|
1020 |
|
1021 |
$continue_import = true;
|
1022 |
|
1023 |
+
$continue_import = apply_filters('wp_all_import_is_post_to_update', $continue_import, $post_to_update_id, $current_xml_node, $this->id);
|
1024 |
|
1025 |
if ( ! $continue_import ){
|
1026 |
|
1042 |
|
1043 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
1044 |
|
1045 |
+
do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration, $xml, $i);
|
1046 |
|
1047 |
$skipped++;
|
1048 |
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
1201 |
|
1202 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
1203 |
|
1204 |
+
$logger and call_user_func($logger, __('<b>SKIPPED</b>: The option \'Create new posts from records newly present in your file\' is disabled in your import settings.', 'wp_all_import_plugin'));
|
1205 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1206 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1207 |
$skipped++;
|
1297 |
if ( empty($articleData['ID']) )
|
1298 |
{
|
1299 |
$continue_import = true;
|
1300 |
+
$continue_import = apply_filters('wp_all_import_is_post_to_create', $continue_import, $current_xml_node, $this->id);
|
1301 |
|
1302 |
if ( ! $continue_import ){
|
1303 |
$skipped++;
|
1663 |
$is_base64_images_allowed = apply_filters("wp_all_import_is_base64_images_allowed", true, $url, $this->id);
|
1664 |
|
1665 |
if ( $bundle_data['type'] == 'images' and base64_encode(base64_decode($url)) == $url and $is_base64_images_allowed ){
|
1666 |
+
$image_name = empty($this->options[$option_slug . 'auto_rename_images']) ? md5($url) . '.jpg' : sanitize_file_name($auto_rename_images_bundle[$slug][$i]) . '.jpg';
|
1667 |
$image_name = apply_filters("wp_all_import_image_filename", $image_name, empty($img_titles[$k]) ? '' : $img_titles[$k], empty($img_captions[$k]) ? '' : $img_captions[$k], empty($img_alts[$k]) ? '' : $img_alts[$k], $articleData, $this->id, $img_url);
|
1668 |
|
1669 |
+
$image_filename = $image_name;
|
|
|
1670 |
|
1671 |
+
// search existing attachment
|
1672 |
+
if ($this->options[$option_slug . 'search_existing_images'] or "gallery" == $this->options[$option_slug . 'download_images']){
|
1673 |
|
1674 |
$attch = wp_all_import_get_image_from_gallery($image_name, $targetDir, $bundle_data['type']);
|
1675 |
|
1697 |
//$image_filename = md5(time()) . '.jpg';
|
1698 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1699 |
imagejpeg($img, $image_filepath);
|
1700 |
+
if( ! ($image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
1701 |
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
1702 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1703 |
} else {
|
1777 |
$wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
1778 |
$wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
|
1779 |
|
1780 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s`', 'wp_all_import_plugin'), $wpai_image_path));
|
1781 |
|
1782 |
if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
|
1783 |
$download_image = false;
|
1821 |
} else{
|
1822 |
|
1823 |
if($bundle_data['type'] == 'images'){
|
1824 |
+
if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
1825 |
$create_image = true;
|
1826 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
1827 |
}
|
1857 |
}
|
1858 |
else{
|
1859 |
if($bundle_data['type'] == 'images'){
|
1860 |
+
if( preg_match('%\W(svg)$%i', wp_all_import_basename($image_filepath)) or $image_info = apply_filters('pmxi_getimagesize', @getimagesize($image_filepath), $image_filepath) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
|
1861 |
$create_image = true;
|
1862 |
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
1863 |
} else {
|
1995 |
|
1996 |
if ($attch != null and empty($attch->post_parent))
|
1997 |
{
|
1998 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment with ID: `%s` has been successfully updated for image `%s`', 'wp_all_import_plugin'), $attid, ($handle_image) ? $handle_image['url'] : $targetUrl . '/' . $image_filename));
|
1999 |
}
|
2000 |
elseif(empty($attch))
|
2001 |
{
|
2002 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment with ID: `%s` has been successfully created for image `%s`', 'wp_all_import_plugin'), $attid, ($handle_image) ? $handle_image['url'] : $targetUrl . '/' . $image_filename));
|
2003 |
}
|
2004 |
}
|
2005 |
}
|
2320 |
endif;
|
2321 |
|
2322 |
// associate taxes with post
|
2323 |
+
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger, $is_cron, $articleData['post_status']);
|
2324 |
|
2325 |
}
|
2326 |
else
|
2336 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
2337 |
|
2338 |
if (!empty($txes[$i]))
|
2339 |
+
$this->associate_terms($pid, $txes[$i], $tx_name, $logger, $is_cron, $articleData['post_status']);
|
2340 |
}
|
2341 |
}
|
2342 |
}
|
2465 |
return $this;
|
2466 |
}
|
2467 |
|
2468 |
+
private function getRecordTitle($articleData){
|
2469 |
+
$title = $articleData['post_title'];
|
2470 |
+
switch ($this->options['custom_type']){
|
2471 |
+
case 'import_users':
|
2472 |
+
$title = $articleData['user_login'];
|
2473 |
+
break;
|
2474 |
+
default:
|
2475 |
+
break;
|
2476 |
+
}
|
2477 |
+
return $title;
|
2478 |
+
}
|
2479 |
+
|
2480 |
public function delete_source($logger = false)
|
2481 |
{
|
2482 |
if ($this->options['is_delete_source'])
|
2542 |
$logger and call_user_func($logger, __('Deleting posts from database', 'wp_all_import_plugin'));
|
2543 |
|
2544 |
$missing_ids_arr = array_chunk($missing_ids, $this->options['records_per_request']);
|
2545 |
+
|
2546 |
+
$skipp_from_deletion = array();
|
2547 |
+
|
2548 |
foreach ($missing_ids_arr as $key => $missingPostRecords) {
|
2549 |
|
2550 |
+
if ( ! empty($missingPostRecords) ) {
|
2551 |
|
2552 |
foreach ( $missingPostRecords as $k => $missingPostRecord ) {
|
2553 |
|
2555 |
|
2556 |
// Instead of deletion, set Custom Field
|
2557 |
if ($this->options['is_update_missing_cf']){
|
2558 |
+
switch ($this->options['custom_type']){
|
2559 |
+
case 'import_users':
|
2560 |
+
update_user_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
2561 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion user with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
2562 |
+
break;
|
2563 |
+
case 'taxonomies':
|
2564 |
+
update_term_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
2565 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion taxonomy term with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
2566 |
+
break;
|
2567 |
+
default:
|
2568 |
+
update_post_meta( $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
2569 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion post with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $missingPostRecord['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
2570 |
+
break;
|
2571 |
}
|
2572 |
+
|
2573 |
$to_delete = false;
|
2574 |
}
|
2575 |
|
2576 |
// Instead of deletion, change post status to Draft
|
2577 |
if ($this->options['set_missing_to_draft']){
|
2578 |
+
if ($final_post_type = get_post_type($missingPostRecord['post_id']) and $final_post_type != 'product_variation' and 'draft' != get_post_status($missingPostRecord['post_id']))
|
2579 |
{
|
2580 |
+
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $missingPostRecord['post_id']) );
|
2581 |
+
$this->recount_terms($missingPostRecord['post_id'], $final_post_type);
|
2582 |
$logger and call_user_func($logger, sprintf(__('Instead of deletion, change post with ID `%s` status to Draft', 'wp_all_import_plugin'), $missingPostRecord['post_id']));
|
2583 |
}
|
2584 |
$to_delete = false;
|
2587 |
$to_delete = apply_filters('wp_all_import_is_post_to_delete', $to_delete, $missingPostRecord['post_id'], $this);
|
2588 |
|
2589 |
if ($to_delete){
|
2590 |
+
if ( ! in_array($this->options['custom_type'], array("import_users", "taxonomies")) ){
|
2591 |
+
// Remove attachments
|
2592 |
+
empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPostRecord['post_id'], true, 'files');
|
2593 |
+
// Remove images
|
2594 |
+
empty($this->options['is_keep_imgs']) and wp_delete_attachments($missingPostRecord['post_id'], true, 'images');
|
2595 |
+
// Clear post's relationships
|
2596 |
+
wp_delete_object_term_relationships($missingPostRecord['post_id'], get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
2597 |
+
}
|
2598 |
}
|
2599 |
else
|
2600 |
+
{
|
2601 |
+
$skipp_from_deletion[] = $missingPostRecord['post_id'];
|
2602 |
$postRecord = new PMXI_Post_Record();
|
2603 |
$postRecord->getBy(array(
|
2604 |
'post_id' => $missingPostRecord['post_id'],
|
2605 |
'import_id' => $this->id,
|
2606 |
));
|
2607 |
+
if ( ! $postRecord->isEmpty() )
|
2608 |
{
|
2609 |
$is_unlink_missing_posts = apply_filters('wp_all_import_is_unlink_missing_posts', false, $this->id, $missingPostRecord['post_id']);
|
2610 |
if ( $is_unlink_missing_posts ){
|
2618 |
}
|
2619 |
|
2620 |
do_action('pmxi_missing_post', $missingPostRecord['post_id']);
|
2621 |
+
|
2622 |
unset($missingPostRecords[$k]);
|
2623 |
}
|
2624 |
}
|
2625 |
|
2626 |
+
$ids = array();
|
2627 |
+
|
2628 |
if ( ! empty($missingPostRecords) ){
|
2629 |
+
|
2630 |
foreach ($missingPostRecords as $k => $missingPostRecord) {
|
2631 |
$ids[] = $missingPostRecord['post_id'];
|
2632 |
}
|
2633 |
|
2634 |
+
switch ($this->options['custom_type']){
|
2635 |
+
case 'import_users':
|
2636 |
+
do_action('pmxi_delete_post', $ids, $this);
|
2637 |
+
$sql = "delete a,b
|
2638 |
+
FROM ".$this->wpdb->users." a
|
2639 |
+
LEFT JOIN ".$this->wpdb->usermeta." b ON ( a.ID = b.user_id )
|
2640 |
+
WHERE a.ID IN (" . implode(',', $ids) . ");";
|
2641 |
+
break;
|
2642 |
+
case 'taxonomies':
|
2643 |
+
do_action('pmxi_delete_taxonomy_term', $ids, $this);
|
2644 |
+
foreach ($ids as $term_id){
|
2645 |
+
wp_delete_term( $term_id, $this->options['taxonomy_type'] );
|
2646 |
+
}
|
2647 |
|
2648 |
+
break;
|
2649 |
+
default:
|
2650 |
+
do_action('pmxi_delete_post', $ids, $this);
|
2651 |
+
$sql = "delete a,b,c
|
2652 |
+
FROM ".$this->wpdb->posts." a
|
2653 |
+
LEFT JOIN ".$this->wpdb->term_relationships." b ON ( a.ID = b.object_id )
|
2654 |
+
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
2655 |
+
WHERE a.ID IN (" . implode(',', $ids) . ");";
|
2656 |
+
break;
|
2657 |
+
}
|
|
|
|
|
|
|
2658 |
|
2659 |
$this->wpdb->query( $sql );
|
2660 |
|
2671 |
}
|
2672 |
|
2673 |
if ( PMXI_Plugin::is_ajax() and "ajax" == $this->options['import_processing']) break;
|
2674 |
+
}
|
2675 |
+
|
2676 |
+
do_action('wp_all_import_skipped_from_deleted', $skipp_from_deletion, $this);
|
2677 |
|
2678 |
return (count($missing_ids_arr) > 1 and "ajax" == $this->options['import_processing']) ? false : true;
|
2679 |
}
|
2722 |
$caps['unfiltered_html'] = true;
|
2723 |
return $caps;
|
2724 |
}
|
2725 |
+
|
2726 |
+
protected function recount_terms($pid, $post_type){
|
2727 |
+
|
2728 |
+
$exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class') : array('post_format'));
|
2729 |
+
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($exclude_taxonomies));
|
2730 |
+
|
2731 |
+
foreach ($post_taxonomies as $ctx){
|
2732 |
+
$terms = wp_get_object_terms( $pid, $ctx->name );
|
2733 |
+
if ( ! empty($terms) ){
|
2734 |
+
if ( ! is_wp_error( $terms ) ) {
|
2735 |
+
foreach ($terms as $term_info) {
|
2736 |
+
$this->wpdb->query( $this->wpdb->prepare("UPDATE {$this->wpdb->term_taxonomy} SET count = count - 1 WHERE term_taxonomy_id = %d AND count > 0", $term_info->term_taxonomy_id) );
|
2737 |
+
}
|
2738 |
+
}
|
2739 |
+
}
|
2740 |
+
}
|
2741 |
+
}
|
2742 |
|
2743 |
+
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger, $is_cron = false, $post_status = 'publish'){
|
2744 |
wp_cache_flush();
|
2745 |
$terms = wp_get_object_terms( $pid, $tx_name );
|
2746 |
$term_ids = array();
|
2751 |
if ( ! is_wp_error( $terms ) ) {
|
2752 |
foreach ($terms as $term_info) {
|
2753 |
$term_ids[] = $term_info->term_taxonomy_id;
|
2754 |
+
$this->wpdb->query( $this->wpdb->prepare("UPDATE {$this->wpdb->term_taxonomy} SET count = count - 1 WHERE term_taxonomy_id = %d AND count > 0", $term_info->term_taxonomy_id) );
|
2755 |
+
}
|
2756 |
$in_tt_ids = "'" . implode( "', '", $term_ids ) . "'";
|
2757 |
$this->wpdb->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $pid ) );
|
2758 |
}
|
2771 |
{
|
2772 |
do_action('wp_all_import_associate_term', $pid, $tt, $tx_name);
|
2773 |
$values[] = $this->wpdb->prepare( "(%d, %d, %d)", $pid, $tt, ++$term_order);
|
2774 |
+
if ( ! in_array($post_status, array('draft'))){
|
2775 |
+
$this->wpdb->query( "UPDATE {$this->wpdb->term_taxonomy} SET count = count + 1 WHERE term_taxonomy_id = $tt" );
|
2776 |
+
}
|
2777 |
}
|
2778 |
|
2779 |
|
2887 |
wp_delete_attachments($id, false, 'images');
|
2888 |
}
|
2889 |
|
2890 |
+
do_action('pmxi_delete_post', $id, $this);
|
2891 |
|
2892 |
if ( $this->options['custom_type'] != 'import_users' ) wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
2893 |
}
|
plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP All Import
|
4 |
Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
|
5 |
Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
|
6 |
-
Version: 3.4.
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
@@ -25,7 +25,7 @@ define('WP_ALL_IMPORT_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
|
|
25 |
*/
|
26 |
define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
|
27 |
|
28 |
-
define('PMXI_VERSION', '3.4.
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
3 |
Plugin Name: WP All Import
|
4 |
Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
|
5 |
Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
|
6 |
+
Version: 3.4.7
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
25 |
*/
|
26 |
define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
|
27 |
|
28 |
+
define('PMXI_VERSION', '3.4.7');
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Import any XML or CSV File to WordPress ===
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 4.1
|
4 |
-
Tested up to: 4.
|
5 |
-
Stable tag: 3.4.
|
6 |
Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
|
7 |
|
8 |
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
|
@@ -105,6 +105,30 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 3.4.5 =
|
109 |
* improvement: custom fields delection
|
110 |
* improvement: new action wp_all_import_post_skipped
|
1 |
=== Import any XML or CSV File to WordPress ===
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 4.1
|
4 |
+
Tested up to: 4.9.4
|
5 |
+
Stable tag: 3.4.7
|
6 |
Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
|
7 |
|
8 |
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 3.4.7 =
|
109 |
+
* improvement: skip to the first specified record when importing only part of a file
|
110 |
+
* new filter: wp_all_import_is_render_whole_xml_tree
|
111 |
+
* new filter: wp_all_import_images_uploads_dir (add-on api)
|
112 |
+
* bug fix: patch XSS exploit
|
113 |
+
* bug fix: conflict with InfiniteWP
|
114 |
+
* bug fix: update notification for Link Cloaking Add-On
|
115 |
+
* bug fix: load functions before pmxi_before_xml_import
|
116 |
+
* bug fix: do not re-count category terms when post imported as draft
|
117 |
+
* bug fix: import base64 encoded images in add-ons
|
118 |
+
* security fix - XSS exploit (Special thanks to Yuji Tounai for reporting)
|
119 |
+
|
120 |
+
= 3.4.6 =
|
121 |
+
* improvement: added timestamp to import log lines
|
122 |
+
* improvement: added support for bmp images
|
123 |
+
* improvement: added new action pmxi_before_post_import_{$addon}
|
124 |
+
* security fix: patch XSS exploit
|
125 |
+
* bug fix: import pages hierarchy
|
126 |
+
* bug fix: error in pclzip.lib.php with php 7.1
|
127 |
+
* bug fix: import taxonomies hierarchy
|
128 |
+
* bug fix: json to xml convertation
|
129 |
+
* bug fix: removed SWFUpload
|
130 |
+
* security fix - XSS exploit (Special thanks to Mardan Muhidin for reporting)
|
131 |
+
|
132 |
= 3.4.5 =
|
133 |
* improvement: custom fields delection
|
134 |
* improvement: new action wp_all_import_post_skipped
|
schema.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin database schema
|
4 |
-
* WARNING:
|
5 |
-
*
|
6 |
* WPDB doesn't like NULL values so better not to have them in the tables;
|
7 |
*/
|
8 |
|
@@ -17,31 +17,33 @@ $charset_collate = '';
|
|
17 |
// Declare these as global in case schema.php is included from a function.
|
18 |
global $wpdb, $plugin_queries;
|
19 |
|
20 |
-
if (
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
$table_prefix = PMXI_Plugin::getInstance()->getTablePrefix();
|
26 |
|
27 |
$plugin_queries = <<<SCHEMA
|
28 |
CREATE TABLE {$table_prefix}templates (
|
29 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
30 |
-
options LONGTEXT,
|
31 |
scheduled VARCHAR(64) NOT NULL DEFAULT '',
|
32 |
name VARCHAR(200) NOT NULL DEFAULT '',
|
33 |
title TEXT,
|
34 |
-
content LONGTEXT,
|
35 |
is_keep_linebreaks TINYINT(1) NOT NULL DEFAULT 0,
|
36 |
is_leave_html TINYINT(1) NOT NULL DEFAULT 0,
|
37 |
-
fix_characters TINYINT(1) NOT NULL DEFAULT 0,
|
38 |
meta LONGTEXT,
|
39 |
PRIMARY KEY (id)
|
40 |
) $charset_collate;
|
41 |
CREATE TABLE {$table_prefix}imports (
|
42 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
43 |
parent_import_id BIGINT(20) NOT NULL DEFAULT 0,
|
44 |
-
name
|
45 |
friendly_name VARCHAR(255) NOT NULL DEFAULT '',
|
46 |
type VARCHAR(32) NOT NULL DEFAULT '',
|
47 |
feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
|
@@ -83,7 +85,7 @@ CREATE TABLE {$table_prefix}posts (
|
|
83 |
CREATE TABLE {$table_prefix}files (
|
84 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
85 |
import_id BIGINT(20) UNSIGNED NOT NULL,
|
86 |
-
name
|
87 |
path TEXT,
|
88 |
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
89 |
PRIMARY KEY (id)
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin database schema
|
4 |
+
* WARNING:
|
5 |
+
* dbDelta() doesn't like empty lines in schema string, so don't put them there;
|
6 |
* WPDB doesn't like NULL values so better not to have them in the tables;
|
7 |
*/
|
8 |
|
17 |
// Declare these as global in case schema.php is included from a function.
|
18 |
global $wpdb, $plugin_queries;
|
19 |
|
20 |
+
if (!empty($wpdb->charset)) {
|
21 |
+
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
22 |
+
}
|
23 |
+
if (!empty($wpdb->collate)) {
|
24 |
+
$charset_collate .= " COLLATE $wpdb->collate";
|
25 |
+
}
|
26 |
+
|
27 |
$table_prefix = PMXI_Plugin::getInstance()->getTablePrefix();
|
28 |
|
29 |
$plugin_queries = <<<SCHEMA
|
30 |
CREATE TABLE {$table_prefix}templates (
|
31 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
32 |
+
options LONGTEXT,
|
33 |
scheduled VARCHAR(64) NOT NULL DEFAULT '',
|
34 |
name VARCHAR(200) NOT NULL DEFAULT '',
|
35 |
title TEXT,
|
36 |
+
content LONGTEXT,
|
37 |
is_keep_linebreaks TINYINT(1) NOT NULL DEFAULT 0,
|
38 |
is_leave_html TINYINT(1) NOT NULL DEFAULT 0,
|
39 |
+
fix_characters TINYINT(1) NOT NULL DEFAULT 0,
|
40 |
meta LONGTEXT,
|
41 |
PRIMARY KEY (id)
|
42 |
) $charset_collate;
|
43 |
CREATE TABLE {$table_prefix}imports (
|
44 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
45 |
parent_import_id BIGINT(20) NOT NULL DEFAULT 0,
|
46 |
+
name TEXT,
|
47 |
friendly_name VARCHAR(255) NOT NULL DEFAULT '',
|
48 |
type VARCHAR(32) NOT NULL DEFAULT '',
|
49 |
feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
|
85 |
CREATE TABLE {$table_prefix}files (
|
86 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
87 |
import_id BIGINT(20) UNSIGNED NOT NULL,
|
88 |
+
name TEXT,
|
89 |
path TEXT,
|
90 |
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
91 |
PRIMARY KEY (id)
|
static/css/admin.css
CHANGED
@@ -2761,6 +2761,20 @@ p.upgrade_link {
|
|
2761 |
color: #777;
|
2762 |
}
|
2763 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2764 |
/*--------------------------------------------------------------------------
|
2765 |
*
|
2766 |
* XML & CSV
|
2761 |
color: #777;
|
2762 |
}
|
2763 |
|
2764 |
+
.wpallimport-plugin .new_element_ico{
|
2765 |
+
padding: 10px 10px 10px 40px;
|
2766 |
+
color: #777;
|
2767 |
+
position: relative;
|
2768 |
+
}
|
2769 |
+
.wpallimport-plugin .new_element_ico::before{
|
2770 |
+
font-family: "dashicons";
|
2771 |
+
content: "\f464";
|
2772 |
+
font-size: 33px;
|
2773 |
+
position: absolute;
|
2774 |
+
top: 25px;
|
2775 |
+
left: 0;
|
2776 |
+
color: #ccc;
|
2777 |
+
}
|
2778 |
/*--------------------------------------------------------------------------
|
2779 |
*
|
2780 |
* XML & CSV
|
static/js/admin.js
CHANGED
@@ -1653,8 +1653,6 @@
|
|
1653 |
container: 'plupload-ui',
|
1654 |
browse_button : 'select-files',
|
1655 |
file_data_name : 'async-upload',
|
1656 |
-
flash_swf_url : plugin_url + '/static/js/plupload/plupload.flash.swf',
|
1657 |
-
silverlight_xap_url : plugin_url + '/static/js/plupload/plupload.silverlight.xap',
|
1658 |
multipart: true,
|
1659 |
max_file_size: '1000mb',
|
1660 |
chunk_size: '1mb',
|
1653 |
container: 'plupload-ui',
|
1654 |
browse_button : 'select-files',
|
1655 |
file_data_name : 'async-upload',
|
|
|
|
|
1656 |
multipart: true,
|
1657 |
max_file_size: '1000mb',
|
1658 |
chunk_size: '1mb',
|
static/js/jquery/browserplus-min.js
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* browserplus.js
|
3 |
-
*
|
4 |
-
* Provides a gateway between user JavaScript and the BrowserPlus platform
|
5 |
-
*
|
6 |
-
* Copyright 2007-2009 Yahoo! Inc. All rights reserved.
|
7 |
-
*/
|
8 |
-
BrowserPlus=(typeof BrowserPlus!="undefined"&&BrowserPlus)?BrowserPlus:(function(){var P=false;var F="__browserPlusPluginID";var E="uninitialized";var G=[];var D="application/x-yahoo-browserplus_2";var J,K,L,H,A;return{initWhenAvailable:function(R,S){setTimeout(function(){try{navigator.plugins.refresh(false)}catch(T){}BrowserPlus.init(R,function(U){if(U.success){S(U)}else{BrowserPlus.initWhenAvailable(R,S)}})},1000)},clientSystemInfo:function(){return I()},listActiveServices:function(R){if(R==null||R.constructor!=Function){throw new Error("BrowserPlus.services() invoked without required callback parameter.")}return N().EnumerateServices(R)},getPlatformInfo:function(){if(N()===null){throw new Error("BrowserPlus.getPlatformInfo() invoked, but init() has not completed successfully.")}return N().Info()},isServiceLoaded:function(S,R){return((S!=undefined&&BrowserPlus.hasOwnProperty(S))&&(R==undefined||BrowserPlus[S].hasOwnProperty(R)))},describeService:function(S,R){if(R==null||R.constructor!=Function){throw new Error("BrowserPlus.services() invoked without required callback parameter")}if(N()===null){throw new Error("BrowserPlus.describeService() invoked, but init() has not completed successfully.")}return N().DescribeService(S,R)},isServiceActivated:function(S,R){return N().DescribeService(S,(function(){var T=R;return function(U){T(U.success)}})())},isInitialized:function(){return(E==="succeeded")},require:function(S,T){if(T==null||T.constructor!=Function){throw new Error("BrowserPlus.require() invoked without required callback parameter")}var R=function(V){if(V.success){var W=[];for(var U=0;U<V.value.length;U++){if(V.value[U].fullDesc){M({value:V.value[U].fullDesc});W.push({service:V.value[U].service,version:V.value[U].version})}else{BrowserPlus.describeService({service:V.value[U].service,version:V.value[U].version},M);W=V.value}}V.value=W}T(V)};N().RequireService(S,R);return true},init:function(T,S){if(I().browser=="Safari"){navigator.plugins.refresh(false)}var X=null;var W=null;if(S==null){W=T}else{X=T;W=S}if(W==null||W.constructor!=Function){throw new Error("BrowserPlus.init() invoked without required callback parameter")}if(X===null){X=new Object}if(typeof(X.locale)=="undefined"){X.locale=I().locale}var R=true;if(!X.supportLevel||X.supportLevel==="experimental"){R=(I().supportLevel!=="unsupported")}else{if(X.supportLevel==="supported"){R=(I().supportLevel==="supported")}}if(!R){W({success:false,error:"bp.unsupportedClient"});return}if(E==="succeeded"){W({success:true});return}if(E=="inprogress"){G.push(W);return}E="inprogress";if(typeof(window.onunload)=="undefined"){window.onunload=function(){}}var V=false;if(Q()&&N()!==null){V=true}if(!V){E="uninitialized";W({success:false,error:"bp.notInstalled"});return}else{G.push(W);var U=(function(){var Y=X;return function(){var d=function(g){if(!g.success&&g.error==="bp.switchVersion"&&I().browser!=="Explorer"){var h="application/x-yahoo-browserplus_";h+=g.verboseError;if(h!==D){D=h;setTimeout(function(){try{var j=document.getElementById(F);if(j){document.documentElement.removeChild(j.parentNode)}navigator.plugins.refresh(false)}catch(i){}if(Q()&&N()!==null){setTimeout(function(){N().Initialize(Y,d)},10)}else{d(g)}},10);return}}if(!g.success&&g.error==="bp.switchVersion"){g={success:false,error:"bp.notInstalled",verboseError:"BrowserPlus isn't installed, or couldn't be loaded"}}E=g.success?"succeeded":"uninitialized";var e=G;G=[];for(var f=0;f<e.length;f++){e[f](g)}};try{N().Initialize(Y,d)}catch(b){var Z=I();var c={success:false,error:"bp.notInstalled",verboseError:String(b)};if(Z.browser=="Explorer"){c.error="bp.unsupportedClient"}else{if(Z.browser=="Firefox"){try{navigator.plugins.refresh(true)}catch(a){}}}d(c)}}})();setTimeout(U,0)}},_detectBrowser:function(){return BrowserPlus.clientSystemInfo()}};function Q(){if(B()){return C()}else{return O()}}function O(){var R=navigator.mimeTypes[D];if(typeof(R)!=="object"||typeof(R.enabledPlugin)!=="object"){return false}var S=document.createElement("div");S.style.visibility="hidden";S.style.borderStyle="hidden";S.style.width=0;S.style.height=0;S.style.border=0;S.style.position="absolute";S.style.top=0;S.style.left=0;S.innerHTML='<object type="'+D+'" id="'+F+'" name="'+F+'"></object>';document.documentElement.appendChild(S);P=true;return true}function C(){if(N()!=null){return true}try{var R=document.createElement("object");R.id=F;R.type=D;R.style.display="none";document.body.appendChild(R);document.getElementById(F).Ping();P=true;return true}catch(T){try{document.body.removeChild(R)}catch(S){}}return false}function N(){if(P){return document.getElementById(F)}return null}function B(){return(I().browser=="Explorer")}function M(T){T=T.value;var V=T.name;var R=T.versionString;if(!BrowserPlus[V]){BrowserPlus[V]={};BrowserPlus[V].corelet=V;BrowserPlus[V].version=R}if(!BrowserPlus[V][R]){BrowserPlus[V][R]={};BrowserPlus[V][R].corelet=V;BrowserPlus[V][R].version=R}if(V=="core"){BrowserPlus[V].version=R}if(T.functions){for(var S=0;S<T.functions.length;S++){var W=T.functions[S].name;var U=(function(){var X=W;return function(Z,Y){if(Y==null||Y.constructor!=Function){throw new Error("BrowserPlus."+V+"."+X+"() invoked without required callback parameter")}return N().ExecuteMethod(V,R,X,Z,Y)}})();BrowserPlus[V][R][W]=U;if(R==BrowserPlus[V].version){BrowserPlus[V][W]=U}}}}function I(){var X=[{string:navigator.vendor,subString:"Apple",identity:"Safari"},{string:navigator.vendor,subString:"Google",identity:"Chrome"},{prop:window.opera,identity:"Opera"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"}];var W=[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}];var U={Mac:{Firefox:"supported",Safari:"supported"},Windows:{Explorer:{"8":"supported","7":"supported","6":"experimental"},Safari:"supported",Firefox:"supported",Chrome:"supported"}};var S;function T(b){for(var Y=0;Y<b.length;Y++){var Z=b[Y].string;var a=b[Y].prop;S=b[Y].versionSearch||b[Y].identity;if(Z){if(Z.indexOf(b[Y].subString)!=-1){return b[Y].identity}}else{if(a){return b[Y].identity}}}return null}function R(Z){var Y=Z.indexOf(S);if(Y==-1){return null}else{return parseFloat(Z.substring(Y+S.length+1))}}function V(){if(U[L]&&U[L][J]){var Y=U[L][J];if(typeof Y==="string"){return Y}else{if(Y[K]){return Y[K]}else{return"unsupported"}}}else{return"unsupported"}}if(!J){J=T(X)||"An unknown browser";K=R(navigator.userAgent)||R(navigator.appVersion)||"an unknown version";L=T(W)||"an unknown OS";if(L==="Mac"&&navigator.userAgent.indexOf("Intel")==-1){A="unsupported"}else{if(navigator.userAgent.indexOf("Firefox/2.0.0")!=-1){A="unsupported"}else{A=V()}}H=navigator.language||navigator.browserLanguage||navigator.userLanguage||navigator.systemLanguage}return{browser:J,version:K,os:L,locale:H,supportLevel:A}}})();if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={}}if(typeof YAHOO.bp=="undefined"||!YAHOO.bp){YAHOO.bp=BrowserPlus};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/js/plupload/plupload.flash.swf
DELETED
Binary file
|
static/js/plupload/plupload.full.js
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
/*1.5b*/
|
2 |
-
(function(){var f=0,l=[],n={},j={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},m=/[<>&\"\']/g,b,c=window.setTimeout,d={},e;function h(){this.returnValue=false}function k(){this.cancelBubble=true}(function(o){var p=o.split(/,/),q,s,r;for(q=0;q<p.length;q+=2){r=p[q+1].split(/ /);for(s=0;s<r.length;s++){j[r[s]]=p[q]}}})("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats,docx pptx xlsx,audio/mpeg,mpga mpega mp2 mp3,audio/x-wav,wav,audio/mp4,m4a,image/bmp,bmp,image/gif,gif,image/jpeg,jpeg jpg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/html,htm html xhtml,text/rtf,rtf,video/mpeg,mpeg mpg mpe,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/vnd.rn-realvideo,rv,text/csv,csv,text/plain,asc txt text diff log,application/octet-stream,exe");var g={VERSION:"1.5b",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:j,extend:function(o){g.each(arguments,function(p,q){if(q>0){g.each(p,function(s,r){o[r]=s})}});return o},cleanName:function(o){var p,q;q=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(p=0;p<q.length;p+=2){o=o.replace(q[p],q[p+1])}o=o.replace(/\s+/g,"_");o=o.replace(/[^a-z0-9_\-\.]+/gi,"");return o},addRuntime:function(o,p){p.name=o;l[o]=p;l.push(p);return p},guid:function(){var o=new Date().getTime().toString(32),p;for(p=0;p<5;p++){o+=Math.floor(Math.random()*65535).toString(32)}return(g.guidPrefix||"p")+o+(f++).toString(32)},buildUrl:function(p,o){var q="";g.each(o,function(s,r){q+=(q?"&":"")+encodeURIComponent(r)+"="+encodeURIComponent(s)});if(q){p+=(p.indexOf("?")>0?"&":"?")+q}return p},each:function(r,s){var q,p,o;if(r){q=r.length;if(q===b){for(p in r){if(r.hasOwnProperty(p)){if(s(r[p],p)===false){return}}}}else{for(o=0;o<q;o++){if(s(r[o],o)===false){return}}}}},formatSize:function(o){if(o===b||/\D/.test(o)){return g.translate("N/A")}if(o>1073741824){return Math.round(o/1073741824,1)+" GB"}if(o>1048576){return Math.round(o/1048576,1)+" MB"}if(o>1024){return Math.round(o/1024,1)+" KB"}return o+" b"},getPos:function(p,t){var u=0,s=0,w,v=document,q,r;p=p;t=t||v.body;function o(C){var A,B,z=0,D=0;if(C){B=C.getBoundingClientRect();A=v.compatMode==="CSS1Compat"?v.documentElement:v.body;z=B.left+A.scrollLeft;D=B.top+A.scrollTop}return{x:z,y:D}}if(p&&p.getBoundingClientRect&&(navigator.userAgent.indexOf("MSIE")>0&&v.documentMode!==8)){q=o(p);r=o(t);return{x:q.x-r.x,y:q.y-r.y}}w=p;while(w&&w!=t&&w.nodeType){u+=w.offsetLeft||0;s+=w.offsetTop||0;w=w.offsetParent}w=p.parentNode;while(w&&w!=t&&w.nodeType){u-=w.scrollLeft||0;s-=w.scrollTop||0;w=w.parentNode}return{x:u,y:s}},getSize:function(o){return{w:o.offsetWidth||o.clientWidth,h:o.offsetHeight||o.clientHeight}},parseSize:function(o){var p;if(typeof(o)=="string"){o=/^([0-9]+)([mgk]?)$/.exec(o.toLowerCase().replace(/[^0-9mkg]/g,""));p=o[2];o=+o[1];if(p=="g"){o*=1073741824}if(p=="m"){o*=1048576}if(p=="k"){o*=1024}}return o},xmlEncode:function(o){return o?(""+o).replace(m,function(p){return a[p]?"&"+a[p]+";":p}):o},toArray:function(q){var p,o=[];for(p=0;p<q.length;p++){o[p]=q[p]}return o},addI18n:function(o){return g.extend(n,o)},translate:function(o){return n[o]||o},isEmptyObj:function(o){if(o===b){return true}for(var p in o){return false}return true},hasClass:function(q,p){var o;if(q.className==""){return false}o=new RegExp("(^|\\s+)"+p+"(\\s+|$)");return o.test(q.className)},addClass:function(p,o){if(!g.hasClass(p,o)){p.className=p.className==""?o:p.className.replace(/\s+$/,"")+" "+o}},removeClass:function(q,p){var o=new RegExp("(^|\\s+)"+p+"(\\s+|$)");q.className=q.className.replace(o,function(s,r,t){return r===" "&&t===" "?" ":""})},getStyle:function(p,o){if(p.currentStyle){return p.currentStyle[o]}else{if(window.getComputedStyle){return window.getComputedStyle(p,null)[o]}}},addEvent:function(t,o,u){var s,r,q,p;p=arguments[3];o=o.toLowerCase();if(e===b){e="Plupload_"+g.guid()}if(t.addEventListener){s=u;t.addEventListener(o,s,false)}else{if(t.attachEvent){s=function(){var v=window.event;if(!v.target){v.target=v.srcElement}v.preventDefault=h;v.stopPropagation=k;u(v)};t.attachEvent("on"+o,s)}}if(t[e]===b){t[e]=g.guid()}if(!d.hasOwnProperty(t[e])){d[t[e]]={}}r=d[t[e]];if(!r.hasOwnProperty(o)){r[o]=[]}r[o].push({func:s,orig:u,key:p})},removeEvent:function(t,o){var r,u,q;if(typeof(arguments[2])=="function"){u=arguments[2]}else{q=arguments[2]}o=o.toLowerCase();if(t[e]&&d[t[e]]&&d[t[e]][o]){r=d[t[e]][o]}else{return}for(var p=r.length-1;p>=0;p--){if(r[p].key===q||r[p].orig===u){if(t.detachEvent){t.detachEvent("on"+o,r[p].func)}else{if(t.removeEventListener){t.removeEventListener(o,r[p].func,false)}}r[p].orig=null;r[p].func=null;r.splice(p,1);if(u!==b){break}}}if(!r.length){delete d[t[e]][o]}if(g.isEmptyObj(d[t[e]])){delete d[t[e]];try{delete t[e]}catch(s){t[e]=b}}},removeAllEvents:function(p){var o=arguments[1];if(p[e]===b||!p[e]){return}g.each(d[p[e]],function(r,q){g.removeEvent(p,q,o)})}};g.Uploader=function(r){var p={},u,t=[],q;u=new g.QueueProgress();r=g.extend({chunk_size:0,multipart:true,multi_selection:true,file_data_name:"file",filters:[]},r);function s(){var w,x=0,v;if(this.state==g.STARTED){for(v=0;v<t.length;v++){if(!w&&t[v].status==g.QUEUED){w=t[v];w.status=g.UPLOADING;if(this.trigger("BeforeUpload",w)){this.trigger("UploadFile",w)}}else{x++}}if(x==t.length){this.trigger("UploadComplete",t);this.stop()}}}function o(){var w,v;u.reset();for(w=0;w<t.length;w++){v=t[w];if(v.size!==b){u.size+=v.size;u.loaded+=v.loaded}else{u.size=b}if(v.status==g.DONE){u.uploaded++}else{if(v.status==g.FAILED){u.failed++}else{u.queued++}}}if(u.size===b){u.percent=t.length>0?Math.ceil(u.uploaded/t.length*100):0}else{u.bytesPerSec=Math.ceil(u.loaded/((+new Date()-q||1)/1000));u.percent=u.size>0?Math.ceil(u.loaded/u.size*100):0}}g.extend(this,{state:g.STOPPED,runtime:"",features:{},files:t,settings:r,total:u,id:g.guid(),init:function(){var A=this,B,x,w,z=0,y;if(typeof(r.preinit)=="function"){r.preinit(A)}else{g.each(r.preinit,function(D,C){A.bind(C,D)})}r.page_url=r.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(r.url)){r.url=r.page_url+r.url}r.chunk_size=g.parseSize(r.chunk_size);r.max_file_size=g.parseSize(r.max_file_size);A.bind("FilesAdded",function(C,F){var E,D,H=0,I,G=r.filters;if(G&&G.length){I=[];g.each(G,function(J){g.each(J.extensions.split(/,/),function(K){if(/^\s*\*\s*$/.test(K)){I.push("\\.*")}else{I.push("\\."+K.replace(new RegExp("["+("/^$.*+?|()[]{}\\".replace(/./g,"\\$&"))+"]","g"),"\\$&"))}})});I=new RegExp(I.join("|")+"$","i")}for(E=0;E<F.length;E++){D=F[E];D.loaded=0;D.percent=0;D.status=g.QUEUED;if(I&&!I.test(D.name)){C.trigger("Error",{code:g.FILE_EXTENSION_ERROR,message:g.translate("File extension error."),file:D});continue}if(D.size!==b&&D.size>r.max_file_size){C.trigger("Error",{code:g.FILE_SIZE_ERROR,message:g.translate("File size error."),file:D});continue}t.push(D);H++}if(H){c(function(){A.trigger("QueueChanged");A.refresh()},1)}else{return false}});if(r.unique_names){A.bind("UploadFile",function(C,D){var F=D.name.match(/\.([^.]+)$/),E="tmp";if(F){E=F[1]}D.target_name=D.id+"."+E})}A.bind("UploadProgress",function(C,D){D.percent=D.size>0?Math.ceil(D.loaded/D.size*100):100;o()});A.bind("StateChanged",function(C){if(C.state==g.STARTED){q=(+new Date())}else{if(C.state==g.STOPPED){for(B=C.files.length-1;B>=0;B--){if(C.files[B].status==g.UPLOADING){C.files[B].status=g.QUEUED;o()}}}}});A.bind("QueueChanged",o);A.bind("Error",function(C,D){if(D.file){D.file.status=g.FAILED;o();if(C.state==g.STARTED){c(function(){s.call(A)},1)}}});A.bind("FileUploaded",function(C,D){D.status=g.DONE;D.loaded=D.size;C.trigger("UploadProgress",D);c(function(){s.call(A)},1)});if(r.runtimes){x=[];y=r.runtimes.split(/\s?,\s?/);for(B=0;B<y.length;B++){if(l[y[B]]){x.push(l[y[B]])}}}else{x=l}function v(){var F=x[z++],E,C,D;if(F){E=F.getFeatures();C=A.settings.required_features;if(C){C=C.split(",");for(D=0;D<C.length;D++){if(!E[C[D]]){v();return}}}F.init(A,function(G){if(G&&G.success){A.features=E;A.runtime=F.name;A.trigger("Init",{runtime:F.name});A.trigger("PostInit");A.refresh()}else{v()}})}else{A.trigger("Error",{code:g.INIT_ERROR,message:g.translate("Init error.")})}}v();if(typeof(r.init)=="function"){r.init(A)}else{g.each(r.init,function(D,C){A.bind(C,D)})}},refresh:function(){this.trigger("Refresh")},start:function(){if(this.state!=g.STARTED){this.state=g.STARTED;this.trigger("StateChanged");s.call(this)}},stop:function(){if(this.state!=g.STOPPED){this.state=g.STOPPED;this.trigger("StateChanged")}},getFile:function(w){var v;for(v=t.length-1;v>=0;v--){if(t[v].id===w){return t[v]}}},removeFile:function(w){var v;for(v=t.length-1;v>=0;v--){if(t[v].id===w.id){return this.splice(v,1)[0]}}},splice:function(x,v){var w;w=t.splice(x===b?0:x,v===b?t.length:v);this.trigger("FilesRemoved",w);this.trigger("QueueChanged");return w},trigger:function(w){var y=p[w.toLowerCase()],x,v;if(y){v=Array.prototype.slice.call(arguments);v[0]=this;for(x=0;x<y.length;x++){if(y[x].func.apply(y[x].scope,v)===false){return false}}}return true},hasEventListener:function(v){return !!p[v.toLowerCase()]},bind:function(v,x,w){var y;v=v.toLowerCase();y=p[v]||[];y.push({func:x,scope:w||this});p[v]=y},unbind:function(v){v=v.toLowerCase();var y=p[v],w,x=arguments[1];if(y){if(x!==b){for(w=y.length-1;w>=0;w--){if(y[w].func===x){y.splice(w,1);break}}}else{y=[]}if(!y.length){delete p[v]}}},unbindAll:function(){var v=this;g.each(p,function(x,w){v.unbind(w)})},destroy:function(){this.trigger("Destroy");this.unbindAll()}})};g.File=function(r,p,q){var o=this;o.id=r;o.name=p;o.size=q;o.loaded=0;o.percent=0;o.status=0};g.Runtime=function(){this.getFeatures=function(){};this.init=function(o,p){}};g.QueueProgress=function(){var o=this;o.size=0;o.loaded=0;o.uploaded=0;o.failed=0;o.queued=0;o.percent=0;o.bytesPerSec=0;o.reset=function(){o.size=o.loaded=o.uploaded=o.failed=o.queued=o.percent=o.bytesPerSec=0}};g.runtimes={};window.plupload=g})();(function(){if(window.google&&google.gears){return}var a=null;if(typeof GearsFactory!="undefined"){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(a.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if(!window.google){window.google={}}if(!google.gears){google.gears={factory:a}}})();(function(e,b,c,d){var f={};function a(h,k,m){var g,j,l,o;j=google.gears.factory.create("beta.canvas");try{j.decode(h);if(!k.width){k.width=j.width}if(!k.height){k.height=j.height}o=Math.min(width/j.width,height/j.height);if(o<1||(o===1&&m==="image/jpeg")){j.resize(Math.round(j.width*o),Math.round(j.height*o));if(k.quality){return j.encode(m,{quality:k.quality/100})}return j.encode(m)}}catch(n){}return h}c.runtimes.Gears=c.addRuntime("gears",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(j,l){var k;if(!e.google||!google.gears){return l({success:false})}try{k=google.gears.factory.create("beta.desktop")}catch(h){return l({success:false})}function g(o){var n,m,p=[],q;for(m=0;m<o.length;m++){n=o[m];q=c.guid();f[q]=n.blob;p.push(new c.File(q,n.name,n.blob.length))}j.trigger("FilesAdded",p)}j.bind("PostInit",function(){var n=j.settings,m=b.getElementById(n.drop_element);if(m){c.addEvent(m,"dragover",function(o){k.setDropEffect(o,"copy");o.preventDefault()},j.id);c.addEvent(m,"drop",function(p){var o=k.getDragData(p,"application/x-gears-files");if(o){g(o.files)}p.preventDefault()},j.id);m=0}c.addEvent(b.getElementById(n.browse_button),"click",function(s){var r=[],p,o,q;s.preventDefault();no_type_restriction:for(p=0;p<n.filters.length;p++){q=n.filters[p].extensions.split(",");for(o=0;o<q.length;o++){if(q[o]==="*"){r=[];break no_type_restriction}r.push("."+q[o])}}k.openFiles(g,{singleFile:!n.multi_selection,filter:r})},j.id)});j.bind("UploadFile",function(s,p){var u=0,t,q,r=0,o=s.settings.resize,m;if(o&&/\.(png|jpg|jpeg)$/i.test(p.name)){f[p.id]=a(f[p.id],o,/\.png$/i.test(p.name)?"image/png":"image/jpeg")}p.size=f[p.id].length;q=s.settings.chunk_size;m=q>0;t=Math.ceil(p.size/q);if(!m){q=p.size;t=1}function n(){var z,B,w=s.settings.multipart,v=0,A={name:p.target_name||p.name},x=s.settings.url;function y(D){var C,I="----pluploadboundary"+c.guid(),F="--",H="\r\n",E,G;if(w){z.setRequestHeader("Content-Type","multipart/form-data; boundary="+I);C=google.gears.factory.create("beta.blobbuilder");c.each(c.extend(A,s.settings.multipart_params),function(K,J){C.append(F+I+H+'Content-Disposition: form-data; name="'+J+'"'+H+H);C.append(K+H)});G=c.mimeTypes[p.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";C.append(F+I+H+'Content-Disposition: form-data; name="'+s.settings.file_data_name+'"; filename="'+p.name+'"'+H+"Content-Type: "+G+H+H);C.append(D);C.append(H+F+I+F+H);E=C.getAsBlob();v=E.length-D.length;D=E}z.send(D)}if(p.status==c.DONE||p.status==c.FAILED||s.state==c.STOPPED){return}if(m){A.chunk=u;A.chunks=t}B=Math.min(q,p.size-(u*q));if(!w){x=c.buildUrl(s.settings.url,A)}z=google.gears.factory.create("beta.httprequest");z.open("POST",x);if(!w){z.setRequestHeader("Content-Disposition",'attachment; filename="'+p.name+'"');z.setRequestHeader("Content-Type","application/octet-stream")}c.each(s.settings.headers,function(D,C){z.setRequestHeader(C,D)});z.upload.onprogress=function(C){p.loaded=r+C.loaded-v;s.trigger("UploadProgress",p)};z.onreadystatechange=function(){var C;if(z.readyState==4){if(z.status==200){C={chunk:u,chunks:t,response:z.responseText,status:z.status};s.trigger("ChunkUploaded",p,C);if(C.cancelled){p.status=c.FAILED;return}r+=B;if(++u>=t){p.status=c.DONE;s.trigger("FileUploaded",p,{response:z.responseText,status:z.status})}else{n()}}else{s.trigger("Error",{code:c.HTTP_ERROR,message:c.translate("HTTP Error: Click here for our <a href=\"http://www.wpallimport.com/documentation/advanced/troubleshooting/\" target=\"_blank\">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to upload a file."),file:p,chunk:u,chunks:t,status:z.status})}}};if(u<t){y(f[p.id].slice(u*q,B))}}n()});j.bind("Destroy",function(m){var n,o,p={browseButton:m.settings.browse_button,dropElm:m.settings.drop_element};for(n in p){o=b.getElementById(p[n]);if(o){c.removeAllEvents(o,m.id)}}});l({success:true})}})})(window,document,plupload);(function(g,b,d,e){var a={},h={};function c(o){var n,m=typeof o,j,l,k;if(o===e||o===null){return"null"}if(m==="string"){n="\bb\tt\nn\ff\rr\"\"''\\\\";return'"'+o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g,function(r,q){var p=n.indexOf(q);if(p+1){return"\\"+n.charAt(p+1)}r=q.charCodeAt().toString(16);return"\\u"+"0000".substring(r.length)+r})+'"'}if(m=="object"){j=o.length!==e;n="";if(j){for(l=0;l<o.length;l++){if(n){n+=","}n+=c(o[l])}n="["+n+"]"}else{for(k in o){if(o.hasOwnProperty(k)){if(n){n+=","}n+=c(k)+":"+c(o[k])}}n="{"+n+"}"}return n}return""+o}function f(s){var v=false,j=null,o=null,k,l,m,u,n,q=0;try{try{o=new ActiveXObject("AgControl.AgControl");if(o.IsVersionSupported(s)){v=true}o=null}catch(r){var p=navigator.plugins["Silverlight Plug-In"];if(p){k=p.description;if(k==="1.0.30226.2"){k="2.0.30226.2"}l=k.split(".");while(l.length>3){l.pop()}while(l.length<4){l.push(0)}m=s.split(".");while(m.length>4){m.pop()}do{u=parseInt(m[q],10);n=parseInt(l[q],10);q++}while(q<m.length&&u===n);if(u<=n&&!isNaN(u)){v=true}}}}catch(t){v=false}return v}d.silverlight={trigger:function(n,k){var m=a[n],l,j;if(m){j=d.toArray(arguments).slice(1);j[0]="Silverlight:"+k;setTimeout(function(){m.trigger.apply(m,j)},0)}}};d.runtimes.Silverlight=d.addRuntime("silverlight",{getFeatures:function(){return{jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(p,q){var o,m="",n=p.settings.filters,l,k=b.body;if(!f("2.0.31005.0")||(g.opera&&g.opera.buildNumber)){q({success:false});return}h[p.id]=false;a[p.id]=p;o=b.createElement("div");o.id=p.id+"_silverlight_container";d.extend(o.style,{position:"absolute",top:"0px",background:p.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100px",height:"100px",overflow:"hidden",opacity:p.settings.shim_bgcolor||b.documentMode>8?"":0.01});o.className="plupload silverlight";if(p.settings.container){k=b.getElementById(p.settings.container);if(d.getStyle(k,"position")==="static"){k.style.position="relative"}}k.appendChild(o);for(l=0;l<n.length;l++){m+=(m!=""?"|":"")+n[l].title+" | *."+n[l].extensions.replace(/,/g,";*.")}o.innerHTML='<object id="'+p.id+'_silverlight" data="data:application/x-silverlight," type="application/x-silverlight-2" style="outline:none;" width="1024" height="1024"><param name="source" value="'+p.settings.silverlight_xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="enablehtmlaccess" value="true"/><param name="initParams" value="id='+p.id+",filter="+m+",multiselect="+p.settings.multi_selection+'"/></object>';function j(){return b.getElementById(p.id+"_silverlight").content.Upload}p.bind("Silverlight:Init",function(){var r,s={};if(h[p.id]){return}h[p.id]=true;p.bind("Silverlight:StartSelectFiles",function(t){r=[]});p.bind("Silverlight:SelectFile",function(t,w,u,v){var x;x=d.guid();s[x]=w;s[w]=x;r.push(new d.File(x,u,v))});p.bind("Silverlight:SelectSuccessful",function(){if(r.length){p.trigger("FilesAdded",r)}});p.bind("Silverlight:UploadChunkError",function(t,w,u,x,v){p.trigger("Error",{code:d.IO_ERROR,message:"IO Error.",details:v,file:t.getFile(s[w])})});p.bind("Silverlight:UploadFileProgress",function(t,x,u,w){var v=t.getFile(s[x]);if(v.status!=d.FAILED){v.size=w;v.loaded=u;t.trigger("UploadProgress",v)}});p.bind("Refresh",function(t){var u,v,w;u=b.getElementById(t.settings.browse_button);if(u){v=d.getPos(u,b.getElementById(t.settings.container));w=d.getSize(u);d.extend(b.getElementById(t.id+"_silverlight_container").style,{top:v.y+"px",left:v.x+"px",width:w.w+"px",height:w.h+"px"})}});p.bind("Silverlight:UploadChunkSuccessful",function(t,w,u,z,y){var x,v=t.getFile(s[w]);x={chunk:u,chunks:z,response:y};t.trigger("ChunkUploaded",v,x);if(v.status!=d.FAILED){j().UploadNextChunk()}if(u==z-1){v.status=d.DONE;t.trigger("FileUploaded",v,{response:y})}});p.bind("Silverlight:UploadSuccessful",function(t,w,u){var v=t.getFile(s[w]);v.status=d.DONE;t.trigger("FileUploaded",v,{response:u})});p.bind("FilesRemoved",function(t,v){var u;for(u=0;u<v.length;u++){j().RemoveFile(s[v[u].id])}});p.bind("UploadFile",function(t,v){var w=t.settings,u=w.resize||{};j().UploadFile(s[v.id],t.settings.url,c({name:v.target_name||v.name,mime:d.mimeTypes[v.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream",chunk_size:w.chunk_size,image_width:u.width,image_height:u.height,image_quality:u.quality||90,multipart:!!w.multipart,multipart_params:w.multipart_params||{},file_data_name:w.file_data_name,headers:w.headers}))});p.bind("Silverlight:MouseEnter",function(t){var u,v;u=b.getElementById(p.settings.browse_button);v=t.settings.browse_button_hover;if(u&&v){d.addClass(u,v)}});p.bind("Silverlight:MouseLeave",function(t){var u,v;u=b.getElementById(p.settings.browse_button);v=t.settings.browse_button_hover;if(u&&v){d.removeClass(u,v)}});p.bind("Silverlight:MouseLeftButtonDown",function(t){var u,v;u=b.getElementById(p.settings.browse_button);v=t.settings.browse_button_active;if(u&&v){d.addClass(u,v);d.addEvent(b.body,"mouseup",function(){d.removeClass(u,v)})}});p.bind("Sliverlight:StartSelectFiles",function(t){var u,v;u=b.getElementById(p.settings.browse_button);v=t.settings.browse_button_active;if(u&&v){d.removeClass(u,v)}});p.bind("Destroy",function(t){var u;d.removeAllEvents(b.body,t.id);delete h[t.id];delete a[t.id];u=b.getElementById(t.id+"_silverlight_container");if(u){k.removeChild(u)}});q({success:true})})}})})(window,document,plupload);(function(f,b,d,e){var a={},g={};function c(){var h;try{h=navigator.plugins["Shockwave Flash"];h=h.description}catch(k){try{h=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(j){h="0.0"}}h=h.match(/\d+/g);return parseFloat(h[0]+"."+h[1])}d.flash={trigger:function(k,h,j){setTimeout(function(){var n=a[k],m,l;if(n){n.trigger("Flash:"+h,j)}},0)}};d.runtimes.Flash=d.addRuntime("flash",{getFeatures:function(){return{jpgresize:true,pngresize:true,maxWidth:8091,maxHeight:8091,chunks:true,progress:true,multipart:true}},init:function(k,p){var o,j,l,q=0,h=b.body;if(c()<10){p({success:false});return}g[k.id]=false;a[k.id]=k;o=b.getElementById(k.settings.browse_button);j=b.createElement("div");j.id=k.id+"_flash_container";d.extend(j.style,{position:"absolute",top:"0px",background:k.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100%",height:"100%"});j.className="plupload flash";if(k.settings.container){h=b.getElementById(k.settings.container);if(d.getStyle(h,"position")==="static"){h.style.position="relative"}}h.appendChild(j);l="id="+escape(k.id);j.innerHTML='<object id="'+k.id+'_flash" width="100%" height="100%" style="outline:0" type="application/x-shockwave-flash" data="'+k.settings.flash_swf_url+'"><param name="movie" value="'+k.settings.flash_swf_url+'" /><param name="flashvars" value="'+l+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>';function n(){return b.getElementById(k.id+"_flash")}function m(){if(q++>5000){p({success:false});return}if(!g[k.id]){setTimeout(m,1)}}m();o=j=null;k.bind("Flash:Init",function(){var s={},r;n().setFileFilters(k.settings.filters,k.settings.multi_selection);if(g[k.id]){return}g[k.id]=true;k.bind("UploadFile",function(t,v){var w=t.settings,u=k.settings.resize||{};n().uploadFile(s[v.id],w.url,{name:v.target_name||v.name,mime:d.mimeTypes[v.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream",chunk_size:w.chunk_size,width:u.width,height:u.height,quality:u.quality,multipart:w.multipart,multipart_params:w.multipart_params||{},file_data_name:w.file_data_name,format:/\.(jpg|jpeg)$/i.test(v.name)?"jpg":"png",headers:w.headers,urlstream_upload:w.urlstream_upload})});k.bind("Flash:UploadProcess",function(u,t){var v=u.getFile(s[t.id]);if(v.status!=d.FAILED){v.loaded=t.loaded;v.size=t.size;u.trigger("UploadProgress",v)}});k.bind("Flash:UploadChunkComplete",function(t,v){var w,u=t.getFile(s[v.id]);w={chunk:v.chunk,chunks:v.chunks,response:v.text};t.trigger("ChunkUploaded",u,w);if(u.status!=d.FAILED){n().uploadNextChunk()}if(v.chunk==v.chunks-1){u.status=d.DONE;t.trigger("FileUploaded",u,{response:v.text})}});k.bind("Flash:SelectFiles",function(t,w){var v,u,x=[],y;for(u=0;u<w.length;u++){v=w[u];y=d.guid();s[y]=v.id;s[v.id]=y;x.push(new d.File(y,v.name,v.size))}if(x.length){k.trigger("FilesAdded",x)}});k.bind("Flash:SecurityError",function(t,u){k.trigger("Error",{code:d.SECURITY_ERROR,message:d.translate("Security error."),details:u.message,file:k.getFile(s[u.id])})});k.bind("Flash:GenericError",function(t,u){k.trigger("Error",{code:d.GENERIC_ERROR,message:d.translate("Generic error."),details:u.message,file:k.getFile(s[u.id])})});k.bind("Flash:IOError",function(t,u){k.trigger("Error",{code:d.IO_ERROR,message:d.translate("IO error."),details:u.message,file:k.getFile(s[u.id])})});k.bind("Flash:ImageError",function(t,u){k.trigger("Error",{code:parseInt(u.code,10),message:d.translate("Image error."),file:k.getFile(s[u.id])})});k.bind("Flash:StageEvent:rollOver",function(t){var u,v;u=b.getElementById(k.settings.browse_button);v=t.settings.browse_button_hover;if(u&&v){d.addClass(u,v)}});k.bind("Flash:StageEvent:rollOut",function(t){var u,v;u=b.getElementById(k.settings.browse_button);v=t.settings.browse_button_hover;if(u&&v){d.removeClass(u,v)}});k.bind("Flash:StageEvent:mouseDown",function(t){var u,v;u=b.getElementById(k.settings.browse_button);v=t.settings.browse_button_active;if(u&&v){d.addClass(u,v);d.addEvent(b.body,"mouseup",function(){d.removeClass(u,v)},t.id)}});k.bind("Flash:StageEvent:mouseUp",function(t){var u,v;u=b.getElementById(k.settings.browse_button);v=t.settings.browse_button_active;if(u&&v){d.removeClass(u,v)}});k.bind("Flash:ExifData",function(t,u){k.trigger("ExifData",k.getFile(s[u.id]),u.data)});k.bind("Flash:GpsData",function(t,u){k.trigger("GpsData",k.getFile(s[u.id]),u.data)});k.bind("QueueChanged",function(t){k.refresh()});k.bind("FilesRemoved",function(t,v){var u;for(u=0;u<v.length;u++){n().removeFile(s[v[u].id])}});k.bind("StateChanged",function(t){k.refresh()});k.bind("Refresh",function(t){var u,v,w;n().setFileFilters(k.settings.filters,k.settings.multi_selection);u=b.getElementById(t.settings.browse_button);if(u){v=d.getPos(u,b.getElementById(t.settings.container));w=d.getSize(u);d.extend(b.getElementById(t.id+"_flash_container").style,{top:v.y+"px",left:v.x+"px",width:w.w+"px",height:w.h+"px"})}});k.bind("Destroy",function(t){var u;d.removeAllEvents(b.body,t.id);delete g[t.id];delete a[t.id];u=b.getElementById(t.id+"_flash_container");if(u){h.removeChild(u)}});p({success:true})})}})})(window,document,plupload);(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true}},init:function(g,j){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(o){var n,m,k=[],l,p;for(m=0;m<o.length;m++){l=o[m];p=a.guid();h[p]=l;k.push(new a.File(p,l.name,l.size))}if(m){g.trigger("FilesAdded",k)}}function b(){g.bind("PostInit",function(){var n,l=d.drop_element,p=g.id+"_droptarget",k=document.getElementById(l),m;function q(s,r){e.DragAndDrop.AddDropTarget({id:s},function(t){e.DragAndDrop.AttachCallbacks({id:s,hover:function(u){if(!u&&r){r()}},drop:function(u){if(r){r()}f(u)}},function(){})})}function o(){document.getElementById(p).style.top="-1000px"}if(k){if(document.attachEvent&&(/MSIE/gi).test(navigator.userAgent)){n=document.createElement("div");n.setAttribute("id",p);a.extend(n.style,{position:"absolute",top:"-1000px",background:"red",filter:"alpha(opacity=0)",opacity:0});document.body.appendChild(n);a.addEvent(k,"dragenter",function(s){var r,t;r=document.getElementById(l);t=a.getPos(r);a.extend(document.getElementById(p).style,{top:t.y+"px",left:t.x+"px",width:r.offsetWidth+"px",height:r.offsetHeight+"px"})});q(p,o)}else{q(l)}}a.addEvent(document.getElementById(d.browse_button),"click",function(w){var u=[],s,r,v=d.filters,t;w.preventDefault();no_type_restriction:for(s=0;s<v.length;s++){t=v[s].extensions.split(",");for(r=0;r<t.length;r++){if(t[r]==="*"){u=[];break no_type_restriction}u.push(a.mimeTypes[t[r]])}}e.FileBrowse.OpenBrowseDialog({mimeTypes:u},function(x){if(x.success){f(x.value)}})});k=n=null});g.bind("UploadFile",function(n,k){var m=h[k.id],s={},l=n.settings.chunk_size,o,p=[];function r(t,v){var u;if(k.status==a.FAILED){return}s.name=k.target_name||k.name;if(l){s.chunk=""+t;s.chunks=""+v}u=p.shift();e.Uploader.upload({url:n.settings.url,files:{file:u},cookies:document.cookies,postvars:a.extend(s,n.settings.multipart_params),progressCallback:function(y){var x,w=0;o[t]=parseInt(y.filePercent*u.size/100,10);for(x=0;x<o.length;x++){w+=o[x]}k.loaded=w;n.trigger("UploadProgress",k)}},function(x){var w,y;if(x.success){w=x.value.statusCode;if(l){n.trigger("ChunkUploaded",k,{chunk:t,chunks:v,response:x.value.body,status:w})}if(p.length>0){r(++t,v)}else{k.status=a.DONE;n.trigger("FileUploaded",k,{response:x.value.body,status:w});if(w>=400){n.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error: Click here for our <a href=\"http://www.wpallimport.com/documentation/advanced/troubleshooting/\" target=\"_blank\">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to upload a file."),file:k,status:w})}}}else{n.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:k,details:x.error})}})}function q(t){k.size=t.size;if(l){e.FileAccess.chunk({file:t,chunkSize:l},function(w){if(w.success){var x=w.value,u=x.length;o=Array(u);for(var v=0;v<u;v++){o[v]=0;p.push(x[v])}r(0,u)}})}else{o=Array(1);p.push(t);r(0,1)}}if(c&&/\.(png|jpg|jpeg)$/i.test(k.name)){BrowserPlus.ImageAlter.transform({file:m,quality:c.quality||90,actions:[{scale:{maxwidth:c.width,maxheight:c.height}}]},function(t){if(t.success){q(t.value.file)}})}else{q(m)}});j({success:true})}if(e){e.init(function(l){var k=[{service:"Uploader",version:"3"},{service:"DragAndDrop",version:"1"},{service:"FileBrowse",version:"1"},{service:"FileAccess",version:"2"}];if(c){k.push({service:"ImageAlter",version:"4"})}if(l.success){e.require({services:k},function(m){if(m.success){b()}else{j()}})}else{j()}})}else{j()}}})})(plupload);(function(h,k,j,e){var c={},g;function m(o,p){var n;if("FileReader" in h){n=new FileReader();n.readAsDataURL(o);n.onload=function(){p(n.result)}}else{return p(o.getAsDataURL())}}function l(o,p){var n;if("FileReader" in h){n=new FileReader();n.readAsBinaryString(o);n.onload=function(){p(n.result)}}else{return p(o.getAsBinary())}}function d(r,p,n,v){var q,o,u,s,t=this;m(c[r.id],function(w){q=k.createElement("canvas");q.style.display="none";k.body.appendChild(q);o=q.getContext("2d");u=new Image();u.onerror=u.onabort=function(){v({success:false})};u.onload=function(){var B,x,z,y,A;if(!p.width){p.width=u.width}if(!p.height){p.height=u.height}s=Math.min(p.width/u.width,p.height/u.height);if(s<1||(s===1&&n==="image/jpeg")){B=Math.round(u.width*s);x=Math.round(u.height*s);q.width=B;q.height=x;o.drawImage(u,0,0,B,x);if(n==="image/jpeg"){y=new f(atob(w.substring(w.indexOf("base64,")+7)));if(y.headers&&y.headers.length){A=new a();if(A.init(y.get("exif")[0])){A.setExif("PixelXDimension",B);A.setExif("PixelYDimension",x);y.set("exif",A.getBinary());if(t.hasEventListener("ExifData")){t.trigger("ExifData",r,A.EXIF())}if(t.hasEventListener("GpsData")){t.trigger("GpsData",r,A.GPS())}}}if(p.quality){try{w=q.toDataURL(n,p.quality/100)}catch(C){w=q.toDataURL(n)}}}else{w=q.toDataURL(n)}w=w.substring(w.indexOf("base64,")+7);w=atob(w);if(y&&y.headers&&y.headers.length){w=y.restore(w);y.purge()}q.parentNode.removeChild(q);v({success:true,data:w})}else{v({success:false})}};u.src=w})}j.runtimes.Html5=j.addRuntime("html5",{getFeatures:function(){var t,o,s,r,q,n,p;p=(function(){var y=navigator,x=y.userAgent,z=y.vendor,v,u,w;v=/WebKit/.test(x);w=v&&z.indexOf("Apple")!==-1;u=h.opera&&h.opera.buildNumber;return{ie:!v&&!u&&(/MSIE/gi).test(x)&&(/Explorer/gi).test(y.appName),webkit:v,gecko:!v&&/Gecko/.test(x),safari:w,safariwin:w&&navigator.platform.indexOf("Win")!==-1,opera:!!u}}());o=s=q=n=false;if(h.XMLHttpRequest){t=new XMLHttpRequest();s=!!t.upload;o=!!(t.sendAsBinary||t.upload)}if(o){r=!!(t.sendAsBinary||(h.Uint8Array&&h.ArrayBuffer));q=!!(File&&(File.prototype.getAsDataURL||h.FileReader)&&r);n=!!(File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice))}g=p.safariwin;return{html5:o,dragdrop:(function(){var u=k.createElement("div");return("draggable" in u)||("ondragstart" in u&&"ondrop" in u)}()),jpgresize:q,pngresize:q,multipart:q||!!h.FileReader||!!h.FormData,canSendBinary:r,cantSendBlobInFormData:!!(p.gecko&&h.FormData&&h.FileReader&&!FileReader.prototype.readAsArrayBuffer),progress:s,chunks:n,triggerDialog:(p.gecko&&h.FormData||p.webkit)}},init:function(p,q){var n;function o(v){var t,s,u=[],w,r={};for(s=0;s<v.length;s++){t=v[s];if(r[t.name]){continue}r[t.name]=true;w=j.guid();c[w]=t;u.push(new j.File(w,t.fileName||t.name,t.fileSize||t.size))}if(u.length){p.trigger("FilesAdded",u)}}n=this.getFeatures();if(!n.html5){q({success:false});return}p.bind("Init",function(v){var F,E,B=[],u,C,s=v.settings.filters,t,A,r=k.body,D;F=k.createElement("div");F.id=v.id+"_html5_container";j.extend(F.style,{position:"absolute",background:p.settings.shim_bgcolor||"transparent",width:"100px",height:"100px",overflow:"hidden",zIndex:99999,opacity:p.settings.shim_bgcolor?"":0});F.className="plupload html5";if(p.settings.container){r=k.getElementById(p.settings.container);if(j.getStyle(r,"position")==="static"){r.style.position="relative"}}r.appendChild(F);no_type_restriction:for(u=0;u<s.length;u++){t=s[u].extensions.split(/,/);for(C=0;C<t.length;C++){if(t[C]==="*"){B=[];break no_type_restriction}A=j.mimeTypes[t[C]];if(A){B.push(A)}}}F.innerHTML='<input id="'+p.id+'_html5" style="font-size:999px" type="file" accept="'+B.join(",")+'" '+(p.settings.multi_selection?'multiple="multiple"':"")+" />";F.scrollTop=100;D=k.getElementById(p.id+"_html5");if(v.features.triggerDialog){j.extend(D.style,{position:"absolute",width:"100%",height:"100%"})}else{j.extend(D.style,{cssFloat:"right",styleFloat:"right"})}D.onchange=function(){o(this.files);this.value=""};E=k.getElementById(v.settings.browse_button);if(E){var x=v.settings.browse_button_hover,z=v.settings.browse_button_active,w=v.features.triggerDialog?E:F;if(x){j.addEvent(w,"mouseover",function(){j.addClass(E,x)},v.id);j.addEvent(w,"mouseout",function(){j.removeClass(E,x)},v.id)}if(z){j.addEvent(w,"mousedown",function(){j.addClass(E,z)},v.id);j.addEvent(k.body,"mouseup",function(){j.removeClass(E,z)},v.id)}if(v.features.triggerDialog){j.addEvent(E,"click",function(y){k.getElementById(v.id+"_html5").click();y.preventDefault()},v.id)}}});p.bind("PostInit",function(){var r=k.getElementById(p.settings.drop_element);if(r){if(g){j.addEvent(r,"dragenter",function(v){var u,s,t;u=k.getElementById(p.id+"_drop");if(!u){u=k.createElement("input");u.setAttribute("type","file");u.setAttribute("id",p.id+"_drop");u.setAttribute("multiple","multiple");j.addEvent(u,"change",function(){o(this.files);j.removeEvent(u,"change",p.id);u.parentNode.removeChild(u)},p.id);r.appendChild(u)}s=j.getPos(r,k.getElementById(p.settings.container));t=j.getSize(r);if(j.getStyle(r,"position")==="static"){j.extend(r.style,{position:"relative"})}j.extend(u.style,{position:"absolute",display:"block",top:0,left:0,width:t.w+"px",height:t.h+"px",opacity:0})},p.id);return}j.addEvent(r,"dragover",function(s){s.preventDefault()},p.id);j.addEvent(r,"drop",function(t){var s=t.dataTransfer;if(s&&s.files){o(s.files)}t.preventDefault()},p.id)}});p.bind("Refresh",function(r){var s,t,u,w,v;s=k.getElementById(p.settings.browse_button);if(s){t=j.getPos(s,k.getElementById(r.settings.container));u=j.getSize(s);w=k.getElementById(p.id+"_html5_container");j.extend(w.style,{top:t.y+"px",left:t.x+"px",width:u.w+"px",height:u.h+"px"});if(p.features.triggerDialog){if(j.getStyle(s,"position")==="static"){j.extend(s.style,{position:"relative"})}v=parseInt(j.getStyle(s,"z-index"),10);if(isNaN(v)){v=0}j.extend(s.style,{zIndex:v});j.extend(w.style,{zIndex:v-1})}}});p.bind("UploadFile",function(r,t){var u=r.settings,x,s;function w(z,C,y){var A;if(File.prototype.slice){try{z.slice();return z.slice(C,y)}catch(B){return z.slice(C,y-C)}}else{if(A=File.prototype.webkitSlice||File.prototype.mozSlice){return A.call(z,C,y)}else{return null}}}function v(z){var C=0,B=0,y=("FileReader" in h)?new FileReader:null,D=typeof(z)==="string";function A(){var I,M,K,L,H,J,F,E=r.settings.url;function G(W){var T=0,U=new XMLHttpRequest,X=U.upload,N="----pluploadboundary"+j.guid(),O,P="--",V="\r\n",R="";if(X){X.onprogress=function(Y){t.loaded=Math.min(t.size,B+Y.loaded-T);r.trigger("UploadProgress",t)}}U.onreadystatechange=function(){var Y,aa;if(U.readyState==4){try{Y=U.status}catch(Z){Y=0}if(Y>=400){r.trigger("Error",{code:j.HTTP_ERROR,message:j.translate("HTTP Error: Click here for our <a href=\"http://www.wpallimport.com/documentation/advanced/troubleshooting/\" target=\"_blank\">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to upload a file."),file:t,status:Y})}else{if(K){aa={chunk:C,chunks:K,response:U.responseText,status:Y};r.trigger("ChunkUploaded",t,aa);B+=J;if(aa.cancelled){t.status=j.FAILED;return}t.loaded=Math.min(t.size,(C+1)*H)}else{t.loaded=t.size}r.trigger("UploadProgress",t);W=I=O=R=null;if(!K||++C>=K){t.status=j.DONE;r.trigger("FileUploaded",t,{response:U.responseText,status:Y})}else{A()}}U=null}};if(r.settings.multipart&&n.multipart){L.name=t.target_name||t.name;U.open("post",E,true);j.each(r.settings.headers,function(Z,Y){U.setRequestHeader(Y,Z)});if(!D&&!!h.FormData){O=new FormData();j.each(j.extend(L,r.settings.multipart_params),function(Z,Y){O.append(Y,Z)});O.append(r.settings.file_data_name,W);U.send(O);return}if(D){U.setRequestHeader("Content-Type","multipart/form-data; boundary="+N);j.each(j.extend(L,r.settings.multipart_params),function(Z,Y){R+=P+N+V+'Content-Disposition: form-data; name="'+Y+'"'+V+V;R+=unescape(encodeURIComponent(Z))+V});F=j.mimeTypes[t.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";R+=P+N+V+'Content-Disposition: form-data; name="'+r.settings.file_data_name+'"; filename="'+unescape(encodeURIComponent(t.name))+'"'+V+"Content-Type: "+F+V+V+W+V+P+N+P+V;T=R.length-W.length;W=R;if(U.sendAsBinary){U.sendAsBinary(W)}else{if(n.canSendBinary){var S=new Uint8Array(W.length);for(var Q=0;Q<W.length;Q++){S[Q]=(W.charCodeAt(Q)&255)}U.send(S.buffer)}}return}}E=j.buildUrl(r.settings.url,j.extend(L,r.settings.multipart_params));U.open("post",E,true);U.setRequestHeader("Content-Type","application/octet-stream");j.each(r.settings.headers,function(Z,Y){U.setRequestHeader(Y,Z)});U.send(W)}if(t.status==j.DONE||t.status==j.FAILED||r.state==j.STOPPED){return}L={name:t.target_name||t.name};if(u.chunk_size&&t.size>u.chunk_size&&(n.chunks||typeof(z)=="string")){H=u.chunk_size;K=Math.ceil(t.size/H);J=Math.min(H,t.size-(C*H));if(typeof(z)=="string"){I=z.substring(C*H,C*H+J)}else{I=w(z,C*H,C*H+J)}L.chunk=C;L.chunks=K}else{J=t.size;I=z}if(y&&n.cantSendBlobInFormData&&n.chunks&&r.settings.chunk_size){y.onload=function(){D=true;G(y.result)};y.readAsBinaryString(I)}else{G(I)}}A()}x=c[t.id];if(n.jpgresize&&r.settings.resize&&/\.(png|jpg|jpeg)$/i.test(t.name)){d.call(r,t,r.settings.resize,/\.png$/i.test(t.name)?"image/png":"image/jpeg",function(y){if(y.success){t.size=y.data.length;v(y.data)}else{v(x)}})}else{if(!n.chunks&&n.jpgresize){l(x,v)}else{v(x)}}});p.bind("Destroy",function(r){var t,u,s=k.body,v={inputContainer:r.id+"_html5_container",inputFile:r.id+"_html5",browseButton:r.settings.browse_button,dropElm:r.settings.drop_element};for(t in v){u=k.getElementById(v[t]);if(u){j.removeAllEvents(u,r.id)}}j.removeAllEvents(k.body,r.id);if(r.settings.container){s=k.getElementById(r.settings.container)}s.removeChild(k.getElementById(v.inputContainer))});q({success:true})}});function b(){var q=false,o;function r(t,v){var s=q?0:-8*(v-1),w=0,u;for(u=0;u<v;u++){w|=(o.charCodeAt(t+u)<<Math.abs(s+u*8))}return w}function n(u,s,t){var t=arguments.length===3?t:o.length-s-1;o=o.substr(0,s)+u+o.substr(t+s)}function p(t,u,w){var x="",s=q?0:-8*(w-1),v;for(v=0;v<w;v++){x+=String.fromCharCode((u>>Math.abs(s+v*8))&255)}n(x,t,w)}return{II:function(s){if(s===e){return q}else{q=s}},init:function(s){q=false;o=s},SEGMENT:function(s,u,t){switch(arguments.length){case 1:return o.substr(s,o.length-s-1);case 2:return o.substr(s,u);case 3:n(t,s,u);break;default:return o}},BYTE:function(s){return r(s,1)},SHORT:function(s){return r(s,2)},LONG:function(s,t){if(t===e){return r(s,4)}else{p(s,t,4)}},SLONG:function(s){var t=r(s,4);return(t>2147483647?t-4294967296:t)},STRING:function(s,t){var u="";for(t+=s;s<t;s++){u+=String.fromCharCode(r(s,1))}return u}}}function f(s){var u={65505:{app:"EXIF",name:"APP1",signature:"Exif\0"},65506:{app:"ICC",name:"APP2",signature:"ICC_PROFILE\0"},65517:{app:"IPTC",name:"APP13",signature:"Photoshop 3.0\0"}},t=[],r,n,p=e,q=0,o;r=new b();r.init(s);if(r.SHORT(0)!==65496){return}n=2;o=Math.min(1048576,s.length);while(n<=o){p=r.SHORT(n);if(p>=65488&&p<=65495){n+=2;continue}if(p===65498||p===65497){break}q=r.SHORT(n+2)+2;if(u[p]&&r.STRING(n+4,u[p].signature.length)===u[p].signature){t.push({hex:p,app:u[p].app.toUpperCase(),name:u[p].name.toUpperCase(),start:n,length:q,segment:r.SEGMENT(n,q)})}n+=q}r.init(null);return{headers:t,restore:function(y){r.init(y);var w=new f(y);if(!w.headers){return false}for(var x=w.headers.length;x>0;x--){var z=w.headers[x-1];r.SEGMENT(z.start,z.length,"")}w.purge();n=r.SHORT(2)==65504?4+r.SHORT(4):2;for(var x=0,v=t.length;x<v;x++){r.SEGMENT(n,0,t[x].segment);n+=t[x].length}return r.SEGMENT()},get:function(x){var y=[];for(var w=0,v=t.length;w<v;w++){if(t[w].app===x.toUpperCase()){y.push(t[w].segment)}}return y},set:function(y,x){var z=[];if(typeof(x)==="string"){z.push(x)}else{z=x}for(var w=ii=0,v=t.length;w<v;w++){if(t[w].app===y.toUpperCase()){t[w].segment=z[ii];t[w].length=z[ii].length;ii++}if(ii>=z.length){break}}},purge:function(){t=[];r.init(null)}}}function a(){var q,n,o={},t;q=new b();n={tiff:{274:"Orientation",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}};t={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}};function p(u,C){var w=q.SHORT(u),z,F,G,B,A,v,x,D,E=[],y={};for(z=0;z<w;z++){x=v=u+12*z+2;G=C[q.SHORT(x)];if(G===e){continue}B=q.SHORT(x+=2);A=q.LONG(x+=2);x+=4;E=[];switch(B){case 1:case 7:if(A>4){x=q.LONG(x)+o.tiffHeader}for(F=0;F<A;F++){E[F]=q.BYTE(x+F)}break;case 2:if(A>4){x=q.LONG(x)+o.tiffHeader}y[G]=q.STRING(x,A-1);continue;case 3:if(A>2){x=q.LONG(x)+o.tiffHeader}for(F=0;F<A;F++){E[F]=q.SHORT(x+F*2)}break;case 4:if(A>1){x=q.LONG(x)+o.tiffHeader}for(F=0;F<A;F++){E[F]=q.LONG(x+F*4)}break;case 5:x=q.LONG(x)+o.tiffHeader;for(F=0;F<A;F++){E[F]=q.LONG(x+F*4)/q.LONG(x+F*4+4)}break;case 9:x=q.LONG(x)+o.tiffHeader;for(F=0;F<A;F++){E[F]=q.SLONG(x+F*4)}break;case 10:x=q.LONG(x)+o.tiffHeader;for(F=0;F<A;F++){E[F]=q.SLONG(x+F*4)/q.SLONG(x+F*4+4)}break;default:continue}D=(A==1?E[0]:E);if(t.hasOwnProperty(G)&&typeof D!="object"){y[G]=t[G][D]}else{y[G]=D}}return y}function s(){var v=e,u=o.tiffHeader;q.II(q.SHORT(u)==18761);if(q.SHORT(u+=2)!==42){return false}o.IFD0=o.tiffHeader+q.LONG(u+=2);v=p(o.IFD0,n.tiff);o.exifIFD=("ExifIFDPointer" in v?o.tiffHeader+v.ExifIFDPointer:e);o.gpsIFD=("GPSInfoIFDPointer" in v?o.tiffHeader+v.GPSInfoIFDPointer:e);return true}function r(w,u,z){var B,y,x,A=0;if(typeof(u)==="string"){var v=n[w.toLowerCase()];for(hex in v){if(v[hex]===u){u=hex;break}}}B=o[w.toLowerCase()+"IFD"];y=q.SHORT(B);for(i=0;i<y;i++){x=B+12*i+2;if(q.SHORT(x)==u){A=x+8;break}}if(!A){return false}q.LONG(A,z);return true}return{init:function(u){o={tiffHeader:10};if(u===e||!u.length){return false}q.init(u);if(q.SHORT(0)===65505&&q.STRING(4,5).toUpperCase()==="EXIF\0"){return s()}return false},EXIF:function(){var u;u=p(o.exifIFD,n.exif);if(u.ExifVersion){u.ExifVersion=String.fromCharCode(u.ExifVersion[0],u.ExifVersion[1],u.ExifVersion[2],u.ExifVersion[3])}return u},GPS:function(){var u;u=p(o.gpsIFD,n.gps);if(u.GPSVersionID){u.GPSVersionID=u.GPSVersionID.join(".")}return u},setExif:function(u,v){if(u!=="PixelXDimension"&&u!=="PixelYDimension"){return false}return r("exif",u,v)},getBinary:function(){return q.SEGMENT()}}}})(window,document,plupload);(function(d,a,b,c){function e(f){return a.getElementById(f)}b.runtimes.Html4=b.addRuntime("html4",{getFeatures:function(){var f=(function(){var l=navigator,k=l.userAgent,m=l.vendor,h,g,j;h=/WebKit/.test(k);j=h&&m.indexOf("Apple")!==-1;g=d.opera&&d.opera.buildNumber;return{ie:!h&&!g&&(/MSIE/gi).test(k)&&(/Explorer/gi).test(l.appName),webkit:h,gecko:!h&&/Gecko/.test(k),safari:j,safariwin:j&&navigator.platform.indexOf("Win")!==-1,opera:!!g}}());return{multipart:true,triggerDialog:(f.gecko&&d.FormData||f.webkit)}},init:function(f,g){f.bind("Init",function(p){var j=a.body,n,h="javascript",k,x,q,z=[],r=/MSIE/.test(navigator.userAgent),t=[],m=p.settings.filters,o,l,s,w;no_type_restriction:for(o=0;o<m.length;o++){l=m[o].extensions.split(/,/);for(w=0;w<l.length;w++){if(l[w]==="*"){t=[];break no_type_restriction}s=b.mimeTypes[l[w]];if(s){t.push(s)}}}t=t.join(",");function v(){var C,A,y,B;q=b.guid();z.push(q);C=a.createElement("form");C.setAttribute("id","form_"+q);C.setAttribute("method","post");C.setAttribute("enctype","multipart/form-data");C.setAttribute("encoding","multipart/form-data");C.setAttribute("target",p.id+"_iframe");C.style.position="absolute";A=a.createElement("input");A.setAttribute("id","input_"+q);A.setAttribute("type","file");A.setAttribute("accept",t);A.setAttribute("size",1);B=e(p.settings.browse_button);if(p.features.triggerDialog&&B){b.addEvent(e(p.settings.browse_button),"click",function(D){A.click();D.preventDefault()},p.id)}b.extend(A.style,{width:"100%",height:"100%",opacity:0,fontSize:"999px"});b.extend(C.style,{overflow:"hidden"});y=p.settings.shim_bgcolor;if(y){C.style.background=y}if(r){b.extend(A.style,{filter:"alpha(opacity=0)"})}b.addEvent(A,"change",function(G){var E=G.target,D,F=[],H;if(E.value){e("form_"+q).style.top=-1048575+"px";D=E.value.replace(/\\/g,"/");D=D.substring(D.length,D.lastIndexOf("/")+1);F.push(new b.File(q,D));if(!p.features.triggerDialog){b.removeAllEvents(C,p.id)}else{b.removeEvent(B,"click",p.id)}b.removeEvent(A,"change",p.id);v();if(F.length){f.trigger("FilesAdded",F)}}},p.id);C.appendChild(A);j.appendChild(C);p.refresh()}function u(){var y=a.createElement("div");y.innerHTML='<iframe id="'+p.id+'_iframe" name="'+p.id+'_iframe" src="'+h+':""" style="display:none"></iframe>';n=y.firstChild;j.appendChild(n);b.addEvent(n,"load",function(D){var E=D.target,C,A;if(!k){return}try{C=E.contentWindow.document||E.contentDocument||d.frames[E.id].document}catch(B){p.trigger("Error",{code:b.SECURITY_ERROR,message:b.translate("Security error."),file:k});return}A=C.documentElement.innerText||C.documentElement.textContent;if(A){k.status=b.DONE;k.loaded=1025;k.percent=100;p.trigger("UploadProgress",k);p.trigger("FileUploaded",k,{response:A})}},p.id)}if(p.settings.container){j=e(p.settings.container);if(b.getStyle(j,"position")==="static"){j.style.position="relative"}}p.bind("UploadFile",function(y,B){var C,A;if(B.status==b.DONE||B.status==b.FAILED||y.state==b.STOPPED){return}C=e("form_"+B.id);A=e("input_"+B.id);A.setAttribute("name",y.settings.file_data_name);C.setAttribute("action",y.settings.url);b.each(b.extend({name:B.target_name||B.name},y.settings.multipart_params),function(F,D){var E=a.createElement("input");b.extend(E,{type:"hidden",name:D,value:F});C.insertBefore(E,C.firstChild)});k=B;e("form_"+q).style.top=-1048575+"px";C.submit();C.parentNode.removeChild(C)});p.bind("FileUploaded",function(y){y.refresh()});p.bind("StateChanged",function(y){if(y.state==b.STARTED){u()}if(y.state==b.STOPPED){d.setTimeout(function(){b.removeEvent(n,"load",y.id);n.parentNode.removeChild(n)},0)}});p.bind("Refresh",function(A){var G,B,C,D,y,H,I,F,E;G=e(A.settings.browse_button);if(G){y=b.getPos(G,e(A.settings.container));H=b.getSize(G);I=e("form_"+q);F=e("input_"+q);b.extend(I.style,{top:y.y+"px",left:y.x+"px",width:H.w+"px",height:H.h+"px"});if(A.features.triggerDialog){if(b.getStyle(G,"position")==="static"){b.extend(G.style,{position:"relative"})}E=parseInt(G.style.zIndex,10);if(isNaN(E)){E=0}b.extend(G.style,{zIndex:E});b.extend(I.style,{zIndex:E-1})}C=A.settings.browse_button_hover;D=A.settings.browse_button_active;B=A.features.triggerDialog?G:I;if(C){b.addEvent(B,"mouseover",function(){b.addClass(G,C)},A.id);b.addEvent(B,"mouseout",function(){b.removeClass(G,C)},A.id)}if(D){b.addEvent(B,"mousedown",function(){b.addClass(G,D)},A.id);b.addEvent(a.body,"mouseup",function(){b.removeClass(G,D)},A.id)}}});f.bind("FilesRemoved",function(y,B){var A,C;for(A=0;A<B.length;A++){C=e("form_"+B[A].id);if(C){C.parentNode.removeChild(C)}}});f.bind("Destroy",function(y){var A,B,C,D={inputContainer:"form_"+q,inputFile:"input_"+q,browseButton:y.settings.browse_button};for(A in D){B=e(D[A]);if(B){b.removeAllEvents(B,y.id)}}b.removeAllEvents(a.body,y.id);b.each(z,function(F,E){C=e("form_"+F);if(C){j.removeChild(C)}})});v()});g({success:true})}})})(window,document,plupload);
|
|
|
|
static/js/plupload/plupload.silverlight.xap
DELETED
Binary file
|
views/admin/import/index.php
CHANGED
@@ -2,34 +2,8 @@
|
|
2 |
|
3 |
<img src="<?php echo PMXI_Plugin::ROOT_URL . '/static/img/soflyy-logo.png'; ?>" class="wpallimport-preload-image"/>
|
4 |
|
5 |
-
<?php
|
6 |
-
|
7 |
-
$l10n = array(
|
8 |
-
'queue_limit_exceeded' => 'You have attempted to queue too many files.',
|
9 |
-
'file_exceeds_size_limit' => 'This file exceeds the maximum upload size for this site.',
|
10 |
-
'zero_byte_file' => 'This file is empty. Please try another.',
|
11 |
-
'invalid_filetype' => 'This file type is not allowed. Please try another.',
|
12 |
-
'default_error' => 'An error occurred in the upload. Please try again later.',
|
13 |
-
'missing_upload_url' => 'There was a configuration error. Please contact the server administrator.',
|
14 |
-
'upload_limit_exceeded' => 'You may only upload 1 file.',
|
15 |
-
'http_error' => 'HTTP Error: Click here for our <a href="http://www.wpallimport.com/documentation/advanced/troubleshooting/" target="_blank">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to upload a file.',
|
16 |
-
'upload_failed' => 'Upload failed.',
|
17 |
-
'io_error' => 'IO error.',
|
18 |
-
'security_error' => 'Security error.',
|
19 |
-
'file_cancelled' => 'File canceled.',
|
20 |
-
'upload_stopped' => 'Upload stopped.',
|
21 |
-
'dismiss' => 'Dismiss',
|
22 |
-
'crunching' => 'Crunching…',
|
23 |
-
'deleted' => 'moved to the trash.',
|
24 |
-
'error_uploading' => 'has failed to upload due to an error',
|
25 |
-
'cancel_upload' => 'Cancel upload',
|
26 |
-
'dismiss' => 'Dismiss'
|
27 |
-
);
|
28 |
-
|
29 |
-
?>
|
30 |
<script type="text/javascript">
|
31 |
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
32 |
-
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
33 |
</script>
|
34 |
|
35 |
<table class="wpallimport-layout wpallimport-step-1">
|
@@ -116,7 +90,7 @@ $l10n = array(
|
|
116 |
<span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
|
117 |
</div>
|
118 |
<div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
|
119 |
-
<?php _e('<strong>Hint:</strong> After you create this import, you can schedule it to run automatically, on a pre-defined schedule, with cron jobs.
|
120 |
<div class="wpallimport-free-edition-notice" style="display:none;">
|
121 |
<a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1748&edd_options%5Bprice_id%5D=0&utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from URL', 'wp_all_import_plugin');?></a>
|
122 |
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
@@ -224,7 +198,9 @@ $l10n = array(
|
|
224 |
<div class="wpallimport-existing-records"><?php _e('Import to existing', 'wp_all_import_plugin'); ?></div>
|
225 |
</div>
|
226 |
<div class="wpallimport-extra-text-right">
|
227 |
-
<div class="wpallimport-new-records"><?php _e('for each record in my data file.', 'wp_all_import_plugin');
|
|
|
|
|
228 |
<div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', 'wp_all_import_plugin'); ?>
|
229 |
<a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" original-title="The Existing Items option is commonly used to update existing products with new stock quantities while leaving all their other data alone, update properties on your site with new pricing, etc. <br/><br/> In Step 4, you will map the records in your file to the existing items on your site and specify which data points will be updated and which will be left alone.">?</a>
|
230 |
</div>
|
2 |
|
3 |
<img src="<?php echo PMXI_Plugin::ROOT_URL . '/static/img/soflyy-logo.png'; ?>" class="wpallimport-preload-image"/>
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
<script type="text/javascript">
|
6 |
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
|
|
7 |
</script>
|
8 |
|
9 |
<table class="wpallimport-layout wpallimport-step-1">
|
90 |
<span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
|
91 |
</div>
|
92 |
<div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
|
93 |
+
<?php _e('<strong>Hint:</strong> After you create this import, you can schedule it to run automatically, on a pre-defined schedule, with cron jobs.', 'wp_all_import_plugin'); ?>
|
94 |
<div class="wpallimport-free-edition-notice" style="display:none;">
|
95 |
<a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=1748&edd_options%5Bprice_id%5D=0&utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the Pro edition of WP All Import to Download from URL', 'wp_all_import_plugin');?></a>
|
96 |
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
198 |
<div class="wpallimport-existing-records"><?php _e('Import to existing', 'wp_all_import_plugin'); ?></div>
|
199 |
</div>
|
200 |
<div class="wpallimport-extra-text-right">
|
201 |
+
<div class="wpallimport-new-records"><?php _e('for each record in my data file.', 'wp_all_import_plugin'); ?>
|
202 |
+
<a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" original-title="The New Items option is commonly used to import new posts or products to your site without touching the existing records.<br/><br/>If the import is later run again with modified data, WP All Import will only update/remove posts created by this import.">?</a>
|
203 |
+
</div>
|
204 |
<div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', 'wp_all_import_plugin'); ?>
|
205 |
<a class="wpallimport-help" href="#help" style="position: relative; top: -2px;" original-title="The Existing Items option is commonly used to update existing products with new stock quantities while leaving all their other data alone, update properties on your site with new pricing, etc. <br/><br/> In Step 4, you will map the records in your file to the existing items on your site and specify which data points will be updated and which will be left alone.">?</a>
|
206 |
</div>
|
views/admin/import/options/_import_file.php
CHANGED
@@ -1,31 +1,5 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$l10n = array(
|
4 |
-
'queue_limit_exceeded' => 'You have attempted to queue too many files.',
|
5 |
-
'file_exceeds_size_limit' => 'This file exceeds the maximum upload size for this site.',
|
6 |
-
'zero_byte_file' => 'This file is empty. Please try another.',
|
7 |
-
'invalid_filetype' => 'This file type is not allowed. Please try another.',
|
8 |
-
'default_error' => 'An error occurred in the upload. Please try again later.',
|
9 |
-
'missing_upload_url' => 'There was a configuration error. Please contact the server administrator.',
|
10 |
-
'upload_limit_exceeded' => 'You may only upload 1 file.',
|
11 |
-
'http_error' => 'HTTP Error: Click here for our <a href="http://www.wpallimport.com/documentation/advanced/troubleshooting/" target="_blank">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to upload a file.',
|
12 |
-
'upload_failed' => 'Upload failed.',
|
13 |
-
'io_error' => 'IO error.',
|
14 |
-
'security_error' => 'Security error.',
|
15 |
-
'file_cancelled' => 'File canceled.',
|
16 |
-
'upload_stopped' => 'Upload stopped.',
|
17 |
-
'dismiss' => 'Dismiss',
|
18 |
-
'crunching' => 'Crunching…',
|
19 |
-
'deleted' => 'moved to the trash.',
|
20 |
-
'error_uploading' => 'has failed to upload due to an error',
|
21 |
-
'cancel_upload' => 'Cancel upload',
|
22 |
-
'dismiss' => 'Dismiss'
|
23 |
-
);
|
24 |
-
|
25 |
-
?>
|
26 |
<script type="text/javascript">
|
27 |
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
28 |
-
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
29 |
</script>
|
30 |
|
31 |
<div class="change_file">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<script type="text/javascript">
|
2 |
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
|
|
3 |
</script>
|
4 |
|
5 |
<div class="change_file">
|
views/admin/import/options/_reimport_options.php
CHANGED
@@ -122,8 +122,12 @@
|
|
122 |
<div class="input">
|
123 |
<input type="hidden" name="is_update_comment_status" value="0" />
|
124 |
<input type="checkbox" id="is_update_comment_status" name="is_update_comment_status" value="1" <?php echo $post['is_update_comment_status'] ? 'checked="checked"': '' ?> />
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
127 |
<div class="input">
|
128 |
<input type="hidden" name="is_update_attachments" value="0" />
|
129 |
<input type="checkbox" id="is_update_attachments" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
|
122 |
<div class="input">
|
123 |
<input type="hidden" name="is_update_comment_status" value="0" />
|
124 |
<input type="checkbox" id="is_update_comment_status" name="is_update_comment_status" value="1" <?php echo $post['is_update_comment_status'] ? 'checked="checked"': '' ?> />
|
125 |
+
<?php if ($post_type == 'product' and class_exists('PMWI_Plugin')): ?>
|
126 |
+
<label for="is_update_comment_status"><?php _e('Enable review setting', 'wp_all_import_plugin') ?></label>
|
127 |
+
<?php else: ?>
|
128 |
+
<label for="is_update_comment_status"><?php _e('Comment status', 'wp_all_import_plugin') ?></label>
|
129 |
+
<?php endif;?>
|
130 |
+
</div>
|
131 |
<div class="input">
|
132 |
<input type="hidden" name="is_update_attachments" value="0" />
|
133 |
<input type="checkbox" id="is_update_attachments" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
|
views/admin/import/options/_reimport_template.php
CHANGED
@@ -66,6 +66,7 @@
|
|
66 |
<?php if ( $this->isWizard ):?>
|
67 |
<p class="drag_an_element_ico"><?php _e('Drag an element, or combo of elements, to the box above. The Unique Identifier should be unique for each record in your file, and should stay the same even if your file is updated. Things like product IDs, titles, and SKUs are good Unique Identifiers because they probably won\'t change. Don\'t use a description or price, since that might be changed.', 'wp_all_import_plugin'); ?></p>
|
68 |
<p class="info_ico"><?php printf(__('If you run this import again with an updated file, the Unique Identifier allows WP All Import to correctly link the records in your updated file with the %s it will create right now. If multiple records in this file have the same Unique Identifier, only the first will be created. The others will be detected as duplicates.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></p>
|
|
|
69 |
<?php endif; ?>
|
70 |
</div>
|
71 |
|
66 |
<?php if ( $this->isWizard ):?>
|
67 |
<p class="drag_an_element_ico"><?php _e('Drag an element, or combo of elements, to the box above. The Unique Identifier should be unique for each record in your file, and should stay the same even if your file is updated. Things like product IDs, titles, and SKUs are good Unique Identifiers because they probably won\'t change. Don\'t use a description or price, since that might be changed.', 'wp_all_import_plugin'); ?></p>
|
68 |
<p class="info_ico"><?php printf(__('If you run this import again with an updated file, the Unique Identifier allows WP All Import to correctly link the records in your updated file with the %s it will create right now. If multiple records in this file have the same Unique Identifier, only the first will be created. The others will be detected as duplicates.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></p>
|
69 |
+
<p class="new_element_ico"><?php _e('In Step 1 you selected New Items. So, if you run this import again WP All Import will only try to update records that were created by this import. It will never update, modify, or remove posts that were not created by this import. If you want to match records in your file to records that already exist on this site, select Existing Items in Step 1.', 'wp_all_import_plugin'); ?></p>
|
70 |
<?php endif; ?>
|
71 |
</div>
|
72 |
|
views/admin/import/preview_taxonomies.php
CHANGED
@@ -42,7 +42,7 @@
|
|
42 |
|
43 |
if ( ! empty($terms_a) and is_array($terms_a)){
|
44 |
foreach ($terms_a as $lvl => $term) {
|
45 |
-
if ( ! empty($post['tax_mapping'][$ctx])){
|
46 |
$mapping_rules = json_decode($post['tax_mapping'][$ctx], true);
|
47 |
if ( ! empty($mapping_rules) ){
|
48 |
foreach ($mapping_rules as $rule_number => $rule) {
|
@@ -53,9 +53,11 @@
|
|
53 |
}
|
54 |
}
|
55 |
}
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
59 |
}
|
60 |
}
|
61 |
else{
|
42 |
|
43 |
if ( ! empty($terms_a) and is_array($terms_a)){
|
44 |
foreach ($terms_a as $lvl => $term) {
|
45 |
+
if ( ! empty($post['tax_mapping'][$ctx]) and empty($post['tax_logic_mapping'][$ctx])){
|
46 |
$mapping_rules = json_decode($post['tax_mapping'][$ctx], true);
|
47 |
if ( ! empty($mapping_rules) ){
|
48 |
foreach ($mapping_rules as $rule_number => $rule) {
|
53 |
}
|
54 |
}
|
55 |
}
|
56 |
+
if (!empty($term)) {
|
57 |
+
?>
|
58 |
+
<p><?php echo str_pad(trim($term), strlen(trim($term)) + $lvl, "-", STR_PAD_LEFT); ?></p>
|
59 |
+
<?php
|
60 |
+
}
|
61 |
}
|
62 |
}
|
63 |
else{
|
views/admin/import/template.php
CHANGED
@@ -38,7 +38,13 @@
|
|
38 |
<div class="wpallimport-collapsed wpallimport-section">
|
39 |
<div class="wpallimport-content-section" style="overflow: hidden; padding-bottom: 0;">
|
40 |
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
</div>
|
43 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
44 |
|
@@ -53,7 +59,7 @@
|
|
53 |
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
|
54 |
|
55 |
<?php wp_editor($post['content'], 'content', array(
|
56 |
-
'teeny' => true,
|
57 |
'editor_class' => 'wpallimport-plugin-editor',
|
58 |
'media_buttons' => false,
|
59 |
'editor_height' => 200));
|
@@ -64,7 +70,12 @@
|
|
64 |
|
65 |
<?php if ( post_type_supports( $post_type, 'excerpt' ) ):?>
|
66 |
<div class="template_input">
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
</div>
|
69 |
<?php endif; ?>
|
70 |
|
38 |
<div class="wpallimport-collapsed wpallimport-section">
|
39 |
<div class="wpallimport-content-section" style="overflow: hidden; padding-bottom: 0;">
|
40 |
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
41 |
+
<?php if ( $post_type == 'taxonomies' ){ ?>
|
42 |
+
<h3><?php _e('Name & Description', 'wp_all_import_plugin'); ?></h3>
|
43 |
+
<?php } elseif ( $post_type == 'product'){ ?>
|
44 |
+
<h3><?php _e('Title & Description', 'wp_all_import_plugin'); ?></h3>
|
45 |
+
<?php } else { ?>
|
46 |
+
<h3><?php _e('Title & Content', 'wp_all_import_plugin'); ?></h3>
|
47 |
+
<?php } ?>
|
48 |
</div>
|
49 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
50 |
|
59 |
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
|
60 |
|
61 |
<?php wp_editor($post['content'], 'content', array(
|
62 |
+
//'teeny' => true,
|
63 |
'editor_class' => 'wpallimport-plugin-editor',
|
64 |
'media_buttons' => false,
|
65 |
'editor_height' => 200));
|
70 |
|
71 |
<?php if ( post_type_supports( $post_type, 'excerpt' ) ):?>
|
72 |
<div class="template_input">
|
73 |
+
<?php if ($post_type == 'product' and class_exists('PMWI_Plugin')): ?>
|
74 |
+
<h3><?php _e('Short Description', 'wp_all_import_plugin'); ?></h3>
|
75 |
+
<input type="text" name="post_excerpt" style="width:100%; line-height: 25px;" value="<?php echo esc_attr($post['post_excerpt']) ?>"/>
|
76 |
+
<?php else: ?>
|
77 |
+
<input type="text" name="post_excerpt" style="width:100%; line-height: 25px;" value="<?php echo esc_attr($post['post_excerpt']) ?>" placeholder="<?php _e('Excerpt', 'wp_all_import_plugin'); ?>"/>
|
78 |
+
<?php endif; ?>
|
79 |
</div>
|
80 |
<?php endif; ?>
|
81 |
|
views/admin/import/template/_nested_template.php
CHANGED
@@ -1,32 +1,7 @@
|
|
1 |
<?php $custom_type = get_post_type_object( $post_type ); ?>
|
2 |
-
<?php
|
3 |
|
4 |
-
$l10n = array(
|
5 |
-
'queue_limit_exceeded' => 'You have attempted to queue too many files.',
|
6 |
-
'file_exceeds_size_limit' => 'This file exceeds the maximum upload size for this site.',
|
7 |
-
'zero_byte_file' => 'This file is empty. Please try another.',
|
8 |
-
'invalid_filetype' => 'This file type is not allowed. Please try another.',
|
9 |
-
'default_error' => 'An error occurred in the upload. Please try again later.',
|
10 |
-
'missing_upload_url' => 'There was a configuration error. Please contact the server administrator.',
|
11 |
-
'upload_limit_exceeded' => 'You may only upload 1 file.',
|
12 |
-
'http_error' => 'HTTP Error: Click here for our <a href="http://www.wpallimport.com/documentation/advanced/troubleshooting/" target="_blank">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to upload a file.',
|
13 |
-
'upload_failed' => 'Upload failed.',
|
14 |
-
'io_error' => 'IO error.',
|
15 |
-
'security_error' => 'Security error.',
|
16 |
-
'file_cancelled' => 'File canceled.',
|
17 |
-
'upload_stopped' => 'Upload stopped.',
|
18 |
-
'dismiss' => 'Dismiss',
|
19 |
-
'crunching' => 'Crunching…',
|
20 |
-
'deleted' => 'moved to the trash.',
|
21 |
-
'error_uploading' => 'has failed to upload due to an error',
|
22 |
-
'cancel_upload' => 'Cancel upload',
|
23 |
-
'dismiss' => 'Dismiss'
|
24 |
-
);
|
25 |
-
|
26 |
-
?>
|
27 |
<script type="text/javascript">
|
28 |
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
29 |
-
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
30 |
</script>
|
31 |
|
32 |
<div class="wpallimport-collapsed closed nested_options wpallimport-section">
|
1 |
<?php $custom_type = get_post_type_object( $post_type ); ?>
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
<script type="text/javascript">
|
4 |
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
|
|
5 |
</script>
|
6 |
|
7 |
<div class="wpallimport-collapsed closed nested_options wpallimport-section">
|
views/admin/import/template/_other_template.php
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
<div class="switcher-target-status_xpath">
|
30 |
<div class="input">
|
31 |
<input type="text" class="smaller-text" name="status_xpath" style="width:190px;" value="<?php echo esc_attr($post['status_xpath']) ?>"/>
|
32 |
-
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'publish\', \'draft\', \'trash\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
|
33 |
</div>
|
34 |
</div>
|
35 |
</div>
|
29 |
<div class="switcher-target-status_xpath">
|
30 |
<div class="input">
|
31 |
<input type="text" class="smaller-text" name="status_xpath" style="width:190px;" value="<?php echo esc_attr($post['status_xpath']) ?>"/>
|
32 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'publish\', \'draft\', \'trash\', \'private\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
|
33 |
</div>
|
34 |
</div>
|
35 |
</div>
|