Version Description
- fixed updating import settings
Download this release
Release Info
Developer | soflyy |
Plugin | Import any XML or CSV File to WordPress |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.1.5 to 3.2.1
- actions/admin_head.php +25 -0
- actions/admin_init.php +51 -1
- actions/admin_menu.php +2 -1
- actions/admin_notices.php +94 -20
- actions/wp.php +1 -3
- actions/wp_ajax_auto_detect_cf.php +57 -0
- actions/wp_ajax_auto_detect_sf.php +49 -0
- actions/wp_ajax_import_failed.php +17 -0
- actions/wp_ajax_nested_merge.php +36 -0
- actions/wp_ajax_nested_xpath.php +60 -0
- actions/wp_ajax_parse_nested_file.php +155 -0
- actions/wp_ajax_test_images.php +93 -0
- actions/wp_ajax_unmerge_file.php +29 -0
- actions/wp_loaded.php +172 -1
- actions/wp_session_garbage_collection.php +0 -65
- classes/arrayaccess.php +0 -140
- classes/chunk.php +10 -5
- classes/handler.php +138 -0
- classes/helper.php +10 -10
- classes/nested.php +88 -0
- classes/render.php +290 -0
- classes/session.php +91 -373
- classes/upload.php +762 -0
- config/options.php +5 -2
- controllers/admin/history.php +119 -0
- controllers/admin/import.php +1505 -974
- controllers/admin/license.php +190 -0
- controllers/admin/manage.php +119 -132
- controllers/admin/settings.php +180 -32
- controllers/controller.php +31 -0
- controllers/controller/admin.php +14 -7
- filters/.gitkeep +0 -0
- helpers/pmxi_ctx_mapping.php +15 -0
- helpers/pmxi_findDuplicates.php +77 -35
- helpers/pmxi_functions.php +210 -37
- helpers/pmxi_insert_post.php +4 -4
- helpers/pmxi_json_to_xml.php +8 -0
- helpers/pmxi_recursion_taxes.php +49 -30
- helpers/reverse_taxonomies_html.php +4 -7
- i18n/languages/.gitkeep +0 -0
- libraries/XmlImportCsvParse.php +41 -22
- libraries/XmlImportSQLParse.php +119 -0
- libraries/XmlImportTemplateCodeGenerator.php +2 -1
- libraries/XmlImportTemplateParser.php +2 -1
- libraries/XmlImportTemplateScanner.php +44 -20
- libraries/cache/.gitkeep +0 -0
- libraries/pclzip.lib.php +1 -1
- models/file/record.php +6 -6
- models/history/list.php +9 -0
- models/history/record.php +25 -0
- models/import/record.php +913 -822
- models/model.php +2 -2
- models/model/list.php +1 -1
- plugin.php +267 -102
- readme.txt +16 -1
- schema.php +23 -9
- shortcodes/.gitkeep +0 -0
- static/css/admin-wp-3.8.css +12 -13
- static/css/admin-wp-4.0.css +0 -0
- static/css/admin.css +2944 -1106
- static/css/custom-editor-style.css +4 -0
- static/img/help.png +0 -0
- static/img/loading-step-2.gif +0 -0
- static/img/loading.png +0 -0
- static/img/preloader.gif +0 -0
- static/img/soflyy-logo.png +0 -0
- static/img/success.png +0 -0
- static/img/ui_4.0/add.png +0 -0
- static/img/ui_4.0/back.png +0 -0
- static/img/ui_4.0/bottom_arrow.png +0 -0
- static/img/ui_4.0/change.png +0 -0
- static/img/ui_4.0/cloud.png +0 -0
- static/img/ui_4.0/cloud_url.png +0 -0
- static/img/ui_4.0/collapser.png +0 -0
- static/img/ui_4.0/completed.png +0 -0
- static/img/ui_4.0/continue.png +0 -0
- static/img/ui_4.0/drag.png +0 -0
- static/img/ui_4.0/element_arrow.png +0 -0
- static/img/ui_4.0/elements.png +0 -0
- static/img/ui_4.0/elements_notify.png +0 -0
- static/img/ui_4.0/file_sprite.png +0 -0
- static/img/ui_4.0/future_step.png +0 -0
- static/img/ui_4.0/icon_cpt.png +0 -0
- static/img/ui_4.0/import_history.png +0 -0
- static/img/ui_4.0/info.png +0 -0
- static/img/ui_4.0/left_btn.png +0 -0
- static/img/ui_4.0/list.png +0 -0
- static/img/ui_4.0/logo.png +0 -0
- static/img/ui_4.0/logo_small.png +0 -0
- static/img/ui_4.0/manage_imports.png +0 -0
- static/img/ui_4.0/remove.png +0 -0
- static/img/ui_4.0/right_btn.png +0 -0
- static/img/ui_4.0/rule.png +0 -0
- static/img/ui_4.0/save_btn.png +0 -0
- static/img/ui_4.0/select_files.png +0 -0
- static/img/ui_4.0/step.png +0 -0
- static/img/ui_4.0/step_1_bar.png +0 -0
- static/img/ui_4.0/step_2_bar.png +0 -0
- static/img/ui_4.0/step_3_bar.png +0 -0
- static/img/ui_4.0/step_4_bar.png +0 -0
- static/img/ui_4.0/step_5_bar.png +0 -0
- static/img/ui_4.0/step_6_bar.png +0 -0
- static/img/ui_4.0/support.png +0 -0
- static/img/ui_4.0/tip.png +0 -0
- static/img/ui_4.0/trash.png +0 -0
- static/img/ui_4.0/upload_sprite.png +0 -0
- static/img/ui_4.0/url.png +0 -0
- static/img/ui_4.0/url_sprite.png +0 -0
- static/img/ui_4.0/use_existing_file.png +0 -0
- static/img/ui_4.0/use_existing_green.png +0 -0
- static/img/ui_4.0/view_log.png +0 -0
- static/img/ui_4.0/zip.png +0 -0
- static/img/xmlicon.png +0 -0
- static/js/admin.js +1125 -354
- static/js/jquery/browserplus-min.js +8 -0
- static/js/jquery/css/redmond/jquery-ui.css +13 -13
- static/js/jquery/css/select2/select2.css +23 -18
- static/js/jquery/jquery.ddslick.min.js +1 -0
- static/js/jquery/jquery.mjs.nestedSortable.js +10 -10
- static/js/jquery/jquery.ui-contextmenu.min.js +2 -0
- static/js/jquery/select2.min.js +2 -2
- static/js/plupload/wplupload.js +41 -24
- static/js/pmxi.js +3 -5
- views/admin/help/index.php +6 -9
- views/admin/history/index.php +237 -0
- views/admin/import/confirm.php +312 -0
- views/admin/import/element.php +204 -102
- views/admin/import/element_after.php +0 -93
- views/admin/import/evaluate.php +14 -5
- views/admin/import/evaluate_variations.php +6 -6
- views/admin/import/index.php +208 -84
- views/admin/import/options.php +70 -128
- views/admin/import/options/_author_template.php +0 -32
- views/admin/import/options/_buttons_template.php +11 -8
- views/admin/import/options/_categories_template.php +0 -76
- views/admin/import/options/_custom_fields_template.php +0 -257
- views/admin/import/options/_featured_template.php +0 -76
- views/admin/import/options/_import_file.php +113 -0
- views/admin/import/options/_main_options_template.php +0 -119
- views/admin/import/options/_reimport_options.php +205 -0
- views/admin/import/options/_reimport_template.php +90 -252
- views/admin/import/options/_scheduling_template.php +0 -39
- views/admin/import/options/_settings_template.php +132 -79
- views/admin/import/options/_taxonomies_template.php +0 -79
- views/admin/import/preview.php +21 -16
- views/admin/import/preview_images.php +103 -0
- views/admin/import/preview_prices.php +23 -0
- views/admin/import/preview_taxonomies.php +1 -0
actions/admin_head.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function pmxi_admin_head(){
|
3 |
+
?>
|
4 |
+
<style type="text/css">
|
5 |
+
#toplevel_page_pmxi-admin-home ul li:last-child{
|
6 |
+
display: none;
|
7 |
+
}
|
8 |
+
</style>
|
9 |
+
<?php
|
10 |
+
$input = new PMXI_Input();
|
11 |
+
$import_id = $input->get('id', false);
|
12 |
+
$import_action = $input->get('action', false);
|
13 |
+
if ($import_id){
|
14 |
+
?>
|
15 |
+
<script type="text/javascript">
|
16 |
+
var import_id = '<?php echo $import_id; ?>';
|
17 |
+
</script>
|
18 |
+
<?php
|
19 |
+
}
|
20 |
+
?>
|
21 |
+
<script type="text/javascript">
|
22 |
+
var import_action = '<?php echo $import_action; ?>';
|
23 |
+
</script>
|
24 |
+
<?php
|
25 |
+
}
|
actions/admin_init.php
CHANGED
@@ -1,9 +1,59 @@
|
|
1 |
<?php
|
2 |
|
3 |
function pmxi_admin_init(){
|
|
|
4 |
wp_enqueue_script('pmxi-script', PMXI_ROOT_URL . '/static/js/pmxi.js', array('jquery'), PMXI_VERSION);
|
5 |
|
6 |
@ini_set('mysql.connect_timeout', 300);
|
7 |
-
@ini_set('default_socket_timeout', 300);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
}
|
1 |
<?php
|
2 |
|
3 |
function pmxi_admin_init(){
|
4 |
+
|
5 |
wp_enqueue_script('pmxi-script', PMXI_ROOT_URL . '/static/js/pmxi.js', array('jquery'), PMXI_VERSION);
|
6 |
|
7 |
@ini_set('mysql.connect_timeout', 300);
|
8 |
+
@ini_set('default_socket_timeout', 300);
|
9 |
+
|
10 |
+
// PressTrends Account API Key
|
11 |
+
$api_key = 'xz614vukf9fcl3w100g1zvnzeenphzti6vt4';
|
12 |
+
$auth = 'mnqfv85ftc98zpkgheiz16qzry9g87s6k';
|
13 |
+
// Start of Metrics
|
14 |
+
global $wpdb;
|
15 |
+
$data = get_transient( 'presstrends_cache_data' );
|
16 |
+
if ( !$data || $data == '' ) {
|
17 |
+
$api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update?auth=';
|
18 |
+
$url = $api_base . $auth . '&api=' . $api_key . '';
|
19 |
+
$count_posts = wp_count_posts();
|
20 |
+
$count_pages = wp_count_posts( 'page' );
|
21 |
+
$comments_count = wp_count_comments();
|
22 |
+
if ( function_exists( 'wp_get_theme' ) ) {
|
23 |
+
$theme_data = wp_get_theme();
|
24 |
+
$theme_name = urlencode( $theme_data->Name );
|
25 |
+
} else {
|
26 |
+
$theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
|
27 |
+
$theme_name = $theme_data['Name'];
|
28 |
+
}
|
29 |
+
$plugin_name = '&';
|
30 |
+
foreach ( get_plugins() as $plugin_info ) {
|
31 |
+
$plugin_name .= $plugin_info['Name'] . '&';
|
32 |
+
}
|
33 |
+
// CHANGE __FILE__ PATH IF LOCATED OUTSIDE MAIN PLUGIN FILE
|
34 |
+
$plugin_data = get_plugin_data( __FILE__ );
|
35 |
+
$posts_with_comments = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' AND comment_count > 0" );
|
36 |
+
$data = array(
|
37 |
+
'url' => base64_encode(site_url()),
|
38 |
+
'posts' => $count_posts->publish,
|
39 |
+
'pages' => $count_pages->publish,
|
40 |
+
'comments' => $comments_count->total_comments,
|
41 |
+
'approved' => $comments_count->approved,
|
42 |
+
'spam' => $comments_count->spam,
|
43 |
+
'pingbacks' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ),
|
44 |
+
'post_conversion' => ( $count_posts->publish > 0 && $posts_with_comments > 0 ) ? number_format( ( $posts_with_comments / $count_posts->publish ) * 100, 0, '.', '' ) : 0,
|
45 |
+
'theme_version' => $plugin_data['Version'],
|
46 |
+
'theme_name' => $theme_name,
|
47 |
+
'site_name' => str_replace( ' ', '', get_bloginfo( 'name' ) ),
|
48 |
+
'plugins' => count( get_option( 'active_plugins' ) ),
|
49 |
+
'plugin' => urlencode( $plugin_name ),
|
50 |
+
'wpversion' => get_bloginfo( 'version' ),
|
51 |
+
);
|
52 |
+
foreach ( $data as $k => $v ) {
|
53 |
+
$url .= '&' . $k . '=' . $v . '';
|
54 |
+
}
|
55 |
+
wp_remote_get( $url );
|
56 |
+
set_transient( 'presstrends_cache_data', $data, 60 * 60 * 24 );
|
57 |
+
}
|
58 |
|
59 |
}
|
actions/admin_menu.php
CHANGED
@@ -12,7 +12,8 @@ function pmxi_admin_menu() {
|
|
12 |
array('pmxi-admin-import', __('New Import', 'pmxi_plugin')),
|
13 |
array('pmxi-admin-manage' , __('Manage Imports', 'pmxi_plugin')),
|
14 |
array('pmxi-admin-settings', __('Settings', 'pmxi_plugin')),
|
15 |
-
array('pmxi-admin-help', __('Support', 'pmxi_plugin'))
|
|
|
16 |
);
|
17 |
|
18 |
$wpai_menu = apply_filters('pmxi_admin_menu', $wpai_menu);
|
12 |
array('pmxi-admin-import', __('New Import', 'pmxi_plugin')),
|
13 |
array('pmxi-admin-manage' , __('Manage Imports', 'pmxi_plugin')),
|
14 |
array('pmxi-admin-settings', __('Settings', 'pmxi_plugin')),
|
15 |
+
array('pmxi-admin-help', __('Support', 'pmxi_plugin')),
|
16 |
+
array('pmxi-admin-history', __('History', 'pmxi_plugin')),
|
17 |
);
|
18 |
|
19 |
$wpai_menu = apply_filters('pmxi_admin_menu', $wpai_menu);
|
actions/admin_notices.php
CHANGED
@@ -2,50 +2,96 @@
|
|
2 |
|
3 |
function pmxi_admin_notices() {
|
4 |
// notify user if history folder is not writable
|
5 |
-
$uploads = wp_upload_dir();
|
6 |
|
7 |
-
|
|
|
8 |
?>
|
9 |
<div class="error"><p>
|
10 |
<?php printf(
|
11 |
-
__('<b>%s Plugin</b>:
|
12 |
-
|
13 |
-
$uploads['basedir'] . '/wpallimport_history'
|
14 |
) ?>
|
15 |
</p></div>
|
16 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
-
//
|
20 |
-
if (
|
21 |
?>
|
22 |
-
<div class="
|
23 |
<?php printf(
|
24 |
-
__('
|
|
|
25 |
) ?>
|
26 |
</p></div>
|
27 |
<?php
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
-
|
|
|
31 |
?>
|
32 |
<div class="error"><p>
|
33 |
<?php printf(
|
34 |
-
__('<b>%s Plugin</b>: Please update your WP All Import
|
35 |
-
|
36 |
) ?>
|
37 |
</p></div>
|
38 |
<?php
|
39 |
|
40 |
-
if (defined('
|
41 |
{
|
42 |
-
deactivate_plugins(
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
}
|
50 |
|
51 |
$input = new PMXI_Input();
|
@@ -59,4 +105,32 @@ function pmxi_admin_notices() {
|
|
59 |
<?php
|
60 |
}
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
2 |
|
3 |
function pmxi_admin_notices() {
|
4 |
// notify user if history folder is not writable
|
5 |
+
$uploads = wp_upload_dir();
|
6 |
|
7 |
+
// compare woocommerce add-on version
|
8 |
+
if ( class_exists( 'PMWI_Plugin' ) and ( defined('PMWI_VERSION') and version_compare(PMWI_VERSION, '2.0.0-beta1') < 0 and PMWI_EDITION == 'paid' or defined('PMWI_FREE_VERSION') and version_compare(PMWI_FREE_VERSION, '1.2.0') < 0 and PMWI_EDITION == 'free') ) {
|
9 |
?>
|
10 |
<div class="error"><p>
|
11 |
<?php printf(
|
12 |
+
__('<b>%s Plugin</b>: Please update your WP All Import WooCommerce add-on to the latest version</a>', 'pmwi_plugin'),
|
13 |
+
PMWI_Plugin::getInstance()->getName()
|
|
|
14 |
) ?>
|
15 |
</p></div>
|
16 |
<?php
|
17 |
+
|
18 |
+
if (defined('PMWI_EDITION') and PMWI_EDITION == 'paid')
|
19 |
+
{
|
20 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/plugin.php');
|
21 |
+
}
|
22 |
+
else
|
23 |
+
{
|
24 |
+
deactivate_plugins( PMWI_FREE_ROOT_DIR . '/plugin.php');
|
25 |
+
}
|
26 |
+
|
27 |
}
|
28 |
|
29 |
+
// compare ACF add-on
|
30 |
+
if ( class_exists( 'PMAI_Plugin' ) and defined('PMAI_VERSION') and version_compare(PMAI_VERSION, '3.0.0-beta1') < 0 and PMAI_EDITION == 'paid' ) {
|
31 |
?>
|
32 |
+
<div class="error"><p>
|
33 |
<?php printf(
|
34 |
+
__('<b>%s Plugin</b>: Please update your WP All Import ACF add-on to the latest version</a>', 'pmwi_plugin'),
|
35 |
+
PMAI_Plugin::getInstance()->getName()
|
36 |
) ?>
|
37 |
</p></div>
|
38 |
<?php
|
39 |
+
|
40 |
+
if (defined('PMAI_EDITION') and PMAI_EDITION == 'paid')
|
41 |
+
{
|
42 |
+
deactivate_plugins( PMAI_ROOT_DIR . '/plugin.php');
|
43 |
+
}
|
44 |
}
|
45 |
|
46 |
+
// compare Linkcloak add-on
|
47 |
+
if ( class_exists( 'PMLCA_Plugin' ) and defined('PMLCA_VERSION') and version_compare(PMLCA_VERSION, '1.0.0-beta1') < 0 and PMLCA_EDITION == 'paid' ) {
|
48 |
?>
|
49 |
<div class="error"><p>
|
50 |
<?php printf(
|
51 |
+
__('<b>%s Plugin</b>: Please update your WP All Import Linkcloak add-on to the latest version</a>', 'pmwi_plugin'),
|
52 |
+
PMLCA_Plugin::getInstance()->getName()
|
53 |
) ?>
|
54 |
</p></div>
|
55 |
<?php
|
56 |
|
57 |
+
if (defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid')
|
58 |
{
|
59 |
+
deactivate_plugins( PMLCA_ROOT_DIR . '/plugin.php');
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
// compare User add-on
|
64 |
+
if ( class_exists( 'PMUI_Plugin' ) and defined('PMUI_VERSION') and version_compare(PMUI_VERSION, '1.0.0-beta1') < 0 and PMUI_EDITION == 'paid' ) {
|
65 |
+
?>
|
66 |
+
<div class="error"><p>
|
67 |
+
<?php printf(
|
68 |
+
__('<b>%s Plugin</b>: Please update your WP All Import User add-on to the latest version</a>', 'pmwi_plugin'),
|
69 |
+
PMUI_Plugin::getInstance()->getName()
|
70 |
+
) ?>
|
71 |
+
</p></div>
|
72 |
+
<?php
|
73 |
+
|
74 |
+
if (defined('PMUI_EDITION') and PMUI_EDITION == 'paid')
|
75 |
+
{
|
76 |
+
deactivate_plugins( PMUI_ROOT_DIR . '/plugin.php');
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
// compare WPML add-on
|
81 |
+
if ( class_exists( 'PMLI_Plugin' ) and defined('PMLI_VERSION') and version_compare(PMLI_VERSION, '1.0.0-beta1') < 0 and PMLI_EDITION == 'paid' ) {
|
82 |
+
?>
|
83 |
+
<div class="error"><p>
|
84 |
+
<?php printf(
|
85 |
+
__('<b>%s Plugin</b>: Please update your WP All Import WPML add-on to the latest version</a>', 'pmwi_plugin'),
|
86 |
+
PMLI_Plugin::getInstance()->getName()
|
87 |
+
) ?>
|
88 |
+
</p></div>
|
89 |
+
<?php
|
90 |
+
|
91 |
+
if (defined('PMLI_EDITION') and PMLI_EDITION == 'paid')
|
92 |
+
{
|
93 |
+
deactivate_plugins( PMLI_ROOT_DIR . '/plugin.php');
|
94 |
+
}
|
95 |
}
|
96 |
|
97 |
$input = new PMXI_Input();
|
105 |
<?php
|
106 |
}
|
107 |
}
|
108 |
+
$warnings = $input->get('warnings', array());
|
109 |
+
if ($warnings) {
|
110 |
+
is_array($warnings) or $warnings = explode(',', $warnings);
|
111 |
+
foreach ($warnings as $code) {
|
112 |
+
switch ($code) {
|
113 |
+
case 1:
|
114 |
+
$m = __('<strong>Warning:</strong> your title is blank.', 'pmxi_plugin');
|
115 |
+
break;
|
116 |
+
case 2:
|
117 |
+
$m = __('<strong>Warning:</strong> your content is blank.', 'pmxi_plugin');
|
118 |
+
break;
|
119 |
+
case 3:
|
120 |
+
$m = __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=images" target="_blank">upgrade to the professional edition of WP All Import</a> to import images. The settings you configured in the images section will be ignored.', 'pmxi_plugin');
|
121 |
+
break;
|
122 |
+
case 4:
|
123 |
+
$m = __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=custom-fields" target="_blank">upgrade to the professional edition of WP All Import</a> to import data to Custom Fields. The settings you configured in the Custom Fields section will be ignored.', 'pmxi_plugin');
|
124 |
+
break;
|
125 |
+
default:
|
126 |
+
$m = false;
|
127 |
+
break;
|
128 |
+
}
|
129 |
+
if ($m):
|
130 |
+
?>
|
131 |
+
<div class="error"><p><?php echo $m ?></p></div>
|
132 |
+
<?php
|
133 |
+
endif;
|
134 |
+
}
|
135 |
+
}
|
136 |
}
|
actions/wp.php
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
<?php
|
2 |
|
3 |
function pmxi_wp() {
|
4 |
-
|
5 |
-
wp_schedule_event( time(), 'twicedaily', 'wp_session_garbage_collection' );
|
6 |
-
}
|
7 |
}
|
1 |
<?php
|
2 |
|
3 |
function pmxi_wp() {
|
4 |
+
|
|
|
|
|
5 |
}
|
actions/wp_ajax_auto_detect_cf.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function pmxi_wp_ajax_auto_detect_cf(){
|
3 |
+
|
4 |
+
$input = new PMXI_Input();
|
5 |
+
$fields = $input->post('fields', array());
|
6 |
+
$post_type = $input->post('post_type', 'post');
|
7 |
+
global $wpdb;
|
8 |
+
|
9 |
+
$ignoreFields = array('_thumbnail_id', '_product_image_gallery', '_default_attributes', '_product_attributes');
|
10 |
+
|
11 |
+
$result = array();
|
12 |
+
|
13 |
+
if ($fields) {
|
14 |
+
is_array($fields) or $fields = array($fields);
|
15 |
+
foreach ($fields as $field) {
|
16 |
+
if ($post_type == 'import_users'){
|
17 |
+
$values = $wpdb->get_results("
|
18 |
+
SELECT DISTINCT usermeta.meta_value
|
19 |
+
FROM ".$wpdb->usermeta." as usermeta
|
20 |
+
WHERE usermeta.meta_key='".$field."'
|
21 |
+
", ARRAY_A);
|
22 |
+
}
|
23 |
+
else{
|
24 |
+
$values = $wpdb->get_results("
|
25 |
+
SELECT DISTINCT postmeta.meta_value
|
26 |
+
FROM ".$wpdb->postmeta." as postmeta
|
27 |
+
WHERE postmeta.meta_key='".$field."'
|
28 |
+
", ARRAY_A);
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( ! empty($values) ){
|
32 |
+
foreach ($values as $key => $value) {
|
33 |
+
if ( ! empty($value['meta_value']) and !empty($field) and ! in_array($field, $ignoreFields)) {
|
34 |
+
$result[] = array(
|
35 |
+
'key' => $field,
|
36 |
+
'val' => $value['meta_value'],
|
37 |
+
'is_serialized' => is_serialized($value['meta_value'])
|
38 |
+
);
|
39 |
+
break;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
if (empty($result)){
|
47 |
+
$custom_type = get_post_type_object( $post_type );
|
48 |
+
$msg = sprintf(__('No Custom Fields are present in your database for %s', 'pmxi_plugin'), $custom_type->labels->name);
|
49 |
+
}
|
50 |
+
elseif (count($result) === 1)
|
51 |
+
$msg = sprintf(__('%s field was automatically detected.', 'pmxi_plugin'), count($result));
|
52 |
+
else{
|
53 |
+
$msg = sprintf(__('%s fields were automatically detected.', 'pmxi_plugin'), count($result));
|
54 |
+
}
|
55 |
+
|
56 |
+
exit( json_encode(array('result' => $result, 'msg' => $msg)) );
|
57 |
+
}
|
actions/wp_ajax_auto_detect_sf.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function pmxi_wp_ajax_auto_detect_sf(){
|
3 |
+
|
4 |
+
$input = new PMXI_Input();
|
5 |
+
$fieldName = $input->post('name', '');
|
6 |
+
$post_type = $input->post('post_type', 'post');
|
7 |
+
global $wpdb;
|
8 |
+
|
9 |
+
$result = array();
|
10 |
+
|
11 |
+
if ($fieldName) {
|
12 |
+
|
13 |
+
if ($post_type == 'import_users'){
|
14 |
+
$values = $wpdb->get_results("
|
15 |
+
SELECT DISTINCT usermeta.meta_value
|
16 |
+
FROM ".$wpdb->usermeta." as usermeta
|
17 |
+
WHERE usermeta.meta_key='".$fieldName."'
|
18 |
+
", ARRAY_A);
|
19 |
+
}
|
20 |
+
else{
|
21 |
+
$values = $wpdb->get_results("
|
22 |
+
SELECT DISTINCT postmeta.meta_value
|
23 |
+
FROM ".$wpdb->postmeta." as postmeta
|
24 |
+
WHERE postmeta.meta_key='".$fieldName."'
|
25 |
+
", ARRAY_A);
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( ! empty($values) ){
|
29 |
+
foreach ($values as $key => $value) {
|
30 |
+
if ( ! empty($value['meta_value']) and is_serialized($value['meta_value'])){
|
31 |
+
$v = unserialize($value['meta_value']);
|
32 |
+
if ( ! empty($v) and is_array($v) ){
|
33 |
+
foreach ($v as $skey => $svalue) {
|
34 |
+
$result[] = array(
|
35 |
+
'key' => $skey,
|
36 |
+
'val' => maybe_serialize($svalue),
|
37 |
+
);
|
38 |
+
}
|
39 |
+
break;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
exit( json_encode(array('result' => $result)) );
|
48 |
+
|
49 |
+
}
|
actions/wp_ajax_import_failed.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function pmxi_wp_ajax_import_failed(){
|
3 |
+
extract($_POST);
|
4 |
+
$import = new PMXI_Import_record();
|
5 |
+
$import->getbyId($id);
|
6 |
+
$result = false;
|
7 |
+
if ( ! $import->isEmpty()){
|
8 |
+
$import->set(array(
|
9 |
+
'executing' => 0,
|
10 |
+
'last_activity' => date('Y-m-d H:i:s'),
|
11 |
+
'failed' => 1,
|
12 |
+
'failed_on' => date('Y-m-d H:i:s')
|
13 |
+
))->save();
|
14 |
+
$result = true;
|
15 |
+
}
|
16 |
+
exit( json_encode( array('result' => $result)));
|
17 |
+
}
|
actions/wp_ajax_nested_merge.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function pmxi_wp_ajax_nested_merge(){
|
4 |
+
|
5 |
+
extract($_POST);
|
6 |
+
|
7 |
+
PMXI_Plugin::$session = PMXI_Session::get_instance();
|
8 |
+
|
9 |
+
/*$nested_file = array(
|
10 |
+
'file' => $filePath,
|
11 |
+
'source' => $realPath,
|
12 |
+
'xpath' => $customXpath,
|
13 |
+
'root_element' => $root_element,
|
14 |
+
'main_xml_field' => $main_xml_field,
|
15 |
+
'child_xml_field' => $child_xml_field
|
16 |
+
); */
|
17 |
+
|
18 |
+
$nested_files = (empty(PMXI_Plugin::$session->options['nested_files'])) ? array() : json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
19 |
+
|
20 |
+
$nested_files[] = $filePath;
|
21 |
+
|
22 |
+
$options = PMXI_Plugin::$session->options;
|
23 |
+
$options['nested_files'] = json_encode($nested_files);
|
24 |
+
|
25 |
+
PMXI_Plugin::$session->set('options', $options);
|
26 |
+
|
27 |
+
PMXI_Plugin::$session->save_data();
|
28 |
+
|
29 |
+
exit( json_encode(array(
|
30 |
+
'success' => true,
|
31 |
+
//'source' => $realPath,
|
32 |
+
'nested_files' => $nested_files
|
33 |
+
)));
|
34 |
+
|
35 |
+
die;
|
36 |
+
}
|
actions/wp_ajax_nested_xpath.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function pmxi_wp_ajax_nested_xpath(){
|
4 |
+
|
5 |
+
extract($_POST);
|
6 |
+
|
7 |
+
$result = array();
|
8 |
+
|
9 |
+
if ( @file_exists($filePath) ){
|
10 |
+
|
11 |
+
$file = new PMXI_Chunk($filePath, array('element' => $root_element, 'encoding' => 'UTF-8'));
|
12 |
+
|
13 |
+
$tagno = 0;
|
14 |
+
$loop = 0;
|
15 |
+
$count = 0;
|
16 |
+
$xml_tree = '';
|
17 |
+
|
18 |
+
while ($xml = $file->read()) {
|
19 |
+
|
20 |
+
if ( ! empty($xml) )
|
21 |
+
{
|
22 |
+
PMXI_Import_Record::preprocessXml($xml);
|
23 |
+
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . $xml;
|
24 |
+
|
25 |
+
if ( '' != $customXpath){
|
26 |
+
$dom = new DOMDocument('1.0', 'UTF-8');
|
27 |
+
$old = libxml_use_internal_errors(true);
|
28 |
+
$dom->loadXML($xml);
|
29 |
+
libxml_use_internal_errors($old);
|
30 |
+
$xpath = new DOMXPath($dom);
|
31 |
+
if (($elements = $xpath->query($customXpath)) and $elements->length){
|
32 |
+
$loop++;
|
33 |
+
$count += $elements->length;
|
34 |
+
if ( ! $tagno or $loop == $tagno ){
|
35 |
+
ob_start();
|
36 |
+
PMXI_Render::render_xml_element($elements->item(0), true);
|
37 |
+
$xml_tree = ob_get_clean();
|
38 |
+
$tagno = 1;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
else {
|
43 |
+
exit(json_encode(array('success' => false, 'msg' => __('XPath is required', 'pmxi_plugin'))));
|
44 |
+
die;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
unset($file);
|
49 |
+
}
|
50 |
+
else{
|
51 |
+
exit(json_encode(array('success' => false, 'msg' => 'File path is required', 'pmxi_plugin'))); die;
|
52 |
+
}
|
53 |
+
|
54 |
+
exit(json_encode(array(
|
55 |
+
'success' => true,
|
56 |
+
'xml_tree' => $xml_tree,
|
57 |
+
'count' => (($count) ? sprintf("<p class='green pmxi_counter'>" . __('Elements founded', 'pmxi_pligun') . " <strong>%s</strong></p>", $count) : "<p class='red pmxi_counter'>" . __('Elements not found', 'pmxi_pligun') . "</p>")
|
58 |
+
))); die;
|
59 |
+
|
60 |
+
}
|
actions/wp_ajax_parse_nested_file.php
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* Ajax action that will parse nested XML/CSV files
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
function pmxi_wp_ajax_parse_nested_file(){
|
8 |
+
|
9 |
+
extract($_POST);
|
10 |
+
|
11 |
+
$result = array();
|
12 |
+
|
13 |
+
$wp_uploads = wp_upload_dir();
|
14 |
+
|
15 |
+
if ( ! empty($_POST['nested_type']) ){
|
16 |
+
|
17 |
+
$root_element = '';
|
18 |
+
$feed_type = '';
|
19 |
+
$errors = new WP_Error();
|
20 |
+
|
21 |
+
switch ($_POST['nested_type']){
|
22 |
+
|
23 |
+
case 'upload':
|
24 |
+
|
25 |
+
$uploader = new PMXI_Upload($_POST['nested_filepath'], $errors);
|
26 |
+
$upload_result = $uploader->upload();
|
27 |
+
|
28 |
+
if ($upload_result instanceof WP_Error){
|
29 |
+
$errors = $upload_result;
|
30 |
+
}
|
31 |
+
else{
|
32 |
+
$source = $upload_result['source'];
|
33 |
+
$filePath = $upload_result['filePath'];
|
34 |
+
if ( ! empty($upload_result['root_element']))
|
35 |
+
$root_element = $upload_result['root_element'];
|
36 |
+
}
|
37 |
+
|
38 |
+
break;
|
39 |
+
|
40 |
+
case 'url':
|
41 |
+
|
42 |
+
$uploader = new PMXI_Upload($_POST['nested_url'], $errors);
|
43 |
+
$upload_result = $uploader->url();
|
44 |
+
|
45 |
+
if ($upload_result instanceof WP_Error){
|
46 |
+
$errors = $upload_result;
|
47 |
+
}
|
48 |
+
else{
|
49 |
+
$source = $upload_result['source'];
|
50 |
+
$filePath = $upload_result['filePath'];
|
51 |
+
if ( ! empty($upload_result['root_element']))
|
52 |
+
$root_element = $upload_result['root_element'];
|
53 |
+
$feed_type = $upload_result['feed_type'];
|
54 |
+
}
|
55 |
+
|
56 |
+
break;
|
57 |
+
|
58 |
+
case 'file':
|
59 |
+
|
60 |
+
$uploader = new PMXI_Upload($_POST['nested_file'], $errors);
|
61 |
+
$upload_result = $uploader->file();
|
62 |
+
|
63 |
+
if ($upload_result instanceof WP_Error){
|
64 |
+
$errors = $upload_result;
|
65 |
+
}
|
66 |
+
else{
|
67 |
+
$source = $upload_result['source'];
|
68 |
+
$filePath = $upload_result['filePath'];
|
69 |
+
if ( ! empty($upload_result['root_element']))
|
70 |
+
$root_element = $upload_result['root_element'];
|
71 |
+
}
|
72 |
+
|
73 |
+
break;
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
if ( $errors->get_error_codes() )
|
78 |
+
{
|
79 |
+
$msgs = $errors->get_error_messages();
|
80 |
+
ob_start();
|
81 |
+
?>
|
82 |
+
<?php foreach ($msgs as $msg): ?>
|
83 |
+
<div class="error"><p><?php echo $msg ?></p></div>
|
84 |
+
<?php endforeach ?>
|
85 |
+
<?php
|
86 |
+
exit(json_encode(array(
|
87 |
+
'success' => false,
|
88 |
+
'errors' => ob_get_clean()
|
89 |
+
))); die;
|
90 |
+
}
|
91 |
+
else
|
92 |
+
{
|
93 |
+
|
94 |
+
$xml_tree = '';
|
95 |
+
|
96 |
+
if ( @file_exists($filePath) ){
|
97 |
+
|
98 |
+
$file = new PMXI_Chunk($filePath, array('element' => $root_element));
|
99 |
+
|
100 |
+
if ( ! empty($file->options['element']) ) {
|
101 |
+
$customXpath = "/".$file->options['element'];
|
102 |
+
$elements_cloud = $file->cloud;
|
103 |
+
}
|
104 |
+
|
105 |
+
$root_element = $file->options['element'];
|
106 |
+
|
107 |
+
$file = new PMXI_Chunk($filePath, array('element' => $root_element, 'encoding' => 'UTF-8'));
|
108 |
+
|
109 |
+
$tagno = 0;
|
110 |
+
$loop = 0;
|
111 |
+
$count = 0;
|
112 |
+
|
113 |
+
while ($xml = $file->read()) {
|
114 |
+
|
115 |
+
if ( ! empty($xml) )
|
116 |
+
{
|
117 |
+
PMXI_Import_Record::preprocessXml($xml);
|
118 |
+
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . $xml;
|
119 |
+
|
120 |
+
if ( '' != $customXpath){
|
121 |
+
$dom = new DOMDocument('1.0', 'UTF-8');
|
122 |
+
$old = libxml_use_internal_errors(true);
|
123 |
+
$dom->loadXML($xml);
|
124 |
+
libxml_use_internal_errors($old);
|
125 |
+
$xpath = new DOMXPath($dom);
|
126 |
+
if (($elements = $xpath->query($customXpath)) and $elements->length){
|
127 |
+
$loop++;
|
128 |
+
$count += $elements->length;
|
129 |
+
if ( ! $tagno or $loop == $tagno ){
|
130 |
+
ob_start();
|
131 |
+
PMXI_Render::render_xml_element($elements->item(0), true);
|
132 |
+
$xml_tree = ob_get_clean();
|
133 |
+
$tagno = 1;
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
else break;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
unset($file);
|
141 |
+
}
|
142 |
+
|
143 |
+
exit(json_encode(array(
|
144 |
+
'success' => true,
|
145 |
+
'source' => $source,
|
146 |
+
'realpath' => $source['path'],
|
147 |
+
'filePath' => $filePath,
|
148 |
+
'root_element' => $root_element,
|
149 |
+
'xml_tree' => $xml_tree,
|
150 |
+
'xpath' => $customXpath,
|
151 |
+
'count' => (($count) ? sprintf("<p class='green pmxi_counter'>" . __('Elements founded', 'pmxi_pligun') . " <strong>%s</strong></p>", $count) : "<p class='red pmxi_counter'>" . __('Elements not found', 'pmxi_pligun') . "</p>")
|
152 |
+
))); die;
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
actions/wp_ajax_test_images.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function pmxi_wp_ajax_test_images(){
|
4 |
+
|
5 |
+
extract($_POST);
|
6 |
+
|
7 |
+
$result = array();
|
8 |
+
|
9 |
+
$wp_uploads = wp_upload_dir();
|
10 |
+
$imgs_basedir = $wp_uploads['basedir'] . '/wpallimport/files/';
|
11 |
+
$targetDir = $wp_uploads['path']; // . '/wpallimport/uploads';
|
12 |
+
$success_images = 0;
|
13 |
+
$success_msg = '';
|
14 |
+
|
15 |
+
$failed_msgs = array();
|
16 |
+
|
17 |
+
if ( ! @is_writable($targetDir) )
|
18 |
+
{
|
19 |
+
$failed_msgs[] = sprintf(__('Uploads folder `%s` is not writable.', 'pmxi_plugin'), $targetDir);
|
20 |
+
}
|
21 |
+
else{
|
22 |
+
|
23 |
+
if ( 'no' == $download ){
|
24 |
+
|
25 |
+
if ( ! empty($imgs) ){
|
26 |
+
|
27 |
+
foreach ($imgs as $img) {
|
28 |
+
|
29 |
+
if ( preg_match('%^(http|https|ftp|ftps)%i', $img)){
|
30 |
+
$failed_msgs[] = sprintf(__('Use image name instead of URL `%s`.', 'pmxi_plugin'), $img);
|
31 |
+
continue;
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( @file_exists($imgs_basedir . $img) ){
|
35 |
+
if (@is_readable($imgs_basedir . $img)){
|
36 |
+
$success_images++;
|
37 |
+
} else{
|
38 |
+
$failed_msgs[] = sprintf(__('File `%s` isn\'t readable'), preg_replace('%.*/wp-content%', '/wp-content', $imgs_basedir . $img));
|
39 |
+
}
|
40 |
+
}
|
41 |
+
else{
|
42 |
+
$failed_msgs[] = sprintf(__('File `%s` doesn\'t exist'), preg_replace('%.*/wp-content%', '/wp-content', $imgs_basedir . $img));
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
if ((int)$success_images === 1)
|
47 |
+
$success_msg = sprintf(__('%d image was successfully retrieved from `%s/wpallimport/files`', 'pmxi_plugin'), $success_images, preg_replace('%.*/wp-content%', '/wp-content', $wp_uploads['basedir']));
|
48 |
+
elseif ((int)$success_images > 1)
|
49 |
+
$success_msg = sprintf(__('%d images were successfully retrieved from `%s/wpallimport/files`', 'pmxi_plugin'), $success_images, preg_replace('%.*/wp-content%', '/wp-content', $wp_uploads['basedir']));
|
50 |
+
}
|
51 |
+
else {
|
52 |
+
|
53 |
+
$start = time();
|
54 |
+
if ( ! empty($imgs) ){
|
55 |
+
|
56 |
+
foreach ($imgs as $img) {
|
57 |
+
|
58 |
+
if ( ! preg_match('%^(http|https|ftp|ftps)%i', $img)){
|
59 |
+
$failed_msgs[] = sprintf(__('URL `%s` is not valid.', 'pmxi_plugin'), $img);
|
60 |
+
continue;
|
61 |
+
}
|
62 |
+
|
63 |
+
$image_name = wp_unique_filename($targetDir, 'test');
|
64 |
+
$image_filepath = $targetDir . '/' . $image_name;
|
65 |
+
|
66 |
+
$request = get_file_curl($img, $image_filepath);
|
67 |
+
|
68 |
+
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($img))) {
|
69 |
+
$failed_msgs[] = (is_wp_error($request)) ? $request->get_error_message() : sprintf(__('File `%s` cannot be saved locally', 'pmxi_plugin'), $img);
|
70 |
+
} elseif( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
71 |
+
$failed_msgs[] = sprintf(__('File `%s` is not a valid image.', 'pmxi_plugin'), $img);
|
72 |
+
} else {
|
73 |
+
$success_images++;
|
74 |
+
}
|
75 |
+
@unlink($image_filepath);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
$time = time() - $start;
|
79 |
+
|
80 |
+
if ((int)$success_images === 1)
|
81 |
+
$success_msg = sprintf(__('%d image was successfully downloaded in %s seconds', 'pmxi_plugin'), $success_images, number_format($time, 2));
|
82 |
+
elseif ((int)$success_images > 1)
|
83 |
+
$success_msg = sprintf(__('%d images were successfully downloaded in %s seconds', 'pmxi_plugin'), $success_images, number_format($time, 2));
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
exit(json_encode(array(
|
88 |
+
'success_images' => $success_images,
|
89 |
+
'success_msg' => $success_msg,
|
90 |
+
'failed_msgs' => $failed_msgs
|
91 |
+
))); die;
|
92 |
+
|
93 |
+
}
|
actions/wp_ajax_unmerge_file.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function pmxi_wp_ajax_unmerge_file(){
|
3 |
+
|
4 |
+
extract($_POST);
|
5 |
+
|
6 |
+
PMXI_Plugin::$session = PMXI_Session::get_instance();
|
7 |
+
|
8 |
+
if ( ! empty(PMXI_Plugin::$session->options['nested_files'])){
|
9 |
+
|
10 |
+
$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
11 |
+
|
12 |
+
unset($nested_files[$source]);
|
13 |
+
|
14 |
+
$options = PMXI_Plugin::$session->options;
|
15 |
+
$options['nested_files'] = json_encode($nested_files);
|
16 |
+
|
17 |
+
PMXI_Plugin::$session->set('options', $options);
|
18 |
+
|
19 |
+
PMXI_Plugin::$session->save_data();
|
20 |
+
|
21 |
+
exit( json_encode(array(
|
22 |
+
'success' => true,
|
23 |
+
'nested_files' => $nested_files
|
24 |
+
)));
|
25 |
+
die;
|
26 |
+
}
|
27 |
+
|
28 |
+
exit( json_encode(array('success' => false)) ); die;
|
29 |
+
}
|
actions/wp_loaded.php
CHANGED
@@ -3,6 +3,177 @@
|
|
3 |
function pmxi_wp_loaded() {
|
4 |
|
5 |
@ini_set("max_input_time", PMXI_Plugin::getInstance()->getOption('max_input_time'));
|
6 |
-
@ini_set("max_execution_time", PMXI_Plugin::getInstance()->getOption('max_execution_time'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
}
|
3 |
function pmxi_wp_loaded() {
|
4 |
|
5 |
@ini_set("max_input_time", PMXI_Plugin::getInstance()->getOption('max_input_time'));
|
6 |
+
@ini_set("max_execution_time", PMXI_Plugin::getInstance()->getOption('max_execution_time'));
|
7 |
+
|
8 |
+
$table = PMXI_Plugin::getInstance()->getTablePrefix() . 'imports';
|
9 |
+
global $wpdb;
|
10 |
+
$imports = $wpdb->get_results("SELECT `id`, `name`, `path` FROM $table WHERE `path` IS NULL", ARRAY_A);
|
11 |
+
|
12 |
+
if ( ! empty($imports) ){
|
13 |
+
|
14 |
+
$importRecord = new PMXI_Import_Record();
|
15 |
+
$importRecord->clear();
|
16 |
+
foreach ($imports as $imp) {
|
17 |
+
$importRecord->getById($imp['id']);
|
18 |
+
if ( ! $importRecord->isEmpty()){
|
19 |
+
$importRecord->delete( true );
|
20 |
+
}
|
21 |
+
$importRecord->clear();
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
/* Check if cron is manualy, then execute import */
|
27 |
+
$cron_job_key = PMXI_Plugin::getInstance()->getOption('cron_job_key');
|
28 |
+
|
29 |
+
if (!empty($cron_job_key) and !empty($_GET['import_id']) and !empty($_GET['import_key']) and $_GET['import_key'] == $cron_job_key and !empty($_GET['action']) and in_array($_GET['action'], array('processing','trigger','pipe'))) {
|
30 |
+
|
31 |
+
$logger = create_function('$m', 'echo "<p>$m</p>\\n";');
|
32 |
+
|
33 |
+
$import = new PMXI_Import_Record();
|
34 |
+
|
35 |
+
$ids = explode(',', $_GET['import_id']);
|
36 |
+
|
37 |
+
if (!empty($ids) and is_array($ids)){
|
38 |
+
|
39 |
+
foreach ($ids as $id) { if (empty($id)) continue;
|
40 |
+
|
41 |
+
$import->getById($id);
|
42 |
+
|
43 |
+
if ( ! $import->isEmpty() ){
|
44 |
+
|
45 |
+
if ( ! in_array($import->type, array('url', 'ftp', 'file')) ) {
|
46 |
+
$logger and call_user_func($logger, sprintf(__('Scheduling update is not working with "upload" import type. Import #%s.', 'pmxi_plugin'), $id));
|
47 |
+
}
|
48 |
+
|
49 |
+
switch ($_GET['action']) {
|
50 |
+
|
51 |
+
case 'trigger':
|
52 |
+
|
53 |
+
if ( (int) $import->executing ){
|
54 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s is currently in manually process. Request skipped.', 'pmxi_plugin'), $id));
|
55 |
+
}
|
56 |
+
elseif ( ! $import->processing and ! $import->triggered ){
|
57 |
+
|
58 |
+
$import->set(array(
|
59 |
+
'triggered' => 1,
|
60 |
+
'imported' => 0,
|
61 |
+
'created' => 0,
|
62 |
+
'updated' => 0,
|
63 |
+
'skipped' => 0,
|
64 |
+
'deleted' => 0,
|
65 |
+
'queue_chunk_number' => 0,
|
66 |
+
'last_activity' => date('Y-m-d H:i:s')
|
67 |
+
))->update();
|
68 |
+
|
69 |
+
$history_log = new PMXI_History_Record();
|
70 |
+
$history_log->set(array(
|
71 |
+
'import_id' => $import->id,
|
72 |
+
'date' => date('Y-m-d H:i:s'),
|
73 |
+
'type' => 'trigger',
|
74 |
+
'summary' => __("triggered by cron", "pmxi_plugin")
|
75 |
+
))->save();
|
76 |
+
|
77 |
+
$logger and call_user_func($logger, sprintf(__('#%s Cron job triggered.', 'pmxi_plugin'), $id));
|
78 |
+
|
79 |
+
}
|
80 |
+
elseif( $import->processing and ! $import->triggered) {
|
81 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s currently in process. Request skipped.', 'pmxi_plugin'), $id));
|
82 |
+
}
|
83 |
+
elseif( ! $import->processing and $import->triggered){
|
84 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s already triggered. Request skipped.', 'pmxi_plugin'), $id));
|
85 |
+
}
|
86 |
+
|
87 |
+
break;
|
88 |
+
|
89 |
+
case 'processing':
|
90 |
+
|
91 |
+
if ( $import->processing == 1 and (time() - strtotime($import->registered_on)) > ((PMXI_Plugin::getInstance()->getOption('cron_processing_time_limit')) ? PMXI_Plugin::getInstance()->getOption('cron_processing_time_limit') : 120)){ // it means processor crashed, so it will reset processing to false, and terminate. Then next run it will work normally.
|
92 |
+
$import->set(array(
|
93 |
+
'processing' => 0
|
94 |
+
))->update();
|
95 |
+
}
|
96 |
+
|
97 |
+
// start execution imports that is in the cron process
|
98 |
+
if ( ! (int) $import->triggered ){
|
99 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s is not triggered. Request skipped.', 'pmxi_plugin'), $id));
|
100 |
+
}
|
101 |
+
elseif ( (int) $import->executing ){
|
102 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s is currently in manually process. Request skipped.', 'pmxi_plugin'), $id));
|
103 |
+
}
|
104 |
+
elseif ( (int) $import->triggered and ! (int) $import->processing ){
|
105 |
+
|
106 |
+
$log_storage = (int) PMXI_Plugin::getInstance()->getOption('log_storage');
|
107 |
+
|
108 |
+
// unlink previous logs
|
109 |
+
$by = array();
|
110 |
+
$by[] = array(array('import_id' => $id, 'type NOT LIKE' => 'trigger'), 'AND');
|
111 |
+
$historyLogs = new PMXI_History_List();
|
112 |
+
$historyLogs->setColumns('id', 'import_id', 'type', 'date')->getBy($by, 'id ASC');
|
113 |
+
if ($historyLogs->count() and $historyLogs->count() >= $log_storage ){
|
114 |
+
$logsToRemove = $historyLogs->count() - $log_storage;
|
115 |
+
foreach ($historyLogs as $i => $file){
|
116 |
+
$historyRecord = new PMXI_History_Record();
|
117 |
+
$historyRecord->getBy('id', $file['id']);
|
118 |
+
if ( ! $historyRecord->isEmpty()) $historyRecord->delete( false ); // unlink history file only
|
119 |
+
if ($i == $logsToRemove)
|
120 |
+
break;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$history_log = new PMXI_History_Record();
|
125 |
+
$history_log->set(array(
|
126 |
+
'import_id' => $import->id,
|
127 |
+
'date' => date('Y-m-d H:i:s'),
|
128 |
+
'type' => 'processing',
|
129 |
+
'summary' => __("cron processing", "pmxi_plugin")
|
130 |
+
))->save();
|
131 |
+
|
132 |
+
if ($log_storage){
|
133 |
+
$wp_uploads = wp_upload_dir();
|
134 |
+
$log_file = pmxi_secure_file( $wp_uploads['basedir'] . "/wpallimport/logs", 'logs', $history_log->id ) . '/' . $history_log->id . '.html';
|
135 |
+
if ( @file_exists($log_file) ) pmxi_remove_source($log_file, false);
|
136 |
+
}
|
137 |
+
|
138 |
+
ob_start();
|
139 |
+
|
140 |
+
$import->set(array('canceled' => 0, 'failed' => 0))->execute($logger, true, $history_log->id);
|
141 |
+
|
142 |
+
$log_data = ob_get_clean();
|
143 |
+
|
144 |
+
if ($log_storage){
|
145 |
+
$log = @fopen($log_file, 'a+');
|
146 |
+
@fwrite($log, $log_data);
|
147 |
+
@fclose($log);
|
148 |
+
}
|
149 |
+
|
150 |
+
if ( ! (int) $import->queue_chunk_number ){
|
151 |
+
|
152 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s complete', 'pmxi_plugin'), $import->id));
|
153 |
+
|
154 |
+
}
|
155 |
+
else{
|
156 |
+
|
157 |
+
$logger and call_user_func($logger, sprintf(__('Records Count %s', 'pmxi_plugin'), (int) $import->count));
|
158 |
+
$logger and call_user_func($logger, sprintf(__('Records Processed %s', 'pmxi_plugin'), (int) $import->queue_chunk_number));
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
}
|
163 |
+
else {
|
164 |
+
$logger and call_user_func($logger, sprintf(__('Import #%s already processing. Request skipped.', 'pmxi_plugin'), $id));
|
165 |
+
}
|
166 |
+
|
167 |
+
break;
|
168 |
+
case 'pipe':
|
169 |
+
|
170 |
+
$import->execute($logger);
|
171 |
+
|
172 |
+
break;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
|
179 |
}
|
actions/wp_session_garbage_collection.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function pmxi_wp_session_garbage_collection() {
|
4 |
-
global $wpdb;
|
5 |
-
|
6 |
-
if ( defined( 'WP_SETUP_CONFIG' ) ) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
$session_mode = PMXI_Plugin::getInstance()->getOption('session_mode');
|
11 |
-
|
12 |
-
if ( ! defined( 'WP_INSTALLING' ) ) {
|
13 |
-
if ($session_mode == 'database'){
|
14 |
-
$expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_pmxi_session_expires_%'" );
|
15 |
-
|
16 |
-
$now = time();
|
17 |
-
$expired_sessions = array();
|
18 |
-
|
19 |
-
foreach( $expiration_keys as $expiration ) {
|
20 |
-
// If the session has expired
|
21 |
-
if ( $now > intval( $expiration->option_value ) ) {
|
22 |
-
// Get the session ID by parsing the option_name
|
23 |
-
$session_id = str_replace("_pmxi_session_expires_", "", $expiration->option_name);
|
24 |
-
|
25 |
-
$expired_sessions[] = $expiration->option_name;
|
26 |
-
$expired_sessions[] = "_pmxi_session_$session_id";
|
27 |
-
}
|
28 |
-
}
|
29 |
-
|
30 |
-
// Delete all expired sessions in a single query
|
31 |
-
if ( ! empty( $expired_sessions ) ) {
|
32 |
-
$option_names = implode( "','", $expired_sessions );
|
33 |
-
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" );
|
34 |
-
}
|
35 |
-
}
|
36 |
-
elseif ($session_mode == 'files'){
|
37 |
-
$session_files = scandir( PMXI_ROOT_DIR . '/sessions');
|
38 |
-
|
39 |
-
if (!empty($session_files)){
|
40 |
-
$now = time();
|
41 |
-
$expired_sessions = array();
|
42 |
-
foreach ($session_files as $key => $file) {
|
43 |
-
if ( strpos($file, "_pmxi_session_expires_") !== false){
|
44 |
-
$expiration_value = @file_get_contents( PMXI_ROOT_DIR . "/sessions/" . $file );
|
45 |
-
|
46 |
-
if ($now > intval($expiration_value)){
|
47 |
-
$session_id = str_replace("_pmxi_session_expires_", "", $file);
|
48 |
-
$expired_sessions[] = $file;
|
49 |
-
$expired_sessions[] = "_pmxi_session_$session_id";
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
// Delete all expired sessions in a single query
|
54 |
-
if ( ! empty( $expired_sessions ) ) {
|
55 |
-
foreach ($expired_sessions as $key => $file) {
|
56 |
-
@unlink( PMXI_ROOT_DIR . "/sessions/" . $file );
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
// Allow other plugins to hook in to the garbage collection process.
|
64 |
-
do_action( 'pmxi_session_cleanup' );
|
65 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/arrayaccess.php
DELETED
@@ -1,140 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Multidimensional ArrayAccess
|
4 |
-
*
|
5 |
-
* Allows ArrayAccess-like functionality with multidimensional arrays. Fully supports
|
6 |
-
* both sets and unsets.
|
7 |
-
*
|
8 |
-
* @package WordPress
|
9 |
-
* @subpackage Session
|
10 |
-
* @since 3.7.0
|
11 |
-
*/
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Recursive array class to allow multidimensional array access.
|
15 |
-
*
|
16 |
-
* @package WordPress
|
17 |
-
* @since 3.7.0
|
18 |
-
*/
|
19 |
-
class PMXI_ArrayAccess implements ArrayAccess {
|
20 |
-
/**
|
21 |
-
* Internal data collection.
|
22 |
-
*
|
23 |
-
* @var array
|
24 |
-
*/
|
25 |
-
public $container = array();
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Flag whether or not the internal collection has been changed.
|
29 |
-
*
|
30 |
-
* @var bool
|
31 |
-
*/
|
32 |
-
protected $dirty = false;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Default object constructor.
|
36 |
-
*
|
37 |
-
* @param array $data
|
38 |
-
*/
|
39 |
-
protected function __construct( $data = array() ) {
|
40 |
-
foreach ( $data as $key => $value ) {
|
41 |
-
$this[ $key ] = $value;
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Allow deep copies of objects
|
47 |
-
*/
|
48 |
-
public function __clone() {
|
49 |
-
foreach ( $this->container as $key => $value ) {
|
50 |
-
if ( $value instanceof self ) {
|
51 |
-
$this[ $key ] = clone $value;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Output the data container as a multidimensional array.
|
58 |
-
*
|
59 |
-
* @return array
|
60 |
-
*/
|
61 |
-
public function toArray() {
|
62 |
-
$data = $this->container;
|
63 |
-
if (!empty($data)){
|
64 |
-
foreach ( $data as $key => $value ) {
|
65 |
-
if ( $value instanceof self ) {
|
66 |
-
$data[ $key ] = $value->toArray();
|
67 |
-
}
|
68 |
-
}
|
69 |
-
}
|
70 |
-
return $data;
|
71 |
-
}
|
72 |
-
|
73 |
-
/*****************************************************************/
|
74 |
-
/* ArrayAccess Implementation */
|
75 |
-
/*****************************************************************/
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Whether a offset exists
|
79 |
-
*
|
80 |
-
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
|
81 |
-
*
|
82 |
-
* @param mixed $offset An offset to check for.
|
83 |
-
*
|
84 |
-
* @return boolean true on success or false on failure.
|
85 |
-
*/
|
86 |
-
public function offsetExists( $offset ) {
|
87 |
-
return isset( $this->container[ $offset ]) ;
|
88 |
-
}
|
89 |
-
|
90 |
-
/**
|
91 |
-
* Offset to retrieve
|
92 |
-
*
|
93 |
-
* @link http://php.net/manual/en/arrayaccess.offsetget.php
|
94 |
-
*
|
95 |
-
* @param mixed $offset The offset to retrieve.
|
96 |
-
*
|
97 |
-
* @return mixed Can return all value types.
|
98 |
-
*/
|
99 |
-
public function offsetGet( $offset ) {
|
100 |
-
return isset( $this->container[ $offset ] ) ? $this->container[ $offset ] : null;
|
101 |
-
}
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Offset to set
|
105 |
-
*
|
106 |
-
* @link http://php.net/manual/en/arrayaccess.offsetset.php
|
107 |
-
*
|
108 |
-
* @param mixed $offset The offset to assign the value to.
|
109 |
-
* @param mixed $value The value to set.
|
110 |
-
*
|
111 |
-
* @return void
|
112 |
-
*/
|
113 |
-
public function offsetSet( $offset, $data ) {
|
114 |
-
if ( is_array( $data ) ) {
|
115 |
-
$data = new self( $data );
|
116 |
-
}
|
117 |
-
if ( $offset === null ) { // don't forget this!
|
118 |
-
$this->container[] = $data;
|
119 |
-
} else {
|
120 |
-
$this->container[ $offset ] = $data;
|
121 |
-
}
|
122 |
-
|
123 |
-
$this->dirty = true;
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Offset to unset
|
128 |
-
*
|
129 |
-
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
|
130 |
-
*
|
131 |
-
* @param mixed $offset The offset to unset.
|
132 |
-
*
|
133 |
-
* @return void
|
134 |
-
*/
|
135 |
-
public function offsetUnset( $offset ) {
|
136 |
-
unset( $this->container[ $offset ] );
|
137 |
-
|
138 |
-
$this->dirty = true;
|
139 |
-
}
|
140 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/chunk.php
CHANGED
@@ -91,7 +91,7 @@ class PMXI_Chunk {
|
|
91 |
switch ($reader->nodeType) {
|
92 |
case (XMLREADER::ELEMENT):
|
93 |
array_push($founded_tags, str_replace(":", "_", $reader->localName));
|
94 |
-
if (count($founded_tags) > 100) break(2);
|
95 |
break;
|
96 |
default:
|
97 |
|
@@ -113,7 +113,7 @@ class PMXI_Chunk {
|
|
113 |
|
114 |
if (!empty($this->cloud)){
|
115 |
|
116 |
-
$main_elements = array('node', 'product', 'job', 'deal', 'entry', 'item', 'property', 'listing', 'hotel', 'record', 'article', 'post');
|
117 |
|
118 |
foreach ($this->cloud as $element_name => $value) {
|
119 |
if ( in_array(strtolower($element_name), $main_elements) ){
|
@@ -137,8 +137,8 @@ class PMXI_Chunk {
|
|
137 |
else $path = $this->file;
|
138 |
|
139 |
$this->reader = new XMLReader();
|
140 |
-
|
141 |
-
|
142 |
|
143 |
|
144 |
}
|
@@ -171,7 +171,7 @@ class PMXI_Chunk {
|
|
171 |
// trim it
|
172 |
$element = trim($this->options['element']);
|
173 |
|
174 |
-
$xml = '';
|
175 |
|
176 |
try {
|
177 |
while ( @$this->reader->read() ) {
|
@@ -218,6 +218,11 @@ class PMXI_Chunk {
|
|
218 |
$pattern = '/(\s+\w+):(\w+[=]{1})/i';
|
219 |
$replacement = '$1_$2';
|
220 |
$feed = preg_replace($pattern, $replacement, $feed);
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
return $feed;
|
223 |
|
91 |
switch ($reader->nodeType) {
|
92 |
case (XMLREADER::ELEMENT):
|
93 |
array_push($founded_tags, str_replace(":", "_", $reader->localName));
|
94 |
+
//if (count($founded_tags) > 100) break(2);
|
95 |
break;
|
96 |
default:
|
97 |
|
113 |
|
114 |
if (!empty($this->cloud)){
|
115 |
|
116 |
+
$main_elements = array('node', 'product', 'job', 'deal', 'entry', 'item', 'property', 'listing', 'hotel', 'record', 'article', 'post', 'book');
|
117 |
|
118 |
foreach ($this->cloud as $element_name => $value) {
|
119 |
if ( in_array(strtolower($element_name), $main_elements) ){
|
137 |
else $path = $this->file;
|
138 |
|
139 |
$this->reader = new XMLReader();
|
140 |
+
@$this->reader->open($path);
|
141 |
+
@$this->reader->setParserProperty(XMLReader::VALIDATE, false);
|
142 |
|
143 |
|
144 |
}
|
171 |
// trim it
|
172 |
$element = trim($this->options['element']);
|
173 |
|
174 |
+
$xml = '';
|
175 |
|
176 |
try {
|
177 |
while ( @$this->reader->read() ) {
|
218 |
$pattern = '/(\s+\w+):(\w+[=]{1})/i';
|
219 |
$replacement = '$1_$2';
|
220 |
$feed = preg_replace($pattern, $replacement, $feed);
|
221 |
+
// pull colons from single element
|
222 |
+
// (<\w+):(\w+\/>)
|
223 |
+
$pattern = '/(<\w+):(\w+\/>)/i';
|
224 |
+
$replacement = '<$2';
|
225 |
+
$feed = preg_replace($pattern, $replacement, $feed);
|
226 |
|
227 |
return $feed;
|
228 |
|
classes/handler.php
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PMXI_Handler extends PMXI_Session {
|
4 |
+
|
5 |
+
/** cookie name */
|
6 |
+
private $_cookie;
|
7 |
+
|
8 |
+
/** session due to expire timestamp */
|
9 |
+
private $_session_expiring;
|
10 |
+
|
11 |
+
/** session expiration timestamp */
|
12 |
+
private $_session_expiration;
|
13 |
+
|
14 |
+
/** Bool based on whether a cookie exists **/
|
15 |
+
private $_has_cookie = false;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Constructor for the session class.
|
19 |
+
*
|
20 |
+
* @access public
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
|
25 |
+
$this->set_session_expiration();
|
26 |
+
|
27 |
+
$this->_import_id = $this->generate_import_id();
|
28 |
+
|
29 |
+
$this->_data = $this->get_session_data();
|
30 |
+
|
31 |
+
//add_action( 'shutdown', array( $this, 'save_data' ), 20 );
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Return true if the current user has an active session, i.e. a cookie to retrieve values
|
37 |
+
* @return boolean
|
38 |
+
*/
|
39 |
+
public function has_session() {
|
40 |
+
return isset( $_COOKIE[ $this->_cookie ] ) || $this->_has_cookie || is_user_logged_in();
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* set_session_expiration function.
|
45 |
+
*
|
46 |
+
* @access public
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
+
public function set_session_expiration() {
|
50 |
+
$this->_session_expiring = time() + intval( apply_filters( 'wpallimport_session_expiring', 60 * 60 * 47 ) ); // 47 Hours
|
51 |
+
$this->_session_expiration = time() + intval( apply_filters( 'wpallimport_session_expiration', 60 * 60 * 48 ) ); // 48 Hours
|
52 |
+
}
|
53 |
+
|
54 |
+
public function generate_import_id() {
|
55 |
+
|
56 |
+
$input = new PMXI_Input();
|
57 |
+
$import_id = $input->get('id', 'new');
|
58 |
+
|
59 |
+
return $import_id;
|
60 |
+
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* get_session_data function.
|
65 |
+
*
|
66 |
+
* @access public
|
67 |
+
* @return array
|
68 |
+
*/
|
69 |
+
public function get_session_data() {
|
70 |
+
return (array) get_option( '_wpallimport_session_' . $this->_import_id . '_', array() );
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* save_data function.
|
75 |
+
*
|
76 |
+
* @access public
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
public function save_data() {
|
80 |
+
// Dirty if something changed - prevents saving nothing new
|
81 |
+
if ( $this->_dirty && $this->has_session() ) {
|
82 |
+
|
83 |
+
$session_option = '_wpallimport_session_' . $this->_import_id . '_';
|
84 |
+
$session_expiry_option = '_wpallimport_session_expires_' . $this->_import_id . '_';
|
85 |
+
|
86 |
+
if ( false === get_option( $session_option ) ) {
|
87 |
+
add_option( $session_option, $this->_data, '', 'no' );
|
88 |
+
add_option( $session_expiry_option, $this->_session_expiration, '', 'no' );
|
89 |
+
} else {
|
90 |
+
update_option( $session_option, $this->_data );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
public function convertData( $import_id ){
|
96 |
+
|
97 |
+
$this->_import_id = 'new';
|
98 |
+
|
99 |
+
$this->_data = $this->get_session_data();
|
100 |
+
|
101 |
+
$this->set_session_expiration();
|
102 |
+
|
103 |
+
$this->_import_id = $import_id;
|
104 |
+
|
105 |
+
$this->clean_session();
|
106 |
+
|
107 |
+
$this->_dirty = true;
|
108 |
+
|
109 |
+
$this->save_data();
|
110 |
+
}
|
111 |
+
|
112 |
+
public function clean_session( $import_id = 'new' ){
|
113 |
+
|
114 |
+
global $wpdb;
|
115 |
+
|
116 |
+
$now = time();
|
117 |
+
$expired_sessions = array();
|
118 |
+
$wpallimport_session_expires = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wpallimport_session_expires_". $import_id ."_%'" );
|
119 |
+
|
120 |
+
foreach ( $wpallimport_session_expires as $wpallimport_session_expire ) {
|
121 |
+
//if ( $now > intval( $wpallimport_session_expire->option_value ) ) {
|
122 |
+
$session_id = substr( $wpallimport_session_expire->option_name, 29 );
|
123 |
+
$expired_sessions[] = $wpallimport_session_expire->option_name; // Expires key
|
124 |
+
$expired_sessions[] = "_wpallimport_session_$session_id"; // Session key
|
125 |
+
//}
|
126 |
+
}
|
127 |
+
|
128 |
+
if ( ! empty( $expired_sessions ) ) {
|
129 |
+
$expired_sessions_chunked = array_chunk( $expired_sessions, 100 );
|
130 |
+
|
131 |
+
foreach ( $expired_sessions_chunked as $chunk ) {
|
132 |
+
$option_names = implode( "','", $chunk );
|
133 |
+
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" );
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
}
|
138 |
+
}
|
classes/helper.php
CHANGED
@@ -14,6 +14,11 @@ class PMXI_Helper {
|
|
14 |
const GLOB_NODOTS = 1024;
|
15 |
const GLOB_RECURSE = 2048;
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
/**
|
18 |
* A safe empowered glob().
|
19 |
*
|
@@ -45,7 +50,7 @@ class PMXI_Helper {
|
|
45 |
$glob = array_merge($glob, self::array_prepend(self::safe_glob($path . '/' . $file . '/' . $mask, $flags), ($flags & self::GLOB_PATH ? '' : $file . '/')));
|
46 |
}
|
47 |
// Match file mask
|
48 |
-
if (self::fnmatch($mask, $file, FNM_CASEFOLD)) {
|
49 |
if ((( ! ($flags & self::GLOB_ONLYDIR)) || is_dir("$path/$file"))
|
50 |
&& (( ! ($flags & self::GLOB_NODIR)) || ( ! is_dir($path . '/' . $file)))
|
51 |
&& (( ! ($flags & self::GLOB_NODOTS)) || ( ! in_array($file, array('.', '..'))))
|
@@ -86,11 +91,6 @@ class PMXI_Helper {
|
|
86 |
return $array;
|
87 |
|
88 |
}
|
89 |
-
|
90 |
-
const FNM_PATHNAME = 1;
|
91 |
-
const FNM_NOESCAPE = 2;
|
92 |
-
const FNM_PERIOD = 4;
|
93 |
-
const FNM_CASEFOLD = 16;
|
94 |
|
95 |
/**
|
96 |
* non-POSIX complient remplacement for the fnmatch
|
@@ -110,22 +110,22 @@ class PMXI_Helper {
|
|
110 |
);
|
111 |
|
112 |
// Forward slash in string must be in pattern:
|
113 |
-
if ($flags & FNM_PATHNAME) {
|
114 |
$transforms['\*'] = '[^/]*';
|
115 |
}
|
116 |
|
117 |
// Back slash should not be escaped:
|
118 |
-
if ($flags & FNM_NOESCAPE) {
|
119 |
unset($transforms['\\']);
|
120 |
}
|
121 |
|
122 |
// Perform case insensitive match:
|
123 |
-
if ($flags & FNM_CASEFOLD) {
|
124 |
$modifiers .= 'i';
|
125 |
}
|
126 |
|
127 |
// Period at start must be the same as pattern:
|
128 |
-
if ($flags & FNM_PERIOD) {
|
129 |
if (strpos($string, '.') === 0 && strpos($pattern, '.') !== 0) return false;
|
130 |
}
|
131 |
|
14 |
const GLOB_NODOTS = 1024;
|
15 |
const GLOB_RECURSE = 2048;
|
16 |
|
17 |
+
const FNM_PATHNAME = 1;
|
18 |
+
const FNM_NOESCAPE = 2;
|
19 |
+
const FNM_PERIOD = 4;
|
20 |
+
const FNM_CASEFOLD = 16;
|
21 |
+
|
22 |
/**
|
23 |
* A safe empowered glob().
|
24 |
*
|
50 |
$glob = array_merge($glob, self::array_prepend(self::safe_glob($path . '/' . $file . '/' . $mask, $flags), ($flags & self::GLOB_PATH ? '' : $file . '/')));
|
51 |
}
|
52 |
// Match file mask
|
53 |
+
if (self::fnmatch($mask, $file, self::FNM_CASEFOLD)) {
|
54 |
if ((( ! ($flags & self::GLOB_ONLYDIR)) || is_dir("$path/$file"))
|
55 |
&& (( ! ($flags & self::GLOB_NODIR)) || ( ! is_dir($path . '/' . $file)))
|
56 |
&& (( ! ($flags & self::GLOB_NODOTS)) || ( ! in_array($file, array('.', '..'))))
|
91 |
return $array;
|
92 |
|
93 |
}
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
/**
|
96 |
* non-POSIX complient remplacement for the fnmatch
|
110 |
);
|
111 |
|
112 |
// Forward slash in string must be in pattern:
|
113 |
+
if ($flags & self::FNM_PATHNAME) {
|
114 |
$transforms['\*'] = '[^/]*';
|
115 |
}
|
116 |
|
117 |
// Back slash should not be escaped:
|
118 |
+
if ($flags & self::FNM_NOESCAPE) {
|
119 |
unset($transforms['\\']);
|
120 |
}
|
121 |
|
122 |
// Perform case insensitive match:
|
123 |
+
if ($flags & self::FNM_CASEFOLD) {
|
124 |
$modifiers .= 'i';
|
125 |
}
|
126 |
|
127 |
// Period at start must be the same as pattern:
|
128 |
+
if ($flags & self::FNM_PERIOD) {
|
129 |
if (strpos($string, '.') === 0 && strpos($pattern, '.') !== 0) return false;
|
130 |
}
|
131 |
|
classes/nested.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists('PMXI_Nested')){
|
4 |
+
|
5 |
+
class PMXI_Nested{
|
6 |
+
protected $nested_files;
|
7 |
+
protected $xpath;
|
8 |
+
protected $dom;
|
9 |
+
protected $elements;
|
10 |
+
public $xml;
|
11 |
+
|
12 |
+
public function __construct( $dom, $nested_files, $xml, $xpath, $elements = false){
|
13 |
+
$this->dom = $dom;
|
14 |
+
$this->nested_files = $nested_files;
|
15 |
+
$this->xpath = $xpath;
|
16 |
+
$this->xml = $xml;
|
17 |
+
$this->elements = $elements;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function merge(){
|
21 |
+
|
22 |
+
/* Merge nested XML/CSV files */
|
23 |
+
if ( ! empty($this->nested_files) ){
|
24 |
+
$tmp_files = array();
|
25 |
+
foreach ($this->nested_files as $key => $nfile) {
|
26 |
+
$nested_fileURL = array_shift(XmlImportParser::factory($this->xml, $this->xpath, $nfile, $tmp_file)->parse()); $tmp_files[] = $tmp_file;
|
27 |
+
if ( ! empty($nested_fileURL) ){
|
28 |
+
$errors = new WP_Error();
|
29 |
+
|
30 |
+
$uploader = new PMXI_Upload($nested_fileURL, $errors);
|
31 |
+
$upload_result = $uploader->url();
|
32 |
+
|
33 |
+
if ($upload_result instanceof WP_Error){
|
34 |
+
$errors = $upload_result;
|
35 |
+
}
|
36 |
+
else{
|
37 |
+
$source = $upload_result['source'];
|
38 |
+
$filePath = $upload_result['filePath'];
|
39 |
+
if ( ! empty($upload_result['root_element']))
|
40 |
+
$root_element = $upload_result['root_element'];
|
41 |
+
else
|
42 |
+
$root_element = '';
|
43 |
+
$feed_type = $upload_result['feed_type'];
|
44 |
+
}
|
45 |
+
|
46 |
+
unset($uploader);
|
47 |
+
|
48 |
+
$nested_xml = file_get_contents($filePath);
|
49 |
+
|
50 |
+
if ( ! empty($nested_xml) )
|
51 |
+
{
|
52 |
+
PMXI_Import_Record::preprocessXml($nested_xml);
|
53 |
+
|
54 |
+
if ( PMXI_Import_Record::validateXml($nested_xml) === true ){
|
55 |
+
|
56 |
+
$nestedDom = new DOMDocument('1.0', 'UTF-8');
|
57 |
+
$nestedold = libxml_use_internal_errors(true);
|
58 |
+
$nestedDom->loadXML($nested_xml);
|
59 |
+
libxml_use_internal_errors($nestedold);
|
60 |
+
$second = $nestedDom->documentElement;
|
61 |
+
|
62 |
+
if ($second->hasChildNodes()) {
|
63 |
+
|
64 |
+
foreach($second->childNodes as $node)
|
65 |
+
{
|
66 |
+
$importNode = $this->dom->importNode($node, true);
|
67 |
+
$this->dom->documentElement->appendChild($importNode);
|
68 |
+
}
|
69 |
+
|
70 |
+
$this->xml = ($this->elements) ? $this->dom->saveXML($this->elements->item(0)) : $this->dom->saveXML();
|
71 |
+
}
|
72 |
+
unset($nestedDom);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
foreach ($tmp_files as $tmp_file) { // remove all temporary files created
|
78 |
+
@unlink($tmp_file);
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
public function get_xml(){
|
84 |
+
return $this->xml;
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
88 |
+
}
|
classes/render.php
ADDED
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists('PMXI_Render')){
|
3 |
+
|
4 |
+
class PMXI_Render{
|
5 |
+
|
6 |
+
public function __construct(){
|
7 |
+
|
8 |
+
}
|
9 |
+
|
10 |
+
public static function xml_find_repeating(DOMElement $el, $path = '/')
|
11 |
+
{
|
12 |
+
$path .= $el->nodeName;
|
13 |
+
if ( ! $el->parentNode instanceof DOMDocument) {
|
14 |
+
$path .= '[1]';
|
15 |
+
}
|
16 |
+
$children = array();
|
17 |
+
foreach ($el->childNodes as $child) {
|
18 |
+
if ($child instanceof DOMElement) {
|
19 |
+
if ( ! empty($children[$child->nodeName])) {
|
20 |
+
return $path . '/' . $child->nodeName;
|
21 |
+
} else {
|
22 |
+
$children[$child->nodeName] = true;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
// reaching this point means we didn't find anything among current element children, so recursively ask children to find something in them
|
27 |
+
foreach ($el->childNodes as $child) {
|
28 |
+
if ($child instanceof DOMElement) {
|
29 |
+
$result = slef::xml_find_repeating($child, $path . '/');
|
30 |
+
if ($result) {
|
31 |
+
return $result;
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
// reaching this point means we didn't find anything, so return element itself if the function was called for it
|
36 |
+
if ('/' . $el->nodeName == $path) {
|
37 |
+
return $path;
|
38 |
+
}
|
39 |
+
|
40 |
+
return NULL;
|
41 |
+
}
|
42 |
+
|
43 |
+
public static function render_csv_element(DOMElement $el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
|
44 |
+
{
|
45 |
+
$path .= $el->nodeName;
|
46 |
+
if ( ! $el->parentNode instanceof DOMDocument and $ind > 0) {
|
47 |
+
$path .= "[$ind]";
|
48 |
+
}
|
49 |
+
|
50 |
+
echo '<div class="xml-element csv_element lvl-' . $lvl . ' lvl-mod4-' . ($lvl % 4) . '" title="' . $path . '">';
|
51 |
+
if ($el->hasChildNodes()) {
|
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 |
+
self::render_csv_text(trim($el->childNodes->item(0)->wholeText), $shorten, $is_render_collapsed);
|
56 |
+
} else {
|
57 |
+
echo '<div class="csv-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
58 |
+
$indexes = array();
|
59 |
+
foreach ($el->childNodes as $child) {
|
60 |
+
if ($child instanceof DOMElement) {
|
61 |
+
empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 0; $indexes[$child->nodeName]++;
|
62 |
+
self::render_csv_element($child, $shorten, $path . '/', $indexes[$child->nodeName], $lvl + 1);
|
63 |
+
} elseif ($child instanceof DOMText) {
|
64 |
+
self::render_csv_text(trim($child->wholeText), $shorten);
|
65 |
+
} elseif ($child instanceof DOMComment) {
|
66 |
+
if (preg_match('%\[pmxi_more:(\d+)\]%', $child->nodeValue, $mtch)) {
|
67 |
+
$no = intval($mtch[1]);
|
68 |
+
echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>';
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
echo '</div>';
|
73 |
+
}
|
74 |
+
//echo '<div class="xml-tag closing"><span class="xml-tag-name">' . $el->nodeName . '</span></div>';
|
75 |
+
} else {
|
76 |
+
echo '<div class="xml-tag opening empty"><span class="xml-tag-name">' . $el->nodeName . '</span>'; self::render_xml_attributes($el); echo '</div>';
|
77 |
+
}
|
78 |
+
echo '</div>';
|
79 |
+
}
|
80 |
+
|
81 |
+
protected static function render_csv_text($text, $shorten = false, $is_render_collapsed = false)
|
82 |
+
{
|
83 |
+
if (empty($text) and 0 !== (int)$text) {
|
84 |
+
return; // do not display empty text nodes
|
85 |
+
}
|
86 |
+
if (preg_match('%\[more:(\d+)\]%', $text, $mtch)) {
|
87 |
+
$no = intval($mtch[1]);
|
88 |
+
echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>';
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
$more = '';
|
92 |
+
if ($shorten and preg_match('%^(.*?\s+){20}(?=\S)%', $text, $mtch)) {
|
93 |
+
$text = $mtch[0];
|
94 |
+
$more = '<span class="xml-more">[' . __('more', 'pmxi_plugin') . ']</span>';
|
95 |
+
}
|
96 |
+
$is_short = strlen($text) <= 40;
|
97 |
+
$newtext = htmlspecialchars($text);
|
98 |
+
//$newtext = preg_replace('%(?<!\s)\b(?!\s|\W[\w\s])|\w{20}%', '$0​', $newtext); // put explicit breaks for xml content to wrap
|
99 |
+
echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_render_collapsed ? ' collapsed' : '') . ' '. (is_numeric($text) ? 'is_numeric' : '') .'">' . $newtext . $more . '</div>';
|
100 |
+
}
|
101 |
+
|
102 |
+
public static function render_xml_elements_for_filtring(DOMElement $el, $path ='', $lvl = 0){
|
103 |
+
|
104 |
+
if ("" != $path){
|
105 |
+
if ($lvl > 1) $path .= "->" . $el->nodeName; else $path = $el->nodeName;
|
106 |
+
echo '<option value="'.$path.'">' .$path . '</option>';
|
107 |
+
}
|
108 |
+
else $path = $el->nodeName;
|
109 |
+
|
110 |
+
foreach ($el->attributes as $attr) {
|
111 |
+
echo '<option value="'.$path . '@' . $attr->nodeName.'">'. $path . '@' . $attr->nodeName . '</option>';
|
112 |
+
}
|
113 |
+
if ($el->hasChildNodes()) {
|
114 |
+
foreach ($el->childNodes as $child) {
|
115 |
+
if ($child instanceof DOMElement)
|
116 |
+
self::render_xml_elements_for_filtring($child, $path, $lvl + 1);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
public static function render_xml_element(DOMElement $el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
|
122 |
+
{
|
123 |
+
$path .= $el->nodeName;
|
124 |
+
$alternativePath = $path;
|
125 |
+
if ( ! $el->parentNode instanceof DOMDocument and $ind > 0) {
|
126 |
+
$path .= "[$ind]";
|
127 |
+
}
|
128 |
+
|
129 |
+
echo '<div class="xml-element lvl-' . $lvl . ' lvl-mod4-' . ($lvl % 4) . '" title="' . $path . '">';
|
130 |
+
//if ($el->hasAttributes()){
|
131 |
+
echo '<div class="xml-element-xpaths">'; self::render_element_xpaths($el, $alternativePath, $ind, $lvl); echo '</div>';
|
132 |
+
//}
|
133 |
+
if ($el->hasChildNodes()) {
|
134 |
+
$is_render_collapsed = $ind > 1;
|
135 |
+
if ($el->childNodes->length > 1 or ! $el->childNodes->item(0) instanceof DOMText or strlen(trim($el->childNodes->item(0)->wholeText)) > 40) {
|
136 |
+
echo '<div class="xml-expander">' . ($is_render_collapsed ? '+' : '-') . '</div>';
|
137 |
+
}
|
138 |
+
echo '<div class="xml-tag opening"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; self::render_xml_attributes($el, $path . '/'); echo '></div>';
|
139 |
+
if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) {
|
140 |
+
self::render_xml_text(trim($el->childNodes->item(0)->wholeText), $shorten, $is_render_collapsed);
|
141 |
+
} else {
|
142 |
+
echo '<div class="xml-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
143 |
+
$indexes = array();
|
144 |
+
foreach ($el->childNodes as $eli => $child) {
|
145 |
+
if ($child instanceof DOMElement) {
|
146 |
+
empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 0; $indexes[$child->nodeName]++;
|
147 |
+
self::render_xml_element($child, $shorten, $path . '/', $indexes[$child->nodeName], $lvl + 1);
|
148 |
+
} elseif ($child instanceof DOMCdataSection) {
|
149 |
+
self::render_xml_text(trim($child->wholeText), $shorten, false, true);
|
150 |
+
} elseif ($child instanceof DOMText) {
|
151 |
+
if ( $el->childNodes->item($eli - 1) and ($el->childNodes->item($eli - 1) instanceof DOMCdataSection) ){
|
152 |
+
|
153 |
+
}
|
154 |
+
elseif( $el->childNodes->item($eli + 1) and ($el->childNodes->item($eli + 1) instanceof DOMCdataSection) ){
|
155 |
+
|
156 |
+
}
|
157 |
+
else{
|
158 |
+
self::render_xml_text(trim($child->wholeText), $shorten);
|
159 |
+
}
|
160 |
+
} elseif ($child instanceof DOMComment) {
|
161 |
+
if (preg_match('%\[pmxi_more:(\d+)\]%', $child->nodeValue, $mtch)) {
|
162 |
+
$no = intval($mtch[1]);
|
163 |
+
echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>';
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
echo '</div>';
|
168 |
+
}
|
169 |
+
echo '<div class="xml-tag closing"></<span class="xml-tag-name">' . $el->nodeName . '</span>></div>';
|
170 |
+
} else {
|
171 |
+
echo '<div class="xml-tag opening empty"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; self::render_xml_attributes($el); echo '/></div>';
|
172 |
+
}
|
173 |
+
echo '</div>';
|
174 |
+
}
|
175 |
+
|
176 |
+
protected static function render_xml_text($text, $shorten = false, $is_render_collapsed = false, $is_cdata = false)
|
177 |
+
{
|
178 |
+
if (empty($text) and 0 !== (int)$text) {
|
179 |
+
return; // do not display empty text nodes
|
180 |
+
}
|
181 |
+
if (preg_match('%\[more:(\d+)\]%', $text, $mtch)) {
|
182 |
+
$no = intval($mtch[1]);
|
183 |
+
echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>';
|
184 |
+
return;
|
185 |
+
}
|
186 |
+
$more = '';
|
187 |
+
if ($shorten and preg_match('%^(.*?\s+){20}(?=\S)%', $text, $mtch)) {
|
188 |
+
$text = $mtch[0];
|
189 |
+
$more = '<span class="xml-more">[' . __('more', 'pmxi_plugin') . ']</span>';
|
190 |
+
}
|
191 |
+
$is_short = strlen($text) <= 40;
|
192 |
+
$text = htmlspecialchars($text);
|
193 |
+
if ($is_cdata){
|
194 |
+
$text = "<span class='wpallimport-cdata'>" . htmlspecialchars("<![CDATA[") . "</span> " . $text . " <span class='wpallimport-cdata'>" . htmlspecialchars("]]>") . "</span>";
|
195 |
+
}
|
196 |
+
//$text = preg_replace('%(?<!\s)\b(?!\s|\W[\w\s])|\w{20}%', '$0​', $text); // put explicit breaks for xml content to wrap
|
197 |
+
echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_render_collapsed ? ' collapsed' : '') . '">' . $text . $more . '</div>';
|
198 |
+
}
|
199 |
+
|
200 |
+
public static function get_xml_path(DOMElement $el, DOMXPath $xpath)
|
201 |
+
{
|
202 |
+
for($p = '', $doc = $el; $doc and ! $doc instanceof DOMDocument; $doc = $doc->parentNode) {
|
203 |
+
if (($ind = $xpath->query('preceding-sibling::' . $doc->nodeName, $doc)->length)) {
|
204 |
+
$p = '[' . ++$ind . ']' . $p;
|
205 |
+
} elseif ( ! $doc->parentNode instanceof DOMDocument) {
|
206 |
+
$p = '[' . ($ind = 1) . ']' . $p;
|
207 |
+
}
|
208 |
+
$p = '/' . $doc->nodeName . $p;
|
209 |
+
}
|
210 |
+
return $p;
|
211 |
+
}
|
212 |
+
|
213 |
+
protected static function render_xml_attributes(DOMElement $el, $path = '/')
|
214 |
+
{
|
215 |
+
foreach ($el->attributes as $attr) {
|
216 |
+
echo ' <span class="xml-attr" title="' . $path . '@' . $attr->nodeName . '"><span class="xml-attr-name">' . $attr->nodeName . '</span>=<span class="xml-attr-value">"' . esc_attr($attr->value) . '"</span></span>';
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
protected static function render_element_xpaths(DOMElement $el, $path = '/', $ind = 1, $lvl = 0){
|
221 |
+
?>
|
222 |
+
<ul id="menu-<?php echo sanitize_title(esc_attr($path)); ?>" class="ui-helper-hidden">
|
223 |
+
<?php foreach ($el->attributes as $attr) : if ( empty($attr->value) ) continue; ?>
|
224 |
+
<li data-command="action1" title="<?php echo esc_attr($path . '[@'. $attr->nodeName .' = "' . esc_attr($attr->value) . '"]'); ?>">
|
225 |
+
<a href="#"><?php echo $path . '[@'. $attr->nodeName .' = "' . esc_attr($attr->value) . '"]'; ?></a>
|
226 |
+
</li>
|
227 |
+
<li data-command="action2" title="<?php echo esc_attr($path . '[@'. $attr->nodeName .'[contains(.,"' . esc_attr($attr->value) . '")]]'); ?>">
|
228 |
+
<a href="#"><?php echo $path . '[@'. $attr->nodeName .'[contains(.,"' . esc_attr($attr->value) . '")]]'; ?></a>
|
229 |
+
</li>
|
230 |
+
<?php endforeach; ?>
|
231 |
+
<?php
|
232 |
+
$altNode = null;
|
233 |
+
$altNodeText = null;
|
234 |
+
$parentNode = $el->parentNode;
|
235 |
+
$grandNode = $parentNode->parentNode;
|
236 |
+
|
237 |
+
if ( ! $grandNode instanceof DOMDocument and $grandNode instanceof DOMElement ){
|
238 |
+
|
239 |
+
$equalsElements = 0;
|
240 |
+
foreach ($grandNode->childNodes as $child) {
|
241 |
+
if ($child instanceof DOMElement) {
|
242 |
+
if ($child->nodeName == $parentNode->nodeName){
|
243 |
+
$equalsElements++;
|
244 |
+
if ($equalsElements > 1)
|
245 |
+
break;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
if ($equalsElements > 1){
|
251 |
+
if ($parentNode->hasChildNodes()) {
|
252 |
+
foreach ($parentNode->childNodes as $i => $child) {
|
253 |
+
if ($child instanceof DOMElement) {
|
254 |
+
if ($child->nodeName != $el->nodeName){
|
255 |
+
$altNode = $child;
|
256 |
+
if ($child->hasChildNodes()){
|
257 |
+
foreach ($child->childNodes as $i => $txtChild) {
|
258 |
+
if ($txtChild instanceof DOMText) {
|
259 |
+
$altNodeText = $txtChild;
|
260 |
+
break;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
break;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
if ( ! empty($altNode) and !empty($altNodeText) ){
|
271 |
+
|
272 |
+
$pathArgs = explode('/', $path);
|
273 |
+
array_pop($pathArgs);
|
274 |
+
array_pop($pathArgs);
|
275 |
+
$vpath = esc_attr(implode('/', $pathArgs) . '/' . $parentNode->nodeName . '[contains('. $altNode->nodeName .',"' . esc_attr($altNodeText->wholeText) . '")]/' . $el->nodeName);
|
276 |
+
?>
|
277 |
+
<li data-command="action3" title="<?php echo $vpath; ?>">
|
278 |
+
<a href="#"><?php echo $vpath; ?></a>
|
279 |
+
</li>
|
280 |
+
<?php
|
281 |
+
|
282 |
+
}
|
283 |
+
}
|
284 |
+
}
|
285 |
+
?>
|
286 |
+
</ul>
|
287 |
+
<?php
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
classes/session.php
CHANGED
@@ -1,378 +1,96 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* WordPress session managment.
|
4 |
-
*
|
5 |
-
* Standardizes WordPress session data using database-backed options for storage.
|
6 |
-
* for storing user session information.
|
7 |
-
*
|
8 |
-
* @package WordPress
|
9 |
-
* @subpackage Session
|
10 |
-
* @since 3.7.0
|
11 |
-
*/
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
*/
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
@chmod(PMXI_ROOT_DIR . "/sessions/_pmxi_session_expires_{$this->session_id}.txt", 0600);
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
} else {
|
106 |
-
$this->session_id = $this->generate_id();
|
107 |
-
$this->set_expiration();
|
108 |
-
}
|
109 |
-
}
|
110 |
-
else{
|
111 |
-
try{
|
112 |
-
$path = @session_save_path();
|
113 |
-
if ( ! @is_dir($path) or ! @is_writable($path)){
|
114 |
-
@ini_set("session.save_handler", "files");
|
115 |
-
@session_save_path(sys_get_temp_dir());
|
116 |
-
}
|
117 |
-
} catch (XmlImportException $e) {
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
// enable sessions
|
122 |
-
if ( ! session_id()) @session_start();
|
123 |
-
}
|
124 |
-
|
125 |
-
$this->read_data();
|
126 |
-
|
127 |
-
$this->set_cookie();
|
128 |
-
}
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Set both the expiration time and the expiration variant.
|
132 |
-
*
|
133 |
-
* If the current time is below the variant, we don't update the session's expiration time. If it's
|
134 |
-
* greater than the variant, then we update the expiration time in the database. This prevents
|
135 |
-
* writing to the database on every page load for active sessions and only updates the expiration
|
136 |
-
* time if we're nearing when the session actually expires.
|
137 |
-
*
|
138 |
-
* By default, the expiration time is set to 30 minutes.
|
139 |
-
* By default, the expiration variant is set to 24 minutes.
|
140 |
-
*
|
141 |
-
* As a result, the session expiration time - at a maximum - will only be written to the database once
|
142 |
-
* every 24 minutes. After 30 minutes, the session will have been expired. No cookie will be sent by
|
143 |
-
* the browser, and the old session will be queued for deletion by the garbage collector.
|
144 |
-
*
|
145 |
-
* @uses apply_filters Calls `wp_session_expiration_variant` to get the max update window for session data.
|
146 |
-
* @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions.
|
147 |
-
*/
|
148 |
-
protected function set_expiration() {
|
149 |
-
$this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 );
|
150 |
-
$this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 );
|
151 |
-
}
|
152 |
-
|
153 |
-
/**
|
154 |
-
* Set the session cookie
|
155 |
-
*/
|
156 |
-
protected function set_cookie() {
|
157 |
-
@setcookie( PMXI_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN );
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* Generate a cryptographically strong unique ID for the session token.
|
162 |
-
*
|
163 |
-
* @return string
|
164 |
-
*/
|
165 |
-
protected function generate_id() {
|
166 |
-
require_once( ABSPATH . 'wp-includes/class-phpass.php');
|
167 |
-
$hasher = new PasswordHash( 8, false );
|
168 |
-
|
169 |
-
return md5( $hasher->get_random_bytes( 32 ) );
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Read data from a transient for the current session.
|
174 |
-
*
|
175 |
-
* Automatically resets the expiration time for the session transient to some time in the future.
|
176 |
-
*
|
177 |
-
* @return array
|
178 |
-
*/
|
179 |
-
protected function read_data() {
|
180 |
-
if ($this->session_mode == 'database'){
|
181 |
-
$this->container = get_option( "_pmxi_session_{$this->session_id}", array() );
|
182 |
-
}
|
183 |
-
elseif ($this->session_mode == 'files'){
|
184 |
-
$container = @file_get_contents(PMXI_ROOT_DIR . "/sessions/_pmxi_session_{$this->session_id}.txt");
|
185 |
-
$this->container = unserialize( (!empty($container)) ? $container : '' );
|
186 |
-
}
|
187 |
-
else{
|
188 |
-
$this['pmxi_import'] = ( ! empty($_SESSION['pmxi_import']) ) ? $_SESSION['pmxi_import'] : array();
|
189 |
-
}
|
190 |
-
|
191 |
-
$this->data = $this->toArray();
|
192 |
-
|
193 |
-
return $this->container;
|
194 |
-
}
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Write the data from the current session to the data storage system.
|
198 |
-
*/
|
199 |
-
public function write_data() {
|
200 |
-
|
201 |
-
$option_key = "_pmxi_session_{$this->session_id}";
|
202 |
-
|
203 |
-
$this->data = $this->toArray();
|
204 |
-
|
205 |
-
// Only write the collection to the DB if it's changed.
|
206 |
-
if ($this->session_mode == "database"){
|
207 |
-
if ( false === get_option( $option_key ) ) {
|
208 |
-
add_option( "_pmxi_session_{$this->session_id}", $this->container, '', 'no' );
|
209 |
-
add_option( "_pmxi_session_expires_{$this->session_id}", $this->expires, '', 'no' );
|
210 |
-
} else {
|
211 |
-
delete_option("_pmxi_session_{$this->session_id}");
|
212 |
-
add_option( "_pmxi_session_{$this->session_id}", $this->container, '', 'no' );
|
213 |
-
}
|
214 |
-
}
|
215 |
-
elseif ($this->session_mode == 'files'){
|
216 |
-
if ( @file_exists( PMXI_ROOT_DIR . "/sessions/" . $option_key . ".txt") ){
|
217 |
-
@file_put_contents( PMXI_ROOT_DIR . "/sessions/" . $option_key . ".txt", (string) serialize($this->container) );
|
218 |
-
@chmod(PMXI_ROOT_DIR . "/sessions/" . $option_key . ".txt", 0600);
|
219 |
-
}
|
220 |
-
else{
|
221 |
-
@file_put_contents( PMXI_ROOT_DIR . "/sessions/" . $option_key . ".txt", (string) serialize($this->container) );
|
222 |
-
@chmod(PMXI_ROOT_DIR . "/sessions/" . $option_key . ".txt", 0600);
|
223 |
-
@file_put_contents( PMXI_ROOT_DIR . "/sessions/_pmxi_session_expires_{$this->session_id}.txt", $this->expires );
|
224 |
-
}
|
225 |
-
}
|
226 |
-
else{
|
227 |
-
$session = $this->toArray(); $_SESSION['pmxi_import'] = (!empty($session['pmxi_import'])) ? $session['pmxi_import'] : array();
|
228 |
-
}
|
229 |
-
|
230 |
-
}
|
231 |
-
|
232 |
-
/**
|
233 |
-
* Output the current container contents as a JSON-encoded string.
|
234 |
-
*
|
235 |
-
* @return string
|
236 |
-
*/
|
237 |
-
public function json_out() {
|
238 |
-
return json_encode( $this->container );
|
239 |
-
}
|
240 |
-
|
241 |
-
/**
|
242 |
-
* Decodes a JSON string and, if the object is an array, overwrites the session container with its contents.
|
243 |
-
*
|
244 |
-
* @param string $data
|
245 |
-
*
|
246 |
-
* @return bool
|
247 |
-
*/
|
248 |
-
public function json_in( $data ) {
|
249 |
-
$array = json_decode( $data );
|
250 |
-
|
251 |
-
if ( is_array( $array ) ) {
|
252 |
-
$this->container = $array;
|
253 |
-
return true;
|
254 |
-
}
|
255 |
-
|
256 |
-
return false;
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Regenerate the current session's ID.
|
261 |
-
*
|
262 |
-
* @param bool $delete_old Flag whether or not to delete the old session data from the server.
|
263 |
-
*/
|
264 |
-
public function regenerate_id( $delete_old = false ) {
|
265 |
-
if ( $delete_old ) {
|
266 |
-
if ($this->session_mode == "database"){
|
267 |
-
delete_option( "_pmxi_session_{$this->session_id}" );
|
268 |
-
}
|
269 |
-
elseif ($this->session_mode == 'files'){
|
270 |
-
@unlink( PMXI_ROOT_DIR . "/sessions/_pmxi_session_{$this->session_id}.txt");
|
271 |
-
}
|
272 |
-
}
|
273 |
-
|
274 |
-
$this->session_id = $this->generate_id();
|
275 |
-
|
276 |
-
$this->set_cookie();
|
277 |
-
}
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Check if a session has been initialized.
|
281 |
-
*
|
282 |
-
* @return bool
|
283 |
-
*/
|
284 |
-
public function session_started() {
|
285 |
-
return !!self::$instance;
|
286 |
-
}
|
287 |
-
|
288 |
-
/**
|
289 |
-
* Return the read-only cache expiration value.
|
290 |
-
*
|
291 |
-
* @return int
|
292 |
-
*/
|
293 |
-
public function cache_expiration() {
|
294 |
-
return $this->expires;
|
295 |
-
}
|
296 |
-
|
297 |
-
/**
|
298 |
-
* Flushes all session variables.
|
299 |
-
*/
|
300 |
-
public function reset() {
|
301 |
-
$this->container = array();
|
302 |
-
if ($this->session_mode == "default") unset($_SESSION['pmxi_import']);
|
303 |
-
}
|
304 |
-
|
305 |
-
/*****************************************************************/
|
306 |
-
/* Iterator Implementation */
|
307 |
-
/*****************************************************************/
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Current position of the array.
|
311 |
-
*
|
312 |
-
* @link http://php.net/manual/en/iterator.current.php
|
313 |
-
*
|
314 |
-
* @return mixed
|
315 |
-
*/
|
316 |
-
public function current() {
|
317 |
-
return current( $this->container );
|
318 |
-
}
|
319 |
-
|
320 |
-
/**
|
321 |
-
* Key of the current element.
|
322 |
-
*
|
323 |
-
* @link http://php.net/manual/en/iterator.key.php
|
324 |
-
*
|
325 |
-
* @return mixed
|
326 |
-
*/
|
327 |
-
public function key() {
|
328 |
-
return key( $this->container );
|
329 |
-
}
|
330 |
-
|
331 |
-
/**
|
332 |
-
* Move the internal point of the container array to the next item
|
333 |
-
*
|
334 |
-
* @link http://php.net/manual/en/iterator.next.php
|
335 |
-
*
|
336 |
-
* @return void
|
337 |
-
*/
|
338 |
-
public function next() {
|
339 |
-
next( $this->container );
|
340 |
-
}
|
341 |
-
|
342 |
-
/**
|
343 |
-
* Rewind the internal point of the container array.
|
344 |
-
*
|
345 |
-
* @link http://php.net/manual/en/iterator.rewind.php
|
346 |
-
*
|
347 |
-
* @return void
|
348 |
-
*/
|
349 |
-
public function rewind() {
|
350 |
-
reset( $this->container );
|
351 |
-
}
|
352 |
-
|
353 |
-
/**
|
354 |
-
* Is the current key valid?
|
355 |
-
*
|
356 |
-
* @link http://php.net/manual/en/iterator.rewind.php
|
357 |
-
*
|
358 |
-
* @return bool
|
359 |
-
*/
|
360 |
-
public function valid() {
|
361 |
-
return $this->offsetExists( $this->key() );
|
362 |
-
}
|
363 |
-
|
364 |
-
/*****************************************************************/
|
365 |
-
/* Countable Implementation */
|
366 |
-
/*****************************************************************/
|
367 |
-
|
368 |
-
/**
|
369 |
-
* Get the count of elements in the container array.
|
370 |
-
*
|
371 |
-
* @link http://php.net/manual/en/countable.count.php
|
372 |
-
*
|
373 |
* @return int
|
374 |
*/
|
375 |
-
public function
|
376 |
-
return
|
377 |
}
|
378 |
-
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
abstract class PMXI_Session {
|
4 |
+
|
5 |
+
/** @var int $_customer_id */
|
6 |
+
protected $_import_id;
|
7 |
+
|
8 |
+
/** @var array $_data */
|
9 |
+
protected $_data = array();
|
10 |
+
|
11 |
+
/** @var bool $_dirty When something changes */
|
12 |
+
protected $_dirty = false;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* __get function.
|
16 |
+
*
|
17 |
+
* @access public
|
18 |
+
* @param mixed $key
|
19 |
+
* @return mixed
|
20 |
+
*/
|
21 |
+
public function __get( $key ) {
|
22 |
+
return $this->get( $key );
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* __set function.
|
27 |
+
*
|
28 |
+
* @access public
|
29 |
+
* @param mixed $key
|
30 |
+
* @param mixed $value
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function __set( $key, $value ) {
|
34 |
+
$this->set( $key, $value );
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* __isset function.
|
39 |
+
*
|
40 |
+
* @access public
|
41 |
+
* @param mixed $key
|
42 |
+
* @return bool
|
43 |
+
*/
|
44 |
+
public function __isset( $key ) {
|
45 |
+
return isset( $this->_data[ sanitize_title( $key ) ] );
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* __unset function.
|
50 |
+
*
|
51 |
+
* @access public
|
52 |
+
* @param mixed $key
|
53 |
+
* @return void
|
54 |
+
*/
|
55 |
+
public function __unset( $key ) {
|
56 |
+
|
57 |
+
if ( isset( $this->_data[ $key ] ) ) {
|
58 |
+
unset( $this->_data[ $key ] );
|
59 |
+
$this->_dirty = true;
|
60 |
+
}
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Get a session variable
|
66 |
+
*
|
67 |
+
* @param string $key
|
68 |
+
* @param mixed $default used if the session variable isn't set
|
69 |
+
* @return mixed value of session variable
|
70 |
+
*/
|
71 |
+
public function get( $key, $default = null ) {
|
72 |
+
$key = sanitize_key( $key );
|
73 |
+
return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Set a session variable
|
78 |
+
*
|
79 |
+
* @param string $key
|
80 |
+
* @param mixed $value
|
81 |
+
*/
|
82 |
+
public function set( $key, $value ) {
|
83 |
+
$this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
|
84 |
+
$this->_dirty = true;
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* get_import_id function.
|
89 |
+
*
|
90 |
+
* @access public
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
* @return int
|
92 |
*/
|
93 |
+
public function get_import_id() {
|
94 |
+
return $this->_import_id;
|
95 |
}
|
96 |
+
}
|
classes/upload.php
ADDED
@@ -0,0 +1,762 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists('PMXI_Upload')){
|
3 |
+
|
4 |
+
class PMXI_Upload{
|
5 |
+
|
6 |
+
protected $file;
|
7 |
+
protected $errors;
|
8 |
+
protected $root_element = '';
|
9 |
+
protected $is_csv = false;
|
10 |
+
|
11 |
+
protected $uploadsPath;
|
12 |
+
|
13 |
+
function __construct( $file, $errors, $targetDir = false ){
|
14 |
+
|
15 |
+
$this->file = $file;
|
16 |
+
$this->errors = $errors;
|
17 |
+
|
18 |
+
$uploads = wp_upload_dir();
|
19 |
+
|
20 |
+
if ( $uploads['error'] )
|
21 |
+
$this->uploadsPath = false;
|
22 |
+
else
|
23 |
+
$this->uploadsPath = (!$targetDir) ? pmxi_secure_file($uploads['basedir'] . '/wpallimport/uploads', 'uploads') : $targetDir;
|
24 |
+
}
|
25 |
+
|
26 |
+
public function upload(){
|
27 |
+
|
28 |
+
$uploads = wp_upload_dir();
|
29 |
+
|
30 |
+
if (empty($this->file)) {
|
31 |
+
$this->errors->add('form-validation', __('Please specify a file to import.<br/><br/>If you are uploading the file from your computer, please wait for it to finish uploading (progress bar at 100%), before trying to continue.', 'pmxi_plugin'));
|
32 |
+
} elseif (!is_file($this->file)) {
|
33 |
+
$this->errors->add('form-validation', __('Uploaded file is empty', 'pmxi_plugin'));
|
34 |
+
} elseif ( ! preg_match('%\W(xml|gzip|zip|csv|gz|json|txt|dat|psv|sql)$%i', trim(basename($this->file)))) {
|
35 |
+
$this->errors->add('form-validation', __('Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV', 'pmxi_plugin'));
|
36 |
+
} elseif (preg_match('%\W(zip)$%i', trim(basename($this->file)))) {
|
37 |
+
|
38 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/pclzip.lib.php');
|
39 |
+
|
40 |
+
$archive = new PclZip($this->file);
|
41 |
+
if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
|
42 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'pmxi_plugin'));
|
43 |
+
}
|
44 |
+
else {
|
45 |
+
|
46 |
+
$filePath = '';
|
47 |
+
|
48 |
+
if (!empty($v_result_list)){
|
49 |
+
foreach ($v_result_list as $unzipped_file) {
|
50 |
+
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json)$%i', trim($unzipped_file['stored_filename']))) { $filePath = $unzipped_file['filename']; break; }
|
51 |
+
}
|
52 |
+
}
|
53 |
+
if ( $this->uploadsPath === false ){
|
54 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
55 |
+
}
|
56 |
+
|
57 |
+
if(empty($filePath)){
|
58 |
+
$zip = zip_open(trim($this->file));
|
59 |
+
if (is_resource($zip)) {
|
60 |
+
while ($zip_entry = zip_read($zip)) {
|
61 |
+
$filePath = zip_entry_name($zip_entry);
|
62 |
+
$fp = fopen($this->uploadsPath."/".$filePath, "w");
|
63 |
+
if (zip_entry_open($zip, $zip_entry, "r")) {
|
64 |
+
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
65 |
+
fwrite($fp,"$buf");
|
66 |
+
zip_entry_close($zip_entry);
|
67 |
+
fclose($fp);
|
68 |
+
}
|
69 |
+
break;
|
70 |
+
}
|
71 |
+
zip_close($zip);
|
72 |
+
|
73 |
+
} else {
|
74 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'pmxi_plugin'));
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
// Detect if file is very large
|
79 |
+
$source = array(
|
80 |
+
'name' => basename($this->file),
|
81 |
+
'type' => 'upload',
|
82 |
+
'path' => $this->file,
|
83 |
+
);
|
84 |
+
|
85 |
+
if (preg_match('%\W(csv|txt|dat|psv)$%i', trim($filePath))){ // If CSV file found in archieve
|
86 |
+
|
87 |
+
if($this->uploadsPath === false){
|
88 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
89 |
+
}
|
90 |
+
|
91 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
92 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
93 |
+
//pmxi_remove_source($filePath, false);
|
94 |
+
$filePath = $csv->xml_path;
|
95 |
+
$this->is_csv = $csv->is_csv;
|
96 |
+
$this->root_element = 'node';
|
97 |
+
|
98 |
+
} elseif (preg_match('%\W(json)$%i', trim($filePath))){
|
99 |
+
|
100 |
+
$json_str = file_get_contents($filePath);
|
101 |
+
$is_json = pmxi_isJson($json_str);
|
102 |
+
|
103 |
+
if( is_wp_error($is_json)){
|
104 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'pmxi_plugin');
|
105 |
+
}
|
106 |
+
else{
|
107 |
+
|
108 |
+
$xml_data = pmxi_json_to_xml( json_decode($json_str, true) );
|
109 |
+
|
110 |
+
if ( empty($xml_data) ){
|
111 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'pmxi_plugin'));
|
112 |
+
}
|
113 |
+
else{
|
114 |
+
$jsontmpname = $this->uploadsPath .'/'. url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
115 |
+
file_put_contents($jsontmpname, $xml_data);
|
116 |
+
pmxi_remove_source($filePath, false);
|
117 |
+
$filePath = $jsontmpname;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
} elseif (preg_match('%\W(sql)$%i', trim($filePath))){
|
122 |
+
|
123 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
124 |
+
|
125 |
+
$localSQLPath = $filePath;
|
126 |
+
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
127 |
+
$filePath = $sql->parse();
|
128 |
+
pmxi_remove_source($localSQLPath, false);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
} elseif ( preg_match('%\W(csv|txt|dat|psv)$%i', trim($this->file))) { // If CSV file uploaded
|
133 |
+
|
134 |
+
if ( $this->uploadsPath === false ){
|
135 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
136 |
+
}
|
137 |
+
$filePath = $this->file;
|
138 |
+
$source = array(
|
139 |
+
'name' => basename($this->file),
|
140 |
+
'type' => 'upload',
|
141 |
+
'path' => $filePath,
|
142 |
+
);
|
143 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
144 |
+
|
145 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $this->file, 'targetDir' => $this->uploadsPath ) );
|
146 |
+
//@unlink($filePath);
|
147 |
+
$filePath = $csv->xml_path;
|
148 |
+
$this->is_csv = $csv->is_csv;
|
149 |
+
$this->root_element = 'node';
|
150 |
+
|
151 |
+
} elseif(preg_match('%\W(gz)$%i', trim($this->file))){ // If gz file uploaded
|
152 |
+
|
153 |
+
$fileInfo = pmxi_gzfile_get_contents($this->file, 0, $this->uploadsPath);
|
154 |
+
|
155 |
+
if ( ! is_wp_error($fileInfo) ){
|
156 |
+
|
157 |
+
$filePath = $fileInfo['localPath'];
|
158 |
+
|
159 |
+
// Detect if file is very large
|
160 |
+
$source = array(
|
161 |
+
'name' => basename($this->file),
|
162 |
+
'type' => 'upload',
|
163 |
+
'path' => $this->file,
|
164 |
+
);
|
165 |
+
|
166 |
+
// detect CSV or XML
|
167 |
+
if ( $fileInfo['type'] == 'csv') { // it is CSV file
|
168 |
+
|
169 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
170 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targeDir' => $this->uploadsPath ) ); // create chunks
|
171 |
+
//@unlink($filePath);
|
172 |
+
$filePath = $csv->xml_path;
|
173 |
+
$this->is_csv = $csv->is_csv;
|
174 |
+
$this->root_element = 'node';
|
175 |
+
|
176 |
+
}
|
177 |
+
|
178 |
+
}
|
179 |
+
else $this->errors->add('form-validation', $fileInfo->get_error_message());
|
180 |
+
|
181 |
+
} elseif (preg_match('%\W(json)$%i', trim($this->file))){
|
182 |
+
|
183 |
+
// Detect if file is very large
|
184 |
+
$source = array(
|
185 |
+
'name' => basename($this->file),
|
186 |
+
'type' => 'upload',
|
187 |
+
'path' => $this->file,
|
188 |
+
);
|
189 |
+
|
190 |
+
$json_str = file_get_contents($this->file);
|
191 |
+
$is_json = pmxi_isJson($json_str);
|
192 |
+
|
193 |
+
if( is_wp_error($is_json)){
|
194 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'pmxi_plugin');
|
195 |
+
}
|
196 |
+
else{
|
197 |
+
|
198 |
+
$xml_data = pmxi_json_to_xml( json_decode($json_str, true) );
|
199 |
+
|
200 |
+
if ( empty($xml_data) ){
|
201 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'pmxi_plugin'));
|
202 |
+
}
|
203 |
+
else{
|
204 |
+
$jsontmpname = $this->uploadsPath .'/'. url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($this->file))));
|
205 |
+
//@unlink($this->file);
|
206 |
+
file_put_contents($jsontmpname, $xml_data);
|
207 |
+
$filePath = $jsontmpname;
|
208 |
+
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
} elseif (preg_match('%\W(sql)$%i', trim($this->file))){
|
213 |
+
|
214 |
+
$source = array(
|
215 |
+
'name' => basename($this->file),
|
216 |
+
'type' => 'upload',
|
217 |
+
'path' => $this->file,
|
218 |
+
);
|
219 |
+
|
220 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
221 |
+
|
222 |
+
$sql = new PMXI_SQLParser( $this->file, $this->uploadsPath );
|
223 |
+
$filePath = $sql->parse();
|
224 |
+
//@unlink($this->file);
|
225 |
+
|
226 |
+
} else { // If XML file uploaded
|
227 |
+
|
228 |
+
// Detect if file is very large
|
229 |
+
$filePath = $this->file;
|
230 |
+
$source = array(
|
231 |
+
'name' => basename($this->file),
|
232 |
+
'type' => 'upload',
|
233 |
+
'path' => $filePath,
|
234 |
+
);
|
235 |
+
|
236 |
+
}
|
237 |
+
|
238 |
+
if ( $this->errors->get_error_codes() ) return $this->errors;
|
239 |
+
|
240 |
+
return array(
|
241 |
+
'filePath' => $filePath,
|
242 |
+
'source' => $source,
|
243 |
+
'root_element' => $this->root_element,
|
244 |
+
'is_csv' => $this->is_csv
|
245 |
+
);
|
246 |
+
}
|
247 |
+
|
248 |
+
public function url( $feed_type = ''){
|
249 |
+
|
250 |
+
$uploads = wp_upload_dir();
|
251 |
+
|
252 |
+
if (empty($this->file)) {
|
253 |
+
$this->errors->add('form-validation', __('Please specify a file to import.', 'pmxi_plugin'));
|
254 |
+
} elseif ( ! preg_match('%^https?://%i', $this->file)) {
|
255 |
+
$this->errors->add('form-validation', __('The URL to your file is not valid.<br/><br/>Please make sure the URL starts with http:// or https://. To import from https://, your server must have OpenSSL installed.'), 'pmxi_plugin');
|
256 |
+
} elseif( ! is_writeable($this->uploadsPath)){
|
257 |
+
$this->errors->add('form-validation', __('Uploads folder '.$this->uploadsPath.' is not writable.'), 'pmxi_plugin');
|
258 |
+
}
|
259 |
+
|
260 |
+
$this->file = trim($this->file);
|
261 |
+
|
262 |
+
$csv_path = '';
|
263 |
+
|
264 |
+
if ( empty($this->errors->errors) ){
|
265 |
+
|
266 |
+
if( '' == $feed_type and ! preg_match('%\W(xml|csv|zip|gz)$%i', trim($this->file))) $feed_type = pmxi_get_remote_file_name(trim($this->file));
|
267 |
+
|
268 |
+
if ('zip' == $feed_type or '' == $feed_type and preg_match('%\W(zip)$%i', trim($this->file))) {
|
269 |
+
|
270 |
+
$tmpname = $this->uploadsPath . '/' . wp_unique_filename($this->uploadsPath, basename($this->file));
|
271 |
+
|
272 |
+
@copy($this->file, $tmpname);
|
273 |
+
|
274 |
+
if (!file_exists($tmpname)) {
|
275 |
+
$request = get_file_curl($this->file, $tmpname);
|
276 |
+
if (is_wp_error($request)) $this->errors->add('form-validation', $request->get_error_message());
|
277 |
+
if (!file_exists($tmpname)) $this->errors->add('form-validation', __('Failed upload ZIP archive', 'pmxi_plugin'));
|
278 |
+
}
|
279 |
+
|
280 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/pclzip.lib.php');
|
281 |
+
|
282 |
+
$archive = new PclZip($tmpname);
|
283 |
+
if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
|
284 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'pmxi_plugin'));
|
285 |
+
}
|
286 |
+
else {
|
287 |
+
|
288 |
+
$filePath = '';
|
289 |
+
|
290 |
+
if (!empty($v_result_list)){
|
291 |
+
foreach ($v_result_list as $unzipped_file) {
|
292 |
+
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json)$%i', trim($unzipped_file['stored_filename']))) { $filePath = $unzipped_file['filename']; break; }
|
293 |
+
}
|
294 |
+
}
|
295 |
+
if($this->uploadsPath === false){
|
296 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
297 |
+
}
|
298 |
+
|
299 |
+
if(empty($filePath)){
|
300 |
+
$zip = zip_open(trim($tmpname));
|
301 |
+
if (is_resource($zip)) {
|
302 |
+
while ($zip_entry = zip_read($zip)) {
|
303 |
+
$filePath = zip_entry_name($zip_entry);
|
304 |
+
$fp = fopen($this->uploadsPath."/".$filePath, "w");
|
305 |
+
if (zip_entry_open($zip, $zip_entry, "r")) {
|
306 |
+
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
307 |
+
fwrite($fp,"$buf");
|
308 |
+
zip_entry_close($zip_entry);
|
309 |
+
fclose($fp);
|
310 |
+
}
|
311 |
+
break;
|
312 |
+
}
|
313 |
+
zip_close($zip);
|
314 |
+
|
315 |
+
} else {
|
316 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'pmxi_plugin'));
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
// Detect if file is very large
|
321 |
+
$source = array(
|
322 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
323 |
+
'type' => 'url',
|
324 |
+
'path' => $this->file,
|
325 |
+
);
|
326 |
+
|
327 |
+
if (preg_match('%\W(csv|txt|dat|psv)$%i', trim($filePath))){
|
328 |
+
|
329 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
330 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
331 |
+
//pmxi_remove_source($filePath, false);
|
332 |
+
|
333 |
+
$csv_path = $filePath;
|
334 |
+
|
335 |
+
$filePath = $csv->xml_path;
|
336 |
+
$this->is_csv = $csv->is_csv;
|
337 |
+
$this->root_element = 'node';
|
338 |
+
|
339 |
+
}
|
340 |
+
elseif (preg_match('%\W(json)$%i', trim($filePath))){
|
341 |
+
|
342 |
+
$json_str = file_get_contents($filePath);
|
343 |
+
$is_json = pmxi_isJson($json_str);
|
344 |
+
|
345 |
+
if( is_wp_error($is_json)){
|
346 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'pmxi_plugin');
|
347 |
+
}
|
348 |
+
else{
|
349 |
+
|
350 |
+
$xml_data = pmxi_json_to_xml( json_decode($json_str, true) );
|
351 |
+
|
352 |
+
if ( empty($xml_data) ){
|
353 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'pmxi_plugin'));
|
354 |
+
}
|
355 |
+
else{
|
356 |
+
$jsontmpname = $this->uploadsPath .'/'. url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
357 |
+
file_put_contents($jsontmpname, $xml_data);
|
358 |
+
pmxi_remove_source($filePath, false);
|
359 |
+
$filePath = $jsontmpname;
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
elseif (preg_match('%\W(sql)$%i', trim($filePath))){
|
364 |
+
|
365 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
366 |
+
|
367 |
+
$localSQLPath = $filePath;
|
368 |
+
|
369 |
+
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
370 |
+
$filePath = $sql->parse();
|
371 |
+
pmxi_remove_source($localSQLPath, false);
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
if (file_exists($tmpname)) pmxi_remove_source($tmpname, false);
|
376 |
+
|
377 |
+
} elseif ('csv' == $feed_type or '' == $feed_type and preg_match('%\W(csv|txt|dat|psv)$%i', trim($this->file))) {
|
378 |
+
|
379 |
+
$source = array(
|
380 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
381 |
+
'type' => 'url',
|
382 |
+
'path' => $this->file,
|
383 |
+
);
|
384 |
+
|
385 |
+
// copy remote file in binary mode
|
386 |
+
$filePath = pmxi_copy_url_file($this->file, false, $this->uploadsPath);
|
387 |
+
|
388 |
+
if ( ! is_wp_error($filePath) ){
|
389 |
+
|
390 |
+
if ( ! file_exists($filePath)) {
|
391 |
+
$this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'pmxi_plugin'));
|
392 |
+
}
|
393 |
+
|
394 |
+
// Detect if file is very large
|
395 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
396 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
397 |
+
//pmxi_remove_source($filePath, false);
|
398 |
+
|
399 |
+
$csv_path = $filePath;
|
400 |
+
|
401 |
+
$filePath = $csv->xml_path;
|
402 |
+
$this->is_csv = $csv->is_csv;
|
403 |
+
$this->root_element = 'node';
|
404 |
+
|
405 |
+
}
|
406 |
+
else $this->errors->add('form-validation', $filePath->get_error_message());
|
407 |
+
|
408 |
+
} elseif (preg_match('%\W(json)$%i', trim($this->file))){
|
409 |
+
|
410 |
+
$source = array(
|
411 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
412 |
+
'type' => 'url',
|
413 |
+
'path' => $this->file,
|
414 |
+
);
|
415 |
+
|
416 |
+
// copy remote file in binary mode
|
417 |
+
$filePath = pmxi_copy_url_file($this->file, false, $this->uploadsPath);
|
418 |
+
|
419 |
+
$json_str = file_get_contents($filePath);
|
420 |
+
$is_json = pmxi_isJson($json_str);
|
421 |
+
|
422 |
+
if( is_wp_error($is_json)){
|
423 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'pmxi_plugin');
|
424 |
+
}
|
425 |
+
else{
|
426 |
+
|
427 |
+
$xml_data = pmxi_json_to_xml( json_decode($json_str, true) );
|
428 |
+
|
429 |
+
if ( empty($xml_data) ){
|
430 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'pmxi_plugin'));
|
431 |
+
}
|
432 |
+
else{
|
433 |
+
$tmpname = $this->uploadsPath .'/'. url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
434 |
+
file_put_contents($tmpname, $xml_data);
|
435 |
+
pmxi_remove_source($filePath, false);
|
436 |
+
$filePath = $tmpname;
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
} elseif (preg_match('%\W(sql)$%i', trim($this->file))){
|
441 |
+
|
442 |
+
$source = array(
|
443 |
+
'name' => basename($this->file),
|
444 |
+
'type' => 'url',
|
445 |
+
'path' => $this->file,
|
446 |
+
);
|
447 |
+
|
448 |
+
// copy remote file in binary mode
|
449 |
+
$localSQLPath = pmxi_copy_url_file($this->file, false, $this->uploadsPath);
|
450 |
+
|
451 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
452 |
+
|
453 |
+
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
454 |
+
$filePath = $sql->parse();
|
455 |
+
pmxi_remove_source($localSQLPath, false);
|
456 |
+
|
457 |
+
} else {
|
458 |
+
|
459 |
+
$fileInfo = ('gz' == $feed_type or '' == $feed_type and preg_match('%\W(gz)$%i', trim($this->file))) ? pmxi_gzfile_get_contents($this->file, 0, $this->uploadsPath) : pmxi_copy_url_file($this->file, true, $this->uploadsPath);
|
460 |
+
|
461 |
+
if ( ! is_wp_error($fileInfo) ){
|
462 |
+
|
463 |
+
$filePath = $fileInfo['localPath'];
|
464 |
+
|
465 |
+
if ( ! file_exists($filePath)) {
|
466 |
+
$this->errors->add('form-validation', __('WP All Import was not able to download your file.<br/><br/>Please make sure the URL to your file is valid.<br/>You can test this by pasting it into your browser.<br/>Other reasons for this error can include some server setting on your host restricting access to this particular URL or external URLs in general, or some setting on the server hosting the file you are trying to access preventing your server from accessing it.', 'pmxi_plugin'));
|
467 |
+
}
|
468 |
+
|
469 |
+
// Detect if file is very large
|
470 |
+
$source = array(
|
471 |
+
'name' => basename(parse_url($this->file, PHP_URL_PATH)),
|
472 |
+
'type' => 'url',
|
473 |
+
'path' => $this->file,
|
474 |
+
);
|
475 |
+
|
476 |
+
// detect CSV or XML
|
477 |
+
if ( $fileInfo['type'] == 'csv') { // it is CSV file
|
478 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
479 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
480 |
+
|
481 |
+
$csv_path = $filePath;
|
482 |
+
|
483 |
+
//pmxi_remove_source($filePath, false);
|
484 |
+
$filePath = $csv->xml_path;
|
485 |
+
$this->is_csv = $csv->is_csv;
|
486 |
+
$this->root_element = 'node';
|
487 |
+
}
|
488 |
+
}
|
489 |
+
else $this->errors->add('form-validation', $fileInfo->get_error_message());
|
490 |
+
}
|
491 |
+
}
|
492 |
+
|
493 |
+
if ( $this->errors->get_error_codes() ) return $this->errors;
|
494 |
+
|
495 |
+
return array(
|
496 |
+
'filePath' => $filePath,
|
497 |
+
'source' => $source,
|
498 |
+
'root_element' => $this->root_element,
|
499 |
+
'feed_type' => $feed_type,
|
500 |
+
'is_csv' => $this->is_csv,
|
501 |
+
'csv_path' => $csv_path
|
502 |
+
);
|
503 |
+
}
|
504 |
+
|
505 |
+
public function file(){
|
506 |
+
|
507 |
+
$wp_uploads = wp_upload_dir();
|
508 |
+
|
509 |
+
$uploads = $wp_uploads['basedir'] . '/wpallimport/files/';
|
510 |
+
|
511 |
+
if (empty($this->file)) {
|
512 |
+
$this->errors->add('form-validation', __('Please specify a file to import.', 'pmxi_plugin'));
|
513 |
+
} elseif (preg_match('%\W(zip)$%i', trim($this->file))) {
|
514 |
+
|
515 |
+
if($this->uploadsPath === false){
|
516 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
517 |
+
}
|
518 |
+
|
519 |
+
echo '<span style="display:none">';
|
520 |
+
copy( $uploads . $this->file, $this->uploadsPath . '/' . basename($this->file));
|
521 |
+
echo '</span>';
|
522 |
+
|
523 |
+
$zipfilePath = $this->uploadsPath . '/' . basename($this->file);
|
524 |
+
|
525 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/pclzip.lib.php');
|
526 |
+
|
527 |
+
$archive = new PclZip($zipfilePath);
|
528 |
+
if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $this->uploadsPath, PCLZIP_OPT_REPLACE_NEWER)) == 0) {
|
529 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'pmxi_plugin'));
|
530 |
+
}
|
531 |
+
else {
|
532 |
+
|
533 |
+
$filePath = '';
|
534 |
+
|
535 |
+
if (!empty($v_result_list)){
|
536 |
+
foreach ($v_result_list as $unzipped_file) {
|
537 |
+
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv|json)$%i', trim($unzipped_file['stored_filename']))) { $filePath = $unzipped_file['filename']; break; }
|
538 |
+
}
|
539 |
+
}
|
540 |
+
if($this->uploadsPath === false){
|
541 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
542 |
+
}
|
543 |
+
|
544 |
+
if(empty($filePath)){
|
545 |
+
$zip = zip_open(trim($zipfilePath));
|
546 |
+
if (is_resource($zip)) {
|
547 |
+
while ($zip_entry = zip_read($zip)) {
|
548 |
+
$filePath = zip_entry_name($zip_entry);
|
549 |
+
$fp = fopen($this->uploadsPath."/".$filePath, "w");
|
550 |
+
if (zip_entry_open($zip, $zip_entry, "r")) {
|
551 |
+
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
552 |
+
fwrite($fp,"$buf");
|
553 |
+
zip_entry_close($zip_entry);
|
554 |
+
fclose($fp);
|
555 |
+
}
|
556 |
+
break;
|
557 |
+
}
|
558 |
+
zip_close($zip);
|
559 |
+
|
560 |
+
} else {
|
561 |
+
$this->errors->add('form-validation', __('WP All Import couldn\'t find a file to import inside your ZIP.<br/><br/>Either the .ZIP file is broken, or doesn\'t contain a file with an extension of XML, CSV, PSV, DAT, or TXT. <br/>Please attempt to unzip your .ZIP file on your computer to ensure it is a valid .ZIP file which can actually be unzipped, and that it contains a file which WP All Import can import.', 'pmxi_plugin'));
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
// Detect if file is very large
|
566 |
+
$source = array(
|
567 |
+
'name' => basename($this->file),
|
568 |
+
'type' => 'file',
|
569 |
+
'path' => $uploads . $this->file,
|
570 |
+
);
|
571 |
+
|
572 |
+
if (preg_match('%\W(csv|txt|dat|psv)$%i', trim($filePath))){ // If CSV file found in archieve
|
573 |
+
|
574 |
+
if($this->uploadsPath === false){
|
575 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
576 |
+
}
|
577 |
+
|
578 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
579 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
580 |
+
//pmxi_remove_source($filePath, false);
|
581 |
+
$filePath = $csv->xml_path;
|
582 |
+
$this->is_csv = $csv->is_csv;
|
583 |
+
$this->root_element = 'node';
|
584 |
+
|
585 |
+
}
|
586 |
+
elseif (preg_match('%\W(json)$%i', trim($filePath))){
|
587 |
+
|
588 |
+
$json_str = file_get_contents($filePath);
|
589 |
+
$is_json = pmxi_isJson($json_str);
|
590 |
+
|
591 |
+
if( is_wp_error($is_json)){
|
592 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'pmxi_plugin');
|
593 |
+
}
|
594 |
+
else{
|
595 |
+
|
596 |
+
$xml_data = pmxi_json_to_xml( json_decode($json_str, true) );
|
597 |
+
|
598 |
+
if ( empty($xml_data) ){
|
599 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'pmxi_plugin'));
|
600 |
+
}
|
601 |
+
else{
|
602 |
+
$jsontmpname = $this->uploadsPath .'/'. url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
603 |
+
file_put_contents($jsontmpname, $xml_data);
|
604 |
+
pmxi_remove_source($filePath);
|
605 |
+
$filePath = $jsontmpname;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
elseif (preg_match('%\W(sql)$%i', trim($filePath))){
|
610 |
+
|
611 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
612 |
+
|
613 |
+
$localSQLPath = $filePath;
|
614 |
+
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
615 |
+
$filePath = $sql->parse();
|
616 |
+
pmxi_remove_source($localSQLPath, false);
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
+
if (file_exists($zipfilePath)) pmxi_remove_source($zipfilePath, false);
|
621 |
+
|
622 |
+
} elseif (preg_match('%\W(csv|txt|dat|psv)$%i', trim($this->file))) {
|
623 |
+
|
624 |
+
if($this->uploadsPath === false){
|
625 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
626 |
+
}
|
627 |
+
// copy file in temporary folder
|
628 |
+
// hide warning message
|
629 |
+
echo '<span style="display:none">';
|
630 |
+
copy( $uploads . $this->file, $this->uploadsPath . '/' . basename($this->file));
|
631 |
+
echo '</span>';
|
632 |
+
|
633 |
+
$filePath = $this->uploadsPath . '/' . basename($this->file);
|
634 |
+
$source = array(
|
635 |
+
'name' => basename($this->file),
|
636 |
+
'type' => 'file',
|
637 |
+
'path' => $uploads . $this->file,
|
638 |
+
);
|
639 |
+
|
640 |
+
// Detect if file is very large
|
641 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
642 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
643 |
+
//pmxi_remove_source($filePath, false);
|
644 |
+
$filePath = $csv->xml_path;
|
645 |
+
$this->is_csv = $csv->is_csv;
|
646 |
+
$this->root_element = 'node';
|
647 |
+
|
648 |
+
}
|
649 |
+
elseif (preg_match('%\W(json)$%i', trim($this->file))){
|
650 |
+
|
651 |
+
if($this->uploadsPath === false){
|
652 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
653 |
+
}
|
654 |
+
// copy file in temporary folder
|
655 |
+
// hide warning message
|
656 |
+
echo '<span style="display:none">';
|
657 |
+
copy( $uploads . $this->file, $this->uploadsPath . '/' . basename($this->file));
|
658 |
+
echo '</span>';
|
659 |
+
|
660 |
+
$filePath = $this->uploadsPath . '/' . basename($this->file);
|
661 |
+
$source = array(
|
662 |
+
'name' => basename($this->file),
|
663 |
+
'type' => 'file',
|
664 |
+
'path' => $uploads . $this->file,
|
665 |
+
);
|
666 |
+
|
667 |
+
$json_str = file_get_contents($filePath);
|
668 |
+
$is_json = pmxi_isJson($json_str);
|
669 |
+
|
670 |
+
if( is_wp_error($is_json)){
|
671 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'pmxi_plugin');
|
672 |
+
}
|
673 |
+
else{
|
674 |
+
|
675 |
+
$xml_data = pmxi_json_to_xml( json_decode($json_str, true) );
|
676 |
+
|
677 |
+
if ( empty($xml_data) ){
|
678 |
+
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', 'pmxi_plugin'));
|
679 |
+
}
|
680 |
+
else{
|
681 |
+
$jsontmpname = $this->uploadsPath .'/'. url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
682 |
+
file_put_contents($jsontmpname, $xml_data);
|
683 |
+
pmxi_remove_source($filePath, false);
|
684 |
+
$filePath = $jsontmpname;
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
} elseif (preg_match('%\W(sql)$%i', trim($this->file))){
|
689 |
+
|
690 |
+
if($this->uploadsPath === false){
|
691 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
692 |
+
}
|
693 |
+
// copy file in temporary folder
|
694 |
+
// hide warning message
|
695 |
+
echo '<span style="display:none">';
|
696 |
+
copy( $uploads . $this->file, $this->uploadsPath . '/' . basename($this->file));
|
697 |
+
echo '</span>';
|
698 |
+
|
699 |
+
$localSQLPath = $this->uploadsPath . '/' . basename($this->file);
|
700 |
+
$source = array(
|
701 |
+
'name' => basename($this->file),
|
702 |
+
'type' => 'file',
|
703 |
+
'path' => $uploads . $this->file,
|
704 |
+
);
|
705 |
+
|
706 |
+
include_once( PMXI_Plugin::ROOT_DIR . '/libraries/XmlImportSQLParse.php' );
|
707 |
+
|
708 |
+
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
709 |
+
$filePath = $sql->parse();
|
710 |
+
pmxi_remove_source($localSQLPath, false);
|
711 |
+
|
712 |
+
}
|
713 |
+
else {
|
714 |
+
|
715 |
+
if($this->uploadsPath === false){
|
716 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'pmxi_plugin'));
|
717 |
+
}
|
718 |
+
// copy file in temporary folder
|
719 |
+
// hide warning message
|
720 |
+
echo '<span style="display:none">';
|
721 |
+
copy( $uploads . $this->file, $this->uploadsPath . '/' . basename($this->file));
|
722 |
+
echo '</span>';
|
723 |
+
|
724 |
+
$source = array(
|
725 |
+
'name' => basename($this->file),
|
726 |
+
'type' => 'file',
|
727 |
+
'path' => $uploads . $this->file,
|
728 |
+
);
|
729 |
+
|
730 |
+
$filePath = $this->uploadsPath . '/' . basename($this->file);
|
731 |
+
|
732 |
+
if ( preg_match('%\W(gz)$%i', basename($this->file))){
|
733 |
+
$fileInfo = pmxi_gzfile_get_contents($filePath, 0, $this->uploadsPath);
|
734 |
+
if ( ! is_wp_error($fileInfo)){
|
735 |
+
pmxi_remove_source($filePath, false);
|
736 |
+
$filePath = $fileInfo['localPath'];
|
737 |
+
}
|
738 |
+
else $this->errors->add('form-validation', $fileInfo->get_error_message());
|
739 |
+
}
|
740 |
+
|
741 |
+
if ( preg_match('%\W(csv|txt|dat|psv)$%i', trim($this->file)) or (!empty($fileInfo) and $fileInfo['type'] == 'csv') ){
|
742 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
743 |
+
$csv = new PMXI_CsvParser( array( 'filename' => $filePath, 'targetDir' => $this->uploadsPath ) ); // create chunks
|
744 |
+
//pmxi_remove_source($filePath, false);
|
745 |
+
$filePath = $csv->xml_path;
|
746 |
+
$this->is_csv = $csv->is_csv;
|
747 |
+
$this->root_element = 'node';
|
748 |
+
}
|
749 |
+
}
|
750 |
+
|
751 |
+
if ( $this->errors->get_error_codes() ) return $this->errors;
|
752 |
+
|
753 |
+
return array(
|
754 |
+
'filePath' => $filePath,
|
755 |
+
'source' => $source,
|
756 |
+
'root_element' => $this->root_element,
|
757 |
+
'is_csv' => $this->is_csv
|
758 |
+
);
|
759 |
+
}
|
760 |
+
}
|
761 |
+
|
762 |
+
}
|
config/options.php
CHANGED
@@ -24,6 +24,9 @@ $config = array(
|
|
24 |
"session_mode" => 'default',
|
25 |
"enable_ftp_import" => 0,
|
26 |
"large_feed_limit" => 1000,
|
27 |
-
"enable_cron_processing_time_limit" => 0,
|
28 |
-
"cron_processing_time_limit" => 120
|
|
|
|
|
|
|
29 |
);
|
24 |
"session_mode" => 'default',
|
25 |
"enable_ftp_import" => 0,
|
26 |
"large_feed_limit" => 1000,
|
27 |
+
//"enable_cron_processing_time_limit" => 0,
|
28 |
+
"cron_processing_time_limit" => 120,
|
29 |
+
"secure" => 1,
|
30 |
+
"log_storage" => 5,
|
31 |
+
"cron_sleep" => ""
|
32 |
);
|
controllers/admin/history.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Manage Import's History
|
4 |
+
*
|
5 |
+
* @author Pavel Kulbakin <p.kulbakin@gmail.com>
|
6 |
+
*/
|
7 |
+
class PMXI_Admin_History extends PMXI_Controller_Admin {
|
8 |
+
|
9 |
+
public function init() {
|
10 |
+
parent::init();
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Import's History list
|
16 |
+
*/
|
17 |
+
public function index() {
|
18 |
+
|
19 |
+
$get = $this->input->get(array(
|
20 |
+
's' => '',
|
21 |
+
'order_by' => 'date',
|
22 |
+
'order' => 'DESC',
|
23 |
+
'pagenum' => 1,
|
24 |
+
'perPage' => 25,
|
25 |
+
'id' => ''
|
26 |
+
));
|
27 |
+
$get['pagenum'] = absint($get['pagenum']);
|
28 |
+
extract($get);
|
29 |
+
if (empty($id)){
|
30 |
+
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Import is not specified.', 'pmxi_plugin'))), $this->baseUrl)); die();
|
31 |
+
}
|
32 |
+
$this->data += $get;
|
33 |
+
$by = array('import_id' => $id);
|
34 |
+
|
35 |
+
$this->data['import'] = new PMXI_Import_Record();
|
36 |
+
$this->data['import']->getById($id);
|
37 |
+
|
38 |
+
$list = new PMXI_History_List();
|
39 |
+
|
40 |
+
$this->data['list'] = $list->setColumns(
|
41 |
+
$list->getTable() . '.*'
|
42 |
+
)->getBy($by, "$order_by $order", $pagenum, $perPage, $list->getTable() . '.id');
|
43 |
+
|
44 |
+
$this->data['page_links'] = paginate_links(array(
|
45 |
+
'base' => add_query_arg(array('id' => $id, 'pagenum' => '%#%'), $this->baseUrl),
|
46 |
+
'format' => '',
|
47 |
+
'prev_text' => __('«', 'pmxi_plugin'),
|
48 |
+
'next_text' => __('»', 'pmxi_plugin'),
|
49 |
+
'total' => ceil($list->total() / $perPage),
|
50 |
+
'current' => $pagenum,
|
51 |
+
));
|
52 |
+
|
53 |
+
$this->render();
|
54 |
+
}
|
55 |
+
|
56 |
+
/*
|
57 |
+
* Download import log file
|
58 |
+
*
|
59 |
+
*/
|
60 |
+
public function log(){
|
61 |
+
|
62 |
+
$id = $this->input->get('history_id');
|
63 |
+
|
64 |
+
$import_id = $this->input->get('id');
|
65 |
+
|
66 |
+
$wp_uploads = wp_upload_dir();
|
67 |
+
|
68 |
+
$log_file = pmxi_secure_file( $wp_uploads['basedir'] . "/wpallimport/logs", 'logs', $id ) . '/' . $id . '.html';
|
69 |
+
|
70 |
+
if (file_exists($log_file))
|
71 |
+
{
|
72 |
+
PMXI_download::xml($log_file);
|
73 |
+
}
|
74 |
+
else
|
75 |
+
{
|
76 |
+
|
77 |
+
wp_redirect(add_query_arg(array('id' => $import_id, 'pmxi_nt' => urlencode(__('Log file does not exists.', 'pmxi_plugin'))), $this->baseUrl)); die();
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Delete an import
|
83 |
+
*/
|
84 |
+
public function delete() {
|
85 |
+
$id = $this->input->get('id');
|
86 |
+
$this->data['item'] = $item = new PMXI_History_Record();
|
87 |
+
if ( ! $id or $item->getById($id)->isEmpty()) {
|
88 |
+
wp_redirect($this->baseUrl); die();
|
89 |
+
}
|
90 |
+
$item->delete();
|
91 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('History deleted', 'pmxi_plugin')), $this->baseUrl)); die();
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Bulk actions
|
96 |
+
*/
|
97 |
+
public function bulk() {
|
98 |
+
check_admin_referer('bulk-imports', '_wpnonce_bulk-imports');
|
99 |
+
if ($this->input->post('doaction2')) {
|
100 |
+
$this->data['action'] = $action = $this->input->post('bulk-action2');
|
101 |
+
} else {
|
102 |
+
$this->data['action'] = $action = $this->input->post('bulk-action');
|
103 |
+
}
|
104 |
+
$this->data['ids'] = $ids = $this->input->post('items');
|
105 |
+
$this->data['items'] = $items = new PMXI_History_List();
|
106 |
+
if (empty($action) or ! in_array($action, array('delete')) or empty($ids) or $items->getBy('id', $ids)->isEmpty()) {
|
107 |
+
wp_redirect($this->baseUrl); die();
|
108 |
+
}
|
109 |
+
|
110 |
+
foreach($items->convertRecords() as $item) {
|
111 |
+
$item->delete();
|
112 |
+
}
|
113 |
+
|
114 |
+
$id = $this->input->get('id');
|
115 |
+
|
116 |
+
wp_redirect(add_query_arg(array('id' => $id, 'pmxi_nt' => urlencode(sprintf(__('<strong>%d</strong> %s deleted', 'pmxi_plugin'), $items->count(), _n('history', 'histories', $items->count(), 'pmxi_plugin')))), $this->baseUrl)); die();
|
117 |
+
|
118 |
+
}
|
119 |
+
}
|
controllers/admin/import.php
CHANGED
@@ -14,8 +14,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
14 |
|
15 |
error_reporting(0);
|
16 |
|
17 |
-
PMXI_Plugin::$session = PMXI_Session::get_instance();
|
18 |
-
PMXI_Plugin::$session->session_started();
|
19 |
|
20 |
if ('PMXI_Admin_Manage' == PMXI_Plugin::getInstance()->getAdminCurrentScreen()->base) { // prereqisites are not checked when flow control is deligated
|
21 |
$id = $this->input->get('id');
|
@@ -26,7 +25,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
26 |
$this->isWizard = false;
|
27 |
|
28 |
} else {
|
29 |
-
$action = PMXI_Plugin::getInstance()->getAdminCurrentScreen()->action;
|
30 |
$this->_step_ready($action);
|
31 |
$this->isInline = 'process' == $action;
|
32 |
}
|
@@ -54,27 +53,26 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
54 |
*/
|
55 |
protected function _step_ready($action) {
|
56 |
// step #1: xml selction - has no prerequisites
|
57 |
-
if ('index' == $action) return true;
|
58 |
|
59 |
// step #2: element selection
|
60 |
-
$this->data['dom'] = $dom = new DOMDocument('1.0', PMXI_Plugin::$session->
|
61 |
$this->data['update_previous'] = $update_previous = new PMXI_Import_Record();
|
62 |
$old = libxml_use_internal_errors(true);
|
63 |
|
64 |
$xml = $this->get_xml();
|
65 |
|
66 |
if (empty($xml) and in_array($action, array('process')) ){
|
67 |
-
! empty(PMXI_Plugin::$session->
|
68 |
return true;
|
69 |
}
|
70 |
|
71 |
-
if (
|
72 |
-
or ! empty(PMXI_Plugin::$session->
|
73 |
-
or ! @$dom->loadXML($xml)// FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
74 |
-
//or empty(PMXI_Plugin::$session['pmxi_import']['source'])
|
75 |
) {
|
76 |
-
if (!PMXI_Plugin::is_ajax()){
|
77 |
-
$this->errors->add('form-validation', __('
|
78 |
wp_redirect_or_javascript($this->baseUrl); die();
|
79 |
}
|
80 |
}
|
@@ -86,24 +84,24 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
86 |
|
87 |
// step #3: template
|
88 |
$xpath = new DOMXPath($dom);
|
89 |
-
$this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->
|
90 |
|
91 |
-
if ('preview' == $action or 'tag' == $action) return true;
|
92 |
|
93 |
-
if (
|
94 |
-
$this->errors->add('form-validation', __('
|
95 |
wp_redirect_or_javascript(add_query_arg('action', 'element', $this->baseUrl)); die();
|
96 |
}
|
97 |
|
98 |
if ('template' == $action or 'preview' == $action or 'tag' == $action) return true;
|
99 |
|
100 |
// step #4: options
|
101 |
-
if (empty(PMXI_Plugin::$session->
|
102 |
wp_redirect_or_javascript(add_query_arg('action', 'template', $this->baseUrl)); die();
|
103 |
}
|
104 |
if ('options' == $action) return true;
|
105 |
|
106 |
-
if (empty(PMXI_Plugin::$session->
|
107 |
wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
|
108 |
}
|
109 |
}
|
@@ -112,19 +110,21 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
112 |
* Step #1: Choose File
|
113 |
*/
|
114 |
public function index() {
|
|
|
|
|
115 |
|
116 |
$this->data['reimported_import'] = $import = new PMXI_Import_Record();
|
117 |
$this->data['id'] = $id = $this->input->get('id');
|
118 |
$this->data['parent_import'] = $parent_import = $this->input->get('parent_import', 0);
|
|
|
119 |
|
120 |
-
|
121 |
-
wp_redirect(remove_query_arg('id', $this->baseUrl)); die();
|
122 |
-
}
|
123 |
-
|
124 |
-
$this->data['post'] = $post = $this->input->post(array(
|
125 |
'type' => 'upload',
|
|
|
|
|
|
|
126 |
'feed_type' => '',
|
127 |
-
'url' => '
|
128 |
'ftp' => array('url' => 'ftp://'),
|
129 |
'file' => '',
|
130 |
'reimport' => '',
|
@@ -132,145 +132,87 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
132 |
'update_previous' => $id,
|
133 |
'xpath' => '/',
|
134 |
'filepath' => '',
|
135 |
-
'root_element' => ''
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
if ($this->input->post('is_submitted_continue')) {
|
139 |
-
if ( ! empty(PMXI_Plugin::$session->
|
140 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
141 |
}
|
142 |
-
} elseif ('upload' == $this->input->post('type')) {
|
143 |
-
|
144 |
-
$uploads = wp_upload_dir();
|
145 |
-
|
146 |
-
if (empty($post['filepath'])) {
|
147 |
-
$this->errors->add('form-validation', __('XML/CSV file must be specified', 'pmxi_plugin'));
|
148 |
-
} elseif (!is_file($post['filepath'])) {
|
149 |
-
$this->errors->add('form-validation', __('Uploaded file is empty', 'pmxi_plugin'));
|
150 |
-
} elseif ( ! preg_match('%\W(xml|gzip|zip|csv|gz)$%i', trim(basename($post['filepath'])))) {
|
151 |
-
$this->errors->add('form-validation', __('Uploaded file must be XML, CSV or ZIP, GZIP', 'pmxi_plugin'));
|
152 |
-
} elseif (preg_match('%\W(zip)$%i', trim(basename($post['filepath'])))) {
|
153 |
-
|
154 |
-
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/pclzip.lib.php');
|
155 |
-
|
156 |
-
$archive = new PclZip($post['filepath']);
|
157 |
-
if (($v_result_list = $archive->extract(PCLZIP_OPT_PATH, $uploads['path'], PCLZIP_OPT_REPLACE_NEWER)) == 0) {
|
158 |
-
$this->errors->add('form-validation', 'Failed to open uploaded ZIP archive : '.$archive->errorInfo(true));
|
159 |
-
}
|
160 |
-
else {
|
161 |
-
|
162 |
-
$filePath = '';
|
163 |
-
|
164 |
-
if (!empty($v_result_list)){
|
165 |
-
foreach ($v_result_list as $unzipped_file) {
|
166 |
-
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv)$%i', trim($unzipped_file['stored_filename']))) { $filePath = $unzipped_file['filename']; break; }
|
167 |
-
}
|
168 |
-
}
|
169 |
-
if($uploads['error']){
|
170 |
-
$this->errors->add('form-validation', __('Can not create upload folder. Permision denied', 'pmxi_plugin'));
|
171 |
-
}
|
172 |
-
|
173 |
-
if(empty($filePath)){
|
174 |
-
$zip = zip_open(trim($post['filepath']));
|
175 |
-
if (is_resource($zip)) {
|
176 |
-
while ($zip_entry = zip_read($zip)) {
|
177 |
-
$filePath = zip_entry_name($zip_entry);
|
178 |
-
$fp = fopen($uploads['path']."/".$filePath, "w");
|
179 |
-
if (zip_entry_open($zip, $zip_entry, "r")) {
|
180 |
-
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
181 |
-
fwrite($fp,"$buf");
|
182 |
-
zip_entry_close($zip_entry);
|
183 |
-
fclose($fp);
|
184 |
-
}
|
185 |
-
break;
|
186 |
-
}
|
187 |
-
zip_close($zip);
|
188 |
-
|
189 |
-
} else {
|
190 |
-
$this->errors->add('form-validation', __('Failed to open uploaded ZIP archive. Can\'t extract files.', 'pmxi_plugin'));
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
// Detect if file is very large
|
195 |
-
$source = array(
|
196 |
-
'name' => basename($post['filepath']),
|
197 |
-
'type' => 'upload',
|
198 |
-
'path' => $post['filepath'],
|
199 |
-
);
|
200 |
-
|
201 |
-
if (preg_match('%\W(csv|txt|dat|psv)$%i', trim($filePath))){ // If CSV file found in archieve
|
202 |
-
|
203 |
-
if($uploads['error']){
|
204 |
-
$this->errors->add('form-validation', __('Can not create upload folder. Permision denied', 'pmxi_plugin'));
|
205 |
-
}
|
206 |
-
|
207 |
-
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
208 |
-
$csv = new PMXI_CsvParser($filePath, true); // create chunks
|
209 |
-
$filePath = $csv->xml_path;
|
210 |
-
$post['root_element'] = 'node';
|
211 |
-
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
} elseif ( preg_match('%\W(csv|txt|dat|psv)$%i', trim($post['filepath']))) { // If CSV file uploaded
|
216 |
-
|
217 |
-
// Detect if file is very large
|
218 |
-
if($uploads['error']){
|
219 |
-
$this->errors->add('form-validation', __('Can not create upload folder. Permision denied', 'pmxi_plugin'));
|
220 |
-
}
|
221 |
-
$filePath = $post['filepath'];
|
222 |
-
$source = array(
|
223 |
-
'name' => basename($post['filepath']),
|
224 |
-
'type' => 'upload',
|
225 |
-
'path' => $filePath,
|
226 |
-
);
|
227 |
-
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
228 |
-
$csv = new PMXI_CsvParser($post['filepath'], true);
|
229 |
-
$filePath = $csv->xml_path;
|
230 |
-
$post['root_element'] = 'node';
|
231 |
-
|
232 |
-
} elseif(preg_match('%\W(gz)$%i', trim($post['filepath']))){ // If gz file uploaded
|
233 |
-
$fileInfo = pmxi_gzfile_get_contents($post['filepath']);
|
234 |
-
|
235 |
-
if ( ! is_wp_error($fileInfo) ){
|
236 |
-
|
237 |
-
$filePath = $fileInfo['localPath'];
|
238 |
-
|
239 |
-
// Detect if file is very large
|
240 |
-
$source = array(
|
241 |
-
'name' => basename($post['filepath']),
|
242 |
-
'type' => 'upload',
|
243 |
-
'path' => $post['filepath'],
|
244 |
-
);
|
245 |
-
|
246 |
-
// detect CSV or XML
|
247 |
-
if ( $fileInfo['type'] == 'csv') { // it is CSV file
|
248 |
-
|
249 |
-
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
250 |
-
$csv = new PMXI_CsvParser($filePath, true); // create chunks
|
251 |
-
$filePath = $csv->xml_path;
|
252 |
-
$post['root_element'] = 'node';
|
253 |
-
|
254 |
-
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
}
|
257 |
-
else
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
'
|
265 |
-
|
266 |
-
|
267 |
-
);
|
268 |
-
}
|
269 |
}
|
270 |
-
elseif ($this->input->post('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
-
|
273 |
-
|
|
|
274 |
|
275 |
if ($post['is_update_previous'] and empty($post['update_previous'])) {
|
276 |
$this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'pmxi_plugin'));
|
@@ -278,18 +220,16 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
278 |
|
279 |
$this->data['detection_feed_extension'] = false;
|
280 |
|
281 |
-
if ( ! class_exists('DOMDocument') ) {
|
282 |
-
$this->errors->add('form-validation', __('
|
283 |
-
}
|
284 |
-
if ( ! class_exists('XMLReader') ) {
|
285 |
-
$this->errors->add('form-validation', __('Class \'XMLReader\' not found.', 'pmxi_plugin'));
|
286 |
}
|
287 |
|
288 |
if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
|
289 |
|
290 |
check_admin_referer('choose-file', '_wpnonce_choose-file');
|
291 |
$elements_cloud = array();
|
292 |
-
@set_time_limit(0);
|
|
|
293 |
$local_paths = !empty($local_paths) ? $local_paths : array($filePath);
|
294 |
|
295 |
foreach ($local_paths as $key => $path) {
|
@@ -301,10 +241,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
301 |
if ( ! empty($file->options['element']) ) {
|
302 |
$xpath = "/".$file->options['element'];
|
303 |
$elements_cloud = $file->cloud;
|
304 |
-
break;
|
305 |
-
}
|
306 |
-
|
307 |
-
|
308 |
}
|
309 |
else $this->errors->add('form-validation', __('Unable to download feed resource.', 'pmxi_plugin'));
|
310 |
}
|
@@ -314,15 +253,18 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
314 |
// xml is valid
|
315 |
$source['root_element'] = $file->options['element'];
|
316 |
$source['first_import'] = date("Y-m-d H:i:s");
|
317 |
-
|
|
|
318 |
|
319 |
-
|
320 |
'filePath' => $filePath,
|
321 |
'parent_import_id' => $parent_import,
|
322 |
'xpath' => (!empty($xpath)) ? $xpath : '',
|
323 |
'feed_type' => $post['feed_type'],
|
|
|
|
|
324 |
'source' => $source,
|
325 |
-
'encoding' => 'UTF-8'
|
326 |
'is_csv' => PMXI_Plugin::$is_csv,
|
327 |
'csv_path' => PMXI_Plugin::$csv_path,
|
328 |
'chunk_number' => 1,
|
@@ -334,43 +276,52 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
334 |
'errors' => 0,
|
335 |
'start_time' => 0,
|
336 |
'local_paths' => (!empty($local_paths)) ? $local_paths : array(), // ftp import local copies of remote files
|
337 |
-
'csv_paths' =>
|
338 |
'action' => 'import',
|
339 |
'elements_cloud' => (!empty($elements_cloud)) ? $elements_cloud : array(),
|
340 |
'pointer' => 1
|
341 |
-
);
|
342 |
-
|
|
|
|
|
|
|
|
|
343 |
$update_previous = new PMXI_Import_Record();
|
344 |
if ($post['is_update_previous'] and ! $update_previous->getById($post['update_previous'])->isEmpty()) {
|
345 |
-
PMXI_Plugin::$session
|
346 |
-
PMXI_Plugin::$session
|
347 |
-
PMXI_Plugin::$session
|
348 |
-
PMXI_Plugin::$session
|
349 |
} else {
|
350 |
-
PMXI_Plugin::$session
|
351 |
}
|
352 |
|
353 |
-
|
354 |
|
355 |
$xml = $this->get_xml();
|
356 |
|
357 |
-
if (empty($xml))
|
358 |
{
|
359 |
$this->errors->add('form-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'pmxi_plugin'));
|
360 |
}
|
361 |
-
else{
|
362 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
363 |
}
|
364 |
-
|
|
|
|
|
|
|
365 |
} else {
|
366 |
$this->errors->add('form-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'pmxi_plugin'));
|
367 |
}
|
368 |
|
369 |
do_action("pmxi_get_file", $filePath);
|
370 |
}
|
|
|
|
|
371 |
|
372 |
$this->render();
|
373 |
-
}
|
374 |
|
375 |
/**
|
376 |
* Step #2: Choose elements
|
@@ -381,8 +332,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
381 |
$xpath = new DOMXPath($this->data['dom']);
|
382 |
$post = $this->input->post(array('xpath' => ''));
|
383 |
$this->data['post'] =& $post;
|
384 |
-
$this->data['elements_cloud'] = PMXI_Plugin::$session->
|
385 |
-
$this->data['is_csv'] = PMXI_Plugin::$session->
|
386 |
|
387 |
$wp_uploads = wp_upload_dir();
|
388 |
|
@@ -394,9 +345,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
394 |
$node_list = @ $xpath->query($post['xpath']); // make sure only element selection is allowed; prevent parsing warning to be displayed
|
395 |
|
396 |
if (FALSE === $node_list) {
|
397 |
-
$this->errors->add('form-validation', __('
|
398 |
-
/*} elseif ( ! $node_list->length) {
|
399 |
-
$this->errors->add('form-validation', __('No matching elements found for XPath expression specified', 'pmxi_plugin'));*/
|
400 |
} else {
|
401 |
foreach ($node_list as $el) {
|
402 |
if ( ! $el instanceof DOMElement) {
|
@@ -415,29 +364,25 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
415 |
|
416 |
} else {
|
417 |
|
418 |
-
if (
|
419 |
-
$post['xpath'] = PMXI_Plugin::$session->
|
420 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
421 |
-
if ( ! $elements->length and ! empty(PMXI_Plugin::$session->
|
422 |
$_GET['pmxi_nt'] = __('<b>Warning</b>: No matching elements found for XPath expression from the import being updated. It probably means that new XML file has different format. Though you can update XPath, procceed only if you sure about update operation being valid.', 'pmxi_plugin');
|
423 |
}
|
424 |
} else {
|
425 |
// suggest 1st repeating element as default selection
|
426 |
-
$post['xpath'] =
|
427 |
-
if (!empty($post['xpath'])){
|
428 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
429 |
}
|
430 |
}
|
431 |
|
432 |
}
|
433 |
|
434 |
-
// workaround to prevent rendered XML representation to eat memory since it has to be stored in
|
435 |
-
$this->render();
|
436 |
-
//add_action('pmxi_action_after', array($this, 'element_after'));
|
437 |
-
}
|
438 |
-
public function element_after()
|
439 |
-
{
|
440 |
$this->render();
|
|
|
441 |
}
|
442 |
|
443 |
/**
|
@@ -457,70 +402,72 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
457 |
header("Pragma: no-cache");
|
458 |
|
459 |
$xpath = new DOMXPath($this->data['dom']);
|
460 |
-
$post = $this->input->post(array('xpath' => '', 'show_element' => 1, 'root_element' => PMXI_Plugin::$session->
|
461 |
$wp_uploads = wp_upload_dir();
|
462 |
|
463 |
if ('' == $post['xpath']) {
|
464 |
-
$this->errors->add('form-validation', __('
|
465 |
-
} else {
|
|
|
|
|
|
|
466 |
// counting selected elements
|
467 |
-
if ('' != $post['delimiter'] and $post['delimiter'] != PMXI_Plugin::$session->
|
|
|
468 |
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
469 |
|
470 |
-
PMXI_Plugin::$session
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
PMXI_Plugin::$session
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
}
|
486 |
-
PMXI_Plugin::$session['pmxi_import']['local_paths'] = $local_paths;
|
487 |
-
}
|
488 |
}
|
489 |
|
490 |
// counting selected elements
|
491 |
-
PMXI_Plugin::$session
|
492 |
|
493 |
$current_xpath = '';
|
494 |
|
495 |
-
if ($post['show_element'] == 1) {
|
496 |
-
PMXI_Plugin::$session
|
497 |
}else{
|
498 |
-
$this->data['node_list_count'] = PMXI_Plugin::$session->
|
499 |
-
//$post['xpath'] .= '[' . $post['show_element'] . ']';
|
500 |
}
|
501 |
|
502 |
$xpath_elements = explode('[', $post['xpath']);
|
503 |
$xpath_parts = explode('/', $xpath_elements[0]);
|
504 |
|
505 |
-
|
|
|
|
|
506 |
|
507 |
-
|
508 |
|
509 |
$loop = 0;
|
510 |
|
511 |
-
foreach (PMXI_Plugin::$session->
|
512 |
|
513 |
-
$file = new PMXI_Chunk($path, array('element' =>
|
514 |
|
515 |
// loop through the file until all lines are read
|
516 |
while ($xml = $file->read()) {
|
517 |
|
518 |
-
if (!empty($xml))
|
519 |
{
|
520 |
PMXI_Import_Record::preprocessXml($xml);
|
521 |
-
$xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->
|
522 |
|
523 |
-
$dom = new DOMDocument('1.0', PMXI_Plugin::$session->
|
524 |
$old = libxml_use_internal_errors(true);
|
525 |
$dom->loadXML($xml);
|
526 |
libxml_use_internal_errors($old);
|
@@ -530,7 +477,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
530 |
|
531 |
if ( $post['show_element'] == 1 ){
|
532 |
$this->data['node_list_count'] += $elements->length;
|
533 |
-
PMXI_Plugin::$session
|
534 |
if (!$loop) $this->data['dom'] = $dom;
|
535 |
}
|
536 |
|
@@ -548,11 +495,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
548 |
unset($file);
|
549 |
}
|
550 |
if ( ! $this->data['node_list_count']) {
|
551 |
-
$this->errors->add('form-validation', __('
|
552 |
}
|
553 |
}
|
554 |
|
555 |
-
|
|
|
|
|
556 |
|
557 |
ob_start();
|
558 |
if ( ! $this->errors->get_error_codes()) {
|
@@ -562,7 +511,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
562 |
if (PMXI_Plugin::getInstance()->getOption('highlight_limit') and $elements->length <= PMXI_Plugin::getInstance()->getOption('highlight_limit')) {
|
563 |
foreach ($elements as $el) {
|
564 |
if ( ! $el instanceof DOMElement) continue;
|
565 |
-
$p =
|
566 |
}
|
567 |
}
|
568 |
$this->render();
|
@@ -574,11 +523,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
574 |
|
575 |
ob_start();
|
576 |
|
577 |
-
if ( ! empty($elements->length) )
|
578 |
|
579 |
$render_element = ob_get_clean();
|
580 |
|
581 |
-
exit( json_encode( array('result' => true, 'html' => $html, 'root_element' =>
|
582 |
}
|
583 |
|
584 |
/**
|
@@ -590,7 +539,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
590 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
591 |
}
|
592 |
|
593 |
-
$post = $this->input->post(array('xpath' => '', 'show_element' => 1, 'root_element' => (!empty(PMXI_Plugin::$session->
|
594 |
$wp_uploads = wp_upload_dir();
|
595 |
|
596 |
$this->get_xml( $post['parent_tagno'] );
|
@@ -600,14 +549,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
600 |
$this->data['tagno'] = max(intval($this->input->getpost('tagno', 1)), 0);
|
601 |
|
602 |
if ('' == $post['xpath']) {
|
603 |
-
$this->errors->add('form-validation', __('
|
604 |
} else {
|
605 |
-
$post['xpath'] = '/' . ((!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->
|
606 |
// in default mode
|
607 |
$this->data['variation_elements'] = $elements = @ $xpath->query($post['xpath']); // prevent parsing warning to be displayed
|
608 |
$this->data['variation_list_count'] = $elements->length;
|
609 |
if (FALSE === $elements) {
|
610 |
-
$this->errors->add('form-validation', __('
|
611 |
} elseif ( ! $elements->length) {
|
612 |
$this->errors->add('form-validation', __('No matching variations found for XPath specified', 'pmxi_plugin'));
|
613 |
} else {
|
@@ -619,7 +568,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
619 |
}
|
620 |
}
|
621 |
}
|
622 |
-
|
623 |
ob_start();
|
624 |
|
625 |
if ( ! $this->errors->get_error_codes()) {
|
@@ -629,7 +578,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
629 |
foreach ($elements as $el) {
|
630 |
if ( ! $el instanceof DOMElement) continue;
|
631 |
|
632 |
-
$p =
|
633 |
}
|
634 |
}
|
635 |
|
@@ -639,108 +588,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
639 |
}
|
640 |
|
641 |
exit( json_encode(array('html' => ob_get_clean())) );
|
642 |
-
}
|
643 |
-
|
644 |
-
/**
|
645 |
-
* Step #3: Choose template
|
646 |
-
*/
|
647 |
-
public function template()
|
648 |
-
{
|
649 |
-
|
650 |
-
$template = new PMXI_Template_Record();
|
651 |
-
$default = array(
|
652 |
-
'title' => '',
|
653 |
-
'content' => '',
|
654 |
-
'name' => '',
|
655 |
-
'is_keep_linebreaks' => 0,
|
656 |
-
'is_leave_html' => 0,
|
657 |
-
'fix_characters' => 0
|
658 |
-
);
|
659 |
-
|
660 |
-
if ($this->isWizard) {
|
661 |
-
$this->data['post'] = $post = $this->input->post(
|
662 |
-
apply_filters('pmxi_template_options', (isset(PMXI_Plugin::$session->data['pmxi_import']['template']) ? PMXI_Plugin::$session->data['pmxi_import']['template'] : array())
|
663 |
-
+ $default, $this->isWizard)
|
664 |
-
);
|
665 |
-
} else {
|
666 |
-
$this->data['post'] = $post = $this->input->post(
|
667 |
-
apply_filters('pmxi_template_options', $this->data['import']->template
|
668 |
-
+ $default, $this->isWizard)
|
669 |
-
);
|
670 |
-
}
|
671 |
-
|
672 |
-
if (($load_template = $this->input->post('load_template'))) { // init form with template selected
|
673 |
-
if ( ! $template->getById($load_template)->isEmpty()) {
|
674 |
-
$this->data['post'] = array(
|
675 |
-
'title' => $template->title,
|
676 |
-
'content' => $template->content,
|
677 |
-
'is_keep_linebreaks' => $template->is_keep_linebreaks,
|
678 |
-
'is_leave_html' => $template->is_leave_html,
|
679 |
-
'fix_characters' => $template->fix_characters,
|
680 |
-
'name' => '', // template is always empty
|
681 |
-
);
|
682 |
-
PMXI_Plugin::$session['pmxi_import']['is_loaded_template'] = $load_template;
|
683 |
-
}
|
684 |
-
|
685 |
-
} elseif ($this->input->post('is_submitted')) { // save template submission
|
686 |
-
check_admin_referer('template', '_wpnonce_template');
|
687 |
-
|
688 |
-
if (empty($post['title'])) {
|
689 |
-
$this->errors->add('form-validation', __('Post title is empty', 'pmxi_plugin'));
|
690 |
-
} else {
|
691 |
-
$this->_validate_template($post['title'], 'Post title');
|
692 |
-
}
|
693 |
-
|
694 |
-
if (!empty($post['content'])) {
|
695 |
-
$this->_validate_template($post['content'], 'Post content');
|
696 |
-
}
|
697 |
-
|
698 |
-
if ( ! $this->errors->get_error_codes()) {
|
699 |
-
if ( ! empty($post['name'])) { // save template in database
|
700 |
-
$template->getByName($post['name'])->set($post)->save();
|
701 |
-
PMXI_Plugin::$session['pmxi_import']['saved_template'] = $template->id;
|
702 |
-
}
|
703 |
-
if ($this->isWizard) {
|
704 |
-
PMXI_Plugin::$session['pmxi_import']['template'] = $post;
|
705 |
-
pmxi_session_commit();
|
706 |
-
wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
|
707 |
-
} else {
|
708 |
-
$this->data['import']->set('template', $post)->save();
|
709 |
-
if ( ! empty($_POST['import_encoding'])){
|
710 |
-
$options = $this->data['import']->options;
|
711 |
-
$options['encoding'] = $_POST['import_encoding'];
|
712 |
-
$this->data['import']->set('options', $options)->save();
|
713 |
-
}
|
714 |
-
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmlc_nt' => urlencode(__('Template updated', 'pmxi_plugin'))) + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)), admin_url('admin.php'))); die();
|
715 |
-
}
|
716 |
-
|
717 |
-
}
|
718 |
-
else $this->errors->add('form-validation', __('Make sure the shortcodes are escaped.', 'pmxi_plugin'));
|
719 |
-
}
|
720 |
-
|
721 |
-
pmxi_session_commit();
|
722 |
-
|
723 |
-
if (user_can_richedit()) {
|
724 |
-
wp_enqueue_script('editor');
|
725 |
-
}
|
726 |
-
wp_enqueue_script('word-count');
|
727 |
-
add_thickbox();
|
728 |
-
wp_enqueue_script('media-upload');
|
729 |
-
wp_enqueue_script('quicktags');
|
730 |
-
$this->render();
|
731 |
-
}
|
732 |
-
|
733 |
-
protected function _validate_template($text, $field_title)
|
734 |
-
{
|
735 |
-
try {
|
736 |
-
$scanner = new XmlImportTemplateScanner();
|
737 |
-
$tokens = $scanner->scan(new XmlImportStringReader($text));
|
738 |
-
$parser = new XmlImportTemplateParser($tokens);
|
739 |
-
$tree = $parser->parse();
|
740 |
-
} catch (XmlImportException $e) {
|
741 |
-
$this->errors->add('form-validation', sprintf(__('%s template is invalid: %s', 'pmxi_plugin'), $field_title, $e->getMessage()));
|
742 |
-
}
|
743 |
-
}
|
744 |
|
745 |
/**
|
746 |
* Preview selected xml tag (called with ajax from `template` step)
|
@@ -754,13 +602,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
754 |
{
|
755 |
$update_previous = new PMXI_Import_Record();
|
756 |
$id = $this->input->get('id');
|
757 |
-
if ($id and $update_previous->getById($id)) {
|
758 |
-
PMXI_Plugin::$session
|
759 |
-
|
760 |
-
|
761 |
-
'template' => $update_previous->template,
|
762 |
-
'options' => $update_previous->options,
|
763 |
-
);
|
764 |
$history = new PMXI_File_List();
|
765 |
$history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $update_previous->id), 'id DESC');
|
766 |
|
@@ -768,53 +613,74 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
768 |
$history_file = new PMXI_File_Record();
|
769 |
$history_file->getBy('id', $history[0]['id']);
|
770 |
|
771 |
-
if (
|
772 |
-
PMXI_Plugin::$session
|
773 |
-
if (
|
774 |
-
|
775 |
-
PMXI_Plugin::$session
|
776 |
-
|
|
|
|
|
777 |
}
|
778 |
}
|
779 |
|
780 |
} else {
|
781 |
-
PMXI_Plugin::$session
|
782 |
}
|
783 |
}
|
784 |
|
785 |
$this->data['tagno'] = max(intval($this->input->getpost('tagno', 1)), 1);
|
|
|
|
|
786 |
|
787 |
if ($this->data['tagno']){
|
788 |
|
789 |
-
|
790 |
-
|
|
|
|
|
791 |
$loop = 0;
|
792 |
|
793 |
foreach ($local_paths as $key => $path) {
|
794 |
|
795 |
if (@file_exists($path)){
|
796 |
|
797 |
-
$file = new PMXI_Chunk($path, array(
|
798 |
-
|
|
|
|
|
|
|
|
|
799 |
while ($xml = $file->read()) {
|
800 |
|
801 |
-
if (!empty($xml))
|
802 |
{
|
803 |
PMXI_Import_Record::preprocessXml($xml);
|
804 |
-
$xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->
|
805 |
|
806 |
-
$dom = new DOMDocument('1.0', PMXI_Plugin::$session->
|
807 |
$old = libxml_use_internal_errors(true);
|
808 |
$dom->loadXML($xml);
|
809 |
libxml_use_internal_errors($old);
|
810 |
$xpath = new DOMXPath($dom);
|
811 |
-
if (($elements = @$xpath->query(PMXI_Plugin::$session->
|
812 |
$this->data['elements'] = $elements;
|
813 |
-
$loop += $elements->length;
|
814 |
-
|
815 |
-
if ($loop == $this->data['tagno'] or $loop == PMXI_Plugin::$session->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
816 |
break(2);
|
817 |
-
|
|
|
|
|
818 |
}
|
819 |
}
|
820 |
unset($file);
|
@@ -825,12 +691,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
825 |
if ( $is_json ){
|
826 |
|
827 |
ob_start();
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
$html = ob_get_clean();
|
832 |
-
|
833 |
-
exit( json_encode(array('html' => $html)) );
|
834 |
|
835 |
}
|
836 |
else $this->render();
|
@@ -851,27 +713,38 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
851 |
'tagno' => 0
|
852 |
));
|
853 |
$wp_uploads = wp_upload_dir();
|
854 |
-
|
855 |
-
$
|
856 |
-
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->data['pmxi_import']['count']);
|
857 |
|
858 |
$xml = '';
|
859 |
|
860 |
-
$local_paths = (!empty(PMXI_Plugin::$session->
|
861 |
|
862 |
$loop = 1;
|
863 |
foreach ($local_paths as $key => $path) {
|
864 |
|
865 |
-
if (PMXI_Plugin::$session->
|
|
|
866 |
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
867 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
}
|
869 |
-
|
870 |
-
$file = new PMXI_Chunk($path, array(
|
|
|
|
|
|
|
871 |
|
872 |
// loop through the file until all lines are read
|
873 |
-
while ($xml = $file->read()) {
|
874 |
-
|
|
|
875 |
{
|
876 |
PMXI_Import_Record::preprocessXml($xml);
|
877 |
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
@@ -881,10 +754,21 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
881 |
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
882 |
libxml_use_internal_errors($old);
|
883 |
$xpath = new DOMXPath($dom);
|
884 |
-
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->
|
885 |
-
|
886 |
-
if ( $loop == $tagno )
|
887 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
888 |
$loop++;
|
889 |
}
|
890 |
}
|
@@ -893,17 +777,18 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
893 |
}
|
894 |
//$this->data['tagno'] = $tagno = 1;
|
895 |
|
896 |
-
$xpath = "(" . PMXI_Plugin::$session->
|
897 |
|
898 |
-
PMXI_Plugin::$session
|
899 |
-
|
900 |
|
901 |
// validate
|
902 |
try {
|
903 |
if (empty($xml)){
|
904 |
-
$this->errors->add('form-validation', __('
|
905 |
-
} elseif (empty($post['title'])) {
|
906 |
-
$this->errors->add('form-validation', __('
|
|
|
907 |
} else {
|
908 |
list($this->data['title']) = XmlImportParser::factory($xml, $xpath, $post['title'], $file)->parse(); unlink($file);
|
909 |
if ( ! isset($this->data['title']) or '' == strval(trim(strip_tags($this->data['title'], '<img><input><textarea><iframe><object><embed>')))) {
|
@@ -916,9 +801,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
916 |
}
|
917 |
try {
|
918 |
if (empty($xml)){
|
919 |
-
$this->errors->add('form-validation', __('
|
920 |
} elseif (empty($post['content'])) {
|
921 |
-
$this->errors->add('form-validation', __('
|
|
|
922 |
} else {
|
923 |
list($this->data['content']) = XmlImportParser::factory($post['is_keep_linebreaks'] ? $xml : preg_replace('%\r\n?|\n%', ' ', $xml), $xpath, $post['content'], $file)->parse(); unlink($file);
|
924 |
if ( ! isset($this->data['content']) or '' == strval(trim(strip_tags($this->data['content'], '<img><input><textarea><iframe><object><embed>')))) {
|
@@ -931,111 +817,695 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
931 |
}
|
932 |
|
933 |
ob_start();
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
$html = ob_get_clean();
|
938 |
-
|
939 |
-
exit( json_encode(array('html' => $html)) );
|
940 |
}
|
941 |
-
|
942 |
/**
|
943 |
-
*
|
944 |
*/
|
945 |
-
public function
|
946 |
-
{
|
947 |
-
|
948 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
949 |
|
950 |
-
|
951 |
-
$this->data['source_type'] = PMXI_Plugin::$session->data['pmxi_import']['source']['type'];
|
952 |
-
$default['unique_key'] = PMXI_Plugin::$session->data['pmxi_import']['template']['title'];
|
953 |
-
|
954 |
-
$keys_black_list = array('programurl');
|
955 |
-
|
956 |
-
// auto searching ID element
|
957 |
-
if (!empty($this->data['dom'])){
|
958 |
-
$this->find_unique_key($this->data['dom']->documentElement);
|
959 |
-
if (!empty($this->_unique_key)){
|
960 |
-
foreach ($keys_black_list as $key => $value) {
|
961 |
-
$default['unique_key'] = str_replace('{' . $value . '[1]}', "", $default['unique_key']);
|
962 |
-
}
|
963 |
-
foreach ($this->_unique_key as $key) {
|
964 |
-
if (stripos($key, 'id') !== false) {
|
965 |
-
$default['unique_key'] .= ' - {'.$key.'[1]}';
|
966 |
-
break;
|
967 |
-
}
|
968 |
-
}
|
969 |
-
foreach ($this->_unique_key as $key) {
|
970 |
-
if (stripos($key, 'url') !== false or stripos($key, 'sku') !== false or stripos($key, 'ref') !== false) {
|
971 |
-
if ( ! in_array($key, $keys_black_list) ){
|
972 |
-
$default['unique_key'] .= ' - {'.$key.'[1]}';
|
973 |
-
break;
|
974 |
-
}
|
975 |
-
}
|
976 |
-
}
|
977 |
-
}
|
978 |
-
}
|
979 |
-
|
980 |
-
$DefaultOptions = (isset(PMXI_Plugin::$session->data['pmxi_import']['options']) ? PMXI_Plugin::$session->data['pmxi_import']['options'] : array()) + $default;
|
981 |
-
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
982 |
-
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
983 |
-
}
|
984 |
-
|
985 |
-
$post = $this->input->post( apply_filters('pmxi_options_options', $DefaultOptions, $this->isWizard) );
|
986 |
-
|
987 |
-
} else {
|
988 |
-
$this->data['source_type'] = $this->data['import']->type;
|
989 |
-
$DefaultOptions = $this->data['import']->options + $default;
|
990 |
-
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
991 |
-
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
992 |
-
}
|
993 |
-
|
994 |
-
$post = $this->input->post( apply_filters( 'pmxi_options_options', $DefaultOptions, $this->isWizard) );
|
995 |
-
|
996 |
-
}
|
997 |
|
998 |
-
$
|
999 |
-
|
1000 |
-
|
1001 |
-
$this->data['meta_keys'] = $keys = new PMXI_Model_List();
|
1002 |
-
$keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'postmeta');
|
1003 |
-
$keys->setColumns('meta_id', 'meta_key')->getBy(NULL, "meta_id", NULL, NULL, "meta_key");
|
1004 |
-
|
1005 |
-
global $wpdb;
|
1006 |
-
|
1007 |
-
$existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes'" );
|
1008 |
-
|
1009 |
-
$this->data['existing_attributes'] = array();
|
1010 |
|
1011 |
-
|
1012 |
-
|
1013 |
-
$existing_attribute = maybe_unserialize($existing_attribute->meta_value);
|
1014 |
-
if (!empty($existing_attribute) and is_array($existing_attribute)):
|
1015 |
-
foreach ($existing_attribute as $key => $value) {
|
1016 |
-
if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
|
1017 |
-
}
|
1018 |
-
endif;
|
1019 |
-
}
|
1020 |
-
}
|
1021 |
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1028 |
}
|
1029 |
-
}
|
1030 |
|
1031 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1032 |
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
|
|
|
|
|
|
|
|
|
|
1037 |
|
1038 |
check_admin_referer('options', '_wpnonce_options');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
|
1040 |
// Categories/taxonomies logic
|
1041 |
if ($post['update_categories_logic'] == 'only'){
|
@@ -1043,7 +1513,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1043 |
}
|
1044 |
elseif ($post['update_categories_logic'] == 'all_except'){
|
1045 |
$post['taxonomies_list'] = explode(",", $post['taxonomies_except_list']);
|
1046 |
-
}
|
1047 |
|
1048 |
// Custom fields logic
|
1049 |
if ($post['update_custom_fields_logic'] == 'only'){
|
@@ -1053,129 +1523,166 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1053 |
$post['custom_fields_list'] = explode(",", $post['custom_fields_except_list']);
|
1054 |
}
|
1055 |
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1061 |
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
// validate
|
1066 |
-
if (array_keys(array_filter($post['custom_name'], 'strlen')) != array_keys(array_filter($post['custom_value'], 'strlen')) and ! count(array_filter($post['custom_format'])) ) {
|
1067 |
-
$this->errors->add('form-validation', __('Both name and value must be set for all custom parameters', 'pmxi_plugin'));
|
1068 |
-
} else {
|
1069 |
-
foreach ($post['custom_name'] as $custom_name) {
|
1070 |
-
$this->_validate_template($custom_name, __('Custom Field Name', 'pmxi_plugin'));
|
1071 |
-
}
|
1072 |
-
foreach ($post['custom_value'] as $key => $custom_value) {
|
1073 |
-
if ( empty($post['custom_format'][$key]) )
|
1074 |
-
$this->_validate_template($custom_value, __('Custom Field Value', 'pmxi_plugin'));
|
1075 |
-
}
|
1076 |
-
}
|
1077 |
-
|
1078 |
-
if ( $post['type'] == "post" and $post['custom_type'] == "product" and class_exists('PMWI_Plugin')){
|
1079 |
-
// remove entires where both custom_name and custom_value are empty
|
1080 |
-
$not_empty = array_flip(array_values(array_merge(array_keys(array_filter($post['attribute_name'], 'strlen')), array_keys(array_filter($post['attribute_value'], 'strlen')))));
|
1081 |
|
1082 |
-
|
1083 |
-
$post['attribute_value'] = array_intersect_key($post['attribute_value'], $not_empty);
|
1084 |
|
1085 |
-
|
1086 |
-
if (array_keys(array_filter($post['attribute_name'], 'strlen')) != array_keys(array_filter($post['attribute_value'], 'strlen'))) {
|
1087 |
-
$this->errors->add('form-validation', __('Both name and value must be set for all woocommerce attributes', 'pmxi_plugin'));
|
1088 |
-
} else {
|
1089 |
-
foreach ($post['attribute_name'] as $attribute_name) {
|
1090 |
-
$this->_validate_template($attribute_name, __('Attribute Field Name', 'pmxi_plugin'));
|
1091 |
-
}
|
1092 |
-
foreach ($post['attribute_value'] as $custom_value) {
|
1093 |
-
$this->_validate_template($custom_value, __('Attribute Field Value', 'pmxi_plugin'));
|
1094 |
-
}
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
}
|
1098 |
|
1099 |
-
if ('page' == $post['type'] and ! preg_match('%^(-?\d+)?$%', $post['order'])) {
|
1100 |
-
$this->errors->add('form-validation', __('Order must be an integer number', 'pmxi_plugin'));
|
1101 |
-
}
|
1102 |
-
if ('post' == $post['type']) {
|
1103 |
-
/*'' == $post['categories'] or $this->_validate_template($post['categories'], __('Categories', 'pmxi_plugin'));*/
|
1104 |
-
'' == $post['tags'] or $this->_validate_template($post['tags'], __('Tags', 'pmxi_plugin'));
|
1105 |
-
}
|
1106 |
-
if ('specific' == $post['date_type']) {
|
1107 |
-
'' == $post['date'] or $this->_validate_template($post['date'], __('Date', 'pmxi_plugin'));
|
1108 |
-
} else {
|
1109 |
-
'' == $post['date_start'] or $this->_validate_template($post['date_start'], __('Start Date', 'pmxi_plugin'));
|
1110 |
-
'' == $post['date_end'] or $this->_validate_template($post['date_end'], __('Start Date', 'pmxi_plugin'));
|
1111 |
-
}
|
1112 |
-
if ('' == $post['tags_delim']) {
|
1113 |
-
$this->errors->add('form-validation', __('Tag list delimiter must cannot be empty', 'pmxi_plugin'));
|
1114 |
-
}
|
1115 |
-
if ($post['is_import_specified']) {
|
1116 |
-
if (empty($post['import_specified'])) {
|
1117 |
-
$this->errors->add('form-validation', __('Records to import must be specified or uncheck `Import only specified records` option to process all records', 'pmxi_plugin'));
|
1118 |
-
} else {
|
1119 |
-
$chanks = preg_split('% *, *%', $post['import_specified']);
|
1120 |
-
foreach ($chanks as $chank) {
|
1121 |
-
if ( ! preg_match('%^([1-9]\d*)( *- *([1-9]\d*))?$%', $chank, $mtch)) {
|
1122 |
-
$this->errors->add('form-validation', __('Wrong format of `Import only specified records` value', 'pmxi_plugin'));
|
1123 |
-
break;
|
1124 |
-
} elseif (isset($mtch[3]) and intval($mtch[3]) > PMXI_Plugin::$session->data['pmxi_import']['count']) {
|
1125 |
-
$this->errors->add('form-validation', __('One of the numbers in `Import only specified records` value exceeds record quantity in XML file', 'pmxi_plugin'));
|
1126 |
-
break;
|
1127 |
}
|
|
|
|
|
|
|
|
|
|
|
1128 |
}
|
|
|
|
|
|
|
|
|
1129 |
}
|
1130 |
-
|
1131 |
-
if ('' == $post['unique_key']) {
|
1132 |
-
$this->errors->add('form-validation', __('Expression for `Post Unique Key` must be set, use the same expression as specified for post title if you are not sure what to put there', 'pmxi_plugin'));
|
1133 |
-
} else {
|
1134 |
-
$this->_validate_template($post['unique_key'], __('Post Unique Key', 'pmxi_plugin'));
|
1135 |
-
}
|
1136 |
-
if ( 'manual' == $post['duplicate_matching'] and 'custom field' == $post['duplicate_indicator']){
|
1137 |
-
if ('' == $post['custom_duplicate_name'])
|
1138 |
-
$this->errors->add('form-validation', __('Custom field name must be specified.', 'pmxi_plugin'));
|
1139 |
-
if ('' == $post['custom_duplicate_value'])
|
1140 |
-
$this->errors->add('form-validation', __('Custom field value must be specified.', 'pmxi_plugin'));
|
1141 |
}
|
1142 |
|
1143 |
$this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, $this->data['import']);
|
1144 |
|
1145 |
-
if ( ! $this->errors->get_error_codes()) { // no validation errors found
|
1146 |
-
// assign some defaults
|
1147 |
-
'' !== $post['date'] or $post['date'] = 'now';
|
1148 |
-
'' !== $post['date_start'] or $post['date_start'] = 'now';
|
1149 |
-
'' !== $post['date_end'] or $post['date_end'] = 'now';
|
1150 |
-
|
1151 |
-
if ( $this->input->post('name')) { // save template in database
|
1152 |
-
$template = new PMXI_Template_Record();
|
1153 |
-
|
1154 |
-
$template->getByName($this->input->post('name'))->set(array(
|
1155 |
-
'name' => $this->input->post('name'),
|
1156 |
-
'options' => $post,
|
1157 |
-
))->save();
|
1158 |
-
}
|
1159 |
|
|
|
|
|
|
|
1160 |
if ($this->isWizard) {
|
1161 |
-
PMXI_Plugin::$session['pmxi_import']['options'] = $post;
|
1162 |
|
1163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1164 |
|
1165 |
if ( ! $this->input->post('save_only')) {
|
1166 |
-
wp_redirect(add_query_arg('action', '
|
1167 |
} else {
|
1168 |
$import = $this->data['update_previous'];
|
1169 |
$is_update = ! $import->isEmpty();
|
1170 |
$import->set(
|
1171 |
-
PMXI_Plugin::$session->
|
1172 |
+ array(
|
1173 |
-
'xpath' => PMXI_Plugin::$session->
|
1174 |
-
'
|
1175 |
-
'
|
1176 |
-
|
1177 |
-
'count' => PMXI_Plugin::$session->data['pmxi_import']['count'],
|
1178 |
-
'friendly_name' => $this->data['post']['friendly_name'],
|
1179 |
)
|
1180 |
)->save();
|
1181 |
|
@@ -1183,36 +1690,207 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1183 |
$history_file->set(array(
|
1184 |
'name' => $import->name,
|
1185 |
'import_id' => $import->id,
|
1186 |
-
'path' => PMXI_Plugin::$session->
|
1187 |
-
'contents' => $this->get_xml(),
|
1188 |
'registered_on' => date('Y-m-d H:i:s'),
|
1189 |
))->save();
|
1190 |
|
1191 |
-
|
1192 |
-
|
1193 |
-
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmlc_nt' => urlencode($is_update ? __('Import updated', 'pmxi_plugin') : __('Import created', 'pmxi_plugin'))), admin_url('admin.php'))); die();
|
1194 |
}
|
|
|
1195 |
} else {
|
1196 |
|
1197 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1198 |
|
1199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1200 |
}
|
1201 |
}
|
1202 |
}
|
1203 |
-
|
1204 |
-
|
1205 |
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1210 |
|
1211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1212 |
|
1213 |
$this->render();
|
1214 |
}
|
1215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1216 |
/**
|
1217 |
* Import processing step (status console)
|
1218 |
*/
|
@@ -1221,50 +1899,92 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1221 |
|
1222 |
$wp_uploads = wp_upload_dir();
|
1223 |
|
1224 |
-
$import = $this->data['update_previous'];
|
|
|
|
|
1225 |
|
1226 |
-
|
1227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1228 |
$import->set(
|
1229 |
-
(empty(PMXI_Plugin::$session->
|
1230 |
+ array(
|
1231 |
-
'xpath' => PMXI_Plugin::$session->
|
1232 |
-
'
|
1233 |
-
'
|
1234 |
-
'
|
1235 |
-
'
|
1236 |
-
'
|
1237 |
-
'parent_import_id' => ($this->data['update_previous']->isEmpty()) ? PMXI_Plugin::$session->data['pmxi_import']['parent_import_id'] : $this->data['update_previous']->parent_import_id,
|
1238 |
'queue_chunk_number' => 0,
|
1239 |
'triggered' => 0,
|
1240 |
'processing' => 0,
|
|
|
1241 |
'iteration' => ( ! empty($import->iteration) ) ? $import->iteration : 0
|
1242 |
)
|
1243 |
)->save();
|
1244 |
|
1245 |
-
if ( PMXI_Plugin::$session->
|
1246 |
// store import info in database
|
1247 |
$import->set(array(
|
1248 |
'imported' => 0,
|
1249 |
'created' => 0,
|
1250 |
'updated' => 0,
|
1251 |
-
'skipped' => 0
|
1252 |
-
|
|
|
1253 |
}
|
1254 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1255 |
foreach ( get_taxonomies() as $tax )
|
1256 |
delete_transient("pmxi_{$tax}_terms");
|
1257 |
|
1258 |
do_action( 'pmxi_before_xml_import', $import->id );
|
1259 |
|
1260 |
-
PMXI_Plugin::$session
|
1261 |
|
1262 |
-
//
|
1263 |
$history = new PMXI_File_List();
|
1264 |
$history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $import->id), 'id DESC');
|
1265 |
if ($history->count()){
|
1266 |
foreach ($history as $file){
|
1267 |
-
if (@file_exists($file['path']) and $file['path'] != PMXI_Plugin::$session->
|
|
|
|
|
|
|
|
|
|
|
1268 |
$history_file = new PMXI_File_Record();
|
1269 |
$history_file->getBy('id', $file['id']);
|
1270 |
if ( ! $history_file->isEmpty()) $history_file->delete();
|
@@ -1276,8 +1996,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1276 |
$history_file->set(array(
|
1277 |
'name' => $import->name,
|
1278 |
'import_id' => $import->id,
|
1279 |
-
'path' => PMXI_Plugin::$session->
|
1280 |
-
'contents' => $this->get_xml(),
|
1281 |
'registered_on' => date('Y-m-d H:i:s')
|
1282 |
))->save();
|
1283 |
}
|
@@ -1293,14 +2013,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1293 |
|
1294 |
$chunk_files = array();
|
1295 |
|
1296 |
-
if (!empty(PMXI_Plugin::$session->
|
1297 |
|
1298 |
$records_count = 0;
|
1299 |
$chunk_records_count = 0;
|
1300 |
|
1301 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
1302 |
|
1303 |
-
foreach (PMXI_Plugin::$session->
|
1304 |
|
1305 |
$file = new PMXI_Chunk($path, array('element' => $import->root_element, 'encoding' => $import->options['encoding']));
|
1306 |
|
@@ -1327,7 +2047,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1327 |
|
1328 |
if ( $chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count ){
|
1329 |
$feed .= "</pmxi_records>";
|
1330 |
-
$chunk_file_path = $wp_uploads['
|
1331 |
file_put_contents($chunk_file_path, $feed);
|
1332 |
$chunk_files[] = $chunk_file_path;
|
1333 |
$chunk_records_count = 0;
|
@@ -1335,48 +2055,62 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1335 |
}
|
1336 |
}
|
1337 |
}
|
1338 |
-
PMXI_Plugin::$session
|
1339 |
}
|
1340 |
}
|
1341 |
|
1342 |
-
|
1343 |
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
|
|
|
|
|
|
|
|
1348 |
|
1349 |
$this->render();
|
1350 |
wp_ob_end_flush_all(); flush();
|
1351 |
-
@set_time_limit(0);
|
|
|
|
|
1352 |
|
1353 |
-
if ( "ajax" == $import->options['import_processing'] )
|
|
|
|
|
|
|
1354 |
}
|
1355 |
-
elseif (empty($import->id))
|
1356 |
-
|
1357 |
-
$import
|
|
|
|
|
1358 |
}
|
1359 |
-
|
1360 |
$ajax_processing = ("ajax" == $import->options['import_processing']) ? true : false;
|
1361 |
|
1362 |
-
if (
|
1363 |
{
|
1364 |
-
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; flush();');
|
1365 |
}
|
1366 |
else
|
1367 |
{
|
1368 |
-
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; if ( "" != strip_tags(pmxi_strip_tags_content($m))) { PMXI_Plugin::$session
|
1369 |
}
|
1370 |
|
1371 |
-
PMXI_Plugin::$session
|
1372 |
|
1373 |
wp_cache_flush();
|
1374 |
|
1375 |
-
if ( PMXI_Plugin::is_ajax() or ! $ajax_processing ) {
|
1376 |
|
1377 |
-
$
|
|
|
|
|
|
|
1378 |
|
1379 |
-
if (
|
1380 |
// HTTP headers for no cache etc
|
1381 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
1382 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
@@ -1400,27 +2134,37 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1400 |
}
|
1401 |
|
1402 |
$records_to_import = (empty($records)) ? $import->count : $records[count($records) -1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1403 |
|
1404 |
$records_per_request = ( ! $ajax_processing and $import->options['records_per_request'] < 50 ) ? 50 : $import->options['records_per_request'];
|
1405 |
|
1406 |
-
if (!empty(PMXI_Plugin::$session->
|
1407 |
|
1408 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
1409 |
|
1410 |
-
foreach (PMXI_Plugin::$session->
|
1411 |
|
1412 |
-
$import_done = ($import->imported + $import->skipped + PMXI_Plugin::$session->
|
1413 |
|
1414 |
if ( $import_done ) {
|
1415 |
-
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path))
|
1416 |
-
PMXI_Plugin::$session
|
1417 |
-
|
1418 |
break;
|
1419 |
-
}
|
1420 |
-
|
1421 |
-
$file = new PMXI_Chunk($path, array('element' => $import->root_element, 'encoding' => $import->options['encoding'], 'pointer' => PMXI_Plugin::$session->
|
|
|
1422 |
// loop through the file until all lines are read
|
1423 |
-
while ($xml = $file->read()) {
|
1424 |
|
1425 |
if ( ! empty($xml) )
|
1426 |
{
|
@@ -1436,48 +2180,72 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1436 |
$pointer++;
|
1437 |
|
1438 |
if (($this->data['elements'] = $elements = @$xpath->query($import->xpath)) and $elements->length){
|
1439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1440 |
// continue action
|
1441 |
-
if ( $import->imported + $import->skipped >= PMXI_Plugin::$session->
|
1442 |
-
PMXI_Plugin::$session
|
1443 |
-
|
1444 |
continue;
|
1445 |
-
}
|
1446 |
|
1447 |
if ( ! $loop and $ajax_processing ) ob_start();
|
1448 |
|
1449 |
$feed .= $xml; $loop += $elements->length;
|
1450 |
|
1451 |
-
$processed_records = $import->imported + $import->skipped + PMXI_Plugin::$session->
|
1452 |
|
1453 |
if ( $loop == $records_per_request or $processed_records + $loop == $records_to_import or $processed_records == $records_to_import) {
|
1454 |
|
1455 |
-
$feed .= "</pmxi_records>";
|
1456 |
-
$import->process($feed, $logger, PMXI_Plugin::$session->
|
1457 |
unset($dom, $xpath);
|
1458 |
|
1459 |
if ( ! $ajax_processing ){
|
1460 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
1461 |
$loop = 0;
|
1462 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1463 |
unset($file);
|
1464 |
-
PMXI_Plugin::$session
|
1465 |
-
|
1466 |
|
1467 |
$log_data = ob_get_clean();
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
|
|
|
|
|
|
|
|
|
|
1471 |
|
1472 |
wp_send_json(array(
|
1473 |
'created' => $import->created,
|
1474 |
'updated' => $import->updated,
|
1475 |
'percentage' => ceil(($processed_records/$import->count) * 100),
|
1476 |
-
'warnings' => PMXI_Plugin::$session->
|
1477 |
-
'errors' => PMXI_Plugin::$session->
|
1478 |
'log' => $log_data,
|
1479 |
-
'done' => false
|
1480 |
-
|
|
|
1481 |
}
|
1482 |
}
|
1483 |
}
|
@@ -1489,46 +2257,57 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1489 |
|
1490 |
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path)) @unlink($path);
|
1491 |
|
1492 |
-
PMXI_Plugin::$session
|
1493 |
$pointer = 0;
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
|
|
1497 |
}
|
1498 |
else break;
|
1499 |
}
|
1500 |
-
}
|
1501 |
}
|
1502 |
|
1503 |
-
if ( ( PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->
|
1504 |
|
1505 |
-
|
1506 |
|
1507 |
-
if ("ajax" != $import->options['import_processing']){
|
1508 |
-
$log_file = $wp_uploads['basedir'] .
|
1509 |
-
if (PMXI_Plugin::$session->
|
1510 |
-
@file_put_contents($log_file, PMXI_Plugin::$session->
|
1511 |
}
|
1512 |
else{
|
1513 |
$log = @fopen($log_file, 'a+');
|
1514 |
-
@fwrite($log, PMXI_Plugin::$session->
|
1515 |
@fclose($log);
|
1516 |
}
|
1517 |
}
|
1518 |
-
|
1519 |
wp_cache_flush();
|
1520 |
foreach ( get_taxonomies() as $tax ) {
|
1521 |
delete_option( "{$tax}_children" );
|
1522 |
_get_term_hierarchy( $tax );
|
1523 |
}
|
1524 |
|
1525 |
-
$import->set(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1526 |
|
1527 |
// clear import session
|
1528 |
-
|
1529 |
|
1530 |
// [indicate in header process is complete]
|
1531 |
-
$msg = addcslashes(__('Complete', 'pmxi_plugin'), "\n\r");
|
1532 |
|
1533 |
if ( $ajax_processing ) ob_start();
|
1534 |
|
@@ -1538,8 +2317,7 @@ echo <<<COMPLETE
|
|
1538 |
<script type="text/javascript">
|
1539 |
//<![CDATA[
|
1540 |
(function($){
|
1541 |
-
$('#status').html('$msg');
|
1542 |
-
$('#import_finished').show();
|
1543 |
window.onbeforeunload = false;
|
1544 |
})(jQuery);
|
1545 |
//]]>
|
@@ -1553,127 +2331,17 @@ COMPLETE;
|
|
1553 |
'created' => $import->created,
|
1554 |
'updated' => $import->updated,
|
1555 |
'percentage' => 100,
|
1556 |
-
'warnings' => PMXI_Plugin::$session->
|
1557 |
-
'errors' => PMXI_Plugin::$session->
|
1558 |
'log' => ob_get_clean(),
|
1559 |
-
'done' => true
|
|
|
1560 |
));
|
1561 |
|
1562 |
}
|
1563 |
-
}
|
1564 |
-
}
|
1565 |
-
|
1566 |
-
protected $_sibling_limit = 20;
|
1567 |
-
protected function get_xml_path(DOMElement $el, DOMXPath $xpath)
|
1568 |
-
{
|
1569 |
-
for($p = '', $doc = $el; $doc and ! $doc instanceof DOMDocument; $doc = $doc->parentNode) {
|
1570 |
-
if (($ind = $xpath->query('preceding-sibling::' . $doc->nodeName, $doc)->length)) {
|
1571 |
-
$p = '[' . ++$ind . ']' . $p;
|
1572 |
-
} elseif ( ! $doc->parentNode instanceof DOMDocument) {
|
1573 |
-
$p = '[' . ($ind = 1) . ']' . $p;
|
1574 |
-
}
|
1575 |
-
$p = '/' . $doc->nodeName . $p;
|
1576 |
-
}
|
1577 |
-
return $p;
|
1578 |
-
}
|
1579 |
|
1580 |
-
protected function shrink_xml_element(DOMElement $el)
|
1581 |
-
{
|
1582 |
-
$prev = null; $sub_ind = null;
|
1583 |
-
for ($i = 0; $i < $el->childNodes->length; $i++) {
|
1584 |
-
$child = $el->childNodes->item($i);
|
1585 |
-
if ($child instanceof DOMText) {
|
1586 |
-
if ('' == trim($child->wholeText)) {
|
1587 |
-
$el->removeChild($child);
|
1588 |
-
$i--;
|
1589 |
-
continue;
|
1590 |
-
}
|
1591 |
-
}
|
1592 |
-
if ($child instanceof DOMComment) {
|
1593 |
-
continue;
|
1594 |
-
}
|
1595 |
-
if ($prev instanceof $child and $prev->nodeName == $child->nodeName) {
|
1596 |
-
$sub_ind++;
|
1597 |
-
} else {
|
1598 |
-
if ($sub_ind > $this->_sibling_limit) {
|
1599 |
-
$el->insertBefore(new DOMComment('[pmxi_more:' . ($sub_ind - $this->_sibling_limit) . ']'), $child);
|
1600 |
-
$i++;
|
1601 |
-
}
|
1602 |
-
$sub_ind = 1;
|
1603 |
-
$prev = null;
|
1604 |
-
}
|
1605 |
-
if ($child instanceof DOMElement) {
|
1606 |
-
$prev = $child;
|
1607 |
-
if ($sub_ind <= $this->_sibling_limit) {
|
1608 |
-
$this->shrink_xml_element($child);
|
1609 |
-
} else {
|
1610 |
-
$el->removeChild($child);
|
1611 |
-
$i--;
|
1612 |
-
}
|
1613 |
-
}
|
1614 |
-
}
|
1615 |
-
if ($sub_ind > $this->_sibling_limit) {
|
1616 |
-
$el->appendChild(new DOMComment('[pmxi_more:' . ($sub_ind - $this->_sibling_limit) . ']'));
|
1617 |
-
}
|
1618 |
-
return $el;
|
1619 |
-
}
|
1620 |
-
protected function render_xml_element(DOMElement $el, $shorten = false, $path = '/', $ind = 1, $lvl = 0)
|
1621 |
-
{
|
1622 |
-
$path .= $el->nodeName;
|
1623 |
-
if ( ! $el->parentNode instanceof DOMDocument and $ind > 0) {
|
1624 |
-
$path .= "[$ind]";
|
1625 |
-
}
|
1626 |
-
|
1627 |
-
echo '<div class="xml-element lvl-' . $lvl . ' lvl-mod4-' . ($lvl % 4) . '" title="' . $path . '">';
|
1628 |
-
if ($el->hasChildNodes()) {
|
1629 |
-
$is_render_collapsed = $ind > 1;
|
1630 |
-
if ($el->childNodes->length > 1 or ! $el->childNodes->item(0) instanceof DOMText or strlen(trim($el->childNodes->item(0)->wholeText)) > 40) {
|
1631 |
-
echo '<div class="xml-expander">' . ($is_render_collapsed ? '+' : '-') . '</div>';
|
1632 |
-
}
|
1633 |
-
echo '<div class="xml-tag opening"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; $this->render_xml_attributes($el, $path . '/'); echo '></div>';
|
1634 |
-
if (1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText) {
|
1635 |
-
$this->render_xml_text(trim($el->childNodes->item(0)->wholeText), $shorten, $is_render_collapsed);
|
1636 |
-
} else {
|
1637 |
-
echo '<div class="xml-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
1638 |
-
$indexes = array();
|
1639 |
-
foreach ($el->childNodes as $child) {
|
1640 |
-
if ($child instanceof DOMElement) {
|
1641 |
-
empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 0; $indexes[$child->nodeName]++;
|
1642 |
-
$this->render_xml_element($child, $shorten, $path . '/', $indexes[$child->nodeName], $lvl + 1);
|
1643 |
-
} elseif ($child instanceof DOMText) {
|
1644 |
-
$this->render_xml_text(trim($child->wholeText), $shorten);
|
1645 |
-
} elseif ($child instanceof DOMComment) {
|
1646 |
-
if (preg_match('%\[pmxi_more:(\d+)\]%', $child->nodeValue, $mtch)) {
|
1647 |
-
$no = intval($mtch[1]);
|
1648 |
-
echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>';
|
1649 |
-
}
|
1650 |
-
}
|
1651 |
-
}
|
1652 |
-
echo '</div>';
|
1653 |
-
}
|
1654 |
-
echo '<div class="xml-tag closing"></<span class="xml-tag-name">' . $el->nodeName . '</span>></div>';
|
1655 |
-
} else {
|
1656 |
-
echo '<div class="xml-tag opening empty"><<span class="xml-tag-name">' . $el->nodeName . '</span>'; $this->render_xml_attributes($el); echo '/></div>';
|
1657 |
-
}
|
1658 |
-
echo '</div>';
|
1659 |
-
}
|
1660 |
-
protected function render_xml_elements_for_filtring(DOMElement $el, $path ='', $lvl = 0){
|
1661 |
-
if ("" != $path){
|
1662 |
-
if ($lvl > 1) $path .= "->" . $el->nodeName; else $path = $el->nodeName;
|
1663 |
-
echo '<option value="'.$path.'">' .$path . '</option>';
|
1664 |
-
}
|
1665 |
-
else $path = $el->nodeName;
|
1666 |
-
|
1667 |
-
foreach ($el->attributes as $attr) {
|
1668 |
-
echo '<option value="'.$path . '@' . $attr->nodeName.'">'. $path . '@' . $attr->nodeName . '</option>';
|
1669 |
-
}
|
1670 |
-
if ($el->hasChildNodes()) {
|
1671 |
-
foreach ($el->childNodes as $child) {
|
1672 |
-
if ($child instanceof DOMElement)
|
1673 |
-
$this->render_xml_elements_for_filtring($child, $path, $lvl + 1);
|
1674 |
-
}
|
1675 |
-
}
|
1676 |
-
}
|
1677 |
protected $_unique_key = array();
|
1678 |
protected function find_unique_key(DOMElement $el){
|
1679 |
if ($el->hasChildNodes()) {
|
@@ -1686,194 +2354,57 @@ COMPLETE;
|
|
1686 |
}
|
1687 |
}
|
1688 |
}
|
1689 |
-
}
|
1690 |
-
protected function render_xml_text($text, $shorten = false, $is_render_collapsed = false)
|
1691 |
-
{
|
1692 |
-
if (empty($text) and 0 !== (int)$text) {
|
1693 |
-
return; // do not display empty text nodes
|
1694 |
-
}
|
1695 |
-
if (preg_match('%\[more:(\d+)\]%', $text, $mtch)) {
|
1696 |
-
$no = intval($mtch[1]);
|
1697 |
-
echo '<div class="xml-more">[ ⇓ ' . sprintf(__('<strong>%s</strong> %s more', 'pmxi_plugin'), $no, _n('element', 'elements', $no, 'pmxi_plugin')) . ' ⇓ ]</div>';
|
1698 |
-
return;
|
1699 |
-
}
|
1700 |
-
$more = '';
|
1701 |
-
if ($shorten and preg_match('%^(.*?\s+){20}(?=\S)%', $text, $mtch)) {
|
1702 |
-
$text = $mtch[0];
|
1703 |
-
$more = '<span class="xml-more">[' . __('more', 'pmxi_plugin') . ']</span>';
|
1704 |
-
}
|
1705 |
-
$is_short = strlen($text) <= 40;
|
1706 |
-
$text = esc_html($text);
|
1707 |
-
//$text = preg_replace('%(?<!\s)\b(?!\s|\W[\w\s])|\w{20}%', '$0​', $text); // put explicit breaks for xml content to wrap
|
1708 |
-
echo '<div class="xml-content textonly' . ($is_short ? ' short' : '') . ($is_render_collapsed ? ' collapsed' : '') . '">' . $text . $more . '</div>';
|
1709 |
-
}
|
1710 |
-
protected function render_xml_attributes(DOMElement $el, $path = '/')
|
1711 |
-
{
|
1712 |
-
foreach ($el->attributes as $attr) {
|
1713 |
-
echo ' <span class="xml-attr" title="' . $path . '@' . $attr->nodeName . '"><span class="xml-attr-name">' . $attr->nodeName . '</span>=<span class="xml-attr-value">"' . esc_attr($attr->value) . '"</span></span>';
|
1714 |
-
}
|
1715 |
-
}
|
1716 |
-
|
1717 |
-
protected function render_xml_element_table(DOMElement $el, $shorten = false, $path = '/', $ind = 0, $lvl = 0)
|
1718 |
-
{
|
1719 |
-
$path .= $el->nodeName;
|
1720 |
-
if ($ind > 0) {
|
1721 |
-
$path .= "[$ind]";
|
1722 |
-
}
|
1723 |
-
|
1724 |
-
$is_render_collapsed = $ind > 1;
|
1725 |
-
echo '<tr class="xml-element lvl-' . $lvl . ($is_render_collapsed ? ' collapsed' : '') . '" title="' . $path . '">';
|
1726 |
-
echo '<td style="padding-left:' . ($lvl + 1) * 15 . 'px">';
|
1727 |
-
$is_inline = true;
|
1728 |
-
if ( ! (0 == $el->attributes->length and 1 == $el->childNodes->length and $el->childNodes->item(0) instanceof DOMText and strlen($el->childNodes->item(0)->wholeText) <= 40)) {
|
1729 |
-
$is_inline = false;
|
1730 |
-
echo '<div class="xml-expander">' . ($is_render_collapsed ? '+' : '-') . '</div>';
|
1731 |
-
}
|
1732 |
-
echo '<div class="xml-tag opening"><span class="xml-tag-name">' . $el->nodeName . '</span></div>';
|
1733 |
-
echo '</td>';
|
1734 |
-
echo '<td>';
|
1735 |
-
$is_inline and $this->render_xml_text_table(trim($el->childNodes->item(0)->wholeText), $shorten, NULL, NULL, $is_inline = true);
|
1736 |
-
echo '</td>';
|
1737 |
-
echo '</tr>';
|
1738 |
-
if ( ! $is_inline) {
|
1739 |
-
echo '<tr class="xml-content' . ($is_render_collapsed ? ' collapsed' : '') . '">';
|
1740 |
-
echo '<td colspan="2">';
|
1741 |
-
echo '<table>';
|
1742 |
-
$this->render_xml_attributes_table($el, $path . '/', $lvl + 1);
|
1743 |
-
$indexes = array();
|
1744 |
-
foreach ($el->childNodes as $child) {
|
1745 |
-
if ($child instanceof DOMElement) {
|
1746 |
-
empty($indexes[$child->nodeName]) and $indexes[$child->nodeName] = 1;
|
1747 |
-
$this->render_xml_element_table($child, $shorten, $path . '/', $indexes[$child->nodeName]++, $lvl + 1);
|
1748 |
-
} elseif ($child instanceof DOMText) {
|
1749 |
-
$this->render_xml_text_table(trim($child->wholeText), $shorten, $path . '/', $lvl + 1);
|
1750 |
-
}
|
1751 |
-
}
|
1752 |
-
echo '</table>';
|
1753 |
-
echo '</td>';
|
1754 |
-
echo '</tr>';
|
1755 |
-
}
|
1756 |
-
}
|
1757 |
-
protected function render_xml_text_table($text, $shorten = false, $path = '/', $lvl = 0, $is_inline = false)
|
1758 |
-
{
|
1759 |
-
if (empty($text)) {
|
1760 |
-
return; // do not display empty text nodes
|
1761 |
-
}
|
1762 |
-
$more = '';
|
1763 |
-
if ($shorten and preg_match('%^(.*?\s+){20}(?=\S)%', $text, $mtch)) {
|
1764 |
-
$text = $mtch[0];
|
1765 |
-
$more = '<span class="xml-more">[' . __('more', 'pmxi_plugin') . ']</span>';
|
1766 |
-
}
|
1767 |
-
$is_short = strlen($text) <= 40;
|
1768 |
-
$text = esc_html($text);
|
1769 |
-
$text = preg_replace('%(?<!\s)\b(?!\s|\W[\w\s])|\w{20}%', '$0​', $text); // put explicit breaks for xml content to wrap
|
1770 |
-
if ($is_inline) {
|
1771 |
-
echo $text . $more;
|
1772 |
-
} else {
|
1773 |
-
echo '<tr class="xml-content-tr textonly lvl-' . $lvl . ($is_short ? ' short' : '') . '" title="' . $path . 'text()">';
|
1774 |
-
echo '<td style="padding-left:' . ($lvl + 1) * 15 . 'px"><span class="xml-attr-name">text</span></td>';
|
1775 |
-
echo '<td>' . $text . $more . '</td>';
|
1776 |
-
echo '</tr>';
|
1777 |
-
}
|
1778 |
-
}
|
1779 |
-
protected function render_xml_attributes_table(DOMElement $el, $path = '/', $lvl = 0)
|
1780 |
-
{
|
1781 |
-
foreach ($el->attributes as $attr) {
|
1782 |
-
echo '<tr class="xml-attr lvl-' . $lvl . '" title="' . $path . '@' . $attr->nodeName . '">';
|
1783 |
-
echo '<td style="padding-left:' . ($lvl + 1) * 15 . 'px"><span class="xml-attr-name">@' . $attr->nodeName . '</span></td>';
|
1784 |
-
echo '<td><span class="xml-attr-value">' . esc_attr($attr->value) . '</span></td>';
|
1785 |
-
echo '</tr>';
|
1786 |
-
}
|
1787 |
-
}
|
1788 |
-
|
1789 |
-
protected function xml_find_repeating(DOMElement $el, $path = '/')
|
1790 |
-
{
|
1791 |
-
$path .= $el->nodeName;
|
1792 |
-
if ( ! $el->parentNode instanceof DOMDocument) {
|
1793 |
-
$path .= '[1]';
|
1794 |
-
}
|
1795 |
-
$children = array();
|
1796 |
-
foreach ($el->childNodes as $child) {
|
1797 |
-
if ($child instanceof DOMElement) {
|
1798 |
-
if ( ! empty($children[$child->nodeName])) {
|
1799 |
-
return $path . '/' . $child->nodeName;
|
1800 |
-
} else {
|
1801 |
-
$children[$child->nodeName] = true;
|
1802 |
-
}
|
1803 |
-
}
|
1804 |
-
}
|
1805 |
-
// reaching this point means we didn't find anything among current element children, so recursively ask children to find something in them
|
1806 |
-
foreach ($el->childNodes as $child) {
|
1807 |
-
if ($child instanceof DOMElement) {
|
1808 |
-
$result = $this->xml_find_repeating($child, $path . '/');
|
1809 |
-
if ($result) {
|
1810 |
-
return $result;
|
1811 |
-
}
|
1812 |
-
}
|
1813 |
-
}
|
1814 |
-
// reaching this point means we didn't find anything, so return element itself if the function was called for it
|
1815 |
-
if ('/' . $el->nodeName == $path) {
|
1816 |
-
return $path;
|
1817 |
-
}
|
1818 |
-
|
1819 |
-
return NULL;
|
1820 |
}
|
1821 |
-
|
1822 |
-
protected function sxml_append(SimpleXMLElement $to, SimpleXMLElement $from) {
|
1823 |
-
$toDom = dom_import_simplexml($to);
|
1824 |
-
$fromDom = dom_import_simplexml($from);
|
1825 |
-
$toDom->appendChild($toDom->ownerDocument->importNode($fromDom, true));
|
1826 |
-
}
|
1827 |
|
1828 |
-
protected function get_xml($tagno = 0){
|
1829 |
-
$xml = '';
|
1830 |
-
$customXpath = PMXI_Plugin::$session->data['pmxi_import']['xpath'];
|
1831 |
-
$wp_uploads = wp_upload_dir();
|
1832 |
$update_previous = new PMXI_Import_Record();
|
1833 |
|
1834 |
-
if ( ! empty(PMXI_Plugin::$session->
|
1835 |
-
|
1836 |
-
$local_paths = (!empty(PMXI_Plugin::$session->data['pmxi_import']['local_paths'])) ? PMXI_Plugin::$session->data['pmxi_import']['local_paths'] : array();
|
1837 |
|
1838 |
-
|
|
|
|
|
1839 |
$history_file = new PMXI_File_Record();
|
1840 |
-
$history_file->getBy(array('import_id' => $update_previous->id), 'id DESC');
|
1841 |
-
$local_paths = ( ! $history_file->isEmpty()) ? array($history_file->path) : array();
|
1842 |
-
}
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
|
|
1846 |
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
|
1851 |
-
$
|
1852 |
|
1853 |
-
|
|
|
|
|
|
|
|
|
1854 |
|
1855 |
-
if (!empty($xml))
|
1856 |
-
{
|
1857 |
PMXI_Import_Record::preprocessXml($xml);
|
1858 |
-
$xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->
|
1859 |
|
1860 |
-
if (
|
1861 |
-
$dom = new DOMDocument('1.0', PMXI_Plugin::$session->
|
1862 |
$old = libxml_use_internal_errors(true);
|
1863 |
$dom->loadXML($xml);
|
1864 |
libxml_use_internal_errors($old);
|
1865 |
$xpath = new DOMXPath($dom);
|
1866 |
-
if (($elements = $xpath->query(
|
1867 |
$this->data['dom'] = $dom;
|
1868 |
$loop++;
|
1869 |
if ( ! $tagno or $loop == $tagno ) break;
|
1870 |
-
}
|
1871 |
}
|
1872 |
else break;
|
1873 |
}
|
1874 |
}
|
1875 |
unset($file);
|
1876 |
-
|
1877 |
}
|
1878 |
}
|
1879 |
}
|
14 |
|
15 |
error_reporting(0);
|
16 |
|
17 |
+
//PMXI_Plugin::$session = PMXI_Session::get_instance();
|
|
|
18 |
|
19 |
if ('PMXI_Admin_Manage' == PMXI_Plugin::getInstance()->getAdminCurrentScreen()->base) { // prereqisites are not checked when flow control is deligated
|
20 |
$id = $this->input->get('id');
|
25 |
$this->isWizard = false;
|
26 |
|
27 |
} else {
|
28 |
+
$action = PMXI_Plugin::getInstance()->getAdminCurrentScreen()->action;
|
29 |
$this->_step_ready($action);
|
30 |
$this->isInline = 'process' == $action;
|
31 |
}
|
53 |
*/
|
54 |
protected function _step_ready($action) {
|
55 |
// step #1: xml selction - has no prerequisites
|
56 |
+
if ('index' == $action) return true;
|
57 |
|
58 |
// step #2: element selection
|
59 |
+
$this->data['dom'] = $dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
|
60 |
$this->data['update_previous'] = $update_previous = new PMXI_Import_Record();
|
61 |
$old = libxml_use_internal_errors(true);
|
62 |
|
63 |
$xml = $this->get_xml();
|
64 |
|
65 |
if (empty($xml) and in_array($action, array('process')) ){
|
66 |
+
! empty( PMXI_Plugin::$session->update_previous ) and $update_previous->getById(PMXI_Plugin::$session->update_previous);
|
67 |
return true;
|
68 |
}
|
69 |
|
70 |
+
if ( ! PMXI_Plugin::$session->has_session()
|
71 |
+
or ! empty( PMXI_Plugin::$session->update_previous ) and $update_previous->getById(PMXI_Plugin::$session->update_previous)->isEmpty()
|
72 |
+
or ! @$dom->loadXML($xml)// FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
|
|
73 |
) {
|
74 |
+
if ( ! PMXI_Plugin::is_ajax() ){
|
75 |
+
$this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your or your web host\'s end.<br/>If you can\'t do an import without seeing this error, change your session settings on the All Import -> Settings page.', 'pmxi_plugin'));
|
76 |
wp_redirect_or_javascript($this->baseUrl); die();
|
77 |
}
|
78 |
}
|
84 |
|
85 |
// step #3: template
|
86 |
$xpath = new DOMXPath($dom);
|
87 |
+
$this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath);
|
88 |
|
89 |
+
if ('preview' == $action or 'tag' == $action or 'preview_images' == $action or 'preview_taxonomies' == $action or 'preview_images' == $action) return true;
|
90 |
|
91 |
+
if ( ! PMXI_Plugin::$session->get('xpath', false) or empty($elements) or ! $elements->length) {
|
92 |
+
$this->errors->add('form-validation', __('There are no elements to import based on your XPath.<br/><br/>If you are in Step 2, you probably specified filtering options that don’t match any elements present in your file.<br/>If you are seeing this error elsewhere, it means that while the XPath expression for your initial import matched some elements in your file previously, there are now zero elements in the file that match this expression.<br/>You can edit the XPath for your import by going to the Manage Imports -> Import Settings page.', 'pmxi_plugin'));
|
93 |
wp_redirect_or_javascript(add_query_arg('action', 'element', $this->baseUrl)); die();
|
94 |
}
|
95 |
|
96 |
if ('template' == $action or 'preview' == $action or 'tag' == $action) return true;
|
97 |
|
98 |
// step #4: options
|
99 |
+
if ( empty( PMXI_Plugin::$session->options ) ) {
|
100 |
wp_redirect_or_javascript(add_query_arg('action', 'template', $this->baseUrl)); die();
|
101 |
}
|
102 |
if ('options' == $action) return true;
|
103 |
|
104 |
+
if ( empty( PMXI_Plugin::$session->options ) ) {
|
105 |
wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
|
106 |
}
|
107 |
}
|
110 |
* Step #1: Choose File
|
111 |
*/
|
112 |
public function index() {
|
113 |
+
|
114 |
+
PMXI_Plugin::$session->clean_session();
|
115 |
|
116 |
$this->data['reimported_import'] = $import = new PMXI_Import_Record();
|
117 |
$this->data['id'] = $id = $this->input->get('id');
|
118 |
$this->data['parent_import'] = $parent_import = $this->input->get('parent_import', 0);
|
119 |
+
$parent_import_record = new PMXI_Import_Record();
|
120 |
|
121 |
+
$default = array(
|
|
|
|
|
|
|
|
|
122 |
'type' => 'upload',
|
123 |
+
'wizard_type' => 'new',
|
124 |
+
'custom_type' => 'post',
|
125 |
+
'show_hidden_cpt' => 0,
|
126 |
'feed_type' => '',
|
127 |
+
'url' => '',
|
128 |
'ftp' => array('url' => 'ftp://'),
|
129 |
'file' => '',
|
130 |
'reimport' => '',
|
132 |
'update_previous' => $id,
|
133 |
'xpath' => '/',
|
134 |
'filepath' => '',
|
135 |
+
'root_element' => '',
|
136 |
+
'downloaded' => ''
|
137 |
+
);
|
138 |
+
|
139 |
+
if ($parent_import and ! $parent_import_record->getById($parent_import)->isEmpty()){
|
140 |
+
$default['custom_type'] = $parent_import_record->options['custom_type'];
|
141 |
+
}
|
142 |
+
|
143 |
+
if ($id and $import->getById($id)->isEmpty()) { // update requested but corresponding import is not found
|
144 |
+
wp_redirect(remove_query_arg('id', $this->baseUrl)); die();
|
145 |
+
}
|
146 |
+
|
147 |
+
$this->data['post'] = $post = $this->input->post( $default );
|
148 |
|
149 |
if ($this->input->post('is_submitted_continue')) {
|
150 |
+
if ( ! empty( PMXI_Plugin::$session->local_paths ) ) {
|
151 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
152 |
}
|
153 |
+
} elseif ('upload' == $this->input->post('type')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
$uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
|
156 |
+
$upload_result = $uploader->upload();
|
157 |
+
if ($upload_result instanceof WP_Error){
|
158 |
+
$this->errors = $upload_result;
|
159 |
+
}
|
160 |
+
else{
|
161 |
+
$source = $upload_result['source'];
|
162 |
+
$filePath = $upload_result['filePath'];
|
163 |
+
PMXI_Plugin::$is_csv = $upload_result['is_csv'];
|
164 |
+
if ( ! empty($upload_result['root_element']))
|
165 |
+
$post['root_element'] = $upload_result['root_element'];
|
166 |
+
}
|
167 |
+
}
|
168 |
+
elseif ('url' == $this->input->post('type')) {
|
169 |
+
|
170 |
+
if ( ! empty($post['downloaded']) ){
|
171 |
+
$downloaded = json_decode($post['downloaded'], true);
|
172 |
+
$source = $downloaded['source'];
|
173 |
+
$filePath = $downloaded['filePath'];
|
174 |
+
PMXI_Plugin::$csv_path = $downloaded['csv_path'];
|
175 |
+
PMXI_Plugin::$is_csv = $downloaded['is_csv'];
|
176 |
+
if ( ! empty($downloaded['root_element']))
|
177 |
+
$post['root_element'] = $downloaded['root_element'];
|
178 |
+
$post['feed_type'] = $downloaded['feed_type'];
|
179 |
+
}
|
180 |
+
else{
|
181 |
+
$uploader = new PMXI_Upload($post['url'], $this->errors);
|
182 |
+
$upload_result = $uploader->url($post['feed_type']);
|
183 |
+
if ($upload_result instanceof WP_Error){
|
184 |
+
$this->errors = $upload_result;
|
185 |
}
|
186 |
+
else{
|
187 |
+
$source = $upload_result['source'];
|
188 |
+
$filePath = $upload_result['filePath'];
|
189 |
+
PMXI_Plugin::$csv_path = $upload_result['csv_path'];
|
190 |
+
PMXI_Plugin::$is_csv = $upload_result['is_csv'];
|
191 |
+
if ( ! empty($upload_result['root_element']))
|
192 |
+
$post['root_element'] = $upload_result['root_element'];
|
193 |
+
$post['feed_type'] = $upload_result['feed_type'];
|
194 |
+
}
|
195 |
+
}
|
|
|
|
|
196 |
}
|
197 |
+
elseif ('file' == $this->input->post('type')) {
|
198 |
+
|
199 |
+
$uploader = new PMXI_Upload($post['file'], $this->errors);
|
200 |
+
$upload_result = $uploader->file();
|
201 |
+
if ($upload_result instanceof WP_Error){
|
202 |
+
$this->errors = $upload_result;
|
203 |
+
}
|
204 |
+
else{
|
205 |
+
$source = $upload_result['source'];
|
206 |
+
$filePath = $upload_result['filePath'];
|
207 |
+
PMXI_Plugin::$is_csv = $upload_result['is_csv'];
|
208 |
+
if ( ! empty($upload_result['root_element']))
|
209 |
+
$post['root_element'] = $upload_result['root_element'];
|
210 |
+
}
|
211 |
+
}
|
212 |
|
213 |
+
if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
|
214 |
+
$this->errors->add('form-validation', __('Select an item type to import the data', 'pmxi_plugin'));
|
215 |
+
}
|
216 |
|
217 |
if ($post['is_update_previous'] and empty($post['update_previous'])) {
|
218 |
$this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'pmxi_plugin'));
|
220 |
|
221 |
$this->data['detection_feed_extension'] = false;
|
222 |
|
223 |
+
if ( ! class_exists('DOMDocument') or ! class_exists('XMLReader') ) {
|
224 |
+
$this->errors->add('form-validation', __('Required PHP components are missing.<br/><br/>WP All Import requires DOMDocument and XMLReader PHP classes to be installed.<br/>These are standard features of PHP, and are necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the DOMDocument and XMLReader PHP classes.', 'pmxi_plugin'));
|
|
|
|
|
|
|
225 |
}
|
226 |
|
227 |
if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
|
228 |
|
229 |
check_admin_referer('choose-file', '_wpnonce_choose-file');
|
230 |
$elements_cloud = array();
|
231 |
+
@set_time_limit(0);
|
232 |
+
|
233 |
$local_paths = !empty($local_paths) ? $local_paths : array($filePath);
|
234 |
|
235 |
foreach ($local_paths as $key => $path) {
|
241 |
if ( ! empty($file->options['element']) ) {
|
242 |
$xpath = "/".$file->options['element'];
|
243 |
$elements_cloud = $file->cloud;
|
244 |
+
break;
|
245 |
+
}
|
246 |
+
|
|
|
247 |
}
|
248 |
else $this->errors->add('form-validation', __('Unable to download feed resource.', 'pmxi_plugin'));
|
249 |
}
|
253 |
// xml is valid
|
254 |
$source['root_element'] = $file->options['element'];
|
255 |
$source['first_import'] = date("Y-m-d H:i:s");
|
256 |
+
|
257 |
+
PMXI_Plugin::$session->clean_session();
|
258 |
|
259 |
+
$session_data = array(
|
260 |
'filePath' => $filePath,
|
261 |
'parent_import_id' => $parent_import,
|
262 |
'xpath' => (!empty($xpath)) ? $xpath : '',
|
263 |
'feed_type' => $post['feed_type'],
|
264 |
+
'wizard_type' => $post['wizard_type'],
|
265 |
+
'custom_type' => $post['custom_type'],
|
266 |
'source' => $source,
|
267 |
+
'encoding' => 'UTF-8',
|
268 |
'is_csv' => PMXI_Plugin::$is_csv,
|
269 |
'csv_path' => PMXI_Plugin::$csv_path,
|
270 |
'chunk_number' => 1,
|
276 |
'errors' => 0,
|
277 |
'start_time' => 0,
|
278 |
'local_paths' => (!empty($local_paths)) ? $local_paths : array(), // ftp import local copies of remote files
|
279 |
+
'csv_paths' => array(PMXI_Plugin::$csv_path), // ftp import local copies of remote CSV files
|
280 |
'action' => 'import',
|
281 |
'elements_cloud' => (!empty($elements_cloud)) ? $elements_cloud : array(),
|
282 |
'pointer' => 1
|
283 |
+
);
|
284 |
+
|
285 |
+
foreach ($session_data as $key => $value) {
|
286 |
+
PMXI_Plugin::$session->set( $key, $value );
|
287 |
+
}
|
288 |
+
|
289 |
$update_previous = new PMXI_Import_Record();
|
290 |
if ($post['is_update_previous'] and ! $update_previous->getById($post['update_previous'])->isEmpty()) {
|
291 |
+
PMXI_Plugin::$session->set('update_previous', $update_previous->id);
|
292 |
+
PMXI_Plugin::$session->set('xpath', $update_previous->xpath);
|
293 |
+
PMXI_Plugin::$session->set('template', $update_previous->template);
|
294 |
+
PMXI_Plugin::$session->set('options', $update_previous->options);
|
295 |
} else {
|
296 |
+
PMXI_Plugin::$session->set('update_previous', '');
|
297 |
}
|
298 |
|
299 |
+
PMXI_Plugin::$session->save_data();
|
300 |
|
301 |
$xml = $this->get_xml();
|
302 |
|
303 |
+
if ( empty($xml) )
|
304 |
{
|
305 |
$this->errors->add('form-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'pmxi_plugin'));
|
306 |
}
|
307 |
+
else{
|
308 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
309 |
}
|
310 |
+
|
311 |
+
} else if ('url' == $this->input->post('type') and !empty($this->errors)){
|
312 |
+
$this->errors->add('form-validation', __('WP All Import unable to detect file type.<br/><br/>WP All Import not able to determine what type of file you are importing. Make sure your file extension is correct for the file type you are importing.<br/> Please choose the correct file type from the dropdown below, or try adding &type=xml or &type=csv to the end of the URL, for example http://example.com/export-products.php?&type=xml', 'pmxi_plugin'));
|
313 |
+
$this->data['detection_feed_extension'] = true;
|
314 |
} else {
|
315 |
$this->errors->add('form-validation', __('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'pmxi_plugin'));
|
316 |
}
|
317 |
|
318 |
do_action("pmxi_get_file", $filePath);
|
319 |
}
|
320 |
+
|
321 |
+
if ($this->input->post('is_submitted') and $this->errors->get_error_codes()) PMXI_Plugin::$session->clean_session();
|
322 |
|
323 |
$this->render();
|
324 |
+
}
|
325 |
|
326 |
/**
|
327 |
* Step #2: Choose elements
|
332 |
$xpath = new DOMXPath($this->data['dom']);
|
333 |
$post = $this->input->post(array('xpath' => ''));
|
334 |
$this->data['post'] =& $post;
|
335 |
+
$this->data['elements_cloud'] = PMXI_Plugin::$session->elements_cloud;
|
336 |
+
$this->data['is_csv'] = PMXI_Plugin::$session->is_csv;
|
337 |
|
338 |
$wp_uploads = wp_upload_dir();
|
339 |
|
345 |
$node_list = @ $xpath->query($post['xpath']); // make sure only element selection is allowed; prevent parsing warning to be displayed
|
346 |
|
347 |
if (FALSE === $node_list) {
|
348 |
+
$this->errors->add('form-validation', __('Your XPath is not valid.<br/><br/>Click "get default XPath" to get the default XPath.', 'pmxi_plugin'));
|
|
|
|
|
349 |
} else {
|
350 |
foreach ($node_list as $el) {
|
351 |
if ( ! $el instanceof DOMElement) {
|
364 |
|
365 |
} else {
|
366 |
|
367 |
+
if ( PMXI_Plugin::$session->xpath ) {
|
368 |
+
$post['xpath'] = PMXI_Plugin::$session->xpath;
|
369 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
370 |
+
if ( ! $elements->length and ! empty( PMXI_Plugin::$session->update_previous ) ) {
|
371 |
$_GET['pmxi_nt'] = __('<b>Warning</b>: No matching elements found for XPath expression from the import being updated. It probably means that new XML file has different format. Though you can update XPath, procceed only if you sure about update operation being valid.', 'pmxi_plugin');
|
372 |
}
|
373 |
} else {
|
374 |
// suggest 1st repeating element as default selection
|
375 |
+
$post['xpath'] = PMXI_Render::xml_find_repeating($this->data['dom']->documentElement);
|
376 |
+
if ( ! empty($post['xpath'])){
|
377 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
378 |
}
|
379 |
}
|
380 |
|
381 |
}
|
382 |
|
383 |
+
// workaround to prevent rendered XML representation to eat memory since it has to be stored in memory when output is bufferred
|
|
|
|
|
|
|
|
|
|
|
384 |
$this->render();
|
385 |
+
|
386 |
}
|
387 |
|
388 |
/**
|
402 |
header("Pragma: no-cache");
|
403 |
|
404 |
$xpath = new DOMXPath($this->data['dom']);
|
405 |
+
$post = $this->input->post(array('xpath' => '', 'show_element' => 1, 'root_element' => PMXI_Plugin::$session->source['root_element'], 'delimiter' => '', 'is_csv' => 0));
|
406 |
$wp_uploads = wp_upload_dir();
|
407 |
|
408 |
if ('' == $post['xpath']) {
|
409 |
+
$this->errors->add('form-validation', __('Your XPath is empty.<br/><br/>Please enter an XPath expression, or click "get default XPath" to get the default XPath.', 'pmxi_plugin'));
|
410 |
+
} else {
|
411 |
+
|
412 |
+
$source = PMXI_Plugin::$session->get('source');
|
413 |
+
|
414 |
// counting selected elements
|
415 |
+
if ('' != $post['delimiter'] and $post['delimiter'] != PMXI_Plugin::$session->is_csv ) {
|
416 |
+
|
417 |
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
418 |
|
419 |
+
PMXI_Plugin::$session->set('is_csv', $post['delimiter']);
|
420 |
+
|
421 |
+
pmxi_remove_source(PMXI_Plugin::$session->filePath, false);
|
422 |
+
|
423 |
+
$csv = new PMXI_CsvParser( array(
|
424 |
+
'filename' => PMXI_Plugin::$session->get('csv_path'),
|
425 |
+
'xpath' => '',
|
426 |
+
'delimiter' => $post['delimiter'],
|
427 |
+
'targetDir' => rtrim(str_replace(basename(PMXI_Plugin::$session->filePath), '', PMXI_Plugin::$session->filePath), '/')
|
428 |
+
));
|
429 |
+
|
430 |
+
$filePath = $csv->xml_path;
|
431 |
+
PMXI_Plugin::$session->set('filePath', $filePath);
|
432 |
+
PMXI_Plugin::$session->set('local_paths', array($filePath));
|
433 |
+
|
|
|
|
|
|
|
434 |
}
|
435 |
|
436 |
// counting selected elements
|
437 |
+
PMXI_Plugin::$session->set('xpath', $post['xpath']);
|
438 |
|
439 |
$current_xpath = '';
|
440 |
|
441 |
+
if ($post['show_element'] == 1) {
|
442 |
+
PMXI_Plugin::$session->set('count', $this->data['node_list_count'] = 0);
|
443 |
}else{
|
444 |
+
$this->data['node_list_count'] = PMXI_Plugin::$session->count;
|
|
|
445 |
}
|
446 |
|
447 |
$xpath_elements = explode('[', $post['xpath']);
|
448 |
$xpath_parts = explode('/', $xpath_elements[0]);
|
449 |
|
450 |
+
$source['root_element'] = $xpath_parts[1];
|
451 |
+
|
452 |
+
PMXI_Plugin::$session->set('source', $source);
|
453 |
|
454 |
+
PMXI_Plugin::$session->save_data();
|
455 |
|
456 |
$loop = 0;
|
457 |
|
458 |
+
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
459 |
|
460 |
+
$file = new PMXI_Chunk($path, array('element' => $source['root_element'], 'encoding' => PMXI_Plugin::$session->encoding));
|
461 |
|
462 |
// loop through the file until all lines are read
|
463 |
while ($xml = $file->read()) {
|
464 |
|
465 |
+
if ( ! empty($xml) )
|
466 |
{
|
467 |
PMXI_Import_Record::preprocessXml($xml);
|
468 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->encoding ."\"?>" . "\n" . $xml;
|
469 |
|
470 |
+
$dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
|
471 |
$old = libxml_use_internal_errors(true);
|
472 |
$dom->loadXML($xml);
|
473 |
libxml_use_internal_errors($old);
|
477 |
|
478 |
if ( $post['show_element'] == 1 ){
|
479 |
$this->data['node_list_count'] += $elements->length;
|
480 |
+
PMXI_Plugin::$session->set('count', $this->data['node_list_count']);
|
481 |
if (!$loop) $this->data['dom'] = $dom;
|
482 |
}
|
483 |
|
495 |
unset($file);
|
496 |
}
|
497 |
if ( ! $this->data['node_list_count']) {
|
498 |
+
$this->errors->add('form-validation', __('There are no elements to import based on your XPath.<br/><br/>If you are in Step 2, you probably specified filtering options that don’t match any elements present in your file.<br/>If you are seeing this error elsewhere, it means that while the XPath expression for your initial import matched some elements in your file previously, there are now zero elements in the file that match this expression.<br/>You can edit the XPath for your import by going to the Manage Imports -> Import Settings page.', 'pmxi_plugin'));
|
499 |
}
|
500 |
}
|
501 |
|
502 |
+
PMXI_Plugin::$session->save_data();
|
503 |
+
|
504 |
+
$this->data['is_csv'] = $post['is_csv'];
|
505 |
|
506 |
ob_start();
|
507 |
if ( ! $this->errors->get_error_codes()) {
|
511 |
if (PMXI_Plugin::getInstance()->getOption('highlight_limit') and $elements->length <= PMXI_Plugin::getInstance()->getOption('highlight_limit')) {
|
512 |
foreach ($elements as $el) {
|
513 |
if ( ! $el instanceof DOMElement) continue;
|
514 |
+
$p = PMXI_Render::get_xml_path($el, $xpath) and $paths[] = $p;
|
515 |
}
|
516 |
}
|
517 |
$this->render();
|
523 |
|
524 |
ob_start();
|
525 |
|
526 |
+
if ( ! empty($elements->length) ) PMXI_Render::render_xml_elements_for_filtring($elements->item(0));
|
527 |
|
528 |
$render_element = ob_get_clean();
|
529 |
|
530 |
+
exit( json_encode( array('result' => true, 'html' => $html, 'root_element' => $source['root_element'], 'count' => $this->data['node_list_count'], 'render_element' => $render_element )));
|
531 |
}
|
532 |
|
533 |
/**
|
539 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
540 |
}
|
541 |
|
542 |
+
$post = $this->input->post(array('xpath' => '', 'show_element' => 1, 'root_element' => (!empty(PMXI_Plugin::$session->source['root_element'])) ? PMXI_Plugin::$session->source['root_element'] : '', 'tagno' => 0, 'parent_tagno' => 1));
|
543 |
$wp_uploads = wp_upload_dir();
|
544 |
|
545 |
$this->get_xml( $post['parent_tagno'] );
|
549 |
$this->data['tagno'] = max(intval($this->input->getpost('tagno', 1)), 0);
|
550 |
|
551 |
if ('' == $post['xpath']) {
|
552 |
+
$this->errors->add('form-validation', __('Your XPath is empty.<br/><br/>Please enter an XPath expression, or click "get default XPath" to get the default XPath.', 'pmxi_plugin'));
|
553 |
} else {
|
554 |
+
$post['xpath'] = '/' . ((!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element']) .'/'. ltrim(trim(str_replace("[*]","",$post['xpath']),'{}'), '/');
|
555 |
// in default mode
|
556 |
$this->data['variation_elements'] = $elements = @ $xpath->query($post['xpath']); // prevent parsing warning to be displayed
|
557 |
$this->data['variation_list_count'] = $elements->length;
|
558 |
if (FALSE === $elements) {
|
559 |
+
$this->errors->add('form-validation', __('Your XPath is not valid.<br/><br/>Click "get default XPath" to get the default XPath.', 'pmxi_plugin'));
|
560 |
} elseif ( ! $elements->length) {
|
561 |
$this->errors->add('form-validation', __('No matching variations found for XPath specified', 'pmxi_plugin'));
|
562 |
} else {
|
568 |
}
|
569 |
}
|
570 |
}
|
571 |
+
|
572 |
ob_start();
|
573 |
|
574 |
if ( ! $this->errors->get_error_codes()) {
|
578 |
foreach ($elements as $el) {
|
579 |
if ( ! $el instanceof DOMElement) continue;
|
580 |
|
581 |
+
$p = PMXI_Render::get_xml_path($el, $xpath) and $paths[] = $p;
|
582 |
}
|
583 |
}
|
584 |
|
588 |
}
|
589 |
|
590 |
exit( json_encode(array('html' => ob_get_clean())) );
|
591 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
|
593 |
/**
|
594 |
* Preview selected xml tag (called with ajax from `template` step)
|
602 |
{
|
603 |
$update_previous = new PMXI_Import_Record();
|
604 |
$id = $this->input->get('id');
|
605 |
+
if ($id and $update_previous->getById($id)) {
|
606 |
+
PMXI_Plugin::$session->set('update_previous', $update_previous->id);
|
607 |
+
PMXI_Plugin::$session->set('xpath', $update_previous->xpath);
|
608 |
+
PMXI_Plugin::$session->set('options', $update_previous->options);
|
|
|
|
|
|
|
609 |
$history = new PMXI_File_List();
|
610 |
$history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $update_previous->id), 'id DESC');
|
611 |
|
613 |
$history_file = new PMXI_File_Record();
|
614 |
$history_file->getBy('id', $history[0]['id']);
|
615 |
|
616 |
+
if ( PMXI_Plugin::$session->has_session() ){
|
617 |
+
PMXI_Plugin::$session->set('filePath', $history_file->path);
|
618 |
+
/*if ( ! @file_exists($history_file->path) )
|
619 |
+
PMXI_Plugin::$session->set('filePath', $wp_uploads['basedir'] . '/wpallimport/history/' . $history_file->id);*/
|
620 |
+
PMXI_Plugin::$session->set('count', $update_previous->count);
|
621 |
+
PMXI_Plugin::$session->set('count', $update_previous->count);
|
622 |
+
PMXI_Plugin::$session->set('encoding', ( ! empty($update_previous->options['encoding'])) ? $update_previous->options['encoding'] : 'UTF-8');
|
623 |
+
PMXI_Plugin::$session->save_data();
|
624 |
}
|
625 |
}
|
626 |
|
627 |
} else {
|
628 |
+
unset(PMXI_Plugin::$session->update_previous);
|
629 |
}
|
630 |
}
|
631 |
|
632 |
$this->data['tagno'] = max(intval($this->input->getpost('tagno', 1)), 1);
|
633 |
+
|
634 |
+
$this->data['import_action'] = $this->input->getpost('import_action', false);
|
635 |
|
636 |
if ($this->data['tagno']){
|
637 |
|
638 |
+
$local_paths = ( ! empty(PMXI_Plugin::$session->local_paths) ) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
639 |
+
|
640 |
+
PMXI_Plugin::$session->set('local_paths', $local_paths);
|
641 |
+
|
642 |
$loop = 0;
|
643 |
|
644 |
foreach ($local_paths as $key => $path) {
|
645 |
|
646 |
if (@file_exists($path)){
|
647 |
|
648 |
+
$file = new PMXI_Chunk($path, array(
|
649 |
+
'element' => PMXI_Plugin::$session->source['root_element'],
|
650 |
+
'encoding' => PMXI_Plugin::$session->encoding
|
651 |
+
));
|
652 |
+
|
653 |
+
// loop through the file until all lines are read
|
654 |
while ($xml = $file->read()) {
|
655 |
|
656 |
+
if ( ! empty($xml) )
|
657 |
{
|
658 |
PMXI_Import_Record::preprocessXml($xml);
|
659 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->encoding ."\"?>" . "\n" . $xml;
|
660 |
|
661 |
+
$dom = new DOMDocument('1.0', PMXI_Plugin::$session->encoding);
|
662 |
$old = libxml_use_internal_errors(true);
|
663 |
$dom->loadXML($xml);
|
664 |
libxml_use_internal_errors($old);
|
665 |
$xpath = new DOMXPath($dom);
|
666 |
+
if (($elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
667 |
$this->data['elements'] = $elements;
|
668 |
+
$loop += $elements->length;
|
669 |
+
|
670 |
+
if ($loop == $this->data['tagno'] or $loop == PMXI_Plugin::$session->count){
|
671 |
+
/* Merge nested XML/CSV files */
|
672 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
673 |
+
if ( ! empty($nested_files) ){
|
674 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
675 |
+
$merger->merge();
|
676 |
+
$xml = $merger->get_xml();
|
677 |
+
unset($merger);
|
678 |
+
}*/
|
679 |
+
unset($dom, $xpath, $elements);
|
680 |
break(2);
|
681 |
+
}
|
682 |
+
unset($dom, $xpath, $elements);
|
683 |
+
}
|
684 |
}
|
685 |
}
|
686 |
unset($file);
|
691 |
if ( $is_json ){
|
692 |
|
693 |
ob_start();
|
694 |
+
$this->render();
|
695 |
+
exit( json_encode(array('html' => ob_get_clean())) );
|
|
|
|
|
|
|
|
|
696 |
|
697 |
}
|
698 |
else $this->render();
|
713 |
'tagno' => 0
|
714 |
));
|
715 |
$wp_uploads = wp_upload_dir();
|
716 |
+
|
717 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
|
|
718 |
|
719 |
$xml = '';
|
720 |
|
721 |
+
$local_paths = ( ! empty(PMXI_Plugin::$session->local_paths) ) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
722 |
|
723 |
$loop = 1;
|
724 |
foreach ($local_paths as $key => $path) {
|
725 |
|
726 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
727 |
+
// conver CSV to XML with selected encoding
|
728 |
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
729 |
+
|
730 |
+
$csv = new PMXI_CsvParser(array(
|
731 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
732 |
+
'xpath' => '',
|
733 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
734 |
+
'encoding' => $post['import_encoding'],
|
735 |
+
'xml_path' => $path
|
736 |
+
));
|
737 |
}
|
738 |
+
|
739 |
+
$file = new PMXI_Chunk($path, array(
|
740 |
+
'element' => PMXI_Plugin::$session->source['root_element'],
|
741 |
+
'encoding' => $post['import_encoding']
|
742 |
+
));
|
743 |
|
744 |
// loop through the file until all lines are read
|
745 |
+
while ($xml = $file->read()) {
|
746 |
+
|
747 |
+
if ( ! empty($xml) )
|
748 |
{
|
749 |
PMXI_Import_Record::preprocessXml($xml);
|
750 |
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
754 |
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
755 |
libxml_use_internal_errors($old);
|
756 |
$xpath = new DOMXPath($dom);
|
757 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
758 |
+
|
759 |
+
if ( $loop == $tagno ){
|
760 |
+
/* Merge nested XML/CSV files */
|
761 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
762 |
+
if ( ! empty($nested_files) ){
|
763 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
764 |
+
$merger->merge();
|
765 |
+
$xml = $merger->get_xml();
|
766 |
+
unset($merger);
|
767 |
+
}*/
|
768 |
+
unset($dom, $xpath, $elements);
|
769 |
+
break(2);
|
770 |
+
}
|
771 |
+
unset($dom, $xpath, $elements);
|
772 |
$loop++;
|
773 |
}
|
774 |
}
|
777 |
}
|
778 |
//$this->data['tagno'] = $tagno = 1;
|
779 |
|
780 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
781 |
|
782 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
783 |
+
PMXI_Plugin::$session->save_data();
|
784 |
|
785 |
// validate
|
786 |
try {
|
787 |
if (empty($xml)){
|
788 |
+
$this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your web host\'s end.<br/>If you can\'t do an import without seeing this error, change your session settings on the All Import -> Settings page.', 'pmxi_plugin'));
|
789 |
+
} elseif (empty($post['title'])) {
|
790 |
+
$this->errors->add('form-validation', __('<strong>Warning</strong>: your title is blank.', 'pmxi_plugin'));
|
791 |
+
$this->data['title'] = "";
|
792 |
} else {
|
793 |
list($this->data['title']) = XmlImportParser::factory($xml, $xpath, $post['title'], $file)->parse(); unlink($file);
|
794 |
if ( ! isset($this->data['title']) or '' == strval(trim(strip_tags($this->data['title'], '<img><input><textarea><iframe><object><embed>')))) {
|
801 |
}
|
802 |
try {
|
803 |
if (empty($xml)){
|
804 |
+
$this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your web host\'s end.<br/>If you can\'t do an import without seeing this error, change your session settings on the All Import -> Settings page.', 'pmxi_plugin'));
|
805 |
} elseif (empty($post['content'])) {
|
806 |
+
$this->errors->add('form-validation', __('<strong>Warning</strong>: your content is blank.', 'pmxi_plugin'));
|
807 |
+
$this->data['content'] = "";
|
808 |
} else {
|
809 |
list($this->data['content']) = XmlImportParser::factory($post['is_keep_linebreaks'] ? $xml : preg_replace('%\r\n?|\n%', ' ', $xml), $xpath, $post['content'], $file)->parse(); unlink($file);
|
810 |
if ( ! isset($this->data['content']) or '' == strval(trim(strip_tags($this->data['content'], '<img><input><textarea><iframe><object><embed>')))) {
|
817 |
}
|
818 |
|
819 |
ob_start();
|
820 |
+
$this->render();
|
821 |
+
exit( json_encode(array('html' => ob_get_clean())) );
|
|
|
|
|
|
|
|
|
822 |
}
|
823 |
+
|
824 |
/**
|
825 |
+
* Preview future post images based on current template and tag (called with ajax from `template` step)
|
826 |
*/
|
827 |
+
public function preview_images()
|
828 |
+
{
|
829 |
+
$post = $this->data['post'] = $this->input->post(array(
|
830 |
+
'download_images' => 'no',
|
831 |
+
'download_featured_delim' => '',
|
832 |
+
'featured_delim' => '',
|
833 |
+
'download_featured_image' => '',
|
834 |
+
'featured_image' => '',
|
835 |
+
'import_encoding' => 'UTF-8',
|
836 |
+
'tagno' => 0
|
837 |
+
));
|
838 |
+
$wp_uploads = wp_upload_dir();
|
839 |
|
840 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
841 |
|
842 |
+
$xml = '';
|
843 |
+
|
844 |
+
$local_paths = (!empty(PMXI_Plugin::$session->local_paths)) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
845 |
|
846 |
+
$loop = 1;
|
847 |
+
foreach ($local_paths as $key => $path) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
848 |
|
849 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
850 |
+
|
851 |
+
// conver CSV to XML with selected encoding
|
852 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
853 |
+
|
854 |
+
$csv = new PMXI_CsvParser(array(
|
855 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
856 |
+
'xpath' => '',
|
857 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
858 |
+
'encoding' => $post['import_encoding'],
|
859 |
+
'xml_path' => $path
|
860 |
+
));
|
861 |
+
|
862 |
}
|
|
|
863 |
|
864 |
+
$file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
|
865 |
+
|
866 |
+
// loop through the file until all lines are read
|
867 |
+
while ($xml = $file->read()) {
|
868 |
+
if (!empty($xml))
|
869 |
+
{
|
870 |
+
PMXI_Import_Record::preprocessXml($xml);
|
871 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
872 |
+
|
873 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
874 |
+
$old = libxml_use_internal_errors(true);
|
875 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
876 |
+
libxml_use_internal_errors($old);
|
877 |
+
$xpath = new DOMXPath($dom);
|
878 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
879 |
+
|
880 |
+
if ( $loop == $tagno ){
|
881 |
+
/* Merge nested XML/CSV files */
|
882 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
883 |
+
if ( ! empty($nested_files) ){
|
884 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
885 |
+
$merger->merge();
|
886 |
+
$xml = $merger->get_xml();
|
887 |
+
unset($merger);
|
888 |
+
} */
|
889 |
+
unset($dom, $xpath, $elements);
|
890 |
+
break(2);
|
891 |
+
}
|
892 |
+
unset($dom, $xpath, $elements);
|
893 |
+
$loop++;
|
894 |
+
}
|
895 |
+
}
|
896 |
+
}
|
897 |
+
unset($file);
|
898 |
+
}
|
899 |
+
//$this->data['tagno'] = $tagno = 1;
|
900 |
+
|
901 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
902 |
+
|
903 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
904 |
+
PMXI_Plugin::$session->save_data();
|
905 |
+
|
906 |
+
// validate
|
907 |
+
try {
|
908 |
+
$featured_image = ( 'yes' == $post['download_images']) ? $post['download_featured_image'] : $post['featured_image'];
|
909 |
+
if (empty($xml)){
|
910 |
+
$this->errors->add('form-validation', __('WP All Import lost track of where you are.<br/><br/>Maybe you cleared your cookies or maybe it is just a temporary issue on your web host\'s end.<br/>If you can\'t do an import without seeing this error, change your session settings on the All Import -> Settings page.', 'pmxi_plugin'));
|
911 |
+
} elseif (empty($featured_image)){
|
912 |
+
$this->data['featured_images'] = false;
|
913 |
+
} else{
|
914 |
+
list($this->data['featured_images']) = XmlImportParser::factory($xml, $xpath, $featured_image, $file)->parse(); unlink($file);
|
915 |
+
}
|
916 |
+
} catch (XmlImportException $e) {
|
917 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'pmxi_plugin'), $e->getMessage()));
|
918 |
+
}
|
919 |
+
|
920 |
+
ob_start();
|
921 |
+
$this->render();
|
922 |
+
exit( json_encode(array('html' => ob_get_clean())) );
|
923 |
+
}
|
924 |
+
|
925 |
+
/**
|
926 |
+
* Preview taxonomies hierarchy based on current template and tag (called with ajax from `template` step)
|
927 |
+
*/
|
928 |
+
public function preview_taxonomies()
|
929 |
+
{
|
930 |
+
$post = $this->data['post'] = $this->input->post(array(
|
931 |
+
'tax_logic' => '',
|
932 |
+
'tax_hierarchical_logic' => '',
|
933 |
+
'tax_hierarchical_xpath' => '',
|
934 |
+
'tax_hierarchical_delim' => '',
|
935 |
+
'tax_mapping' => '',
|
936 |
+
'import_encoding' => 'UTF-8',
|
937 |
+
'tagno' => 0
|
938 |
+
));
|
939 |
+
|
940 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
941 |
+
|
942 |
+
$xml = '';
|
943 |
+
|
944 |
+
$local_paths = (!empty(PMXI_Plugin::$session->local_paths)) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
945 |
+
|
946 |
+
$loop = 1;
|
947 |
+
foreach ($local_paths as $key => $path) {
|
948 |
+
|
949 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
950 |
+
// conver CSV to XML with selected encoding
|
951 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
952 |
+
|
953 |
+
$csv = new PMXI_CsvParser(array(
|
954 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
955 |
+
'xpath' => '',
|
956 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
957 |
+
'encoding' => $post['import_encoding'],
|
958 |
+
'xml_path' => $path
|
959 |
+
));
|
960 |
+
}
|
961 |
+
|
962 |
+
$file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
|
963 |
+
|
964 |
+
// loop through the file until all lines are read
|
965 |
+
while ($xml = $file->read()) {
|
966 |
+
if (!empty($xml))
|
967 |
+
{
|
968 |
+
PMXI_Import_Record::preprocessXml($xml);
|
969 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
970 |
+
|
971 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
972 |
+
$old = libxml_use_internal_errors(true);
|
973 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
974 |
+
libxml_use_internal_errors($old);
|
975 |
+
$xpath = new DOMXPath($dom);
|
976 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
977 |
+
|
978 |
+
if ( $loop == $tagno ){
|
979 |
+
/* Merge nested XML/CSV files */
|
980 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
981 |
+
if ( ! empty($nested_files) ){
|
982 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
983 |
+
$merger->merge();
|
984 |
+
$xml = $merger->get_xml();
|
985 |
+
unset($merger);
|
986 |
+
} */
|
987 |
+
unset($dom, $xpath, $elements);
|
988 |
+
break(2);
|
989 |
+
}
|
990 |
+
unset($dom, $xpath, $elements);
|
991 |
+
$loop++;
|
992 |
+
}
|
993 |
+
}
|
994 |
+
}
|
995 |
+
unset($file);
|
996 |
+
}
|
997 |
+
//$this->data['tagno'] = $tagno = 1;
|
998 |
+
|
999 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
1000 |
+
|
1001 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
1002 |
+
PMXI_Plugin::$session->save_data();
|
1003 |
+
|
1004 |
+
// validate
|
1005 |
+
try {
|
1006 |
+
if (empty($xml)){
|
1007 |
+
$this->errors->add('form-validation', __('Error parsing: String could not be parsed as XML', 'pmxi_plugin'));
|
1008 |
+
} else{
|
1009 |
+
$data_to_preview = false;
|
1010 |
+
foreach ($post['tax_logic'] as $ctx => $logic) {
|
1011 |
+
if ( $logic == 'hierarchical' and ! empty($post['tax_hierarchical_logic'][$ctx]) and "entire" == $post['tax_hierarchical_logic'][$ctx]){
|
1012 |
+
list($this->data['tax_hierarchical'][$ctx]) = XmlImportParser::factory($xml, $xpath, $post['tax_hierarchical_xpath'][$ctx], $file)->parse(); unlink($file);
|
1013 |
+
$data_to_preview = true;
|
1014 |
+
}
|
1015 |
+
}
|
1016 |
+
if ( ! $data_to_preview )
|
1017 |
+
$this->errors->add('form-validation', __('There is no data to preview', 'pmxi_plugin'));
|
1018 |
+
}
|
1019 |
+
} catch (XmlImportException $e) {
|
1020 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'pmxi_plugin'), $e->getMessage()));
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
ob_start();
|
1024 |
+
$this->render();
|
1025 |
+
exit( json_encode(array('html' => ob_get_clean())) );
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
/**
|
1029 |
+
* Preview prices based on current template and tag (called with ajax from `template` step)
|
1030 |
+
*/
|
1031 |
+
public function preview_prices()
|
1032 |
+
{
|
1033 |
+
$post = $this->data['post'] = $this->input->post(array(
|
1034 |
+
'single_product_regular_price' => '',
|
1035 |
+
'single_product_sale_price' => '',
|
1036 |
+
'disable_prepare_price' => 0,
|
1037 |
+
'single_product_regular_price_adjust' => '',
|
1038 |
+
'single_product_regular_price_adjust_type' => '%',
|
1039 |
+
'single_product_sale_price_adjust' => '',
|
1040 |
+
'single_product_sale_price_adjust_type' => '%',
|
1041 |
+
'import_encoding' => 'UTF-8',
|
1042 |
+
'tagno' => 0
|
1043 |
+
));
|
1044 |
+
|
1045 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
1046 |
+
|
1047 |
+
$xml = '';
|
1048 |
+
|
1049 |
+
$local_paths = (!empty(PMXI_Plugin::$session->local_paths)) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
1050 |
+
|
1051 |
+
$loop = 1;
|
1052 |
+
foreach ($local_paths as $key => $path) {
|
1053 |
+
|
1054 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
1055 |
+
// conver CSV to XML with selected encoding
|
1056 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
1057 |
+
|
1058 |
+
$csv = new PMXI_CsvParser(array(
|
1059 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
1060 |
+
'xpath' => '',
|
1061 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
1062 |
+
'encoding' => $post['import_encoding'],
|
1063 |
+
'xml_path' => $path
|
1064 |
+
));
|
1065 |
+
}
|
1066 |
+
|
1067 |
+
$file = new PMXI_Chunk($path, array('element' => (!empty($this->data['update_previous']->root_element)) ? $this->data['update_previous']->root_element : PMXI_Plugin::$session->source['root_element'], 'encoding' => $post['import_encoding']));
|
1068 |
+
|
1069 |
+
// loop through the file until all lines are read
|
1070 |
+
while ($xml = $file->read()) {
|
1071 |
+
if (!empty($xml))
|
1072 |
+
{
|
1073 |
+
PMXI_Import_Record::preprocessXml($xml);
|
1074 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
1075 |
+
|
1076 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
1077 |
+
$old = libxml_use_internal_errors(true);
|
1078 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
1079 |
+
libxml_use_internal_errors($old);
|
1080 |
+
$xpath = new DOMXPath($dom);
|
1081 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
1082 |
+
|
1083 |
+
if ( $loop == $tagno ){
|
1084 |
+
/* Merge nested XML/CSV files */
|
1085 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
1086 |
+
if ( ! empty($nested_files) ){
|
1087 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
1088 |
+
$merger->merge();
|
1089 |
+
$xml = $merger->get_xml();
|
1090 |
+
unset($merger);
|
1091 |
+
} */
|
1092 |
+
unset($dom, $xpath, $elements);
|
1093 |
+
break(2);
|
1094 |
+
}
|
1095 |
+
unset($dom, $xpath, $elements);
|
1096 |
+
$loop++;
|
1097 |
+
}
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
unset($file);
|
1101 |
+
}
|
1102 |
+
//$this->data['tagno'] = $tagno = 1;
|
1103 |
+
|
1104 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
1105 |
+
|
1106 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
1107 |
+
PMXI_Plugin::$session->save_data();
|
1108 |
+
|
1109 |
+
// validate
|
1110 |
+
try {
|
1111 |
+
if (empty($xml)){
|
1112 |
+
$this->errors->add('form-validation', __('Error parsing: String could not be parsed as XML', 'pmxi_plugin'));
|
1113 |
+
} else{
|
1114 |
+
$data_to_preview = false;
|
1115 |
+
|
1116 |
+
if ("" != $post['single_product_regular_price']){
|
1117 |
+
list($this->data['product_regular_price']) = XmlImportParser::factory($xml, $xpath, $post['single_product_regular_price'], $file)->parse(); unlink($file);
|
1118 |
+
$this->data['product_regular_price'] = pmwi_adjust_price(pmwi_prepare_price($this->data['product_regular_price'], $post['disable_prepare_price']), 'regular_price', $post);
|
1119 |
+
$data_to_preview = true;
|
1120 |
+
|
1121 |
+
}
|
1122 |
+
if ("" != $post['single_product_sale_price']){
|
1123 |
+
list($this->data['product_sale_price']) = XmlImportParser::factory($xml, $xpath, $post['single_product_sale_price'], $file)->parse(); unlink($file);
|
1124 |
+
$this->data['product_sale_price'] = pmwi_adjust_price(pmwi_prepare_price($this->data['product_sale_price'], $post['disable_prepare_price']), 'sale_price', $post);
|
1125 |
+
$data_to_preview = true;
|
1126 |
+
|
1127 |
+
}
|
1128 |
+
|
1129 |
+
if ( ! $data_to_preview )
|
1130 |
+
$this->errors->add('form-validation', __('There is no data to preview', 'pmxi_plugin'));
|
1131 |
+
}
|
1132 |
+
} catch (XmlImportException $e) {
|
1133 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'pmxi_plugin'), $e->getMessage()));
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
ob_start();
|
1137 |
+
$this->render();
|
1138 |
+
exit( json_encode(array('html' => ob_get_clean())) );
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
/**
|
1142 |
+
* Step #3: Choose template
|
1143 |
+
*/
|
1144 |
+
public function template()
|
1145 |
+
{
|
1146 |
+
|
1147 |
+
$template = new PMXI_Template_Record();
|
1148 |
+
|
1149 |
+
$default = PMXI_Plugin::get_default_import_options();
|
1150 |
+
|
1151 |
+
if ($this->isWizard) {
|
1152 |
+
$this->data['source_type'] = PMXI_Plugin::$session->source['type'];
|
1153 |
+
$DefaultOptions = (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()) + $default;
|
1154 |
+
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1155 |
+
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1156 |
+
}
|
1157 |
+
$DefaultOptions['wizard_type'] = PMXI_Plugin::$session->wizard_type;
|
1158 |
+
$DefaultOptions['custom_type'] = PMXI_Plugin::$session->custom_type;
|
1159 |
+
$DefaultOptions['delimiter'] = PMXI_Plugin::$session->is_csv;
|
1160 |
+
$post = $this->input->post( apply_filters('pmxi_options_options', $DefaultOptions, $this->isWizard) );
|
1161 |
+
|
1162 |
+
} else {
|
1163 |
+
$this->data['source_type'] = $this->data['import']->type;
|
1164 |
+
$DefaultOptions = $this->data['import']->options + $default;
|
1165 |
+
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1166 |
+
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
$source = array(
|
1170 |
+
'name' => $this->data['import']->name,
|
1171 |
+
'type' => $this->data['import']->type,
|
1172 |
+
'path' => $this->data['import']->path,
|
1173 |
+
'root_element' => $this->data['import']->root_element,
|
1174 |
+
);
|
1175 |
+
|
1176 |
+
PMXI_Plugin::$session->set('source', $source);
|
1177 |
+
|
1178 |
+
$post = $this->input->post( apply_filters( 'pmxi_options_options', $DefaultOptions, $this->isWizard) );
|
1179 |
+
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
$this->data['post'] =& $post;
|
1183 |
+
|
1184 |
+
PMXI_Plugin::$session->set('options', $post);
|
1185 |
+
|
1186 |
+
if (($load_template = $this->input->post('load_template'))) { // init form with template selected
|
1187 |
+
if ( ! $template->getById($load_template)->isEmpty()) {
|
1188 |
+
|
1189 |
+
$template_options = $template->options;
|
1190 |
+
$template_options['type'] = $post['type'];
|
1191 |
+
$template_options['custom_type'] = $post['custom_type'];
|
1192 |
+
$template_options['wizard_type'] = $post['wizard_type'];
|
1193 |
+
$template_options['delimiter'] = $post['delimiter'];
|
1194 |
+
|
1195 |
+
$this->data['post'] = $template_options;
|
1196 |
+
PMXI_Plugin::$session->set('is_loaded_template', $load_template);
|
1197 |
+
PMXI_Plugin::$session->set('options', $template_options);
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
} elseif ($this->input->post('is_submitted')) { // save template submission
|
1201 |
+
|
1202 |
+
check_admin_referer('template', '_wpnonce_template');
|
1203 |
+
|
1204 |
+
if (!empty($post['title'])) {
|
1205 |
+
$this->_validate_template($post['title'], 'Post title');
|
1206 |
+
}
|
1207 |
+
else{
|
1208 |
+
$this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', 'pmxi_plugin'));
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
if (!empty($post['content'])) {
|
1212 |
+
$this->_validate_template($post['content'], 'Post content');
|
1213 |
+
}
|
1214 |
+
else{
|
1215 |
+
$this->warnings->add('2', __('<strong>Warning:</strong> your content is blank.', 'pmxi_plugin'));
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
if ((!empty($post['featured_image']) or !empty($post['download_featured_image'])) and ($post['custom_type'] != 'product' or ! class_exists('PMWI_Plugin'))) {
|
1219 |
+
|
1220 |
+
$this->warnings->add('3', __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=images" target="_blank">upgrade to the professional edition of WP All Import</a> to import images. The settings you configured in the images section will be ignored.', 'pmxi_plugin'));
|
1221 |
+
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
if ( ! $this->errors->get_error_codes()) {
|
1225 |
+
|
1226 |
+
if ( ! empty($post['name'])) { // save template in database
|
1227 |
+
$template->getByName($post['name'])->set(array(
|
1228 |
+
'name' => $post['name'],
|
1229 |
+
'is_keep_linebreaks' => $post['is_keep_linebreaks'],
|
1230 |
+
'is_leave_html' => $post['is_leave_html'],
|
1231 |
+
'fix_characters' => $post['fix_characters'],
|
1232 |
+
'options' => $post
|
1233 |
+
))->save();
|
1234 |
+
PMXI_Plugin::$session->set('saved_template', $template->id);
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
// Attributes fields logic
|
1238 |
+
$post = apply_filters('pmxi_save_options', $post);
|
1239 |
+
|
1240 |
+
// remove entires where both custom_name and custom_value are empty
|
1241 |
+
$not_empty = array_flip(array_values(array_merge(array_keys(array_filter($post['custom_name'], 'strlen')), array_keys(array_filter($post['custom_value'], 'strlen')))));
|
1242 |
+
|
1243 |
+
$post['custom_name'] = array_intersect_key($post['custom_name'], $not_empty);
|
1244 |
+
$post['custom_value'] = array_intersect_key($post['custom_value'], $not_empty);
|
1245 |
+
|
1246 |
+
// validate
|
1247 |
+
if (array_keys(array_filter($post['custom_name'], 'strlen')) != array_keys(array_filter($post['custom_value'], 'strlen')) and ! count(array_filter($post['custom_format'])) ) {
|
1248 |
+
$this->errors->add('form-validation', __('Both name and value must be set for all custom parameters', 'pmxi_plugin'));
|
1249 |
+
} else {
|
1250 |
+
foreach ($post['custom_name'] as $custom_name) {
|
1251 |
+
$this->_validate_template($custom_name, __('Custom Field Name', 'pmxi_plugin'));
|
1252 |
+
}
|
1253 |
+
foreach ($post['custom_value'] as $key => $custom_value) {
|
1254 |
+
if ( empty($post['custom_format'][$key]) )
|
1255 |
+
$this->_validate_template($custom_value, __('Custom Field Value', 'pmxi_plugin'));
|
1256 |
+
}
|
1257 |
+
if ( ! empty($post['custom_name']) and !empty($post['custom_value'])) {
|
1258 |
+
|
1259 |
+
$this->warnings->add('4', __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=custom-fields" target="_blank">upgrade to the professional edition of WP All Import</a> to import data to Custom Fields. The settings you configured in the Custom Fields section will be ignored.', 'pmxi_plugin'));
|
1260 |
+
|
1261 |
+
}
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
if ( $post['type'] == "post" and $post['custom_type'] == "product" and class_exists('PMWI_Plugin')){
|
1265 |
+
// remove entires where both custom_name and custom_value are empty
|
1266 |
+
$not_empty = array_flip(array_values(array_merge(array_keys(array_filter($post['attribute_name'], 'strlen')), array_keys(array_filter($post['attribute_value'], 'strlen')))));
|
1267 |
+
|
1268 |
+
$post['attribute_name'] = array_intersect_key($post['attribute_name'], $not_empty);
|
1269 |
+
$post['attribute_value'] = array_intersect_key($post['attribute_value'], $not_empty);
|
1270 |
+
|
1271 |
+
// validate
|
1272 |
+
if (array_keys(array_filter($post['attribute_name'], 'strlen')) != array_keys(array_filter($post['attribute_value'], 'strlen'))) {
|
1273 |
+
$this->errors->add('form-validation', __('Both name and value must be set for all woocommerce attributes', 'pmxi_plugin'));
|
1274 |
+
} else {
|
1275 |
+
foreach ($post['attribute_name'] as $attribute_name) {
|
1276 |
+
$this->_validate_template($attribute_name, __('Attribute Field Name', 'pmxi_plugin'));
|
1277 |
+
}
|
1278 |
+
foreach ($post['attribute_value'] as $custom_value) {
|
1279 |
+
$this->_validate_template($custom_value, __('Attribute Field Value', 'pmxi_plugin'));
|
1280 |
+
}
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
}
|
1284 |
+
|
1285 |
+
if ('post' == $post['type']) {
|
1286 |
+
'' == $post['tags'] or $this->_validate_template($post['tags'], __('Tags', 'pmxi_plugin'));
|
1287 |
+
}
|
1288 |
+
if ('specific' == $post['date_type']) {
|
1289 |
+
'' == $post['date'] or $this->_validate_template($post['date'], __('Date', 'pmxi_plugin'));
|
1290 |
+
} else {
|
1291 |
+
'' == $post['date_start'] or $this->_validate_template($post['date_start'], __('Start Date', 'pmxi_plugin'));
|
1292 |
+
'' == $post['date_end'] or $this->_validate_template($post['date_end'], __('Start Date', 'pmxi_plugin'));
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
$this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, $this->data['import']);
|
1296 |
+
|
1297 |
+
if ( ! $this->errors->get_error_codes()) { // no validation errors found
|
1298 |
+
// assign some defaults
|
1299 |
+
'' !== $post['date'] or $post['date'] = 'now';
|
1300 |
+
'' !== $post['date_start'] or $post['date_start'] = 'now';
|
1301 |
+
'' !== $post['date_end'] or $post['date_end'] = 'now';
|
1302 |
+
|
1303 |
+
if ($this->isWizard) {
|
1304 |
+
PMXI_Plugin::$session->set('options', $post);
|
1305 |
+
PMXI_Plugin::$session->save_data();
|
1306 |
+
wp_redirect(add_query_arg('action', 'options', $this->baseUrl)); die();
|
1307 |
+
|
1308 |
+
} else {
|
1309 |
+
$this->data['import']->set(array( 'options' => $post, 'settings_update_on' => date('Y-m-d H:i:s')))->update();
|
1310 |
+
$args = array(
|
1311 |
+
'page' => 'pmxi-admin-manage',
|
1312 |
+
'pmxi_nt' => urlencode(__('Template updated', 'pmxi_plugin'))
|
1313 |
+
);
|
1314 |
+
|
1315 |
+
if ($this->warnings->get_error_codes())
|
1316 |
+
$args['warnings'] = implode(',', $this->warnings->get_error_codes());
|
1317 |
+
|
1318 |
+
wp_redirect(add_query_arg( $args + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)) ,admin_url('admin.php')));
|
1319 |
+
die();
|
1320 |
+
}
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
}
|
1324 |
+
}
|
1325 |
+
|
1326 |
+
PMXI_Plugin::$session->save_data();
|
1327 |
+
|
1328 |
+
if ( ! in_array($post['custom_type'], array('import_users')) ){
|
1329 |
+
|
1330 |
+
global $wpdb;
|
1331 |
+
|
1332 |
+
// Get all meta keys for requested post type
|
1333 |
+
$this->data['meta_keys'] = array();
|
1334 |
+
$hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
|
1335 |
+
$records = get_posts( array('post_type' => $post['custom_type']) );
|
1336 |
+
if ( ! empty($records)){
|
1337 |
+
foreach ($records as $record) {
|
1338 |
+
$record_meta = get_post_meta($record->ID, '');
|
1339 |
+
if ( ! empty($record_meta)){
|
1340 |
+
foreach ($record_meta as $record_meta_key => $record_meta_value) {
|
1341 |
+
if ( ! in_array($record_meta_key, $this->data['meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['meta_keys'][] = $record_meta_key;
|
1342 |
+
}
|
1343 |
+
}
|
1344 |
+
}
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
// Get existing product attributes
|
1348 |
+
$existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes' LIMIT 0 , 50" );
|
1349 |
+
$this->data['existing_attributes'] = array();
|
1350 |
+
if ( ! empty($existing_attributes)){
|
1351 |
+
foreach ($existing_attributes as $key => $existing_attribute) {
|
1352 |
+
$existing_attribute = maybe_unserialize($existing_attribute->meta_value);
|
1353 |
+
if (!empty($existing_attribute) and is_array($existing_attribute)):
|
1354 |
+
foreach ($existing_attribute as $key => $value) {
|
1355 |
+
if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
|
1356 |
+
}
|
1357 |
+
endif;
|
1358 |
+
}
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
else {
|
1362 |
+
// Get All meta keys in the system
|
1363 |
+
$this->data['meta_keys'] = array();
|
1364 |
+
$meta_keys = new PMXI_Model_List();
|
1365 |
+
$meta_keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'usermeta');
|
1366 |
+
$meta_keys->setColumns('umeta_id', 'meta_key')->getBy(NULL, "umeta_id", NULL, NULL, "meta_key");
|
1367 |
+
$hide_fields = array('first_name', 'last_name', 'nickname', 'description', 'wp_capabilities');
|
1368 |
+
if ( ! empty($meta_keys) and $meta_keys->count() ){
|
1369 |
+
foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
|
1370 |
+
$this->data['meta_keys'][] = $meta_key['meta_key'];
|
1371 |
+
}
|
1372 |
+
}
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
if (user_can_richedit()) {
|
1376 |
+
wp_enqueue_script('editor');
|
1377 |
+
}
|
1378 |
+
wp_enqueue_script('word-count');
|
1379 |
+
add_thickbox();
|
1380 |
+
wp_enqueue_script('media-upload');
|
1381 |
+
wp_enqueue_script('quicktags');
|
1382 |
+
$this->render();
|
1383 |
+
}
|
1384 |
+
|
1385 |
+
protected function _validate_template($text, $field_title)
|
1386 |
+
{
|
1387 |
+
try {
|
1388 |
+
$scanner = new XmlImportTemplateScanner();
|
1389 |
+
$tokens = $scanner->scan(new XmlImportStringReader($text));
|
1390 |
+
$parser = new XmlImportTemplateParser($tokens);
|
1391 |
+
$tree = $parser->parse();
|
1392 |
+
} catch (XmlImportException $e) {
|
1393 |
+
$this->errors->add('form-validation', sprintf(__('%s template is invalid: %s', 'pmxi_plugin'), $field_title, $e->getMessage()));
|
1394 |
+
}
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
/**
|
1398 |
+
* Step #4: Options
|
1399 |
+
*/
|
1400 |
+
public function options()
|
1401 |
+
{
|
1402 |
+
|
1403 |
+
$default = PMXI_Plugin::get_default_import_options();
|
1404 |
+
|
1405 |
+
if ($this->isWizard) {
|
1406 |
+
$this->data['source_type'] = PMXI_Plugin::$session->source['type'];
|
1407 |
+
|
1408 |
+
$DefaultOptions = (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()) + $default;
|
1409 |
+
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1410 |
+
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
if (empty(PMXI_Plugin::$session->options['title']))
|
1414 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1415 |
+
if (empty(PMXI_Plugin::$session->options['content']))
|
1416 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1417 |
+
if ((!empty(PMXI_Plugin::$session->options['featured_image']) or !empty(PMXI_Plugin::$session->options['download_featured_image'])) and ( PMXI_Plugin::$session->options['custom_type'] != 'product' or ! class_exists('PMWI_Plugin')))
|
1418 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=images" target="_blank">upgrade to the professional edition of WP All Import</a> to import images. The settings you configured in the images section will be ignored.'));
|
1419 |
+
if (!empty(PMXI_Plugin::$session->options['custom_name']) and !empty(PMXI_Plugin::$session->options['custom_value']))
|
1420 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=custom-fields" target="_blank">upgrade to the professional edition of WP All Import</a> to import data to Custom Fields. The settings you configured in the Custom Fields section will be ignored.'));
|
1421 |
+
|
1422 |
+
$DefaultOptions['unique_key'] = PMXI_Plugin::$session->options['title'];
|
1423 |
+
|
1424 |
+
$keys_black_list = array('programurl');
|
1425 |
+
|
1426 |
+
// auto searching ID element
|
1427 |
+
if (!empty($this->data['dom'])){
|
1428 |
+
$this->find_unique_key($this->data['dom']->documentElement);
|
1429 |
+
if (!empty($this->_unique_key)){
|
1430 |
+
foreach ($keys_black_list as $key => $value) {
|
1431 |
+
$DefaultOptions['unique_key'] = str_replace('{' . $value . '[1]}', "", $DefaultOptions['unique_key']);
|
1432 |
+
}
|
1433 |
+
foreach ($this->_unique_key as $key) {
|
1434 |
+
if (stripos($key, 'id') !== false) {
|
1435 |
+
$DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
|
1436 |
+
break;
|
1437 |
+
}
|
1438 |
+
}
|
1439 |
+
foreach ($this->_unique_key as $key) {
|
1440 |
+
if (stripos($key, 'url') !== false or stripos($key, 'sku') !== false or stripos($key, 'ref') !== false) {
|
1441 |
+
if ( ! in_array($key, $keys_black_list) ){
|
1442 |
+
$DefaultOptions['unique_key'] .= ' - {'.$key.'[1]}';
|
1443 |
+
break;
|
1444 |
+
}
|
1445 |
+
}
|
1446 |
+
}
|
1447 |
+
}
|
1448 |
+
}
|
1449 |
+
|
1450 |
+
$DefaultOptions['unique_key'] = apply_filters('pmxi_unique_key', $DefaultOptions['unique_key'], PMXI_Plugin::$session->options);
|
1451 |
+
|
1452 |
+
$post = $this->input->post( $DefaultOptions );
|
1453 |
+
|
1454 |
+
} else {
|
1455 |
+
$this->data['source_type'] = $this->data['import']->type;
|
1456 |
+
$DefaultOptions = $this->data['import']->options + $default;
|
1457 |
+
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1458 |
+
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1459 |
+
}
|
1460 |
+
|
1461 |
+
$source = array(
|
1462 |
+
'name' => $this->data['import']->name,
|
1463 |
+
'type' => $this->data['import']->type,
|
1464 |
+
'path' => $this->data['import']->path,
|
1465 |
+
'root_element' => $this->data['import']->root_element
|
1466 |
+
);
|
1467 |
+
|
1468 |
+
PMXI_Plugin::$session->set('source', $source);
|
1469 |
|
1470 |
+
$post = $this->input->post( $DefaultOptions );
|
1471 |
+
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
$this->data['post'] =& $post;
|
1475 |
+
|
1476 |
+
PMXI_Plugin::$session->set('options', $post);
|
1477 |
+
|
1478 |
+
if ($this->input->post('is_submitted')) {
|
1479 |
|
1480 |
check_admin_referer('options', '_wpnonce_options');
|
1481 |
+
|
1482 |
+
if ($post['is_import_specified']) {
|
1483 |
+
if (empty($post['import_specified'])) {
|
1484 |
+
$this->errors->add('form-validation', __('Records to import must be specified or uncheck `Import only specified records` option to process all records', 'pmxi_plugin'));
|
1485 |
+
} else {
|
1486 |
+
$chanks = preg_split('% *, *%', $post['import_specified']);
|
1487 |
+
foreach ($chanks as $chank) {
|
1488 |
+
if ( ! preg_match('%^([1-9]\d*)( *- *([1-9]\d*))?$%', $chank, $mtch)) {
|
1489 |
+
$this->errors->add('form-validation', __('Wrong format of `Import only specified records` value', 'pmxi_plugin'));
|
1490 |
+
break;
|
1491 |
+
} elseif (isset($mtch[3]) and intval($mtch[3]) > PMXI_Plugin::$session->count) {
|
1492 |
+
$this->errors->add('form-validation', __('One of the numbers in `Import only specified records` value exceeds record quantity in XML file', 'pmxi_plugin'));
|
1493 |
+
break;
|
1494 |
+
}
|
1495 |
+
}
|
1496 |
+
}
|
1497 |
+
}
|
1498 |
+
if ('manual' != $post['duplicate_matching'] and '' == $post['unique_key']) {
|
1499 |
+
$this->errors->add('form-validation', __('Expression for `Post Unique Key` must be set, use the same expression as specified for post title if you are not sure what to put there', 'pmxi_plugin'));
|
1500 |
+
} elseif ('manual' != $post['duplicate_matching']) {
|
1501 |
+
$this->_validate_template($post['unique_key'], __('Post Unique Key', 'pmxi_plugin'));
|
1502 |
+
}
|
1503 |
+
if ( 'manual' == $post['duplicate_matching'] and 'custom field' == $post['duplicate_indicator']){
|
1504 |
+
if ('' == $post['custom_duplicate_name'])
|
1505 |
+
$this->errors->add('form-validation', __('Custom field name must be specified.', 'pmxi_plugin'));
|
1506 |
+
if ('' == $post['custom_duplicate_value'])
|
1507 |
+
$this->errors->add('form-validation', __('Custom field value must be specified.', 'pmxi_plugin'));
|
1508 |
+
}
|
1509 |
|
1510 |
// Categories/taxonomies logic
|
1511 |
if ($post['update_categories_logic'] == 'only'){
|
1513 |
}
|
1514 |
elseif ($post['update_categories_logic'] == 'all_except'){
|
1515 |
$post['taxonomies_list'] = explode(",", $post['taxonomies_except_list']);
|
1516 |
+
}
|
1517 |
|
1518 |
// Custom fields logic
|
1519 |
if ($post['update_custom_fields_logic'] == 'only'){
|
1523 |
$post['custom_fields_list'] = explode(",", $post['custom_fields_except_list']);
|
1524 |
}
|
1525 |
|
1526 |
+
$upload_result = false;
|
1527 |
+
|
1528 |
+
if ( ! $this->isWizard) {
|
1529 |
+
|
1530 |
+
// File Path validation
|
1531 |
+
switch ($this->input->post('new_type')){
|
1532 |
+
case 'upload':
|
1533 |
+
$filePath = $this->input->post('filepath');
|
1534 |
+
|
1535 |
+
$uploader = new PMXI_Upload($filePath, $this->errors);
|
1536 |
+
$upload_result = $uploader->upload();
|
1537 |
+
|
1538 |
+
|
1539 |
+
break;
|
1540 |
+
case 'url':
|
1541 |
+
$filePath = $this->input->post('url');
|
1542 |
+
|
1543 |
+
$uploader = new PMXI_Upload($filePath, $this->errors);
|
1544 |
+
$upload_result = $uploader->url($this->data['import']->feed_type);
|
1545 |
+
|
1546 |
+
break;
|
1547 |
+
case 'file':
|
1548 |
+
|
1549 |
+
$filePath = $this->input->post('file');
|
1550 |
+
|
1551 |
+
$uploader = new PMXI_Upload($filePath, $this->errors);
|
1552 |
+
$upload_result = $uploader->file();
|
1553 |
+
|
1554 |
+
break;
|
1555 |
+
default:
|
1556 |
+
|
1557 |
+
$this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'pmxi_plugin'));
|
1558 |
+
|
1559 |
+
break;
|
1560 |
+
}
|
1561 |
+
|
1562 |
+
if ($upload_result instanceof WP_Error){
|
1563 |
+
$this->errors = $upload_result;
|
1564 |
+
}
|
1565 |
+
elseif ($upload_result !== false and $this->data['import']['path'] != $filePath) {
|
1566 |
+
|
1567 |
+
$file = new PMXI_Chunk($upload_result['filePath'], array('element' => ( ! empty($this->data['import']->root_element)) ? $this->data['import']->root_element : ''));
|
1568 |
+
|
1569 |
+
$root_element = '';
|
1570 |
+
if ( ! empty($file->options['element']) ) {
|
1571 |
+
|
1572 |
+
$root_element = $file->options['element'];
|
1573 |
+
|
1574 |
+
$baseXpath = $this->data['import']->xpath;
|
1575 |
+
|
1576 |
+
$loop = 0;
|
1577 |
+
|
1578 |
+
// loop through the file until all lines are read
|
1579 |
+
while ($xml = $file->read()) {
|
1580 |
+
|
1581 |
+
if ( ! empty($xml) )
|
1582 |
+
{
|
1583 |
+
PMXI_Import_Record::preprocessXml($xml);
|
1584 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $this->data['import']['options']['encoding'] ."\"?>" . "\n" . $xml;
|
1585 |
+
|
1586 |
+
$dom = new DOMDocument('1.0', $this->data['import']['options']['encoding']);
|
1587 |
+
$old = libxml_use_internal_errors(true);
|
1588 |
+
$dom->loadXML($xml);
|
1589 |
+
libxml_use_internal_errors($old);
|
1590 |
+
$xpath = new DOMXPath($dom);
|
1591 |
+
|
1592 |
+
if (($elements = @$xpath->query($baseXpath)) and $elements->length) $loop += $elements->length;
|
1593 |
+
unset($dom, $xpath, $elements);
|
1594 |
+
|
1595 |
+
}
|
1596 |
+
}
|
1597 |
+
unset($file);
|
1598 |
+
|
1599 |
+
if ( (int) $loop === 0 ){
|
1600 |
+
|
1601 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> this file does not have the same structure as the last file associated with this import. WP All Import won\'t be able to import this file with your current settings. Probably you\'ll need to adjust your XPath in the "Configure Advanced Settings" box below, and reconfigure your import by clicking "Edit" on the Manage Imports page.', 'pmxi_plugin'));
|
1602 |
+
|
1603 |
+
$file = new PMXI_Chunk($upload_result['filePath'], array('element' => ( ! empty($upload_result['root_element'])) ? $upload_result['root_element'] : ''));
|
1604 |
+
|
1605 |
+
if ( ! empty($file->options['element']) ) {
|
1606 |
+
|
1607 |
+
$root_element = $file->options['element'];
|
1608 |
+
|
1609 |
+
$baseXpath = '/' . $upload_result['root_element'];
|
1610 |
+
|
1611 |
+
$loop = 0;
|
1612 |
+
|
1613 |
+
// loop through the file until all lines are read
|
1614 |
+
while ($xml = $file->read()) {
|
1615 |
+
|
1616 |
+
if ( ! empty($xml) )
|
1617 |
+
{
|
1618 |
+
PMXI_Import_Record::preprocessXml($xml);
|
1619 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $this->data['import']['options']['encoding'] ."\"?>" . "\n" . $xml;
|
1620 |
+
|
1621 |
+
$dom = new DOMDocument('1.0', $this->data['import']['options']['encoding']);
|
1622 |
+
$old = libxml_use_internal_errors(true);
|
1623 |
+
$dom->loadXML($xml);
|
1624 |
+
libxml_use_internal_errors($old);
|
1625 |
+
$xpath = new DOMXPath($dom);
|
1626 |
+
|
1627 |
+
if (($elements = @$xpath->query($baseXpath)) and $elements->length) $loop += $elements->length;
|
1628 |
+
unset($dom, $xpath, $elements);
|
1629 |
|
1630 |
+
}
|
1631 |
+
}
|
1632 |
+
unset($file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1633 |
|
1634 |
+
if ($loop) $this->data['import']->set(array('count' => $loop))->save();
|
|
|
1635 |
|
1636 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1638 |
}
|
1639 |
+
|
1640 |
+
$upload_result['root_element'] = $root_element;
|
1641 |
+
|
1642 |
+
$post['delimiter'] = ( ! empty($upload_result['is_csv']) ) ? $upload_result['is_csv'] : '';
|
1643 |
+
|
1644 |
}
|
1645 |
+
else{
|
1646 |
+
$this->errors->add('form-validation', __('Root element not found for uploaded feed.', 'pmxi_plugin'));
|
1647 |
+
}
|
1648 |
+
|
1649 |
}
|
1650 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1651 |
}
|
1652 |
|
1653 |
$this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, $this->data['import']);
|
1654 |
|
1655 |
+
if ( ! $this->errors->get_error_codes()) { // no validation errors found
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1656 |
|
1657 |
+
// Attributes fields logic
|
1658 |
+
$post = apply_filters('pmxi_save_options', $post);
|
1659 |
+
|
1660 |
if ($this->isWizard) {
|
|
|
1661 |
|
1662 |
+
PMXI_Plugin::$session->set('options', $post);
|
1663 |
+
|
1664 |
+
PMXI_Plugin::$session->save_data();
|
1665 |
+
|
1666 |
+
// update import template with final settings
|
1667 |
+
if ( PMXI_Plugin::$session->saved_template ){
|
1668 |
+
$template = new PMXI_Template_Record();
|
1669 |
+
$template->getById(PMXI_Plugin::$session->saved_template)->set(array(
|
1670 |
+
'options' => $post
|
1671 |
+
))->save();
|
1672 |
+
}
|
1673 |
|
1674 |
if ( ! $this->input->post('save_only')) {
|
1675 |
+
wp_redirect(add_query_arg('action', 'confirm', $this->baseUrl)); die();
|
1676 |
} else {
|
1677 |
$import = $this->data['update_previous'];
|
1678 |
$is_update = ! $import->isEmpty();
|
1679 |
$import->set(
|
1680 |
+
PMXI_Plugin::$session->source
|
1681 |
+ array(
|
1682 |
+
'xpath' => PMXI_Plugin::$session->xpath,
|
1683 |
+
'options' => PMXI_Plugin::$session->options,
|
1684 |
+
'count' => PMXI_Plugin::$session->count,
|
1685 |
+
'friendly_name' => $this->data['post']['friendly_name'],
|
|
|
|
|
1686 |
)
|
1687 |
)->save();
|
1688 |
|
1690 |
$history_file->set(array(
|
1691 |
'name' => $import->name,
|
1692 |
'import_id' => $import->id,
|
1693 |
+
'path' => PMXI_Plugin::$session->filePath,
|
1694 |
+
//'contents' => $this->get_xml(),
|
1695 |
'registered_on' => date('Y-m-d H:i:s'),
|
1696 |
))->save();
|
1697 |
|
1698 |
+
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode($is_update ? __('Import updated', 'pmxi_plugin') : __('Import created', 'pmxi_plugin'))), admin_url('admin.php'))); die();
|
|
|
|
|
1699 |
}
|
1700 |
+
|
1701 |
} else {
|
1702 |
|
1703 |
+
$xpath = $this->input->post('xpath');
|
1704 |
+
|
1705 |
+
$toUpdate = array(
|
1706 |
+
'friendly_name' => $this->data['post']['friendly_name'],
|
1707 |
+
'xpath' => $this->input->post('xpath'),
|
1708 |
+
'settings_update_on' => date('Y-m-d H:i:s')
|
1709 |
+
);
|
1710 |
+
|
1711 |
+
// detecting root element
|
1712 |
+
if ( $xpath != $this->data['import']->xpath ){
|
1713 |
+
$xpath_elements = explode('[', $xpath);
|
1714 |
+
$xpath_parts = explode('/', $xpath_elements[0]);
|
1715 |
+
$toUpdate['root_element'] = $xpath_parts[1];
|
1716 |
+
}
|
1717 |
+
|
1718 |
+
$this->data['import']->set('options', $post)->set( $toUpdate )->save();
|
1719 |
+
|
1720 |
+
// set new import file
|
1721 |
+
|
1722 |
+
switch ($this->input->post('new_type')){
|
1723 |
+
case 'upload':
|
1724 |
+
$filePath = $this->input->post('filepath');
|
1725 |
+
$source = array(
|
1726 |
+
'name' => basename($filePath),
|
1727 |
+
'type' => 'upload',
|
1728 |
+
'path' => $filePath,
|
1729 |
+
);
|
1730 |
+
break;
|
1731 |
+
case 'url':
|
1732 |
+
$filePath = $this->input->post('url');
|
1733 |
+
$source = array(
|
1734 |
+
'name' => basename(parse_url($filePath, PHP_URL_PATH)),
|
1735 |
+
'type' => 'url',
|
1736 |
+
'path' => $filePath,
|
1737 |
+
);
|
1738 |
+
break;
|
1739 |
+
case 'file':
|
1740 |
+
$wp_uploads = wp_upload_dir();
|
1741 |
+
$filePath = $this->input->post('file');
|
1742 |
+
$source = array(
|
1743 |
+
'name' => basename($filePath),
|
1744 |
+
'type' => 'file',
|
1745 |
+
'path' => $wp_uploads['basedir'] . '/wpallimport/files/' . $filePath,
|
1746 |
+
);
|
1747 |
+
break;
|
1748 |
+
/*case 'ftp':
|
1749 |
+
$ftp = $this->input->post('ftp');
|
1750 |
+
$filePath = preg_replace('%://([^@/]*@)?%', '://' . rawurlencode($ftp['user']) . ':' . rawurlencode($ftp['pass']) . '@', $ftp['url'], 1);
|
1751 |
+
$source = array(
|
1752 |
+
'name' => basename($filePath),
|
1753 |
+
'type' => 'ftp',
|
1754 |
+
'path' => $filePath,
|
1755 |
+
);
|
1756 |
+
break;*/
|
1757 |
+
}
|
1758 |
+
|
1759 |
+
// unlick previous files
|
1760 |
+
$history = new PMXI_File_List();
|
1761 |
+
$history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $this->data['import']->id), 'id DESC');
|
1762 |
+
if ($history->count()){
|
1763 |
+
foreach ($history as $file){
|
1764 |
+
if ( @file_exists($file['path']) and $file['path'] != $upload_result['filePath'] ){
|
1765 |
+
if (in_array($this->data['import']->type, array('upload')))
|
1766 |
+
pmxi_remove_source($file['path'], false);
|
1767 |
+
else
|
1768 |
+
pmxi_remove_source($file['path']);
|
1769 |
+
}
|
1770 |
+
$history_file = new PMXI_File_Record();
|
1771 |
+
$history_file->getBy('id', $file['id']);
|
1772 |
+
if ( ! $history_file->isEmpty()) $history_file->delete();
|
1773 |
+
}
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
$history_file = new PMXI_File_Record();
|
1777 |
+
$history_file->set(array(
|
1778 |
+
'name' => $this->data['import']->name,
|
1779 |
+
'import_id' => $this->data['import']->id,
|
1780 |
+
'path' => $upload_result['filePath'],
|
1781 |
+
//'contents' => $this->get_xml(),
|
1782 |
+
'registered_on' => date('Y-m-d H:i:s')
|
1783 |
+
))->save();
|
1784 |
|
1785 |
+
if ( ! $this->warnings->get_error_codes()) {
|
1786 |
+
|
1787 |
+
$this->data['import']->set($source)->save();
|
1788 |
+
|
1789 |
+
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Configuration updated', 'pmxi_plugin'))) + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)), admin_url('admin.php'))); die();
|
1790 |
+
}
|
1791 |
+
else{
|
1792 |
+
|
1793 |
+
$source['root_element'] = $upload_result['root_element'];
|
1794 |
+
|
1795 |
+
PMXI_Plugin::$session->set('source', $source);
|
1796 |
+
|
1797 |
+
$this->data['import']->set( array_merge($source, array('xpath' => '/' . $upload_result['root_element'])) )->save();
|
1798 |
+
|
1799 |
+
}
|
1800 |
}
|
1801 |
}
|
1802 |
}
|
1803 |
+
|
1804 |
+
PMXI_Plugin::$session->save_data();
|
1805 |
|
1806 |
+
$this->data['existing_meta_keys'] = array();
|
1807 |
+
|
1808 |
+
if ( ! in_array($post['custom_type'], array('import_users'))){
|
1809 |
+
|
1810 |
+
global $wpdb;
|
1811 |
+
|
1812 |
+
// Get all meta keys for requested post type
|
1813 |
+
$hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
|
1814 |
+
$records = get_posts( array('post_type' => $post['custom_type']) );
|
1815 |
+
if ( ! empty($records)){
|
1816 |
+
foreach ($records as $record) {
|
1817 |
+
$record_meta = get_post_meta($record->ID, '');
|
1818 |
+
if ( ! empty($record_meta)){
|
1819 |
+
foreach ($record_meta as $record_meta_key => $record_meta_value) {
|
1820 |
+
if ( ! in_array($record_meta_key, $this->data['existing_meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['existing_meta_keys'][] = $record_meta_key;
|
1821 |
+
}
|
1822 |
+
}
|
1823 |
+
}
|
1824 |
+
}
|
1825 |
|
1826 |
+
// Get existing product attributes
|
1827 |
+
$existing_attributes = $wpdb->get_results("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = '_product_attributes' LIMIT 0 , 50" );
|
1828 |
+
$this->data['existing_attributes'] = array();
|
1829 |
+
if ( ! empty($existing_attributes)){
|
1830 |
+
foreach ($existing_attributes as $key => $existing_attribute) {
|
1831 |
+
$existing_attribute = maybe_unserialize($existing_attribute->meta_value);
|
1832 |
+
if (!empty($existing_attribute) and is_array($existing_attribute)):
|
1833 |
+
foreach ($existing_attribute as $key => $value) {
|
1834 |
+
if (strpos($key, "pa_") === false and ! in_array($key, $this->data['existing_attributes'])) $this->data['existing_attributes'][] = $key;
|
1835 |
+
}
|
1836 |
+
endif;
|
1837 |
+
}
|
1838 |
+
}
|
1839 |
+
}
|
1840 |
|
1841 |
$this->render();
|
1842 |
}
|
1843 |
|
1844 |
+
/**
|
1845 |
+
* Step #5: Confirm & Run Import
|
1846 |
+
*/
|
1847 |
+
public function confirm(){
|
1848 |
+
|
1849 |
+
$default = PMXI_Plugin::get_default_import_options();
|
1850 |
+
|
1851 |
+
$this->data['source'] = PMXI_Plugin::$session->source;
|
1852 |
+
$this->data['locfilePath'] = PMXI_Plugin::$session->filePath;
|
1853 |
+
$this->data['count'] = PMXI_Plugin::$session->count;
|
1854 |
+
$this->data['xpath'] = PMXI_Plugin::$session->xpath;
|
1855 |
+
$this->data['isWizard'] = true;
|
1856 |
+
$DefaultOptions = (isset(PMXI_Plugin::$session->options) ? PMXI_Plugin::$session->options : array()) + $default;
|
1857 |
+
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1858 |
+
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1859 |
+
}
|
1860 |
+
|
1861 |
+
if ($this->isWizard){
|
1862 |
+
if (empty(PMXI_Plugin::$session->options['title']))
|
1863 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1864 |
+
if (empty(PMXI_Plugin::$session->options['content']))
|
1865 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1866 |
+
if ((!empty(PMXI_Plugin::$session->options['featured_image']) or !empty(PMXI_Plugin::$session->options['download_featured_image'])) and ( PMXI_Plugin::$session->options['custom_type'] != 'product' or ! class_exists('PMWI_Plugin')))
|
1867 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=images" target="_blank">upgrade to the professional edition of WP All Import</a> to import images. The settings you configured in the images section will be ignored.'));
|
1868 |
+
if (!empty(PMXI_Plugin::$session->options['custom_name']) and !empty(PMXI_Plugin::$session->options['custom_value']))
|
1869 |
+
$this->warnings->add('form-validation', __('<strong>Warning:</strong> You must <a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=custom-fields" target="_blank">upgrade to the professional edition of WP All Import</a> to import data to Custom Fields. The settings you configured in the Custom Fields section will be ignored.'));
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
$this->data['post'] =& $DefaultOptions;
|
1873 |
+
|
1874 |
+
if ($this->input->post('is_confirmed')) {
|
1875 |
+
|
1876 |
+
check_admin_referer('confirm', '_wpnonce_confirm');
|
1877 |
+
|
1878 |
+
$continue = $this->input->post('is_continue', 'no');
|
1879 |
+
|
1880 |
+
if ($continue == 'yes'){
|
1881 |
+
PMXI_Plugin::$session->set('action', 'continue');
|
1882 |
+
PMXI_Plugin::$session->save_data();
|
1883 |
+
}
|
1884 |
+
|
1885 |
+
if ( ! $this->errors->get_error_codes()) { // no validation errors found
|
1886 |
+
wp_redirect(add_query_arg('action', 'process', $this->baseUrl)); die();
|
1887 |
+
}
|
1888 |
+
|
1889 |
+
}
|
1890 |
+
|
1891 |
+
$this->render();
|
1892 |
+
}
|
1893 |
+
|
1894 |
/**
|
1895 |
* Import processing step (status console)
|
1896 |
*/
|
1899 |
|
1900 |
$wp_uploads = wp_upload_dir();
|
1901 |
|
1902 |
+
$import = $this->data['update_previous'];
|
1903 |
+
|
1904 |
+
$history_log = new PMXI_History_Record();
|
1905 |
|
1906 |
+
$input = new PMXI_Input();
|
1907 |
|
1908 |
+
if ( ! empty(PMXI_Plugin::$session->history_id) ) $history_log->getById(PMXI_Plugin::$session->history_id);
|
1909 |
+
|
1910 |
+
$log_storage = (int) PMXI_Plugin::getInstance()->getOption('log_storage');
|
1911 |
+
|
1912 |
+
if ( ! PMXI_Plugin::is_ajax() ) {
|
1913 |
+
|
1914 |
$import->set(
|
1915 |
+
(empty(PMXI_Plugin::$session->source) ? array() : PMXI_Plugin::$session->source)
|
1916 |
+ array(
|
1917 |
+
'xpath' => PMXI_Plugin::$session->xpath,
|
1918 |
+
'options' => PMXI_Plugin::$session->options,
|
1919 |
+
'count' => PMXI_Plugin::$session->count,
|
1920 |
+
'friendly_name' => PMXI_Plugin::$session->options['friendly_name'],
|
1921 |
+
'feed_type' => PMXI_Plugin::$session->feed_type,
|
1922 |
+
'parent_import_id' => ($this->data['update_previous']->isEmpty()) ? PMXI_Plugin::$session->parent_import_id : $this->data['update_previous']->parent_import_id,
|
|
|
1923 |
'queue_chunk_number' => 0,
|
1924 |
'triggered' => 0,
|
1925 |
'processing' => 0,
|
1926 |
+
'executing' => 1,
|
1927 |
'iteration' => ( ! empty($import->iteration) ) ? $import->iteration : 0
|
1928 |
)
|
1929 |
)->save();
|
1930 |
|
1931 |
+
if ( PMXI_Plugin::$session->action != 'continue' ){
|
1932 |
// store import info in database
|
1933 |
$import->set(array(
|
1934 |
'imported' => 0,
|
1935 |
'created' => 0,
|
1936 |
'updated' => 0,
|
1937 |
+
'skipped' => 0,
|
1938 |
+
'deleted' => 0
|
1939 |
+
))->update();
|
1940 |
}
|
1941 |
|
1942 |
+
// add history log
|
1943 |
+
$custom_type = get_post_type_object( $import->options['custom_type'] );
|
1944 |
+
|
1945 |
+
// unlink previous logs
|
1946 |
+
$by = array();
|
1947 |
+
$by[] = array(array('import_id' => $import->id, 'type NOT LIKE' => 'trigger'), 'AND');
|
1948 |
+
$historyLogs = new PMXI_History_List();
|
1949 |
+
$historyLogs->setColumns('id', 'import_id', 'type', 'date')->getBy($by, 'id ASC');
|
1950 |
+
if ($historyLogs->count() and $historyLogs->count() >= $log_storage ){
|
1951 |
+
$logsToRemove = $historyLogs->count() - $log_storage;
|
1952 |
+
foreach ($historyLogs as $i => $file){
|
1953 |
+
$historyRecord = new PMXI_History_Record();
|
1954 |
+
$historyRecord->getBy('id', $file['id']);
|
1955 |
+
if ( ! $historyRecord->isEmpty()) $historyRecord->delete( false ); // unlink history file only
|
1956 |
+
if ($i == $logsToRemove)
|
1957 |
+
break;
|
1958 |
+
}
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
$history_log->set(array(
|
1962 |
+
'import_id' => $import->id,
|
1963 |
+
'date' => date('Y-m-d H:i:s'),
|
1964 |
+
'type' => ( PMXI_Plugin::$session->action != 'continue' ) ? 'manual' : 'continue',
|
1965 |
+
'summary' => sprintf(__("%d %ss created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, $custom_type->labels->singular_name, $import->updated, $import->deleted, $import->skipped)
|
1966 |
+
))->save();
|
1967 |
+
|
1968 |
+
PMXI_Plugin::$session->set('history_id', $history_log->id);
|
1969 |
+
|
1970 |
foreach ( get_taxonomies() as $tax )
|
1971 |
delete_transient("pmxi_{$tax}_terms");
|
1972 |
|
1973 |
do_action( 'pmxi_before_xml_import', $import->id );
|
1974 |
|
1975 |
+
PMXI_Plugin::$session->set('update_previous', $import->id);
|
1976 |
|
1977 |
+
// unlink previous files
|
1978 |
$history = new PMXI_File_List();
|
1979 |
$history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $import->id), 'id DESC');
|
1980 |
if ($history->count()){
|
1981 |
foreach ($history as $file){
|
1982 |
+
if ( @file_exists($file['path']) and $file['path'] != PMXI_Plugin::$session->filePath ){
|
1983 |
+
if (in_array($import->type, array('upload')))
|
1984 |
+
pmxi_remove_source($file['path'], false);
|
1985 |
+
else
|
1986 |
+
pmxi_remove_source($file['path']);
|
1987 |
+
}
|
1988 |
$history_file = new PMXI_File_Record();
|
1989 |
$history_file->getBy('id', $file['id']);
|
1990 |
if ( ! $history_file->isEmpty()) $history_file->delete();
|
1996 |
$history_file->set(array(
|
1997 |
'name' => $import->name,
|
1998 |
'import_id' => $import->id,
|
1999 |
+
'path' => PMXI_Plugin::$session->filePath,
|
2000 |
+
//'contents' => $this->get_xml(),
|
2001 |
'registered_on' => date('Y-m-d H:i:s')
|
2002 |
))->save();
|
2003 |
}
|
2013 |
|
2014 |
$chunk_files = array();
|
2015 |
|
2016 |
+
if ( ! empty(PMXI_Plugin::$session->local_paths)){
|
2017 |
|
2018 |
$records_count = 0;
|
2019 |
$chunk_records_count = 0;
|
2020 |
|
2021 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
2022 |
|
2023 |
+
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
2024 |
|
2025 |
$file = new PMXI_Chunk($path, array('element' => $import->root_element, 'encoding' => $import->options['encoding']));
|
2026 |
|
2047 |
|
2048 |
if ( $chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count ){
|
2049 |
$feed .= "</pmxi_records>";
|
2050 |
+
$chunk_file_path = pmxi_secure_file($wp_uploads['basedir'] . "/wpallimport/temp", 'temp') . "/pmxi_chunk_" . count($chunk_files) . "_" . basename($path);
|
2051 |
file_put_contents($chunk_file_path, $feed);
|
2052 |
$chunk_files[] = $chunk_file_path;
|
2053 |
$chunk_records_count = 0;
|
2055 |
}
|
2056 |
}
|
2057 |
}
|
2058 |
+
PMXI_Plugin::$session->set('local_paths', $chunk_files);
|
2059 |
}
|
2060 |
}
|
2061 |
|
2062 |
+
PMXI_Plugin::$session->save_data();
|
2063 |
|
2064 |
+
if ( $log_storage ){
|
2065 |
+
$log_file = pmxi_secure_file( $wp_uploads['basedir'] . "/wpallimport/logs", 'logs', $history_log->id ) . '/' . $history_log->id . '.html';
|
2066 |
+
if ( PMXI_Plugin::$session->action != 'continue' and file_exists($log_file)){
|
2067 |
+
pmxi_remove_source($log_file, false);
|
2068 |
+
}
|
2069 |
+
}
|
2070 |
+
|
2071 |
+
$this->data['ajax_processing'] = ("ajax" == $import->options['import_processing']) ? true : false;
|
2072 |
|
2073 |
$this->render();
|
2074 |
wp_ob_end_flush_all(); flush();
|
2075 |
+
@set_time_limit(0);
|
2076 |
+
|
2077 |
+
$import_id = $input->get('id', 0);
|
2078 |
|
2079 |
+
if ( "ajax" == $import->options['import_processing'] and ! $import_id){
|
2080 |
+
PMXI_Plugin::$session->convertData($import->id);
|
2081 |
+
//die();
|
2082 |
+
}
|
2083 |
}
|
2084 |
+
elseif (empty($import->id))
|
2085 |
+
{
|
2086 |
+
$import = new PMXI_Import_Record();
|
2087 |
+
$import_id = $input->get('id', PMXI_Plugin::$session->update_previous);
|
2088 |
+
$import->getById($import_id);
|
2089 |
}
|
2090 |
+
|
2091 |
$ajax_processing = ("ajax" == $import->options['import_processing']) ? true : false;
|
2092 |
|
2093 |
+
if ($ajax_processing)
|
2094 |
{
|
2095 |
+
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; flush();');
|
2096 |
}
|
2097 |
else
|
2098 |
{
|
2099 |
+
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; if ( "" != strip_tags(pmxi_strip_tags_content($m))) { PMXI_Plugin::$session->log .= "<p>".strip_tags(pmxi_strip_tags_content($m))."</p>"; flush(); }');
|
2100 |
}
|
2101 |
|
2102 |
+
PMXI_Plugin::$session->set('start_time', (empty(PMXI_Plugin::$session->start_time)) ? time() : PMXI_Plugin::$session->start_time);
|
2103 |
|
2104 |
wp_cache_flush();
|
2105 |
|
2106 |
+
if ( PMXI_Plugin::is_ajax() or ! $ajax_processing ) {
|
2107 |
|
2108 |
+
$iteration_start_time = time();
|
2109 |
+
|
2110 |
+
if ( $log_storage )
|
2111 |
+
$log_file = pmxi_secure_file( $wp_uploads['basedir'] . "/wpallimport/logs", 'logs', $history_log->id ) . '/' . $history_log->id . '.html';
|
2112 |
|
2113 |
+
if ( $ajax_processing ) {
|
2114 |
// HTTP headers for no cache etc
|
2115 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
2116 |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
2134 |
}
|
2135 |
|
2136 |
$records_to_import = (empty($records)) ? $import->count : $records[count($records) -1];
|
2137 |
+
|
2138 |
+
$failures = $input->get('failures', 0);
|
2139 |
+
|
2140 |
+
// auto decrease records per iteration option
|
2141 |
+
if ( $failures ){
|
2142 |
+
$options = $import->options;
|
2143 |
+
$options['records_per_request'] = (ceil($options['records_per_request']/2)) ? ceil($options['records_per_request']/2) : 1;
|
2144 |
+
$import->set(array('options' => $options))->update();
|
2145 |
+
}
|
2146 |
|
2147 |
$records_per_request = ( ! $ajax_processing and $import->options['records_per_request'] < 50 ) ? 50 : $import->options['records_per_request'];
|
2148 |
|
2149 |
+
if ( ! empty(PMXI_Plugin::$session->local_paths) ) {
|
2150 |
|
2151 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
2152 |
|
2153 |
+
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
2154 |
|
2155 |
+
$import_done = ($import->imported + $import->skipped + PMXI_Plugin::$session->errors == $records_to_import ) ? true : false;
|
2156 |
|
2157 |
if ( $import_done ) {
|
2158 |
+
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path)) pmxi_remove_source($path, false);
|
2159 |
+
PMXI_Plugin::$session->set('local_paths', array());
|
2160 |
+
PMXI_Plugin::$session->save_data();
|
2161 |
break;
|
2162 |
+
}
|
2163 |
+
|
2164 |
+
$file = new PMXI_Chunk($path, array('element' => $import->root_element, 'encoding' => $import->options['encoding'], 'pointer' => PMXI_Plugin::$session->pointer));
|
2165 |
+
|
2166 |
// loop through the file until all lines are read
|
2167 |
+
while ($xml = $file->read() and empty($import->canceled) ) {
|
2168 |
|
2169 |
if ( ! empty($xml) )
|
2170 |
{
|
2180 |
$pointer++;
|
2181 |
|
2182 |
if (($this->data['elements'] = $elements = @$xpath->query($import->xpath)) and $elements->length){
|
2183 |
+
|
2184 |
+
/* Merge nested XML/CSV files */
|
2185 |
+
/*$nested_files = json_decode($import->options['nested_files'], true);
|
2186 |
+
if ( ! empty($nested_files) and is_array($nested_files)){
|
2187 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, $import->xpath, $elements);
|
2188 |
+
$merger->merge();
|
2189 |
+
$xml = $merger->get_xml();
|
2190 |
+
unset($merger);
|
2191 |
+
} */
|
2192 |
+
|
2193 |
// continue action
|
2194 |
+
if ( $import->imported + $import->skipped >= PMXI_Plugin::$session->chunk_number + $elements->length - 1 ){
|
2195 |
+
PMXI_Plugin::$session->set('chunk_number', PMXI_Plugin::$session->chunk_number + $elements->length);
|
2196 |
+
PMXI_Plugin::$session->save_data();
|
2197 |
continue;
|
2198 |
+
}
|
2199 |
|
2200 |
if ( ! $loop and $ajax_processing ) ob_start();
|
2201 |
|
2202 |
$feed .= $xml; $loop += $elements->length;
|
2203 |
|
2204 |
+
$processed_records = $import->imported + $import->skipped + PMXI_Plugin::$session->errors;
|
2205 |
|
2206 |
if ( $loop == $records_per_request or $processed_records + $loop == $records_to_import or $processed_records == $records_to_import) {
|
2207 |
|
2208 |
+
$feed .= "</pmxi_records>";
|
2209 |
+
$import->process($feed, $logger, PMXI_Plugin::$session->chunk_number, false, '/pmxi_records', $loop);
|
2210 |
unset($dom, $xpath);
|
2211 |
|
2212 |
if ( ! $ajax_processing ){
|
2213 |
$feed = "<?xml version=\"1.0\" encoding=\"". $import->options['encoding'] ."\"?>" . "\n" . "<pmxi_records>";
|
2214 |
$loop = 0;
|
2215 |
} else {
|
2216 |
+
|
2217 |
+
if ( ! $history_log->isEmpty()){
|
2218 |
+
$custom_type = get_post_type_object( $import->options['custom_type'] );
|
2219 |
+
$history_log->set(array(
|
2220 |
+
'time_run' => time() - strtotime($history_log->date),
|
2221 |
+
'summary' => sprintf(__("%d %ss created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, $custom_type->labels->singular_name, $import->updated, $import->deleted, $import->skipped)
|
2222 |
+
))->update();
|
2223 |
+
}
|
2224 |
+
|
2225 |
unset($file);
|
2226 |
+
PMXI_Plugin::$session->set('pointer', PMXI_Plugin::$session->pointer + $pointer);
|
2227 |
+
PMXI_Plugin::$session->save_data();
|
2228 |
|
2229 |
$log_data = ob_get_clean();
|
2230 |
+
|
2231 |
+
if ( $log_storage ){
|
2232 |
+
$log = @fopen($log_file, 'a+');
|
2233 |
+
@fwrite($log, $log_data);
|
2234 |
+
@fclose($log);
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
$iteration_execution_time = time() - $iteration_start_time;
|
2238 |
|
2239 |
wp_send_json(array(
|
2240 |
'created' => $import->created,
|
2241 |
'updated' => $import->updated,
|
2242 |
'percentage' => ceil(($processed_records/$import->count) * 100),
|
2243 |
+
'warnings' => PMXI_Plugin::$session->warnings,
|
2244 |
+
'errors' => PMXI_Plugin::$session->errors,
|
2245 |
'log' => $log_data,
|
2246 |
+
'done' => false,
|
2247 |
+
'records_per_request' => $import->options['records_per_request']
|
2248 |
+
));
|
2249 |
}
|
2250 |
}
|
2251 |
}
|
2257 |
|
2258 |
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path)) @unlink($path);
|
2259 |
|
2260 |
+
PMXI_Plugin::$session->set('pointer', 1);
|
2261 |
$pointer = 0;
|
2262 |
+
$lp = PMXI_Plugin::$session->local_paths;
|
2263 |
+
array_shift($lp);
|
2264 |
+
PMXI_Plugin::$session->set('local_paths', $lp);
|
2265 |
+
PMXI_Plugin::$session->save_data();
|
2266 |
}
|
2267 |
else break;
|
2268 |
}
|
2269 |
+
}
|
2270 |
}
|
2271 |
|
2272 |
+
if ( ( PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->local_paths) ) or ! $ajax_processing or ! empty($import->canceled) ) {
|
2273 |
|
2274 |
+
do_action( 'pmxi_after_xml_import', $import->id );
|
2275 |
|
2276 |
+
if ("ajax" != $import->options['import_processing'] and $log_storage ){
|
2277 |
+
$log_file = pmxi_secure_file( $wp_uploads['basedir'] . "/wpallimport/logs", 'logs', $history_log->id ) . '/' . $history_log->id . '.html';
|
2278 |
+
if (PMXI_Plugin::$session->action != 'continue'){
|
2279 |
+
@file_put_contents($log_file, PMXI_Plugin::$session->log);
|
2280 |
}
|
2281 |
else{
|
2282 |
$log = @fopen($log_file, 'a+');
|
2283 |
+
@fwrite($log, PMXI_Plugin::$session->log);
|
2284 |
@fclose($log);
|
2285 |
}
|
2286 |
}
|
2287 |
+
|
2288 |
wp_cache_flush();
|
2289 |
foreach ( get_taxonomies() as $tax ) {
|
2290 |
delete_option( "{$tax}_children" );
|
2291 |
_get_term_hierarchy( $tax );
|
2292 |
}
|
2293 |
|
2294 |
+
$import->set(array(
|
2295 |
+
'registered_on' => date('Y-m-d H:i:s'),
|
2296 |
+
'executing' => 0
|
2297 |
+
))->update();
|
2298 |
+
|
2299 |
+
// add history log
|
2300 |
+
$custom_type = get_post_type_object( $import->options['custom_type'] );
|
2301 |
+
$history_log->set(array(
|
2302 |
+
'time_run' => time() - strtotime($history_log->date),
|
2303 |
+
'summary' => sprintf(__("%d %ss created %d updated %d deleted %d skipped", "pmxi_plugin"), $import->created, $custom_type->labels->singular_name, $import->updated, $import->deleted, $import->skipped)
|
2304 |
+
))->update();
|
2305 |
|
2306 |
// clear import session
|
2307 |
+
PMXI_Plugin::$session->clean_session($import->id); // clear session data (prevent from reimporting the same data on page refresh)
|
2308 |
|
2309 |
// [indicate in header process is complete]
|
2310 |
+
$msg = ( ! empty($import->canceled) ) ? addcslashes(__('Canceled', 'pmxi_plugin'), "\n\r") : addcslashes(__('Complete', 'pmxi_plugin'), "\n\r");
|
2311 |
|
2312 |
if ( $ajax_processing ) ob_start();
|
2313 |
|
2317 |
<script type="text/javascript">
|
2318 |
//<![CDATA[
|
2319 |
(function($){
|
2320 |
+
$('#status').html('$msg');
|
|
|
2321 |
window.onbeforeunload = false;
|
2322 |
})(jQuery);
|
2323 |
//]]>
|
2331 |
'created' => $import->created,
|
2332 |
'updated' => $import->updated,
|
2333 |
'percentage' => 100,
|
2334 |
+
'warnings' => PMXI_Plugin::$session->warnings,
|
2335 |
+
'errors' => PMXI_Plugin::$session->errors,
|
2336 |
'log' => ob_get_clean(),
|
2337 |
+
'done' => true,
|
2338 |
+
'records_per_request' => $import->options['records_per_request']
|
2339 |
));
|
2340 |
|
2341 |
}
|
2342 |
+
}
|
2343 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2345 |
protected $_unique_key = array();
|
2346 |
protected function find_unique_key(DOMElement $el){
|
2347 |
if ($el->hasChildNodes()) {
|
2354 |
}
|
2355 |
}
|
2356 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2357 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2358 |
|
2359 |
+
protected function get_xml( $tagno = 0 ){
|
2360 |
+
$xml = '';
|
|
|
|
|
2361 |
$update_previous = new PMXI_Import_Record();
|
2362 |
|
2363 |
+
if ( ! empty(PMXI_Plugin::$session->update_previous) ) $update_previous->getById(PMXI_Plugin::$session->update_previous);
|
|
|
|
|
2364 |
|
2365 |
+
$local_paths = (empty(PMXI_Plugin::$session->local_paths)) ? array() : PMXI_Plugin::$session->local_paths;
|
2366 |
+
|
2367 |
+
if ( empty($local_paths) and ! $update_previous->isEmpty() ){
|
2368 |
$history_file = new PMXI_File_Record();
|
2369 |
+
$history_file->getBy( array('import_id' => $update_previous->id), 'id DESC' );
|
2370 |
+
$local_paths = ( ! $history_file->isEmpty() ) ? array($history_file->path) : array();
|
2371 |
+
}
|
2372 |
+
|
2373 |
+
if ( ! empty($local_paths)) {
|
2374 |
+
|
2375 |
+
$loop = 0;
|
2376 |
|
2377 |
+
foreach ( $local_paths as $key => $path ) {
|
2378 |
+
|
2379 |
+
if ( @file_exists($path) ){
|
2380 |
|
2381 |
+
$root_element = ( ! $update_previous->isEmpty() ) ? $update_previous->root_element : PMXI_Plugin::$session->source['root_element'];
|
2382 |
|
2383 |
+
$file = new PMXI_Chunk($path, array('element' => $root_element, 'encoding' => PMXI_Plugin::$session->encoding) );
|
2384 |
+
|
2385 |
+
while ($xml = $file->read()) {
|
2386 |
+
|
2387 |
+
if ( ! empty($xml) ) {
|
2388 |
|
|
|
|
|
2389 |
PMXI_Import_Record::preprocessXml($xml);
|
2390 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". PMXI_Plugin::$session->encoding ."\"?>" . "\n" . $xml;
|
2391 |
|
2392 |
+
if ( PMXI_Plugin::$session->xpath ){
|
2393 |
+
$dom = new DOMDocument( '1.0', PMXI_Plugin::$session->encoding );
|
2394 |
$old = libxml_use_internal_errors(true);
|
2395 |
$dom->loadXML($xml);
|
2396 |
libxml_use_internal_errors($old);
|
2397 |
$xpath = new DOMXPath($dom);
|
2398 |
+
if (($elements = $xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
2399 |
$this->data['dom'] = $dom;
|
2400 |
$loop++;
|
2401 |
if ( ! $tagno or $loop == $tagno ) break;
|
2402 |
+
}
|
2403 |
}
|
2404 |
else break;
|
2405 |
}
|
2406 |
}
|
2407 |
unset($file);
|
|
|
2408 |
}
|
2409 |
}
|
2410 |
}
|
controllers/admin/license.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin License page
|
4 |
+
*
|
5 |
+
* @author Max Tsiplyakov <makstsiplyakov@gmail.com>
|
6 |
+
*/
|
7 |
+
class PMXI_Admin_License extends PMXI_Controller_Admin {
|
8 |
+
|
9 |
+
public function index() {
|
10 |
+
|
11 |
+
$this->data['post'] = $post = $this->input->post(PMXI_Plugin::getInstance()->getOption());
|
12 |
+
|
13 |
+
if ($this->input->post('is_licenses_submitted')) { // save settings form
|
14 |
+
|
15 |
+
check_admin_referer('edit-licenses', '_wpnonce_edit-licenses');
|
16 |
+
|
17 |
+
if ( ! $this->errors->get_error_codes()) { // no validation errors detected
|
18 |
+
|
19 |
+
PMXI_Plugin::getInstance()->updateOption($post);
|
20 |
+
|
21 |
+
$this->activate_licenses();
|
22 |
+
|
23 |
+
$this->deactivate_licenses();
|
24 |
+
|
25 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Licenses saved', 'pmxi_plugin')), $this->baseUrl)); die();
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
$addons = new PMXI_Admin_Addons();
|
31 |
+
|
32 |
+
$this->data['addons'] = $addons->get_premium_addons();
|
33 |
+
|
34 |
+
$this->data['addons']['PMXI_Plugin'] = array(
|
35 |
+
'title' => __('WP All Import', 'pmxi_plugin'),
|
36 |
+
'active' => (class_exists('PMXI_Plugin') and defined('PMXI_EDITION') and PMXI_EDITION == 'paid')
|
37 |
+
);
|
38 |
+
|
39 |
+
$this->data['addons'] = array_reverse($this->data['addons']);
|
40 |
+
|
41 |
+
$this->render();
|
42 |
+
}
|
43 |
+
|
44 |
+
/*
|
45 |
+
*
|
46 |
+
* Activate licenses for main plugin and all premium addons
|
47 |
+
*
|
48 |
+
*/
|
49 |
+
protected function activate_licenses() {
|
50 |
+
|
51 |
+
// listen for our activate button to be clicked
|
52 |
+
if( isset( $_POST['pmxi_license_activate'] ) ) {
|
53 |
+
|
54 |
+
// retrieve the license from the database
|
55 |
+
$options = PMXI_Plugin::getInstance()->getOption();
|
56 |
+
|
57 |
+
foreach ($_POST['pmxi_license_activate'] as $class => $val) {
|
58 |
+
|
59 |
+
if (!empty($options['licenses'][$class])){
|
60 |
+
|
61 |
+
$product_name = (method_exists($class, 'getEddName')) ? call_user_func(array($class, 'getEddName')) : false;
|
62 |
+
|
63 |
+
if ( $product_name !== false ){
|
64 |
+
// data to send in our API request
|
65 |
+
$api_params = array(
|
66 |
+
'edd_action'=> 'activate_license',
|
67 |
+
'license' => $options['licenses'][$class],
|
68 |
+
'item_name' => urlencode( $product_name ) // the name of our product in EDD
|
69 |
+
);
|
70 |
+
|
71 |
+
// Call the custom API.
|
72 |
+
$response = wp_remote_get( add_query_arg( $api_params, $options['info_api_url'] ), array( 'timeout' => 15, 'sslverify' => false ) );
|
73 |
+
|
74 |
+
// make sure the response came back okay
|
75 |
+
if ( is_wp_error( $response ) )
|
76 |
+
continue;
|
77 |
+
|
78 |
+
// decode the license data
|
79 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
80 |
+
|
81 |
+
// $license_data->license will be either "active" or "inactive"
|
82 |
+
|
83 |
+
$options['statuses'][$class] = $license_data->license;
|
84 |
+
|
85 |
+
PMXI_Plugin::getInstance()->updateOption($options);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
/*
|
95 |
+
*
|
96 |
+
* Deactivate licenses for main plugin and all premium addons
|
97 |
+
*
|
98 |
+
*/
|
99 |
+
protected function deactivate_licenses(){
|
100 |
+
|
101 |
+
// listen for our activate button to be clicked
|
102 |
+
if( isset( $_POST['pmxi_license_deactivate'] ) ) {
|
103 |
+
|
104 |
+
// retrieve the license from the database
|
105 |
+
$options = PMXI_Plugin::getInstance()->getOption();
|
106 |
+
|
107 |
+
foreach ($_POST['pmxi_license_deactivate'] as $class => $val) {
|
108 |
+
|
109 |
+
if (!empty($options['licenses'][$class])){
|
110 |
+
|
111 |
+
$product_name = (method_exists($class, 'getEddName')) ? call_user_func(array($class, 'getEddName')) : false;
|
112 |
+
|
113 |
+
if ( $product_name !== false ){
|
114 |
+
|
115 |
+
// data to send in our API request
|
116 |
+
$api_params = array(
|
117 |
+
'edd_action'=> 'deactivate_license',
|
118 |
+
'license' => $options['licenses'][$class],
|
119 |
+
'item_name' => urlencode( $product_name ) // the name of our product in EDD
|
120 |
+
);
|
121 |
+
|
122 |
+
// Call the custom API.
|
123 |
+
$response = wp_remote_get( add_query_arg( $api_params, $options['info_api_url'] ), array( 'timeout' => 15, 'sslverify' => false ) );
|
124 |
+
|
125 |
+
// make sure the response came back okay
|
126 |
+
if ( is_wp_error( $response ) )
|
127 |
+
continue;
|
128 |
+
|
129 |
+
// decode the license data
|
130 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
131 |
+
|
132 |
+
// $license_data->license will be either "deactivated" or "failed"
|
133 |
+
if( $license_data->license == 'deactivated' ){
|
134 |
+
|
135 |
+
$options['statuses'][$class] = 'deactivated';
|
136 |
+
|
137 |
+
PMXI_Plugin::getInstance()->updateOption($options);
|
138 |
+
|
139 |
+
}
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/*
|
147 |
+
*
|
148 |
+
* Check plugin's license
|
149 |
+
*
|
150 |
+
*/
|
151 |
+
public static function check_license($class) {
|
152 |
+
|
153 |
+
global $wp_version;
|
154 |
+
|
155 |
+
$options = PMXI_Plugin::getInstance()->getOption();
|
156 |
+
|
157 |
+
if (!empty($options['licenses'][$class])){
|
158 |
+
|
159 |
+
$product_name = (method_exists($class, 'getEddName')) ? call_user_func(array($class, 'getEddName')) : false;
|
160 |
+
|
161 |
+
if ( $product_name !== false ){
|
162 |
+
|
163 |
+
$api_params = array(
|
164 |
+
'edd_action' => 'check_license',
|
165 |
+
'license' => $license,
|
166 |
+
'item_name' => urlencode( $product_name )
|
167 |
+
);
|
168 |
+
|
169 |
+
// Call the custom API.
|
170 |
+
$response = wp_remote_get( add_query_arg( $api_params, $options['info_api_url'] ), array( 'timeout' => 15, 'sslverify' => false ) );
|
171 |
+
|
172 |
+
if ( is_wp_error( $response ) )
|
173 |
+
return false;
|
174 |
+
|
175 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
176 |
+
|
177 |
+
if( $license_data->license == 'valid' ) {
|
178 |
+
return true;
|
179 |
+
// this license is still valid
|
180 |
+
} else {
|
181 |
+
return false;
|
182 |
+
// this license is no longer valid
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
+
return false;
|
188 |
+
|
189 |
+
}
|
190 |
+
}
|
controllers/admin/manage.php
CHANGED
@@ -17,7 +17,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
17 |
/**
|
18 |
* Previous Imports list
|
19 |
*/
|
20 |
-
public function index() {
|
21 |
|
22 |
$get = $this->input->get(array(
|
23 |
's' => '',
|
@@ -54,7 +54,8 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
54 |
'current' => $pagenum,
|
55 |
));
|
56 |
|
57 |
-
pmxi_session_unset();
|
|
|
58 |
|
59 |
$this->render();
|
60 |
}
|
@@ -62,9 +63,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
62 |
/**
|
63 |
* Edit Template
|
64 |
*/
|
65 |
-
public function edit() {
|
66 |
-
|
67 |
-
pmxi_session_unset();
|
68 |
|
69 |
// deligate operation to other controller
|
70 |
$controller = new PMXI_Admin_Import();
|
@@ -75,9 +74,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
75 |
/**
|
76 |
* Edit Options
|
77 |
*/
|
78 |
-
public function options() {
|
79 |
-
|
80 |
-
pmxi_session_unset();
|
81 |
|
82 |
// deligate operation to other controller
|
83 |
$controller = new PMXI_Admin_Import();
|
@@ -98,117 +95,122 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
98 |
|
99 |
$this->render();
|
100 |
}
|
101 |
-
|
102 |
/**
|
103 |
-
*
|
104 |
*/
|
105 |
-
public function
|
|
|
106 |
$id = $this->input->get('id');
|
107 |
-
|
|
|
108 |
|
109 |
-
$
|
110 |
if ( ! $id or $item->getById($id)->isEmpty()) {
|
111 |
wp_redirect($this->baseUrl); die();
|
112 |
-
}
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
-
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
if ( in_array($item->type, array('upload')) ) { // if import type NOT URL
|
127 |
-
|
128 |
-
if (preg_match('%\W(zip)$%i', trim(basename($item->path)))) {
|
129 |
-
|
130 |
-
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/pclzip.lib.php');
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
else {
|
137 |
-
|
138 |
-
$filePath = '';
|
139 |
|
140 |
-
|
141 |
-
foreach ($v_result_list as $unzipped_file) {
|
142 |
-
if ($unzipped_file['status'] == 'ok' and preg_match('%\W(xml|csv|txt|dat|psv)$%i', trim($unzipped_file['stored_filename']))) { $filePath = $unzipped_file['filename']; break; }
|
143 |
-
}
|
144 |
-
}
|
145 |
-
if($uploads['error']){
|
146 |
-
$this->errors->add('form-validation', __('Can not create upload folder. Permision denied', 'pmxi_plugin'));
|
147 |
-
}
|
148 |
|
149 |
-
|
150 |
-
$zip = zip_open(trim($item->path));
|
151 |
-
if (is_resource($zip)) {
|
152 |
-
while ($zip_entry = zip_read($zip)) {
|
153 |
-
$filePath = zip_entry_name($zip_entry);
|
154 |
-
$fp = fopen($uploads['path']."/".$filePath, "w");
|
155 |
-
if (zip_entry_open($zip, $zip_entry, "r")) {
|
156 |
-
$buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
|
157 |
-
fwrite($fp,"$buf");
|
158 |
-
zip_entry_close($zip_entry);
|
159 |
-
fclose($fp);
|
160 |
-
}
|
161 |
-
break;
|
162 |
-
}
|
163 |
-
zip_close($zip);
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
-
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
$csv = new PMXI_CsvParser($filePath, true, '', ( ! empty($item->options['delimiter']) ) ? $item->options['delimiter'] : '', ( ! empty($item->options['encoding']) ) ? $item->options['encoding'] : ''); // create chunks
|
177 |
-
$filePath = $csv->xml_path;
|
178 |
-
}
|
179 |
-
}
|
180 |
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
if ( $fileInfo['type'] == 'csv') { // it is CSV file
|
195 |
-
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
196 |
-
$csv = new PMXI_CsvParser($filePath, true, '', ( ! empty($item->options['delimiter']) ) ? $item->options['delimiter'] : '', ( ! empty($item->options['encoding']) ) ? $item->options['encoding'] : ''); // create chunks
|
197 |
-
$filePath = $csv->xml_path;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
else $this->errors->add('form-validation', $fileInfo->get_error_message());
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
-
|
209 |
|
210 |
-
|
211 |
-
$local_paths = !empty($local_paths) ? $local_paths : array($filePath);
|
212 |
|
213 |
foreach ($local_paths as $key => $path) {
|
214 |
|
@@ -221,7 +223,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
221 |
|
222 |
while ($xml = $file->read()) {
|
223 |
|
224 |
-
if (!empty($xml))
|
225 |
{
|
226 |
PMXI_Import_Record::preprocessXml($xml);
|
227 |
$xml = "<?xml version=\"1.0\" encoding=\"". $item->options['encoding'] ."\"?>" . "\n" . $xml;
|
@@ -246,12 +248,12 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
246 |
|
247 |
}
|
248 |
|
249 |
-
if ( $chunks ) { // xml is valid
|
250 |
|
251 |
-
if ( ! PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->
|
252 |
|
253 |
// compose data to look like result of wizard steps
|
254 |
-
|
255 |
'filePath' => $filePath,
|
256 |
'source' => array(
|
257 |
'name' => $item->name,
|
@@ -262,13 +264,11 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
262 |
'feed_type' => $item->feed_type,
|
263 |
'update_previous' => $item->id,
|
264 |
'parent_import_id' => $item->parent_import_id,
|
265 |
-
'xpath' => $item->xpath,
|
266 |
-
'template' => $item->template,
|
267 |
'options' => $item->options,
|
268 |
'encoding' => (!empty($item->options['encoding'])) ? $item->options['encoding'] : 'UTF-8',
|
269 |
'is_csv' => (!empty($item->options['delimiter'])) ? $item->options['delimiter'] : PMXI_Plugin::$is_csv,
|
270 |
-
'csv_path' => PMXI_Plugin::$csv_path,
|
271 |
-
'scheduled' => $item->scheduled,
|
272 |
'chunk_number' => 1,
|
273 |
'log' => '',
|
274 |
'warnings' => 0,
|
@@ -280,18 +280,25 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
280 |
'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
|
281 |
);
|
282 |
|
283 |
-
|
|
|
|
|
|
|
|
|
284 |
|
285 |
}
|
286 |
|
|
|
|
|
287 |
// deligate operation to other controller
|
288 |
$controller = new PMXI_Admin_Import();
|
289 |
$controller->data['update_previous'] = $item;
|
290 |
$controller->process();
|
291 |
return;
|
292 |
}
|
293 |
-
}
|
294 |
-
|
|
|
295 |
}
|
296 |
|
297 |
/**
|
@@ -343,25 +350,5 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
343 |
|
344 |
$this->render();
|
345 |
}
|
346 |
-
|
347 |
-
/*
|
348 |
-
* Download import log file
|
349 |
-
*
|
350 |
-
*/
|
351 |
-
public function log(){
|
352 |
-
|
353 |
-
$id = $this->input->get('id');
|
354 |
-
|
355 |
-
$wp_uploads = wp_upload_dir();
|
356 |
-
$log_file = $wp_uploads['basedir'] . '/wpallimport_logs/' .$id.'.html';
|
357 |
-
|
358 |
-
if (file_exists($log_file))
|
359 |
-
{
|
360 |
-
PMXI_download::xml($log_file);
|
361 |
-
}
|
362 |
-
else
|
363 |
-
{
|
364 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Log file does not exists.', 'pmxi_plugin')), $this->baseUrl)); die();
|
365 |
-
}
|
366 |
-
}
|
367 |
}
|
17 |
/**
|
18 |
* Previous Imports list
|
19 |
*/
|
20 |
+
public function index() {
|
21 |
|
22 |
$get = $this->input->get(array(
|
23 |
's' => '',
|
54 |
'current' => $pagenum,
|
55 |
));
|
56 |
|
57 |
+
//pmxi_session_unset();
|
58 |
+
PMXI_Plugin::$session->clean_session();
|
59 |
|
60 |
$this->render();
|
61 |
}
|
63 |
/**
|
64 |
* Edit Template
|
65 |
*/
|
66 |
+
public function edit() {
|
|
|
|
|
67 |
|
68 |
// deligate operation to other controller
|
69 |
$controller = new PMXI_Admin_Import();
|
74 |
/**
|
75 |
* Edit Options
|
76 |
*/
|
77 |
+
public function options() {
|
|
|
|
|
78 |
|
79 |
// deligate operation to other controller
|
80 |
$controller = new PMXI_Admin_Import();
|
95 |
|
96 |
$this->render();
|
97 |
}
|
98 |
+
|
99 |
/**
|
100 |
+
* Cancel import processing
|
101 |
*/
|
102 |
+
public function cancel(){
|
103 |
+
|
104 |
$id = $this->input->get('id');
|
105 |
+
|
106 |
+
PMXI_Plugin::$session->clean_session( $id );
|
107 |
|
108 |
+
$item = new PMXI_Import_Record();
|
109 |
if ( ! $id or $item->getById($id)->isEmpty()) {
|
110 |
wp_redirect($this->baseUrl); die();
|
111 |
+
}
|
112 |
+
$item->set(array(
|
113 |
+
'triggered' => 0,
|
114 |
+
'processing' => 0,
|
115 |
+
'executing' => 0,
|
116 |
+
'canceled' => 1,
|
117 |
+
'canceled_on' => date('Y-m-d H:i:s')
|
118 |
+
))->update();
|
119 |
+
|
120 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Import canceled', 'pmxi_plugin')), $this->baseUrl)); die();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Re-run import
|
125 |
+
*/
|
126 |
+
public function update() {
|
127 |
|
128 |
+
$id = $this->input->get('id');
|
129 |
|
130 |
+
PMXI_Plugin::$session->clean_session( $id );
|
131 |
+
|
132 |
+
$action_type = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
+
$this->data['import'] = $item = new PMXI_Import_Record();
|
135 |
+
if ( ! $id or $item->getById($id)->isEmpty()) {
|
136 |
+
wp_redirect($this->baseUrl); die();
|
137 |
+
}
|
|
|
|
|
|
|
138 |
|
139 |
+
$this->data['isWizard'] = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
+
$default = PMXI_Plugin::get_default_import_options();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
+
$DefaultOptions = $item->options + $default;
|
144 |
+
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
145 |
+
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
146 |
+
}
|
147 |
|
148 |
+
$this->data['post'] =& $DefaultOptions;
|
149 |
|
150 |
+
$this->data['source'] = array(
|
151 |
+
'path' => $item->path,
|
152 |
+
'root_element' => $item->root_element
|
153 |
+
);
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
$this->data['xpath'] = $item->xpath;
|
156 |
+
$this->data['count'] = $item->count;
|
157 |
+
|
158 |
+
$history = new PMXI_File_List();
|
159 |
+
$history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $item->id), 'id DESC');
|
160 |
+
if ($history->count()){
|
161 |
+
foreach ($history as $file){
|
162 |
+
if (@file_exists($file['path'])) {
|
163 |
+
$this->data['locfilePath'] = $file['path'];
|
164 |
+
break;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
|
169 |
+
$chunks = 0;
|
170 |
+
|
171 |
+
if ( ($this->input->post('is_confirmed') and check_admin_referer('confirm', '_wpnonce_confirm')) ) {
|
172 |
+
|
173 |
+
$continue = $this->input->post('is_continue', 'no');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
+
// mark action type ad continue
|
176 |
+
if ($continue == 'yes') $action_type = 'continue';
|
177 |
+
|
178 |
+
$filePath = '';
|
179 |
+
|
180 |
+
// upload new file in case when import is not continue
|
181 |
+
if ( empty(PMXI_Plugin::$session->chunk_number) ) {
|
182 |
+
|
183 |
+
if ($item->type == 'url'){ // up to date the file from URL
|
184 |
+
|
185 |
+
$uploader = new PMXI_Upload(trim($item->path), $this->errors);
|
186 |
+
$upload_result = $uploader->url($item->feed_type);
|
187 |
+
if ($upload_result instanceof WP_Error)
|
188 |
+
$this->errors = $upload_result;
|
189 |
+
else
|
190 |
+
$filePath = $upload_result['filePath'];
|
191 |
+
}
|
192 |
+
elseif ( $item->type == 'file' ) { // copy file from /uploads/wpallimport folder
|
193 |
+
|
194 |
+
$uploader = new PMXI_Upload(trim(basename($item->path)), $this->errors);
|
195 |
+
$upload_result = $uploader->file();
|
196 |
+
if ($upload_result instanceof WP_Error)
|
197 |
+
$this->errors = $upload_result;
|
198 |
+
else
|
199 |
+
$filePath = $upload_result['filePath'];
|
200 |
+
}
|
201 |
+
elseif ( ! in_array($item->type, array('ftp'))){ // retrieve already uploaded file
|
202 |
+
|
203 |
+
$uploader = new PMXI_Upload(trim($item->path), $this->errors, rtrim(str_replace(basename($item->path), '', $item->path), '/'));
|
204 |
+
$upload_result = $uploader->upload();
|
205 |
+
if ($upload_result instanceof WP_Error)
|
206 |
+
$this->errors = $upload_result;
|
207 |
+
else
|
208 |
+
$filePath = $upload_result['filePath'];
|
209 |
+
}
|
210 |
|
211 |
+
@set_time_limit(0);
|
212 |
|
213 |
+
$local_paths = ( ! empty($local_paths) ) ? $local_paths : array($filePath);
|
|
|
214 |
|
215 |
foreach ($local_paths as $key => $path) {
|
216 |
|
223 |
|
224 |
while ($xml = $file->read()) {
|
225 |
|
226 |
+
if ( ! empty($xml) )
|
227 |
{
|
228 |
PMXI_Import_Record::preprocessXml($xml);
|
229 |
$xml = "<?xml version=\"1.0\" encoding=\"". $item->options['encoding'] ."\"?>" . "\n" . $xml;
|
248 |
|
249 |
}
|
250 |
|
251 |
+
if ( $chunks ) { // xml is valid
|
252 |
|
253 |
+
if ( ! PMXI_Plugin::is_ajax() and empty(PMXI_Plugin::$session->chunk_number)){
|
254 |
|
255 |
// compose data to look like result of wizard steps
|
256 |
+
$sesson_data = array(
|
257 |
'filePath' => $filePath,
|
258 |
'source' => array(
|
259 |
'name' => $item->name,
|
264 |
'feed_type' => $item->feed_type,
|
265 |
'update_previous' => $item->id,
|
266 |
'parent_import_id' => $item->parent_import_id,
|
267 |
+
'xpath' => $item->xpath,
|
|
|
268 |
'options' => $item->options,
|
269 |
'encoding' => (!empty($item->options['encoding'])) ? $item->options['encoding'] : 'UTF-8',
|
270 |
'is_csv' => (!empty($item->options['delimiter'])) ? $item->options['delimiter'] : PMXI_Plugin::$is_csv,
|
271 |
+
'csv_path' => PMXI_Plugin::$csv_path,
|
|
|
272 |
'chunk_number' => 1,
|
273 |
'log' => '',
|
274 |
'warnings' => 0,
|
280 |
'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
|
281 |
);
|
282 |
|
283 |
+
foreach ($sesson_data as $key => $value) {
|
284 |
+
PMXI_Plugin::$session->set($key, $value);
|
285 |
+
}
|
286 |
+
|
287 |
+
PMXI_Plugin::$session->save_data();
|
288 |
|
289 |
}
|
290 |
|
291 |
+
$item->set(array('canceled' => 0, 'failed' => 0))->update();
|
292 |
+
|
293 |
// deligate operation to other controller
|
294 |
$controller = new PMXI_Admin_Import();
|
295 |
$controller->data['update_previous'] = $item;
|
296 |
$controller->process();
|
297 |
return;
|
298 |
}
|
299 |
+
}
|
300 |
+
|
301 |
+
$this->render('admin/import/confirm');
|
302 |
}
|
303 |
|
304 |
/**
|
350 |
|
351 |
$this->render();
|
352 |
}
|
353 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
}
|
controllers/admin/settings.php
CHANGED
@@ -5,8 +5,41 @@
|
|
5 |
* @author Pavel Kulbakin <p.kulbakin@gmail.com>
|
6 |
*/
|
7 |
class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
public function index() {
|
|
|
10 |
$this->data['post'] = $post = $this->input->post(PMXI_Plugin::getInstance()->getOption());
|
11 |
|
12 |
if ($this->input->post('is_settings_submitted')) { // save settings form
|
@@ -94,10 +127,11 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
94 |
}
|
95 |
|
96 |
$uploads = wp_upload_dir();
|
|
|
97 |
$export_file_name = "templates_".uniqid().".txt";
|
98 |
-
file_put_contents($
|
99 |
|
100 |
-
PMXI_download::csv($
|
101 |
|
102 |
}
|
103 |
}
|
@@ -107,6 +141,34 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
107 |
$this->render();
|
108 |
}
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
public function dismiss(){
|
111 |
|
112 |
PMXI_Plugin::getInstance()->updateOption("dismiss", 1);
|
@@ -128,7 +190,6 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
128 |
exit( json_encode(array('result' => 'OK')) );
|
129 |
}
|
130 |
|
131 |
-
|
132 |
public function meta_values(){
|
133 |
|
134 |
global $wpdb;
|
@@ -141,20 +202,15 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
141 |
WHERE postmeta.meta_key='".$meta_key."'
|
142 |
", ARRAY_A);
|
143 |
|
144 |
-
$
|
145 |
|
146 |
-
if (!empty($r)){
|
147 |
-
$html .= '<select class="existing_meta_values"><option value="">'.__('Existing Values...','pmxi_plugin').'</option>';
|
148 |
foreach ($r as $key => $value) { if (empty($value['meta_value'])) continue;
|
149 |
-
$
|
150 |
}
|
151 |
-
|
152 |
-
}
|
153 |
-
else $html .= '<p>' . __('No existing values were found for this field.','pmxi_plugin') . '</p>';
|
154 |
-
|
155 |
-
$html .= '</div>';
|
156 |
|
157 |
-
exit( json_encode(array('
|
158 |
}
|
159 |
|
160 |
/**
|
@@ -177,12 +233,14 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
177 |
|
178 |
// Settings
|
179 |
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
180 |
-
|
181 |
|
182 |
-
$targetDir = $uploads['
|
183 |
|
184 |
-
if (! is_dir($targetDir) || ! is_writable($targetDir))
|
185 |
-
|
|
|
|
|
186 |
|
187 |
$cleanupTargetDir = true; // Remove old files
|
188 |
$maxFileAge = 5 * 3600; // Temp file age in seconds
|
@@ -232,8 +290,10 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
232 |
}
|
233 |
|
234 |
closedir($dir);
|
235 |
-
} else
|
236 |
-
|
|
|
|
|
237 |
|
238 |
|
239 |
// Look for the content type header
|
@@ -255,15 +315,21 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
255 |
if ($in) {
|
256 |
while ($buff = fread($in, 4096))
|
257 |
fwrite($out, $buff);
|
258 |
-
} else
|
259 |
-
|
|
|
|
|
260 |
fclose($in);
|
261 |
fclose($out);
|
262 |
@unlink($_FILES['file']['tmp_name']);
|
263 |
-
} else
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
|
|
|
|
|
|
267 |
} else {
|
268 |
// Open temp file
|
269 |
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
|
@@ -274,23 +340,105 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
274 |
if ($in) {
|
275 |
while ($buff = fread($in, 4096))
|
276 |
fwrite($out, $buff);
|
277 |
-
} else
|
278 |
-
|
|
|
|
|
279 |
|
280 |
fclose($in);
|
281 |
fclose($out);
|
282 |
-
} else
|
283 |
-
|
|
|
|
|
284 |
}
|
285 |
|
286 |
// Check if file has been uploaded
|
287 |
if (!$chunks || $chunk == $chunks - 1) {
|
288 |
// Strip the temp .part suffix off
|
289 |
rename("{$filePath}.part", $filePath); chmod($filePath, 0755);
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
// Return JSON-RPC response
|
293 |
-
echo json_encode(array("jsonrpc" => "2.0", "result" => null, "id" => "id", "name" => $filePath)); die;
|
294 |
|
295 |
}
|
296 |
|
5 |
* @author Pavel Kulbakin <p.kulbakin@gmail.com>
|
6 |
*/
|
7 |
class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
8 |
+
|
9 |
+
public static $path;
|
10 |
+
|
11 |
+
public static $upload_transient;
|
12 |
+
|
13 |
+
public function __construct(){
|
14 |
+
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
self::$upload_transient = 'pmxi_uploads_path';
|
18 |
+
|
19 |
+
$uploads = wp_upload_dir();
|
20 |
+
|
21 |
+
$is_secure_import = PMXI_Plugin::getInstance()->getOption('secure');
|
22 |
+
|
23 |
+
if ( ! $is_secure_import ){
|
24 |
+
|
25 |
+
self::$path = pmxi_secure_file($uploads['basedir'] . '/wpallimport/uploads', 'uploads');
|
26 |
+
|
27 |
+
}
|
28 |
+
else {
|
29 |
+
|
30 |
+
self::$path = get_transient( self::$upload_transient );
|
31 |
+
|
32 |
+
if ( empty(self::$path) ) {
|
33 |
+
self::$path = pmxi_secure_file($uploads['basedir'] . '/wpallimport/uploads', 'uploads');
|
34 |
+
set_transient( self::$upload_transient, self::$path);
|
35 |
+
}
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
40 |
|
41 |
public function index() {
|
42 |
+
|
43 |
$this->data['post'] = $post = $this->input->post(PMXI_Plugin::getInstance()->getOption());
|
44 |
|
45 |
if ($this->input->post('is_settings_submitted')) { // save settings form
|
127 |
}
|
128 |
|
129 |
$uploads = wp_upload_dir();
|
130 |
+
$targetDir = $uploads['basedir'] . '/wpallimport/uploads';
|
131 |
$export_file_name = "templates_".uniqid().".txt";
|
132 |
+
file_put_contents($targetDir . DIRECTORY_SEPARATOR . $export_file_name, json_encode($export_data));
|
133 |
|
134 |
+
PMXI_download::csv($targetDir . DIRECTORY_SEPARATOR . $export_file_name);
|
135 |
|
136 |
}
|
137 |
}
|
141 |
$this->render();
|
142 |
}
|
143 |
|
144 |
+
public function cleanup(){
|
145 |
+
|
146 |
+
$removedFiles = 0;
|
147 |
+
|
148 |
+
$wp_uploads = wp_upload_dir();
|
149 |
+
|
150 |
+
$dir = $wp_uploads['basedir'] . '/wpallimport/temp';
|
151 |
+
|
152 |
+
$cacheDir = PMXI_Plugin::ROOT_DIR . '/libraries/cache';
|
153 |
+
|
154 |
+
$files = array_diff(@scandir($dir), array('.','..'));
|
155 |
+
|
156 |
+
$cacheFiles = array_diff(@scandir($cacheDir), array('.','..'));
|
157 |
+
|
158 |
+
$msg = __('Files not found', 'pmxi_plugin');
|
159 |
+
|
160 |
+
if ( count($files) or count($cacheFiles)){
|
161 |
+
|
162 |
+
pmxi_clear_directory( $dir );
|
163 |
+
|
164 |
+
pmxi_clear_directory( $cacheDir );
|
165 |
+
|
166 |
+
$msg = __('Clean Up has been successfully completed.', 'pmxi_plugin');
|
167 |
+
}
|
168 |
+
|
169 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode($msg), $this->baseUrl)); die();
|
170 |
+
}
|
171 |
+
|
172 |
public function dismiss(){
|
173 |
|
174 |
PMXI_Plugin::getInstance()->updateOption("dismiss", 1);
|
190 |
exit( json_encode(array('result' => 'OK')) );
|
191 |
}
|
192 |
|
|
|
193 |
public function meta_values(){
|
194 |
|
195 |
global $wpdb;
|
202 |
WHERE postmeta.meta_key='".$meta_key."'
|
203 |
", ARRAY_A);
|
204 |
|
205 |
+
$meta_values = array();
|
206 |
|
207 |
+
if ( ! empty($r) ){
|
|
|
208 |
foreach ($r as $key => $value) { if (empty($value['meta_value'])) continue;
|
209 |
+
$meta_values[] = esc_html($value['meta_value']);
|
210 |
}
|
211 |
+
}
|
|
|
|
|
|
|
|
|
212 |
|
213 |
+
exit( json_encode(array('meta_values' => $meta_values)) );
|
214 |
}
|
215 |
|
216 |
/**
|
233 |
|
234 |
// Settings
|
235 |
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
236 |
+
//$uploads = wp_upload_dir();
|
237 |
|
238 |
+
$targetDir = self::$path;//pmxi_secure_file($uploads['basedir'] . '/wpallimport/uploads', 'uploads');
|
239 |
|
240 |
+
if (! is_dir($targetDir) || ! is_writable($targetDir)){
|
241 |
+
delete_transient( self::$upload_transient );
|
242 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Uploads folder is not writable.", "pmxi_plugin")), "id" => "id")));
|
243 |
+
}
|
244 |
|
245 |
$cleanupTargetDir = true; // Remove old files
|
246 |
$maxFileAge = 5 * 3600; // Temp file age in seconds
|
290 |
}
|
291 |
|
292 |
closedir($dir);
|
293 |
+
} else{
|
294 |
+
delete_transient( self::$upload_transient );
|
295 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Failed to open temp directory.", "pmxi_plugin")), "id" => "id")));
|
296 |
+
}
|
297 |
|
298 |
|
299 |
// Look for the content type header
|
315 |
if ($in) {
|
316 |
while ($buff = fread($in, 4096))
|
317 |
fwrite($out, $buff);
|
318 |
+
} else{
|
319 |
+
delete_transient( self::$upload_transient );
|
320 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 101, "message" => __("Failed to open input stream.", "pmxi_plugin")), "id" => "id")));
|
321 |
+
}
|
322 |
fclose($in);
|
323 |
fclose($out);
|
324 |
@unlink($_FILES['file']['tmp_name']);
|
325 |
+
} else{
|
326 |
+
delete_transient( self::$upload_transient );
|
327 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => __("Failed to open output stream.", "pmxi_plugin")), "id" => "id")));
|
328 |
+
}
|
329 |
+
} else{
|
330 |
+
delete_transient( self::$upload_transient );
|
331 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 103, "message" => __("Failed to move uploaded file.", "pmxi_plugin")), "id" => "id")));
|
332 |
+
}
|
333 |
} else {
|
334 |
// Open temp file
|
335 |
$out = fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
|
340 |
if ($in) {
|
341 |
while ($buff = fread($in, 4096))
|
342 |
fwrite($out, $buff);
|
343 |
+
} else{
|
344 |
+
delete_transient( self::$upload_transient );
|
345 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 101, "message" => __("Failed to open input stream.", "pmxi_plugin")), "id" => "id")));
|
346 |
+
}
|
347 |
|
348 |
fclose($in);
|
349 |
fclose($out);
|
350 |
+
} else{
|
351 |
+
delete_transient( self::$upload_transient );
|
352 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => __("Failed to open output stream.", "pmxi_plugin")), "id" => "id")));
|
353 |
+
}
|
354 |
}
|
355 |
|
356 |
// Check if file has been uploaded
|
357 |
if (!$chunks || $chunk == $chunks - 1) {
|
358 |
// Strip the temp .part suffix off
|
359 |
rename("{$filePath}.part", $filePath); chmod($filePath, 0755);
|
360 |
+
delete_transient( self::$upload_transient );
|
361 |
+
|
362 |
+
$errors = new WP_Error;
|
363 |
+
|
364 |
+
$uploader = new PMXI_Upload($filePath, $errors, rtrim(str_replace(basename($filePath), '', $filePath), '/'));
|
365 |
+
|
366 |
+
$upload_result = $uploader->upload();
|
367 |
+
|
368 |
+
if ($upload_result instanceof WP_Error){
|
369 |
+
$errors = $upload_result;
|
370 |
+
|
371 |
+
$msgs = $errors->get_error_messages();
|
372 |
+
ob_start();
|
373 |
+
?>
|
374 |
+
<?php foreach ($msgs as $msg): ?>
|
375 |
+
<div class="error inline"><p><?php echo $msg ?></p></div>
|
376 |
+
<?php endforeach ?>
|
377 |
+
<?php
|
378 |
+
$response = ob_get_clean();
|
379 |
+
|
380 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => $response), "id" => "id")));
|
381 |
+
}
|
382 |
+
else {
|
383 |
+
|
384 |
+
// validate XML
|
385 |
+
$file = new PMXI_Chunk($upload_result['filePath'], array('element' => $upload_result['root_element']));
|
386 |
+
|
387 |
+
$is_valid = true;
|
388 |
+
|
389 |
+
if ( ! empty($file->options['element']) )
|
390 |
+
$defaultXpath = "/". $file->options['element'];
|
391 |
+
else
|
392 |
+
$is_valid = false;
|
393 |
+
|
394 |
+
if ( $is_valid ){
|
395 |
+
|
396 |
+
while ($xml = $file->read()) {
|
397 |
+
|
398 |
+
if ( ! empty($xml) ) {
|
399 |
+
|
400 |
+
PMXI_Import_Record::preprocessXml($xml);
|
401 |
+
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . $xml;
|
402 |
+
|
403 |
+
$dom = new DOMDocument( '1.0', 'UTF-8' );
|
404 |
+
$old = libxml_use_internal_errors(true);
|
405 |
+
$dom->loadXML($xml);
|
406 |
+
libxml_use_internal_errors($old);
|
407 |
+
$xpath = new DOMXPath($dom);
|
408 |
+
if (($elements = $xpath->query($defaultXpath)) and $elements->length){
|
409 |
+
break;
|
410 |
+
}
|
411 |
+
}
|
412 |
+
/*else {
|
413 |
+
$is_valid = false;
|
414 |
+
break;
|
415 |
+
}*/
|
416 |
+
|
417 |
+
}
|
418 |
+
|
419 |
+
if ( empty($xml) ) $is_valid = false;
|
420 |
+
}
|
421 |
+
|
422 |
+
unset($file);
|
423 |
+
|
424 |
+
if ( ! $is_valid )
|
425 |
+
{
|
426 |
+
ob_start();
|
427 |
+
?>
|
428 |
+
|
429 |
+
<div class="error inline"><p><?php _e('Please confirm you are importing a valid feed.<br/> Often, feed providers distribute feeds with invalid data, improperly wrapped HTML, line breaks where they should not be, faulty character encodings, syntax errors in the XML, and other issues.<br/><br/>WP All Import has checks in place to automatically fix some of the most common problems, but we can’t catch every single one.<br/><br/>It is also possible that there is a bug in WP All Import, and the problem is not with the feed.<br/><br/>If you need assistance, please contact support – <a href="mailto:support@wpallimport.com">support@wpallimport.com</a> – with your XML/CSV file. We will identify the problem and release a bug fix if necessary.', 'pmxi_plugin'); ?></p></div>
|
430 |
+
|
431 |
+
<?php
|
432 |
+
$response = ob_get_clean();
|
433 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => $response), "id" => "id")));
|
434 |
+
}
|
435 |
+
|
436 |
+
}
|
437 |
+
|
438 |
+
}
|
439 |
+
|
440 |
// Return JSON-RPC response
|
441 |
+
echo json_encode(array("jsonrpc" => "2.0", "error" => null, "result" => null, "id" => "id", "name" => $filePath)); die;
|
442 |
|
443 |
}
|
444 |
|
controllers/controller.php
CHANGED
@@ -15,6 +15,11 @@ abstract class PMXI_Controller {
|
|
15 |
* @var WP_Error
|
16 |
*/
|
17 |
protected $errors;
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Associative array of data which will be automatically available as variables when template is rendered
|
20 |
* @var array
|
@@ -28,6 +33,7 @@ abstract class PMXI_Controller {
|
|
28 |
$this->input->addFilter('trim');
|
29 |
|
30 |
$this->errors = new WP_Error();
|
|
|
31 |
|
32 |
$this->init();
|
33 |
}
|
@@ -98,5 +104,30 @@ abstract class PMXI_Controller {
|
|
98 |
$this->render('controller/error.php');
|
99 |
}
|
100 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
}
|
15 |
* @var WP_Error
|
16 |
*/
|
17 |
protected $errors;
|
18 |
+
/**
|
19 |
+
* Warning messages
|
20 |
+
* @var WP_Error
|
21 |
+
*/
|
22 |
+
protected $warnings;
|
23 |
/**
|
24 |
* Associative array of data which will be automatically available as variables when template is rendered
|
25 |
* @var array
|
33 |
$this->input->addFilter('trim');
|
34 |
|
35 |
$this->errors = new WP_Error();
|
36 |
+
$this->warnings = new WP_Error();
|
37 |
|
38 |
$this->init();
|
39 |
}
|
104 |
$this->render('controller/error.php');
|
105 |
}
|
106 |
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Display list of warnings
|
110 |
+
*
|
111 |
+
* @param string|array|WP_Error[optional] $msgs
|
112 |
+
*/
|
113 |
+
protected function warning($msgs = NULL) {
|
114 |
+
if (is_null($msgs)) {
|
115 |
+
$msgs = $this->warnings;
|
116 |
+
}
|
117 |
+
if (is_wp_error($msgs)) {
|
118 |
+
$msgs = $msgs->get_error_messages();
|
119 |
+
}
|
120 |
+
if ( ! is_array($msgs)) {
|
121 |
+
$msgs = array($msgs);
|
122 |
+
}
|
123 |
+
$this->data['warnings'] = $msgs;
|
124 |
+
|
125 |
+
$viewPathRel = str_replace('_', '/', preg_replace('%^' . preg_quote(PMXI_Plugin::PREFIX, '%') . '%', '', strtolower(get_class($this)))) . '/warning.php';
|
126 |
+
if (is_file(PMXI_Plugin::ROOT_DIR . '/views/' . $viewPathRel)) { // if calling controller class has specific error view
|
127 |
+
$this->render($viewPathRel);
|
128 |
+
} else { // render default error view
|
129 |
+
$this->render('controller/warning.php');
|
130 |
+
}
|
131 |
+
}
|
132 |
|
133 |
}
|
controllers/controller/admin.php
CHANGED
@@ -25,10 +25,10 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
25 |
*/
|
26 |
public function __construct() {
|
27 |
$remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
|
|
|
|
|
28 |
|
29 |
-
$
|
30 |
-
|
31 |
-
$url = $p_url['scheme'] . '://' . $p_url['host'];
|
32 |
|
33 |
if ($remove) {
|
34 |
$this->baseUrl = $url . remove_query_arg($remove);
|
@@ -51,12 +51,17 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
51 |
wp_enqueue_style('pmxi-admin-style-ie', PMXI_ROOT_URL . '/static/css/admin-ie.css');
|
52 |
wp_enqueue_style('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/css/select2/select2.css');
|
53 |
wp_enqueue_style('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/css/select2/select2-bootstrap.css');
|
|
|
|
|
54 |
$wp_styles->add_data('pmxi-admin-style-ie', 'conditional', 'lte IE 7');
|
55 |
-
wp_enqueue_style('wp-pointer');
|
56 |
|
57 |
if ( version_compare(get_bloginfo('version'), '3.8-RC1') >= 0 ){
|
58 |
wp_enqueue_style('pmxi-admin-style-wp-3.8', PMXI_ROOT_URL . '/static/css/admin-wp-3.8.css');
|
59 |
}
|
|
|
|
|
|
|
60 |
|
61 |
$scheme_color = get_user_option('admin_color') and is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css') or $scheme_color = 'fresh';
|
62 |
if (is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
|
@@ -69,6 +74,8 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
69 |
wp_enqueue_script('jquery-nestable', PMXI_ROOT_URL . '/static/js/jquery/jquery.mjs.nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
|
70 |
wp_enqueue_script('jquery-moment', PMXI_ROOT_URL . '/static/js/jquery/moment.js', 'jquery');
|
71 |
wp_enqueue_script('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
|
|
|
|
|
72 |
wp_enqueue_script('wp-pointer');
|
73 |
|
74 |
/* load plupload scripts */
|
@@ -76,12 +83,12 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
76 |
wp_deregister_script('swfupload-handlers');
|
77 |
wp_enqueue_script('swfupload-handlers', get_option('siteurl') . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
|
78 |
|
79 |
-
wp_enqueue_script('jquery-browserplus-min', '
|
80 |
wp_enqueue_script('full-plupload', PMXI_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
|
81 |
-
wp_enqueue_script('jquery-plupload', PMXI_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
|
82 |
|
83 |
wp_enqueue_script('pmxi-admin-script', PMXI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
|
84 |
-
|
85 |
}
|
86 |
|
87 |
/**
|
25 |
*/
|
26 |
public function __construct() {
|
27 |
$remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
|
28 |
+
|
29 |
+
$p_url = parse_url( site_url() );
|
30 |
|
31 |
+
$url = $p_url['scheme'] . '://' . $p_url['host'] . ':' . $_SERVER['SERVER_PORT'];
|
|
|
|
|
32 |
|
33 |
if ($remove) {
|
34 |
$this->baseUrl = $url . remove_query_arg($remove);
|
51 |
wp_enqueue_style('pmxi-admin-style-ie', PMXI_ROOT_URL . '/static/css/admin-ie.css');
|
52 |
wp_enqueue_style('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/css/select2/select2.css');
|
53 |
wp_enqueue_style('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/css/select2/select2-bootstrap.css');
|
54 |
+
add_editor_style( PMXI_ROOT_URL . '/static/css/custom-editor-style.css' );
|
55 |
+
|
56 |
$wp_styles->add_data('pmxi-admin-style-ie', 'conditional', 'lte IE 7');
|
57 |
+
wp_enqueue_style('wp-pointer');
|
58 |
|
59 |
if ( version_compare(get_bloginfo('version'), '3.8-RC1') >= 0 ){
|
60 |
wp_enqueue_style('pmxi-admin-style-wp-3.8', PMXI_ROOT_URL . '/static/css/admin-wp-3.8.css');
|
61 |
}
|
62 |
+
if ( version_compare(get_bloginfo('version'), '4.0-beta3') >= 0 ){
|
63 |
+
wp_enqueue_style('pmxi-admin-style-wp-3.8', PMXI_ROOT_URL . '/static/css/admin-wp-4.0.css');
|
64 |
+
}
|
65 |
|
66 |
$scheme_color = get_user_option('admin_color') and is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css') or $scheme_color = 'fresh';
|
67 |
if (is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
|
74 |
wp_enqueue_script('jquery-nestable', PMXI_ROOT_URL . '/static/js/jquery/jquery.mjs.nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
|
75 |
wp_enqueue_script('jquery-moment', PMXI_ROOT_URL . '/static/js/jquery/moment.js', 'jquery');
|
76 |
wp_enqueue_script('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
|
77 |
+
wp_enqueue_script('jquery-ddslick', PMXI_ROOT_URL . '/static/js/jquery/jquery.ddslick.min.js', 'jquery');
|
78 |
+
wp_enqueue_script('jquery-contextmenu', PMXI_ROOT_URL . '/static/js/jquery/jquery.ui-contextmenu.min.js', array('jquery', 'jquery-ui-menu'));
|
79 |
wp_enqueue_script('wp-pointer');
|
80 |
|
81 |
/* load plupload scripts */
|
83 |
wp_deregister_script('swfupload-handlers');
|
84 |
wp_enqueue_script('swfupload-handlers', get_option('siteurl') . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
|
85 |
|
86 |
+
wp_enqueue_script('jquery-browserplus-min', PMXI_ROOT_URL . '/static/js/jquery/browserplus-min.js', array('jquery'));
|
87 |
wp_enqueue_script('full-plupload', PMXI_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
|
88 |
+
wp_enqueue_script('jquery-plupload', PMXI_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
|
89 |
|
90 |
wp_enqueue_script('pmxi-admin-script', PMXI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
|
91 |
+
|
92 |
}
|
93 |
|
94 |
/**
|
filters/.gitkeep
ADDED
File without changes
|
helpers/pmxi_ctx_mapping.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! function_exists('pmxi_ctx_mapping')){
|
4 |
+
function pmxi_ctx_mapping( $ctx, $mapping_rules, $tx_name ){
|
5 |
+
if ( ! empty( $mapping_rules) and $ctx['is_mapping']){
|
6 |
+
foreach ($mapping_rules as $rule) {
|
7 |
+
if ( ! empty($rule[trim($ctx['name'])])){
|
8 |
+
$ctx['name'] = trim($rule[trim($ctx['name'])]);
|
9 |
+
break;
|
10 |
+
}
|
11 |
+
}
|
12 |
+
}
|
13 |
+
return apply_filters('pmxi_single_category', $ctx, $tx_name);
|
14 |
+
}
|
15 |
+
}
|
helpers/pmxi_findDuplicates.php
CHANGED
@@ -11,34 +11,61 @@ function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_
|
|
11 |
|
12 |
$duplicate_ids = array();
|
13 |
|
14 |
-
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
}
|
43 |
|
44 |
return $duplicate_ids;
|
@@ -62,17 +89,32 @@ function pmxi_findDuplicates($articleData, $custom_duplicate_name = '', $custom_
|
|
62 |
));
|
63 |
}
|
64 |
else{
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
}
|
11 |
|
12 |
$duplicate_ids = array();
|
13 |
|
14 |
+
if ( ! empty($articleData['post_type'])){
|
15 |
+
$post_types = (class_exists('PMWI_Plugin') and $articleData['post_type'] == 'product') ? array('product', 'product_variation') : array($articleData['post_type']);
|
16 |
|
17 |
+
$args = array(
|
18 |
+
'post_type' => $post_types,
|
19 |
+
'post_status' => array('draft', 'publish', 'trash', 'pending', 'future', 'private'),
|
20 |
+
'meta_query' => array(
|
21 |
+
array(
|
22 |
+
'key' => trim($custom_duplicate_name),
|
23 |
+
'value' => htmlspecialchars(trim($custom_duplicate_value)),
|
24 |
+
)
|
25 |
+
),
|
26 |
+
'order' => 'ASC',
|
27 |
+
'orderby' => 'ID'
|
28 |
+
);
|
29 |
+
$query = new WP_Query( $args );
|
30 |
+
|
31 |
+
if ( $query->have_posts() ) $duplicate_ids[] = $query->post->ID;
|
32 |
+
|
33 |
+
wp_reset_postdata();
|
34 |
+
|
35 |
+
if (empty($duplicate_ids)){
|
36 |
|
37 |
+
$query = $wpdb->get_results( $wpdb->prepare("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->posts.".ID FROM ".$wpdb->posts." INNER JOIN ".$wpdb->postmeta." ON (".$wpdb->posts.".ID = ".$wpdb->postmeta.".post_id) WHERE 1=1 AND ".$wpdb->posts.".post_type IN ('". implode("','", $post_types) ."') AND (".$wpdb->posts.".post_status = 'publish' OR ".$wpdb->posts.".post_status = 'future' OR ".$wpdb->posts.".post_status = 'draft' OR ".$wpdb->posts.".post_status = 'pending' OR ".$wpdb->posts.".post_status = 'trash' OR ".$wpdb->posts.".post_status = 'private') AND ( (".$wpdb->postmeta.".meta_key = '%s' AND CAST(".$wpdb->postmeta.".meta_value AS CHAR) = '%s') ) GROUP BY ".$wpdb->posts.".ID ORDER BY ".$wpdb->posts.".ID ASC LIMIT 0, 20", trim($custom_duplicate_name), htmlspecialchars(trim($custom_duplicate_value))));
|
38 |
|
39 |
+
if ( ! empty($query) )
|
40 |
+
foreach ($query as $p)
|
41 |
+
$duplicate_ids[] = $p->ID;
|
42 |
+
|
43 |
+
}
|
44 |
+
}
|
45 |
+
else{
|
46 |
+
$args = array(
|
47 |
+
'meta_query' => array(
|
48 |
+
0 => array(
|
49 |
+
'key' => $custom_duplicate_name,
|
50 |
+
'value' => $custom_duplicate_value,
|
51 |
+
'compare' => '='
|
52 |
+
)
|
53 |
+
)
|
54 |
+
);
|
55 |
+
$user_query = new WP_User_Query( $args );
|
56 |
|
57 |
+
if ( ! empty( $user_query->results ) ) {
|
58 |
+
foreach ( $user_query->results as $user ) {
|
59 |
+
$duplicate_ids[] = $user->ID;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
else{
|
63 |
+
$query = $wpdb->get_results( $wpdb->prepare("SELECT SQL_CALC_FOUND_ROWS ".$wpdb->users.".ID FROM ".$wpdb->users." INNER JOIN ".$wpdb->usermeta." ON (".$wpdb->users.".ID = ".$wpdb->usermeta.".user_id) WHERE 1=1 AND ( (".$wpdb->usermeta.".meta_key = '%s' AND CAST(".$wpdb->usermeta.".meta_value AS CHAR) = '%s') ) GROUP BY ".$wpdb->users.".ID ORDER BY ".$wpdb->users.".ID ASC LIMIT 0, 20", $custom_duplicate_name, $custom_duplicate_value));
|
64 |
|
65 |
+
if ( ! empty($query) )
|
66 |
+
foreach ($query as $p)
|
67 |
+
$duplicate_ids[] = $p->ID;
|
68 |
+
}
|
69 |
}
|
70 |
|
71 |
return $duplicate_ids;
|
89 |
));
|
90 |
}
|
91 |
else{
|
92 |
+
|
93 |
+
if ( ! empty($articleData['post_type'])){
|
94 |
+
$field = 'post_' . $duplicate_indicator; // post_title or post_content
|
95 |
+
return $wpdb->get_col($wpdb->prepare("
|
96 |
+
SELECT ID FROM " . $wpdb->posts . "
|
97 |
+
WHERE
|
98 |
+
post_type = %s
|
99 |
+
AND ID != %s
|
100 |
+
AND REPLACE(REPLACE(REPLACE($field, ' ', ''), '\\t', ''), '\\n', '') = %s
|
101 |
+
",
|
102 |
+
$articleData['post_type'],
|
103 |
+
isset($articleData['ID']) ? $articleData['ID'] : 0,
|
104 |
+
preg_replace('%[ \\t\\n]%', '', $articleData[$field])
|
105 |
+
));
|
106 |
+
}
|
107 |
+
else{
|
108 |
+
if ($duplicate_indicator == 'title'){
|
109 |
+
$field = 'user_login';
|
110 |
+
$u = get_user_by('login', $articleData[$field]);
|
111 |
+
return (!empty($u)) ? array($u->ID) : false;
|
112 |
+
}
|
113 |
+
else{
|
114 |
+
$field = 'user_email';
|
115 |
+
$u = get_user_by('email', $articleData[$field]);
|
116 |
+
return (!empty($u)) ? array($u->ID) : false;
|
117 |
+
}
|
118 |
+
}
|
119 |
}
|
120 |
}
|
helpers/pmxi_functions.php
CHANGED
@@ -226,14 +226,19 @@
|
|
226 |
*/
|
227 |
if ( ! function_exists('pmxi_copy_url_file')){
|
228 |
|
229 |
-
function pmxi_copy_url_file($filePath, $detect = false){
|
230 |
|
231 |
$type = (preg_match('%\W(csv|txt|dat|psv)$%i', basename($filePath))) ? 'csv' : false;
|
232 |
if (!$type) $type = (preg_match('%\W(xml)$%i', basename($filePath))) ? 'xml' : false;
|
|
|
|
|
233 |
|
234 |
$uploads = wp_upload_dir();
|
235 |
-
|
236 |
-
$
|
|
|
|
|
|
|
237 |
|
238 |
$file = @fopen($filePath, "rb");
|
239 |
|
@@ -242,7 +247,7 @@
|
|
242 |
$first_chunk = true;
|
243 |
while ( ! @feof($file) ) {
|
244 |
$chunk = @fread($file, 1024);
|
245 |
-
if (!$type and $first_chunk and strpos($chunk, "
|
246 |
$first_chunk = false;
|
247 |
@fwrite($fp, $chunk);
|
248 |
}
|
@@ -280,13 +285,14 @@
|
|
280 |
}
|
281 |
|
282 |
if ( ! function_exists('pmxi_gzfile_get_contents')){
|
283 |
-
function pmxi_gzfile_get_contents($filename, $use_include_path = 0) {
|
284 |
|
285 |
$type = 'csv';
|
286 |
-
$uploads = wp_upload_dir();
|
|
|
287 |
|
288 |
-
$tmpname = wp_unique_filename($
|
289 |
-
$localPath = $
|
290 |
|
291 |
$fp = @fopen($localPath, 'w');
|
292 |
$file = @gzopen($filename, 'rb', $use_include_path);
|
@@ -302,8 +308,8 @@
|
|
302 |
}
|
303 |
else{
|
304 |
|
305 |
-
$tmpname = wp_unique_filename($
|
306 |
-
$localGZpath = $
|
307 |
$request = get_file_curl($filename, $localGZpath, false, true);
|
308 |
|
309 |
if ( ! is_wp_error($request) ){
|
@@ -445,45 +451,212 @@
|
|
445 |
}
|
446 |
}
|
447 |
|
448 |
-
if ( ! function_exists('pmxi_cdata_filter'))
|
449 |
function pmxi_cdata_filter($matches){
|
450 |
PMXI_Import_Record::$cdata[] = $matches[0];
|
451 |
return '{{CPLACE_'. count(PMXI_Import_Record::$cdata) .'}}';
|
452 |
}
|
453 |
-
|
454 |
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
|
|
465 |
|
466 |
-
|
467 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
468 |
}
|
|
|
469 |
|
470 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
}
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
478 |
|
479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
}
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
226 |
*/
|
227 |
if ( ! function_exists('pmxi_copy_url_file')){
|
228 |
|
229 |
+
function pmxi_copy_url_file($filePath, $detect = false, $targetDir = false){
|
230 |
|
231 |
$type = (preg_match('%\W(csv|txt|dat|psv)$%i', basename($filePath))) ? 'csv' : false;
|
232 |
if (!$type) $type = (preg_match('%\W(xml)$%i', basename($filePath))) ? 'xml' : false;
|
233 |
+
if (!$type) $type = (preg_match('%\W(json)$%i', basename($filePath))) ? 'json' : false;
|
234 |
+
if (!$type) $type = (preg_match('%\W(sql)$%i', basename($filePath))) ? 'sql' : false;
|
235 |
|
236 |
$uploads = wp_upload_dir();
|
237 |
+
|
238 |
+
$targetDir = (!$targetDir) ? pmxi_secure_file($uploads['basedir'] . '/wpallimport/uploads', 'uploads') : $targetDir;
|
239 |
+
|
240 |
+
$tmpname = wp_unique_filename($targetDir, ($type and strlen(basename($filePath)) < 30) ? basename($filePath) : time());
|
241 |
+
$localPath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname)) . ((!$type) ? '.tmp' : '');
|
242 |
|
243 |
$file = @fopen($filePath, "rb");
|
244 |
|
247 |
$first_chunk = true;
|
248 |
while ( ! @feof($file) ) {
|
249 |
$chunk = @fread($file, 1024);
|
250 |
+
if (!$type and $first_chunk and strpos($chunk, "<?") !== false) $type = 'xml'; elseif (!$type and $first_chunk) $type = 'csv'; // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
251 |
$first_chunk = false;
|
252 |
@fwrite($fp, $chunk);
|
253 |
}
|
285 |
}
|
286 |
|
287 |
if ( ! function_exists('pmxi_gzfile_get_contents')){
|
288 |
+
function pmxi_gzfile_get_contents($filename, $use_include_path = 0, $targetDir = false) {
|
289 |
|
290 |
$type = 'csv';
|
291 |
+
$uploads = wp_upload_dir();
|
292 |
+
$targetDir = (!$targetDir) ? pmxi_secure_file($uploads['basedir'] . '/wpallimport/uploads', 'uploads') : $targetDir;
|
293 |
|
294 |
+
$tmpname = wp_unique_filename($targetDir, (strlen(basename($filename)) < 30) ? basename($filename) : time() );
|
295 |
+
$localPath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname));
|
296 |
|
297 |
$fp = @fopen($localPath, 'w');
|
298 |
$file = @gzopen($filename, 'rb', $use_include_path);
|
308 |
}
|
309 |
else{
|
310 |
|
311 |
+
$tmpname = wp_unique_filename($targetDir, (strlen(basename($filename)) < 30) ? basename($filename) : time() );
|
312 |
+
$localGZpath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname));
|
313 |
$request = get_file_curl($filename, $localGZpath, false, true);
|
314 |
|
315 |
if ( ! is_wp_error($request) ){
|
451 |
}
|
452 |
}
|
453 |
|
454 |
+
if ( ! function_exists('pmxi_cdata_filter')){
|
455 |
function pmxi_cdata_filter($matches){
|
456 |
PMXI_Import_Record::$cdata[] = $matches[0];
|
457 |
return '{{CPLACE_'. count(PMXI_Import_Record::$cdata) .'}}';
|
458 |
}
|
459 |
+
}
|
460 |
|
461 |
+
if (!function_exists('human_filesize')){
|
462 |
+
function human_filesize($bytes, $decimals = 2) {
|
463 |
+
$sz = 'BKMGTP';
|
464 |
+
$factor = floor((strlen($bytes) - 1) / 3);
|
465 |
+
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
|
466 |
+
}
|
467 |
+
}
|
468 |
|
469 |
+
if ( ! function_exists('pmxi_secure_file') ){
|
470 |
+
|
471 |
+
function pmxi_secure_file( $targetDir, $folder = 'temp', $importID = false){
|
472 |
+
|
473 |
+
$is_secure_import = PMXI_Plugin::getInstance()->getOption('secure');
|
474 |
+
|
475 |
+
if ( $is_secure_import ){
|
476 |
+
|
477 |
+
$wp_uploads = wp_upload_dir();
|
478 |
|
479 |
+
$dir = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . 'wpallimport' . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . ( ( $importID ) ? md5($importID) : md5(time()) );
|
480 |
+
|
481 |
+
@mkdir($dir, 0755);
|
482 |
+
|
483 |
+
if (@is_writable($dir) and @is_dir($dir)){
|
484 |
+
$targetDir = $dir;
|
485 |
+
@touch( $dir . DIRECTORY_SEPARATOR . 'index.php' );
|
486 |
+
}
|
487 |
+
|
488 |
+
}
|
489 |
+
|
490 |
+
return $targetDir;
|
491 |
}
|
492 |
+
}
|
493 |
|
494 |
+
if ( ! function_exists('pmxi_remove_source')){
|
495 |
+
function pmxi_remove_source($file, $remove_dir = true){
|
496 |
+
|
497 |
+
@unlink($file);
|
498 |
+
|
499 |
+
$path_parts = pathinfo($file);
|
500 |
+
if ( ! empty($path_parts['dirname'])){
|
501 |
+
$path_all_parts = explode('/', $path_parts['dirname']);
|
502 |
+
$dirname = array_pop($path_all_parts);
|
503 |
+
|
504 |
+
if ( pmxi_isValidMd5($dirname)){
|
505 |
+
if ($remove_dir){
|
506 |
+
@unlink($path_parts['dirname'] . DIRECTORY_SEPARATOR . 'index.php' );
|
507 |
+
}
|
508 |
+
if ($remove_dir or count(@scandir($path_parts['dirname'])) == 2)
|
509 |
+
pmxi_rmdir($path_parts['dirname']);
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
}
|
514 |
}
|
515 |
|
516 |
+
function pmxi_rmdir($dir) {
|
517 |
+
$scanned_files = @scandir($dir);
|
518 |
+
if (!empty($scanned_files) and is_array($scanned_files)){
|
519 |
+
$files = array_diff($scanned_files, array('.','..'));
|
520 |
+
if (!empty($files)){
|
521 |
+
foreach ($files as $file) {
|
522 |
+
(is_dir("$dir/$file")) ? pmxi_rmdir("$dir/$file") : @unlink("$dir/$file");
|
523 |
+
}
|
524 |
+
}
|
525 |
+
return @rmdir($dir);
|
526 |
+
}
|
527 |
+
}
|
528 |
+
|
529 |
+
if ( ! function_exists('pmxi_clear_directory') ){
|
530 |
+
function pmxi_clear_directory($path){
|
531 |
+
if (($dir = @opendir($path . '/')) !== false or ($dir = @opendir($path)) !== false) {
|
532 |
+
while(($file = @readdir($dir)) !== false) {
|
533 |
+
$filePath = $path . '/' . $file;
|
534 |
+
if ( is_dir($filePath) && ( ! in_array($file, array('.', '..'))) ){
|
535 |
+
pmxi_rmdir($filePath);
|
536 |
+
}
|
537 |
+
elseif( is_file($filePath) ){
|
538 |
+
@unlink($filePath);
|
539 |
+
}
|
540 |
+
}
|
541 |
+
}
|
542 |
+
}
|
543 |
+
}
|
544 |
|
545 |
+
// function defination to convert array to xml
|
546 |
+
if ( ! function_exists('pmxi_array_to_xml')){
|
547 |
+
function pmxi_array_to_xml($data, &$xml) {
|
548 |
+
foreach($data as $key => $value) {
|
549 |
+
if(is_array($value)) {
|
550 |
+
if(!is_numeric($key)){
|
551 |
+
$subnode = $xml->addChild("$key");
|
552 |
+
pmxi_array_to_xml($value, $subnode);
|
553 |
+
}
|
554 |
+
else{
|
555 |
+
$subnode = $xml->addChild("item_" . $key);
|
556 |
+
pmxi_array_to_xml($value, $subnode);
|
557 |
+
}
|
558 |
+
}
|
559 |
+
else {
|
560 |
+
$xml->addChild("$key",htmlspecialchars("$value"));
|
561 |
+
}
|
562 |
+
}
|
563 |
+
}
|
564 |
}
|
565 |
|
566 |
+
class PMXI_ArrayToXML
|
567 |
+
{
|
568 |
+
/**
|
569 |
+
* The main function for converting to an XML document.
|
570 |
+
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
|
571 |
+
*
|
572 |
+
* @param array $data
|
573 |
+
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
|
574 |
+
* @param SimpleXMLElement $xml - should only be used recursively
|
575 |
+
* @return string XML
|
576 |
+
*/
|
577 |
+
public static function toXml($data, $rootNodeName = 'data', $xml=null)
|
578 |
+
{
|
579 |
+
// turn off compatibility mode as simple xml throws a wobbly if you don't.
|
580 |
+
if (ini_get('zend.ze1_compatibility_mode') == 1)
|
581 |
+
{
|
582 |
+
ini_set ('zend.ze1_compatibility_mode', 0);
|
583 |
+
}
|
584 |
+
|
585 |
+
if ($xml == null)
|
586 |
+
{
|
587 |
+
$xml = simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><'.$rootNodeName .'/>');
|
588 |
+
}
|
589 |
+
if ( !empty($data)){
|
590 |
+
// loop through the data passed in.
|
591 |
+
foreach($data as $key => $value)
|
592 |
+
{
|
593 |
+
// no numeric keys in our xml please!
|
594 |
+
if (is_numeric($key))
|
595 |
+
{
|
596 |
+
// make string key...
|
597 |
+
$key = "item_" . $key;
|
598 |
+
}
|
599 |
+
|
600 |
+
// replace anything not alpha numeric
|
601 |
+
$key = preg_replace('/[^a-z0-9_]/i', '', $key);
|
602 |
+
|
603 |
+
// if there is another array found recrusively call this function
|
604 |
+
if (is_array($value) or is_object($value))
|
605 |
+
{
|
606 |
+
$node = $xml->addChild($key);
|
607 |
+
// recrusive call.
|
608 |
+
PMXI_ArrayToXML::toXml($value, $rootNodeName, $node);
|
609 |
+
}
|
610 |
+
else
|
611 |
+
{
|
612 |
+
// add single node.
|
613 |
+
$value = htmlspecialchars($value);
|
614 |
+
$xml->addChild($key,$value);
|
615 |
+
}
|
616 |
+
|
617 |
+
}
|
618 |
+
}
|
619 |
+
// pass back as string. or simple xml object if you want!
|
620 |
+
return $xml->asXML();
|
621 |
+
}
|
622 |
+
|
623 |
+
|
624 |
+
}
|
625 |
+
|
626 |
+
|
627 |
+
if ( ! function_exists('pmxi_isJson')){
|
628 |
+
function pmxi_isJson($string) {
|
629 |
+
json_decode($string);
|
630 |
+
|
631 |
+
switch (json_last_error()) {
|
632 |
+
case JSON_ERROR_NONE:
|
633 |
+
return true;
|
634 |
+
break;
|
635 |
+
case JSON_ERROR_DEPTH:
|
636 |
+
return new WP_Error( 'broke', __( "Maximum stack depth exceeded", "pmxi_plugin" ) );
|
637 |
+
break;
|
638 |
+
case JSON_ERROR_STATE_MISMATCH:
|
639 |
+
return new WP_Error( 'broke', __( "Underflow or the modes mismatch", "pmxi_plugin" ) );
|
640 |
+
break;
|
641 |
+
case JSON_ERROR_CTRL_CHAR:
|
642 |
+
return new WP_Error( 'broke', __( "Unexpected control character found", "pmxi_plugin" ) );
|
643 |
+
break;
|
644 |
+
case JSON_ERROR_SYNTAX:
|
645 |
+
return new WP_Error( 'broke', __( "Syntax error, malformed JSON", "pmxi_plugin" ) );
|
646 |
+
break;
|
647 |
+
case JSON_ERROR_UTF8:
|
648 |
+
return new WP_Error( 'broke', __( "Malformed UTF-8 characters, possibly incorrectly encoded", "pmxi_plugin" ) );
|
649 |
+
break;
|
650 |
+
default:
|
651 |
+
return new WP_Error( 'broke', __( "Unknown json error", "pmxi_plugin" ) );
|
652 |
+
break;
|
653 |
+
}
|
654 |
+
}
|
655 |
+
}
|
656 |
+
|
657 |
+
if ( ! function_exists('pmxi_isValidMd5')){
|
658 |
+
function pmxi_isValidMd5($md5 ='')
|
659 |
+
{
|
660 |
+
return preg_match('/^[a-f0-9]{32}$/', $md5);
|
661 |
+
}
|
662 |
}
|
helpers/pmxi_insert_post.php
CHANGED
@@ -50,10 +50,10 @@ function pmxi_insert_post($postarr, $wp_error = false){
|
|
50 |
$post_author = $user_id;
|
51 |
|
52 |
// Create a valid post name. Drafts and pending posts are allowed to have an empty
|
53 |
-
// post name.
|
54 |
if ( empty($post_name) ) {
|
55 |
-
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
|
56 |
-
$post_name = sanitize_title($post_title);
|
57 |
else
|
58 |
$post_name = '';
|
59 |
} else {
|
@@ -62,7 +62,7 @@ function pmxi_insert_post($postarr, $wp_error = false){
|
|
62 |
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $ID ) == $check_name )
|
63 |
$post_name = $check_name;
|
64 |
else // new post, or slug has changed.
|
65 |
-
$post_name = sanitize_title($post_name);
|
66 |
}
|
67 |
|
68 |
// If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
|
50 |
$post_author = $user_id;
|
51 |
|
52 |
// Create a valid post name. Drafts and pending posts are allowed to have an empty
|
53 |
+
// post name.
|
54 |
if ( empty($post_name) ) {
|
55 |
+
if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
|
56 |
+
$post_name = sanitize_title($post_title);
|
57 |
else
|
58 |
$post_name = '';
|
59 |
} else {
|
62 |
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $ID ) == $check_name )
|
63 |
$post_name = $check_name;
|
64 |
else // new post, or slug has changed.
|
65 |
+
$post_name = sanitize_title($post_name);
|
66 |
}
|
67 |
|
68 |
// If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
|
helpers/pmxi_json_to_xml.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function pmxi_json_to_xml( $json = array() ){
|
4 |
+
|
5 |
+
return PMXI_ArrayToXML::toXml($json);
|
6 |
+
|
7 |
+
}
|
8 |
+
|
helpers/pmxi_recursion_taxes.php
CHANGED
@@ -1,38 +1,48 @@
|
|
1 |
<?php
|
2 |
function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
3 |
|
4 |
-
if (is_array($parent)){
|
5 |
-
|
6 |
-
if (empty($parent['parent'])){
|
7 |
|
8 |
-
$term = term_exists($parent['name'], $tx_name);
|
9 |
|
10 |
if ( empty($term) and !is_wp_error($term) ){
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
-
|
|
|
|
|
17 |
}
|
18 |
else{
|
|
|
19 |
$parent_id = pmxi_recursion_taxes($parent['parent'], $tx_name, $txes, $key);
|
20 |
|
21 |
$term = term_exists($parent['name'], $tx_name, (int)$parent_id);
|
22 |
|
23 |
if ( empty($term) and !is_wp_error($term) ){
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
-
return ( ! is_wp_error($term)) ? $term['term_id'] : 0;
|
|
|
31 |
}
|
32 |
}
|
33 |
-
else{
|
34 |
-
|
35 |
-
$parent = htmlspecialchars($parent);
|
36 |
|
37 |
if ( !empty($txes[$key - 1]) and !empty($txes[$key - 1]['parent']) and $parent != $txes[$key - 1]['parent']) {
|
38 |
|
@@ -40,25 +50,34 @@ function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
|
40 |
|
41 |
$term = term_exists($parent, $tx_name, (int)$parent_id);
|
42 |
|
43 |
-
if ( empty($term) and ! is_wp_error($term) ){
|
44 |
-
$term =
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
49 |
}
|
50 |
-
|
|
|
|
|
51 |
}
|
52 |
else{
|
53 |
|
54 |
$term = term_exists($parent, $tx_name);
|
55 |
if ( empty($term) and !is_wp_error($term) ){
|
56 |
-
$term =
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
60 |
}
|
61 |
-
return ( ! is_wp_error($term)) ? $term['term_id'] : 0;
|
|
|
62 |
}
|
63 |
}
|
64 |
|
1 |
<?php
|
2 |
function pmxi_recursion_taxes($parent, $tx_name, $txes, $key){
|
3 |
|
4 |
+
if ( is_array($parent) ){
|
5 |
+
|
6 |
+
if ( empty($parent['parent']) ){
|
7 |
|
8 |
+
$term = term_exists($parent['name'], $tx_name);
|
9 |
|
10 |
if ( empty($term) and !is_wp_error($term) ){
|
11 |
+
|
12 |
+
$term = term_exists(htmlspecialchars($parent['name']), $tx_name);
|
13 |
+
if ( empty($term) and !is_wp_error($term) ){
|
14 |
+
$term = wp_insert_term(
|
15 |
+
$parent['name'], // the term
|
16 |
+
$tx_name // the taxonomy
|
17 |
+
);
|
18 |
+
}
|
19 |
}
|
20 |
+
|
21 |
+
return ( ! empty($term) and ! is_wp_error($term)) ? $term['term_id'] : 0;
|
22 |
+
|
23 |
}
|
24 |
else{
|
25 |
+
|
26 |
$parent_id = pmxi_recursion_taxes($parent['parent'], $tx_name, $txes, $key);
|
27 |
|
28 |
$term = term_exists($parent['name'], $tx_name, (int)$parent_id);
|
29 |
|
30 |
if ( empty($term) and !is_wp_error($term) ){
|
31 |
+
|
32 |
+
$term = term_exists(htmlspecialchars($parent['name']), $tx_name, (int)$parent_id);
|
33 |
+
if ( empty($term) and !is_wp_error($term) ){
|
34 |
+
$term = wp_insert_term(
|
35 |
+
$parent['name'], // the term
|
36 |
+
$tx_name, // the taxonomy
|
37 |
+
array('parent'=> (!empty($parent_id)) ? (int)$parent_id : 0)
|
38 |
+
);
|
39 |
+
}
|
40 |
}
|
41 |
+
return ( ! empty($term) and ! is_wp_error($term)) ? $term['term_id'] : 0;
|
42 |
+
|
43 |
}
|
44 |
}
|
45 |
+
else{
|
|
|
|
|
46 |
|
47 |
if ( !empty($txes[$key - 1]) and !empty($txes[$key - 1]['parent']) and $parent != $txes[$key - 1]['parent']) {
|
48 |
|
50 |
|
51 |
$term = term_exists($parent, $tx_name, (int)$parent_id);
|
52 |
|
53 |
+
if ( empty($term) and ! is_wp_error($term) ){
|
54 |
+
$term = term_exists(htmlspecialchars($parent), $tx_name, (int)$parent_id);
|
55 |
+
if ( empty($term) and !is_wp_error($term) ){
|
56 |
+
$term = wp_insert_term(
|
57 |
+
$parent, // the term
|
58 |
+
$tx_name, // the taxonomy
|
59 |
+
array('parent'=> (!empty($parent_id)) ? (int)$parent_id : 0)
|
60 |
+
);
|
61 |
+
}
|
62 |
}
|
63 |
+
|
64 |
+
return ( ! empty($term) and ! is_wp_error($term) ) ? $term['term_id'] : 0;
|
65 |
+
|
66 |
}
|
67 |
else{
|
68 |
|
69 |
$term = term_exists($parent, $tx_name);
|
70 |
if ( empty($term) and !is_wp_error($term) ){
|
71 |
+
$term = term_exists(htmlspecialchars($parent), $tx_name);
|
72 |
+
if ( empty($term) and !is_wp_error($term) ){
|
73 |
+
$term = wp_insert_term(
|
74 |
+
$parent, // the term
|
75 |
+
$tx_name // the taxonomy
|
76 |
+
);
|
77 |
+
}
|
78 |
}
|
79 |
+
return ( ! empty($term) and ! is_wp_error($term)) ? $term['term_id'] : 0;
|
80 |
+
|
81 |
}
|
82 |
}
|
83 |
|
helpers/reverse_taxonomies_html.php
CHANGED
@@ -4,8 +4,8 @@ if ( ! function_exists('reverse_taxonomies_html') ) {
|
|
4 |
|
5 |
function reverse_taxonomies_html($post_taxonomies, $item_id, &$i, $ctx_name = '', $entry = ''){
|
6 |
$childs = array();
|
7 |
-
foreach ($post_taxonomies as $j => $cat) if ($cat->parent_id == $item_id) { $childs[] = $cat; }
|
8 |
-
|
9 |
if (!empty($childs)){
|
10 |
?>
|
11 |
<ol>
|
@@ -14,12 +14,9 @@ if ( ! function_exists('reverse_taxonomies_html') ) {
|
|
14 |
$i++;
|
15 |
?>
|
16 |
<li id="item_<?php echo $i; ?>" class="dragging">
|
17 |
-
<div class="drag-element">
|
18 |
-
<input
|
19 |
-
<input class="widefat xpath_field" type="text" value="<?php echo esc_attr($child_cat->xpath); ?>"/>
|
20 |
-
|
21 |
<?php do_action('pmxi_category_view', $cat, $i, $ctx_name, $entry); ?>
|
22 |
-
|
23 |
</div>
|
24 |
<a href="javascript:void(0);" class="icon-item remove-ico"></a>
|
25 |
<?php echo reverse_taxonomies_html($post_taxonomies, $child_cat->item_id, $i, $ctx_name, $entry); ?>
|
4 |
|
5 |
function reverse_taxonomies_html($post_taxonomies, $item_id, &$i, $ctx_name = '', $entry = ''){
|
6 |
$childs = array();
|
7 |
+
foreach ($post_taxonomies as $j => $cat) if ($cat->parent_id == $item_id and $cat->item_id != $item_id) { $childs[] = $cat; }
|
8 |
+
|
9 |
if (!empty($childs)){
|
10 |
?>
|
11 |
<ol>
|
14 |
$i++;
|
15 |
?>
|
16 |
<li id="item_<?php echo $i; ?>" class="dragging">
|
17 |
+
<div class="drag-element">
|
18 |
+
<input class="widefat xpath_field" type="text" value="<?php echo esc_attr($child_cat->xpath); ?>"/>
|
|
|
|
|
19 |
<?php do_action('pmxi_category_view', $cat, $i, $ctx_name, $entry); ?>
|
|
|
20 |
</div>
|
21 |
<a href="javascript:void(0);" class="icon-item remove-ico"></a>
|
22 |
<?php echo reverse_taxonomies_html($post_taxonomies, $child_cat->item_id, $i, $ctx_name, $entry); ?>
|
i18n/languages/.gitkeep
ADDED
File without changes
|
libraries/XmlImportCsvParse.php
CHANGED
@@ -21,9 +21,7 @@ class PMXI_CsvParser
|
|
21 |
|
22 |
$xpath = '',
|
23 |
|
24 |
-
$delimiter = '',
|
25 |
-
|
26 |
-
$large_import = false,
|
27 |
|
28 |
$htmlentities = false,
|
29 |
|
@@ -33,6 +31,10 @@ class PMXI_CsvParser
|
|
33 |
|
34 |
$csv_encoding = 'UTF-8',
|
35 |
|
|
|
|
|
|
|
|
|
36 |
$auto_encoding = true;
|
37 |
|
38 |
protected
|
@@ -70,31 +72,49 @@ class PMXI_CsvParser
|
|
70 |
* @see load()
|
71 |
* @return void
|
72 |
*/
|
73 |
-
public function __construct($
|
74 |
{
|
75 |
-
PMXI_Plugin::$csv_path = $filename;
|
76 |
-
|
77 |
-
$this->
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
$this->auto_encoding = false;
|
83 |
}
|
84 |
-
if (''
|
85 |
|
86 |
@ini_set( "display_errors", 0);
|
87 |
@ini_set('auto_detect_line_endings', true);
|
88 |
|
89 |
-
$file_params = self::analyse_file($filename, 1);
|
90 |
|
91 |
$this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
|
92 |
|
93 |
unset($file_params);
|
94 |
|
95 |
-
|
|
|
|
|
96 |
|
97 |
-
$this->load($filename);
|
98 |
}
|
99 |
|
100 |
/**
|
@@ -902,14 +922,13 @@ class PMXI_CsvParser
|
|
902 |
{
|
903 |
if (!$this->validates()) {
|
904 |
return false;
|
905 |
-
}
|
906 |
-
|
907 |
-
$wp_uploads = wp_upload_dir();
|
908 |
|
909 |
-
$tmpname = wp_unique_filename($
|
910 |
-
if ("" == $this->xml_path)
|
|
|
911 |
|
912 |
-
$this->toXML(true);
|
913 |
|
914 |
/*$file = new PMXI_Chunk($this->xml_path, array('element' => 'node'));
|
915 |
|
@@ -928,7 +947,7 @@ class PMXI_CsvParser
|
|
928 |
$e = $this->settings['escape'];
|
929 |
$l = $this->settings['length'];
|
930 |
|
931 |
-
|
932 |
|
933 |
$res = fopen($this->_filename, 'rb');
|
934 |
|
21 |
|
22 |
$xpath = '',
|
23 |
|
24 |
+
$delimiter = '',
|
|
|
|
|
25 |
|
26 |
$htmlentities = false,
|
27 |
|
31 |
|
32 |
$csv_encoding = 'UTF-8',
|
33 |
|
34 |
+
$is_csv = false,
|
35 |
+
|
36 |
+
$targetDir = '',
|
37 |
+
|
38 |
$auto_encoding = true;
|
39 |
|
40 |
protected
|
72 |
* @see load()
|
73 |
* @return void
|
74 |
*/
|
75 |
+
public function __construct( $options = array('filename' => null, 'xpath' => '', 'delimiter' => '', 'encoding' => '', 'xml_path' => '', 'targetDir' => false) )
|
76 |
{
|
77 |
+
PMXI_Plugin::$csv_path = $options['filename'];
|
78 |
+
|
79 |
+
$this->xpath = (!empty($options['xpath']) ? $options['xpath'] : ((!empty($_POST['xpath'])) ? $_POST['xpath'] : '/node'));
|
80 |
+
|
81 |
+
if ( ! empty($options['delimiter']) ){
|
82 |
+
$this->delimiter = $options['delimiter'];
|
83 |
+
}
|
84 |
+
else{
|
85 |
+
$input = new PMXI_Input();
|
86 |
+
$id = $input->get('id', 0);
|
87 |
+
if (!$id){
|
88 |
+
$id = $input->get('import_id', 0);
|
89 |
+
}
|
90 |
+
if ( $id ){
|
91 |
+
$import = new PMXI_Import_Record();
|
92 |
+
$import->getbyId($id);
|
93 |
+
if ( ! $import->isEmpty() ){
|
94 |
+
$this->delimiter = $import->options['delimiter'];
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
if ( ! empty($options['encoding'])){
|
99 |
+
$this->csv_encoding = $options['encoding'];
|
100 |
$this->auto_encoding = false;
|
101 |
}
|
102 |
+
if (!empty($options['xml_path'])) $this->xml_path = $options['xml_path'];
|
103 |
|
104 |
@ini_set( "display_errors", 0);
|
105 |
@ini_set('auto_detect_line_endings', true);
|
106 |
|
107 |
+
$file_params = self::analyse_file($options['filename'], 1);
|
108 |
|
109 |
$this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
|
110 |
|
111 |
unset($file_params);
|
112 |
|
113 |
+
$wp_uploads = wp_upload_dir();
|
114 |
+
|
115 |
+
$this->targetDir = (empty($options['targetDir'])) ? pmxi_secure_file($wp_uploads['basedir'] . '/wpallimport/uploads', 'uploads') : $options['targetDir'];
|
116 |
|
117 |
+
$this->load($options['filename']);
|
118 |
}
|
119 |
|
120 |
/**
|
922 |
{
|
923 |
if (!$this->validates()) {
|
924 |
return false;
|
925 |
+
}
|
|
|
|
|
926 |
|
927 |
+
$tmpname = wp_unique_filename($this->targetDir, str_replace("csv", "xml", basename($this->_filename)));
|
928 |
+
if ("" == $this->xml_path)
|
929 |
+
$this->xml_path = $this->targetDir .'/'. url_title($tmpname);
|
930 |
|
931 |
+
$this->toXML(true);
|
932 |
|
933 |
/*$file = new PMXI_Chunk($this->xml_path, array('element' => 'node'));
|
934 |
|
947 |
$e = $this->settings['escape'];
|
948 |
$l = $this->settings['length'];
|
949 |
|
950 |
+
$this->is_csv = $d;
|
951 |
|
952 |
$res = fopen($this->_filename, 'rb');
|
953 |
|
libraries/XmlImportSQLParse.php
ADDED
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PMXI_SQLParser{
|
4 |
+
|
5 |
+
public $xml_path;
|
6 |
+
|
7 |
+
public $_filename;
|
8 |
+
|
9 |
+
public $targetDir;
|
10 |
+
|
11 |
+
public function __construct($path, $targetDir = false){
|
12 |
+
|
13 |
+
$this->_filename = $path;
|
14 |
+
|
15 |
+
$wp_uploads = wp_upload_dir();
|
16 |
+
|
17 |
+
$this->targetDir = (!$targetDir) ? pmxi_secure_file($wp_uploads['basedir'] . '/wpallimport/uploads', 'uploads') : $targetDir;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function parse(){
|
21 |
+
|
22 |
+
$tmpname = wp_unique_filename($this->targetDir, str_replace("sql", "xml", basename($this->_filename)));
|
23 |
+
|
24 |
+
$this->xml_path = $this->targetDir . '/' . url_title($tmpname);
|
25 |
+
|
26 |
+
$this->toXML();
|
27 |
+
|
28 |
+
return $this->xml_path;
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function toXML(){
|
32 |
+
|
33 |
+
$fp = fopen($this->_filename, 'rb');
|
34 |
+
fseek($fp, 0);
|
35 |
+
|
36 |
+
$xmlWriter = new XMLWriter();
|
37 |
+
$xmlWriter->openURI($this->xml_path);
|
38 |
+
$xmlWriter->setIndent(true);
|
39 |
+
$xmlWriter->setIndentString("\t");
|
40 |
+
$xmlWriter->startDocument('1.0', 'UTF-8');
|
41 |
+
$xmlWriter->startElement('data');
|
42 |
+
|
43 |
+
while( ! feof($fp) )
|
44 |
+
{
|
45 |
+
//reset time limit for big files
|
46 |
+
set_time_limit(0);
|
47 |
+
|
48 |
+
$sql = fread($fp, 1024 * 8);
|
49 |
+
|
50 |
+
$count = preg_match_all("%INSERT INTO .*;%Uis", $sql, $matches);
|
51 |
+
|
52 |
+
if ( $count ){
|
53 |
+
|
54 |
+
foreach ($matches[0] as $key => $insert) {
|
55 |
+
|
56 |
+
$current_table = 'node';
|
57 |
+
|
58 |
+
$table = preg_match_all("%INTO\s*[^\(].*\(%Uis", $insert, $table_matches);
|
59 |
+
|
60 |
+
if ( $table )
|
61 |
+
$current_table = sanitize_key(trim(trim(str_replace('INTO', '', trim($table_matches[0][0],'('))), '`'));
|
62 |
+
|
63 |
+
$rawData = array();
|
64 |
+
|
65 |
+
$headers = preg_match_all("%\(.*\)\s*VALUES%Uis", $insert, $headers_matches);
|
66 |
+
|
67 |
+
if ( $headers ){
|
68 |
+
|
69 |
+
foreach ($headers_matches[0] as $key => $founded_headers) {
|
70 |
+
$hdrs = explode(',', rtrim(ltrim(trim(rtrim(trim($founded_headers), 'VALUES')),'('),')'));
|
71 |
+
if ( ! empty($hdrs) ){
|
72 |
+
foreach ($hdrs as $header) {
|
73 |
+
$rawData[ sanitize_key(trim(trim($header), '`')) ] = '';
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
$values = preg_match_all("%\([^`].*\)\s*[,|;]{1}%Uis", $insert, $values_matches);
|
79 |
+
|
80 |
+
if ( $values ){
|
81 |
+
foreach ($values_matches[0] as $key => $value) {
|
82 |
+
$insertData = array();
|
83 |
+
$vals = explode(',', rtrim(ltrim(trim(rtrim(rtrim(trim($value), ','),';')),'('),')'));
|
84 |
+
if ( ! empty($vals) ){
|
85 |
+
$i = 0;
|
86 |
+
foreach ($rawData as $r_key => $v) {
|
87 |
+
foreach ($vals as $k => $val) {
|
88 |
+
if ($i == $k) $insertData[$r_key] = trim(trim($val),"'");
|
89 |
+
}
|
90 |
+
$i++;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
if ( ! empty($insertData)){
|
94 |
+
|
95 |
+
$xmlWriter->startElement($current_table);
|
96 |
+
foreach ($insertData as $h => $xml_value) {
|
97 |
+
$xmlWriter->startElement($h);
|
98 |
+
$xmlWriter->writeCData($xml_value);
|
99 |
+
$xmlWriter->endElement();
|
100 |
+
}
|
101 |
+
$xmlWriter->endElement();
|
102 |
+
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
fclose($fp);
|
111 |
+
|
112 |
+
$xmlWriter->endElement();
|
113 |
+
|
114 |
+
$xmlWriter->flush(true);
|
115 |
+
|
116 |
+
return true;
|
117 |
+
|
118 |
+
}
|
119 |
+
}
|
libraries/XmlImportTemplateCodeGenerator.php
CHANGED
@@ -105,7 +105,8 @@ class XmlImportTemplateCodeGenerator
|
|
105 |
}
|
106 |
if ( ! $filename or ! @is_writable($filename) ){
|
107 |
$uploads = wp_upload_dir();
|
108 |
-
$
|
|
|
109 |
}
|
110 |
|
111 |
file_put_contents($filename, $result);
|
105 |
}
|
106 |
if ( ! $filename or ! @is_writable($filename) ){
|
107 |
$uploads = wp_upload_dir();
|
108 |
+
$targetDir = $uploads['basedir'] . '/wpallimport/temp';
|
109 |
+
$filename = $targetDir . '/' . wp_unique_filename($targetDir, 'tmpfile');
|
110 |
}
|
111 |
|
112 |
file_put_contents($filename, $result);
|
libraries/XmlImportTemplateParser.php
CHANGED
@@ -227,7 +227,8 @@ class XmlImportTemplateParser
|
|
227 |
*/
|
228 |
private function parseFunction()
|
229 |
{
|
230 |
-
$function = new XmlImportAstFunction($this->tokens[++$this->index]->getValue());
|
|
|
231 |
if ($this->tokens[$this->index + 1]->getKind() != XmlImportToken::KIND_OPEN)
|
232 |
throw new XmlImportException ("Open brace expected instead of " . $this->tokens[$this->index + 1]->getKind());
|
233 |
$this->index++;
|
227 |
*/
|
228 |
private function parseFunction()
|
229 |
{
|
230 |
+
$function = new XmlImportAstFunction($this->tokens[++$this->index]->getValue());
|
231 |
+
|
232 |
if ($this->tokens[$this->index + 1]->getKind() != XmlImportToken::KIND_OPEN)
|
233 |
throw new XmlImportException ("Open brace expected instead of " . $this->tokens[$this->index + 1]->getKind());
|
234 |
$this->index++;
|
libraries/XmlImportTemplateScanner.php
CHANGED
@@ -145,7 +145,7 @@ final class XmlImportTemplateScanner
|
|
145 |
}
|
146 |
elseif ($ch == '(')
|
147 |
{
|
148 |
-
$this->isLangBegin = false;
|
149 |
$input->read();
|
150 |
$results[] = new XmlImportToken(XmlImportToken::KIND_OPEN);
|
151 |
}
|
@@ -168,8 +168,14 @@ final class XmlImportTemplateScanner
|
|
168 |
//omit ]
|
169 |
$input->read();
|
170 |
}
|
171 |
-
else
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
break;
|
175 |
}
|
@@ -258,30 +264,48 @@ final class XmlImportTemplateScanner
|
|
258 |
*/
|
259 |
private function scanName(XmlImportReaderInterface $input)
|
260 |
{
|
261 |
-
$accum = $input->read();
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
if (
|
|
|
|
|
273 |
{
|
274 |
return new XmlImportToken(strtoupper($accum));
|
275 |
}
|
276 |
else
|
277 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
if ($this->isLangBegin)
|
279 |
{
|
280 |
-
$this->isLangBegin = false;
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
}
|
283 |
-
else
|
284 |
-
return new XmlImportToken(XmlImportToken::KIND_FUNCTION, $accum);
|
285 |
}
|
286 |
}
|
287 |
|
145 |
}
|
146 |
elseif ($ch == '(')
|
147 |
{
|
148 |
+
$this->isLangBegin = false;
|
149 |
$input->read();
|
150 |
$results[] = new XmlImportToken(XmlImportToken::KIND_OPEN);
|
151 |
}
|
168 |
//omit ]
|
169 |
$input->read();
|
170 |
}
|
171 |
+
else{
|
172 |
+
if ($ch == "'"){
|
173 |
+
throw new XmlImportException("Unexpected symbol ' - When using shortcodes/PHP functions, use double quotes \", not single quotes '");
|
174 |
+
}
|
175 |
+
else{
|
176 |
+
throw new XmlImportException("Unexpected symbol '$ch'");
|
177 |
+
}
|
178 |
+
}
|
179 |
|
180 |
break;
|
181 |
}
|
264 |
*/
|
265 |
private function scanName(XmlImportReaderInterface $input)
|
266 |
{
|
267 |
+
$accum = $input->read();
|
268 |
+
$is_function = false;
|
269 |
+
while (preg_match('/[_a-z0-9=\s"]/i', $input->peek(), $matches))
|
270 |
+
{
|
271 |
+
$accum .= $input->read();
|
272 |
+
if ($input->peek() === false)
|
273 |
+
throw new XmlImportException("Unexpected end of function or keyword name \"$accum\"");
|
274 |
+
}
|
275 |
+
|
276 |
+
$ch = $input->peek();
|
277 |
+
|
278 |
+
if ($ch == "(") $is_function = true;
|
279 |
+
|
280 |
+
if (in_array(strtoupper(trim($accum)), $this->keywords))
|
281 |
{
|
282 |
return new XmlImportToken(strtoupper($accum));
|
283 |
}
|
284 |
else
|
285 |
+
{
|
286 |
+
|
287 |
+
if (strpos($accum, "=") !== false or (shortcode_exists($accum) and !$is_function) or ! $is_function) {
|
288 |
+
|
289 |
+
$this->isLangBegin = false;
|
290 |
+
return new XmlImportToken(XmlImportToken::KIND_TEXT, '[' . trim(trim($accum, "["), "]") . ']');
|
291 |
+
|
292 |
+
}
|
293 |
+
|
294 |
if ($this->isLangBegin)
|
295 |
{
|
296 |
+
$this->isLangBegin = false;
|
297 |
+
if ( function_exists($accum))
|
298 |
+
return array(new XmlImportToken(XmlImportToken::KIND_PRINT), new XmlImportToken(XmlImportToken::KIND_FUNCTION, $accum));
|
299 |
+
else
|
300 |
+
throw new XmlImportException("Call to undefined function \"$accum\"");
|
301 |
+
|
302 |
+
}
|
303 |
+
else{
|
304 |
+
if ( function_exists($accum))
|
305 |
+
return new XmlImportToken(XmlImportToken::KIND_FUNCTION, $accum);
|
306 |
+
else
|
307 |
+
throw new XmlImportException("Call to undefined function \"$accum\"");
|
308 |
}
|
|
|
|
|
309 |
}
|
310 |
}
|
311 |
|
libraries/cache/.gitkeep
ADDED
File without changes
|
libraries/pclzip.lib.php
CHANGED
@@ -66,7 +66,7 @@
|
|
66 |
$wp_uploads = wp_upload_dir();
|
67 |
|
68 |
if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
69 |
-
define( 'PCLZIP_TEMPORARY_DIR', $wp_uploads['
|
70 |
}
|
71 |
|
72 |
// ----- Optional threshold ratio for use of temporary files
|
66 |
$wp_uploads = wp_upload_dir();
|
67 |
|
68 |
if (!defined('PCLZIP_TEMPORARY_DIR')) {
|
69 |
+
define( 'PCLZIP_TEMPORARY_DIR', $wp_uploads['basedir'] . '/wpallimport/temp/' );
|
70 |
}
|
71 |
|
72 |
// ----- Optional threshold ratio for use of temporary files
|
models/file/record.php
CHANGED
@@ -25,7 +25,7 @@ class PMXI_File_Record extends PMXI_Model_Record {
|
|
25 |
$uploads = wp_upload_dir();
|
26 |
|
27 |
if (isset($this->id) and ! is_null($file_contents)) {
|
28 |
-
file_put_contents($uploads['basedir'] . '/
|
29 |
}
|
30 |
|
31 |
$list = new PMXI_File_List();
|
@@ -47,7 +47,7 @@ class PMXI_File_Record extends PMXI_Model_Record {
|
|
47 |
|
48 |
if (isset($this->id) and ! is_null($file_contents)) {
|
49 |
$uploads = wp_upload_dir();
|
50 |
-
file_put_contents($uploads['basedir'] . '/
|
51 |
}
|
52 |
|
53 |
return $this;
|
@@ -56,7 +56,7 @@ class PMXI_File_Record extends PMXI_Model_Record {
|
|
56 |
public function __isset($field) {
|
57 |
if ('contents' == $field and ! $this->offsetExists($field)) {
|
58 |
$uploads = wp_upload_dir();
|
59 |
-
return isset($this->id) and file_exists($uploads['basedir'] . '/
|
60 |
}
|
61 |
return parent::__isset($field);
|
62 |
}
|
@@ -65,7 +65,7 @@ class PMXI_File_Record extends PMXI_Model_Record {
|
|
65 |
if ('contents' == $field and ! $this->offsetExists('contents')) {
|
66 |
if (isset($this->contents)) {
|
67 |
$uploads = wp_upload_dir();
|
68 |
-
$this['contents'] = file_get_contents($uploads['basedir'] . '/
|
69 |
} else {
|
70 |
$this->contents = NULL;
|
71 |
}
|
@@ -76,8 +76,8 @@ class PMXI_File_Record extends PMXI_Model_Record {
|
|
76 |
public function delete() {
|
77 |
if ($this->id) { // delete history file first
|
78 |
$uploads = wp_upload_dir();
|
79 |
-
$file_name = $uploads['basedir'] . '/
|
80 |
-
@file_exists($file_name) and @is_file($file_name) and
|
81 |
}
|
82 |
return parent::delete();
|
83 |
}
|
25 |
$uploads = wp_upload_dir();
|
26 |
|
27 |
if (isset($this->id) and ! is_null($file_contents)) {
|
28 |
+
file_put_contents($uploads['basedir'] . '/wpallimport/history/' . $this->id, $file_contents);
|
29 |
}
|
30 |
|
31 |
$list = new PMXI_File_List();
|
47 |
|
48 |
if (isset($this->id) and ! is_null($file_contents)) {
|
49 |
$uploads = wp_upload_dir();
|
50 |
+
file_put_contents($uploads['basedir'] . '/wpallimport/history/' . $this->id, $file_contents);
|
51 |
}
|
52 |
|
53 |
return $this;
|
56 |
public function __isset($field) {
|
57 |
if ('contents' == $field and ! $this->offsetExists($field)) {
|
58 |
$uploads = wp_upload_dir();
|
59 |
+
return isset($this->id) and file_exists($uploads['basedir'] . '/wpallimport/history/' . $this->id);
|
60 |
}
|
61 |
return parent::__isset($field);
|
62 |
}
|
65 |
if ('contents' == $field and ! $this->offsetExists('contents')) {
|
66 |
if (isset($this->contents)) {
|
67 |
$uploads = wp_upload_dir();
|
68 |
+
$this['contents'] = file_get_contents($uploads['basedir'] . '/wpallimport/history/' . $this->id);
|
69 |
} else {
|
70 |
$this->contents = NULL;
|
71 |
}
|
76 |
public function delete() {
|
77 |
if ($this->id) { // delete history file first
|
78 |
$uploads = wp_upload_dir();
|
79 |
+
$file_name = $uploads['basedir'] . '/wpallimport/history/' . $this->id;
|
80 |
+
@file_exists($file_name) and @is_file($file_name) and pmxi_remove_source($file_name, false);
|
81 |
}
|
82 |
return parent::delete();
|
83 |
}
|
models/history/list.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PMXI_History_List extends PMXI_Model_List {
|
4 |
+
|
5 |
+
public function __construct() {
|
6 |
+
parent::__construct();
|
7 |
+
$this->setTable(PMXI_Plugin::getInstance()->getTablePrefix() . 'history');
|
8 |
+
}
|
9 |
+
}
|
models/history/record.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PMXI_History_Record extends PMXI_Model_Record {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Initialize model instance
|
7 |
+
* @param array[optional] $data Array of record data to initialize object with
|
8 |
+
*/
|
9 |
+
public function __construct($data = array()) {
|
10 |
+
parent::__construct($data);
|
11 |
+
$this->setTable(PMXI_Plugin::getInstance()->getTablePrefix() . 'history');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function delete( $db = true ) {
|
15 |
+
if ($this->id) { // delete history file first
|
16 |
+
$uploads = wp_upload_dir();
|
17 |
+
$file_name = $uploads['basedir'] . '/wpallimport/logs/' . $this->id . '.html';
|
18 |
+
@file_exists($file_name) and @is_file($file_name) and pmxi_remove_source($file_name, true);
|
19 |
+
$file_name = pmxi_secure_file( $uploads['basedir'] . "/wpallimport/logs", 'logs', $this->id ) . '/' . $this->id . '.html';
|
20 |
+
@file_exists($file_name) and @is_file($file_name) and pmxi_remove_source($file_name, true);
|
21 |
+
}
|
22 |
+
return ($db) ? parent::delete() : true;
|
23 |
+
}
|
24 |
+
|
25 |
+
}
|
models/import/record.php
CHANGED
@@ -4,7 +4,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
4 |
|
5 |
public static $cdata = array();
|
6 |
|
7 |
-
protected $errors;
|
8 |
|
9 |
/**
|
10 |
* Some pre-processing logic, such as removing control characters from xml to prevent parsing errors
|
@@ -12,7 +12,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
12 |
*/
|
13 |
public static function preprocessXml( & $xml) {
|
14 |
|
15 |
-
if ( empty(PMXI_Plugin::$session->
|
16 |
|
17 |
self::$cdata = array();
|
18 |
|
@@ -36,7 +36,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
36 |
*/
|
37 |
public static function validateXml( & $xml, $errors = NULL) {
|
38 |
if (FALSE === $xml or '' == $xml) {
|
39 |
-
$errors and $errors->add('form-validation', __('
|
40 |
} else {
|
41 |
|
42 |
PMXI_Import_Record::preprocessXml($xml);
|
@@ -64,7 +64,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
64 |
}
|
65 |
}
|
66 |
else{
|
67 |
-
$errors and $errors->add('form-validation', __('
|
|
|
68 |
}
|
69 |
}
|
70 |
return false;
|
@@ -78,8 +79,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
78 |
parent::__construct($data);
|
79 |
$this->setTable(PMXI_Plugin::getInstance()->getTablePrefix() . 'imports');
|
80 |
$this->errors = new WP_Error();
|
81 |
-
}
|
82 |
|
|
|
|
|
83 |
/**
|
84 |
* Perform import operation
|
85 |
* @param string $xml XML string to import
|
@@ -87,18 +90,19 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
87 |
* @return PMXI_Import_Record
|
88 |
* @chainable
|
89 |
*/
|
90 |
-
public function process($xml, $logger = NULL, $chunk = false, $is_cron = false, $xpath_prefix = '') {
|
91 |
-
|
92 |
add_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // do not perform special filtering for imported content
|
93 |
-
|
94 |
-
kses_remove_filters();
|
95 |
|
|
|
|
|
96 |
$cxpath = $xpath_prefix . $this->xpath;
|
97 |
|
98 |
$this->options += PMXI_Plugin::get_default_import_options(); // make sure all options are defined
|
99 |
|
100 |
$avoid_pingbacks = PMXI_Plugin::getInstance()->getOption('pingbacks');
|
101 |
|
|
|
|
|
102 |
if ( $avoid_pingbacks and ! defined( 'WP_IMPORTING' ) ) define( 'WP_IMPORTING', true );
|
103 |
|
104 |
$postRecord = new PMXI_Post_Record();
|
@@ -112,11 +116,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
112 |
try {
|
113 |
|
114 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', 'pmxi_plugin'));
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing excerpts...', 'pmxi_plugin'));
|
118 |
$post_excerpt = array();
|
119 |
-
if (!empty($this->options['post_excerpt'])){
|
120 |
$post_excerpt = XmlImportParser::factory($xml, $cxpath, $this->options['post_excerpt'], $file)->parse($records); $tmp_files[] = $file;
|
121 |
}
|
122 |
else{
|
@@ -168,11 +177,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
168 |
}
|
169 |
|
170 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing contents...', 'pmxi_plugin'));
|
171 |
-
if (!empty($this->
|
172 |
$contents = XmlImportParser::factory(
|
173 |
-
((!empty($this->
|
174 |
$cxpath,
|
175 |
-
$this->
|
176 |
$file)->parse($records
|
177 |
); $tmp_files[] = $file;
|
178 |
}
|
@@ -189,7 +198,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
189 |
$time = strtotime($d);
|
190 |
if (FALSE === $time) {
|
191 |
in_array($d, $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'pmxi_plugin'), $warned[] = $d));
|
192 |
-
$logger and
|
193 |
$time = time();
|
194 |
}
|
195 |
$dates[$i] = date('Y-m-d H:i:s', $time);
|
@@ -202,238 +211,169 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
202 |
$time_start = strtotime($dates_start[$i]);
|
203 |
if (FALSE === $time_start) {
|
204 |
in_array($dates_start[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'pmxi_plugin'), $warned[] = $dates_start[$i]));
|
205 |
-
$logger and
|
206 |
$time_start = time();
|
207 |
}
|
208 |
$time_end = strtotime($dates_end[$i]);
|
209 |
if (FALSE === $time_end) {
|
210 |
in_array($dates_end[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'pmxi_plugin'), $warned[] = $dates_end[$i]));
|
211 |
-
$logger and
|
212 |
$time_end = time();
|
213 |
}
|
214 |
$dates[$i] = date('Y-m-d H:i:s', mt_rand($time_start, $time_end));
|
215 |
}
|
216 |
}
|
217 |
-
|
218 |
-
|
219 |
-
if ($this->options['tags']) {
|
220 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing tags...', 'pmxi_plugin'));
|
221 |
-
$tags_raw = XmlImportParser::factory($xml, $cxpath, $this->options['tags'], $file)->parse($records); $tmp_files[] = $file;
|
222 |
-
foreach ($tags_raw as $i => $t_raw) {
|
223 |
-
$tags[$i] = '';
|
224 |
-
if ('' != $t_raw) $tags[$i] = implode(', ', str_getcsv($t_raw, $this->options['tags_delim']));
|
225 |
-
}
|
226 |
-
} else {
|
227 |
-
count($titles) and $tags = array_fill(0, count($titles), '');
|
228 |
-
}
|
229 |
-
|
230 |
-
// [posts categories]
|
231 |
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
$
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
$
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
}
|
271 |
-
elseif($this->options['categories_auto_nested']){
|
272 |
-
|
273 |
-
$filtered_cats = apply_filters('pmxi_single_category', array(array(
|
274 |
-
'name' => trim($cc),
|
275 |
-
'parent' => (!empty($delimeted_categories[$j - 1])) ? apply_filters('pmxi_parent_category', trim($delimeted_categories[$j - 1]), $category) : false, // if parent taxonomy exists then return ID else return TITLE
|
276 |
-
'assign' => $category->assign
|
277 |
-
)), $category);
|
278 |
-
foreach ($filtered_cats as $filtered_cat)
|
279 |
-
$cats[$i][] = $filtered_cat;
|
280 |
-
|
281 |
-
}
|
282 |
}
|
283 |
}
|
284 |
}
|
285 |
}
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
'
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
foreach ($filtered_cats as $filtered_cat)
|
306 |
-
$cats[$i][] = $filtered_cat;
|
307 |
-
|
308 |
-
}
|
309 |
-
|
310 |
-
}
|
311 |
-
}
|
312 |
-
if ($count_cats < count($cats[$i])) $categories_hierarchy[$k]->cat_ids[$i][] = apply_filters('pmxi_single_category', $cats[$i][count($cats[$i]) - 1], $categories_hierarchy[$k]);
|
313 |
-
}
|
314 |
-
endforeach;
|
315 |
-
} else{
|
316 |
-
count($titles) and $cats = array_fill(0, count($titles), '');
|
317 |
-
}
|
318 |
-
|
319 |
-
}
|
320 |
-
// [/posts categories]
|
321 |
-
|
322 |
-
// [custom taxonomies]
|
323 |
-
$taxonomies = array();
|
324 |
-
$taxonomies_param = $this->options['type'].'_taxonomies';
|
325 |
-
if ('page' == $this->options['type']) {
|
326 |
-
$taxonomies_object_type = 'page';
|
327 |
-
} elseif ('' != $this->options['custom_type']) {
|
328 |
-
$taxonomies_object_type = $this->options['custom_type'];
|
329 |
-
} else {
|
330 |
-
$taxonomies_object_type = 'post';
|
331 |
-
}
|
332 |
-
|
333 |
-
if (!empty($this->options[$taxonomies_param]) and is_array($this->options[$taxonomies_param])): foreach ($this->options[$taxonomies_param] as $tx_name => $tx_template) if ('' != $tx_template) {
|
334 |
-
$tx = get_taxonomy($tx_name);
|
335 |
-
$taxonomies[$tx_name] = array();
|
336 |
-
if (!empty($tx->object_type) and in_array($taxonomies_object_type, $tx->object_type)) {
|
337 |
-
$chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'pmxi_plugin'), $tx->labels->name));
|
338 |
-
$txes = array();
|
339 |
-
|
340 |
-
$taxonomies_hierarchy = json_decode($tx_template);
|
341 |
-
foreach ($taxonomies_hierarchy as $k => $taxonomy){ if ("" == $taxonomy->xpath) continue;
|
342 |
-
$txes_raw = XmlImportParser::factory($xml, $cxpath, str_replace('\'','"',$taxonomy->xpath), $file)->parse($records); $tmp_files[] = $file;
|
343 |
-
$warned = array();
|
344 |
-
foreach ($txes_raw as $i => $tx_raw) {
|
345 |
-
if (empty($taxonomies_hierarchy[$k]->txn_names[$i])) $taxonomies_hierarchy[$k]->txn_names[$i] = array();
|
346 |
-
if (empty($taxonomies[$tx_name][$i])) $taxonomies[$tx_name][$i] = array();
|
347 |
-
$count_cats = count($taxonomies[$tx_name][$i]);
|
348 |
-
|
349 |
-
$delimeted_taxonomies = explode((!empty($taxonomy->delim)) ? $taxonomy->delim : ',', $tx_raw);
|
350 |
-
|
351 |
-
if ('' != $tx_raw) foreach (explode((!empty($taxonomy->delim)) ? $taxonomy->delim : ',', $tx_raw) as $j => $cc) if ('' != $cc) {
|
352 |
-
|
353 |
-
$cat = get_term_by('name', trim($cc), $tx_name) or $cat = get_term_by('slug', trim($cc), $tx_name) or ctype_digit($cc) and $cat = get_term_by('id', $cc, $tx_name);
|
354 |
-
if (!empty($taxonomy->parent_id)) {
|
355 |
-
foreach ($taxonomies_hierarchy as $key => $value){
|
356 |
-
if ($value->item_id == $taxonomy->parent_id and !empty($value->txn_names[$i])){
|
357 |
-
foreach ($value->txn_names[$i] as $parent) {
|
358 |
-
if (!$j or !$taxonomy->auto_nested){
|
359 |
-
|
360 |
-
$filtered_txs = apply_filters('pmxi_single_category', array(array(
|
361 |
-
'name' => trim($cc),
|
362 |
-
'parent' => $parent,
|
363 |
-
'assign' => $taxonomy->assign
|
364 |
-
)), $taxonomy);
|
365 |
-
foreach ($filtered_txs as $filtered_tx)
|
366 |
-
$taxonomies[$tx_name][$i][] = $filtered_tx;
|
367 |
-
|
368 |
}
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
408 |
}
|
409 |
-
|
410 |
-
|
|
|
|
|
|
|
411 |
}
|
412 |
}
|
413 |
-
|
414 |
-
|
415 |
-
// [/custom taxonomies]
|
416 |
|
417 |
-
//
|
418 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
419 |
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': ' . $uploads['error']);
|
420 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>: No featured images will be created', 'pmxi_plugin'));
|
421 |
-
$logger and
|
422 |
} else {
|
423 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for featured images...', 'pmxi_plugin'));
|
424 |
$featured_images = array();
|
425 |
-
if ($this->options['
|
426 |
-
|
427 |
-
|
428 |
-
|
|
|
|
|
429 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
}
|
431 |
|
432 |
-
//
|
433 |
-
if ( $this->options['
|
434 |
-
$uploads = wp_upload_dir();
|
435 |
-
|
436 |
-
// serialized images meta titles
|
437 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (titles)...', 'pmxi_plugin'));
|
438 |
$image_meta_titles = array();
|
439 |
|
@@ -442,8 +382,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
442 |
} else {
|
443 |
count($titles) and $image_meta_titles = array_fill(0, count($titles), '');
|
444 |
}
|
|
|
445 |
|
446 |
-
|
|
|
447 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (captions)...', 'pmxi_plugin'));
|
448 |
$image_meta_captions = array();
|
449 |
if ($this->options['image_meta_caption']) {
|
@@ -451,7 +393,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
451 |
} else {
|
452 |
count($titles) and $image_meta_captions = array_fill(0, count($titles), '');
|
453 |
}
|
454 |
-
|
|
|
|
|
|
|
455 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (alt text)...', 'pmxi_plugin'));
|
456 |
$image_meta_alts = array();
|
457 |
if ($this->options['image_meta_alt']) {
|
@@ -459,7 +404,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
459 |
} else {
|
460 |
count($titles) and $image_meta_alts = array_fill(0, count($titles), '');
|
461 |
}
|
462 |
-
|
|
|
|
|
|
|
463 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (description)...', 'pmxi_plugin'));
|
464 |
$image_meta_descriptions = array();
|
465 |
if ($this->options['image_meta_description']) {
|
@@ -469,21 +417,33 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
469 |
}
|
470 |
}
|
471 |
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
$auto_rename_images
|
477 |
-
|
478 |
-
|
479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
}
|
481 |
|
482 |
-
//
|
483 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
484 |
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': ' . $uploads['error']);
|
485 |
$logger and call_user_func($logger, __('<b>WARNING</b>: No attachments will be created', 'pmxi_plugin'));
|
486 |
-
$logger and
|
487 |
} else {
|
488 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for attachments files...', 'pmxi_plugin'));
|
489 |
$attachments = array();
|
@@ -520,15 +480,18 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
520 |
$chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'pmxi_plugin'));
|
521 |
|
522 |
if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
|
523 |
-
$post_type =
|
524 |
} else {
|
525 |
$post_type = $this->options['type'];
|
526 |
}
|
527 |
|
|
|
|
|
528 |
$addons = array();
|
529 |
$addons_data = array();
|
530 |
|
531 |
// data parsing for WP All Import add-ons
|
|
|
532 |
$parsingData = array(
|
533 |
'import' => $this,
|
534 |
'count' => count($titles),
|
@@ -557,7 +520,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
557 |
$specified_records = array();
|
558 |
|
559 |
if ($this->options['is_import_specified']) {
|
560 |
-
|
561 |
foreach (preg_split('% *, *%', $this->options['import_specified'], -1, PREG_SPLIT_NO_EMPTY) as $chank) {
|
562 |
if (preg_match('%^(\d+)-(\d+)$%', $chank, $mtch)) {
|
563 |
$specified_records = array_merge($specified_records, range(intval($mtch[1]), intval($mtch[2])));
|
@@ -568,58 +531,90 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
568 |
|
569 |
}
|
570 |
|
571 |
-
foreach ($titles as $i => $void) {
|
|
|
|
|
|
|
|
|
|
|
572 |
|
573 |
wp_cache_flush();
|
574 |
|
|
|
575 |
do_action('pmxi_before_post_import', $this->id);
|
576 |
|
577 |
-
if (empty($titles[$i])) {
|
578 |
-
if (!empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i])){
|
579 |
$titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
|
580 |
-
}
|
581 |
else{
|
582 |
-
$
|
583 |
-
$logger and
|
584 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['chunk_number'] = ++PMXI_Plugin::$session->data['pmxi_import']['chunk_number'];
|
585 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
586 |
-
pmxi_session_commit();
|
587 |
-
continue;
|
588 |
}
|
589 |
}
|
590 |
|
591 |
-
$
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
607 |
|
608 |
// Re-import Records Matching
|
609 |
$post_to_update = false; $post_to_update_id = false;
|
610 |
|
611 |
// if Auto Matching re-import option selected
|
612 |
-
if ("manual" != $this->options['duplicate_matching']){
|
613 |
|
614 |
-
// find corresponding article among previously imported
|
|
|
615 |
$postRecord->clear();
|
616 |
$postRecord->getBy(array(
|
617 |
'unique_key' => $unique_keys[$i],
|
618 |
'import_id' => $this->id,
|
619 |
));
|
620 |
|
621 |
-
if ( ! $postRecord->isEmpty() )
|
622 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
|
624 |
// if Manual Matching re-import option seleted
|
625 |
} else {
|
@@ -631,18 +626,27 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
631 |
else{
|
632 |
count($titles) and $custom_duplicate_name = $custom_duplicate_value = array_fill(0, count($titles), '');
|
633 |
}
|
634 |
-
|
|
|
635 |
// handle duplicates according to import settings
|
636 |
if ($duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'])) {
|
637 |
-
$duplicate_id = array_shift($duplicates);
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
}
|
643 |
}
|
644 |
|
645 |
-
if (!empty($specified_records)){
|
646 |
|
647 |
if ( ! in_array($created + $updated + $skipped + 1, $specified_records) ){
|
648 |
|
@@ -650,9 +654,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
650 |
|
651 |
$skipped++;
|
652 |
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'pmxi_plugin'));
|
653 |
-
$logger and
|
654 |
-
$logger and
|
655 |
-
|
656 |
continue;
|
657 |
}
|
658 |
}
|
@@ -660,6 +664,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
660 |
// Duplicate record is founded
|
661 |
if ($post_to_update){
|
662 |
|
|
|
|
|
663 |
// Do not update already existing records option selected
|
664 |
if ("yes" == $this->options['is_keep_former_posts']) {
|
665 |
|
@@ -669,114 +675,115 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
669 |
|
670 |
$skipped++;
|
671 |
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
672 |
-
$logger and
|
673 |
-
$logger and
|
674 |
-
|
675 |
continue;
|
676 |
}
|
677 |
|
678 |
$articleData['ID'] = $post_to_update_id;
|
679 |
// Choose which data to update
|
680 |
if ( $this->options['update_all_data'] == 'no' ){
|
681 |
-
|
682 |
-
if ( ! $this->options['
|
683 |
-
|
684 |
-
|
685 |
-
$
|
686 |
-
|
687 |
-
$
|
688 |
-
$
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
}
|
694 |
-
$existing_cats[$i] = $cats_new;
|
695 |
-
}
|
696 |
-
|
697 |
-
// Re-import Post Tags
|
698 |
-
if ( ! $this->options['is_update_categories'] or $this->options['update_categories_logic'] == 'add_new'
|
699 |
-
or ($this->options['update_categories_logic'] == 'only' and empty($this->options['taxonomies_list']))
|
700 |
-
or (! empty($this->options['taxonomies_list']) and is_array($this->options['taxonomies_list']) and ((in_array('post_tag', $this->options['taxonomies_list']) and $this->options['update_categories_logic'] == 'all_except') or (!in_array('post_tag', $this->options['taxonomies_list']) and $this->options['update_categories_logic'] == 'only')))) {
|
701 |
-
|
702 |
-
$tags_list = get_the_tags($articleData['ID']);
|
703 |
-
if (is_wp_error($tags_list)) {
|
704 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to get current tags for article #%d, updating with those read from XML file', 'pmxi_plugin'), $articleData['ID']));
|
705 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
706 |
} else {
|
707 |
-
$
|
708 |
-
if (
|
709 |
-
|
710 |
-
|
711 |
-
|
|
|
|
|
712 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
}
|
714 |
-
|
715 |
-
$existing_taxonomies = array();
|
716 |
-
foreach (array_keys($taxonomies) as $tx_name) {
|
717 |
-
$txes_list = get_the_terms($articleData['ID'], $tx_name);
|
718 |
-
if (is_wp_error($txes_list)) {
|
719 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to get current taxonomies for article #%d, updating with those read from XML file', 'pmxi_plugin'), $articleData['ID']));
|
720 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
721 |
-
} else {
|
722 |
-
$txes_new = array();
|
723 |
-
if (!empty($txes_list)):
|
724 |
-
foreach ($txes_list as $t) {
|
725 |
-
$txes_new[] = $t->slug;
|
726 |
-
}
|
727 |
-
endif;
|
728 |
-
$existing_taxonomies[$tx_name][$i] = $txes_new;
|
729 |
-
}
|
730 |
-
}
|
731 |
-
}
|
732 |
-
else{
|
733 |
-
//Remove existing taxonomies
|
734 |
-
foreach (array_keys($taxonomies) as $tx_name) wp_set_object_terms($articleData['ID'], NULL, $tx_name);
|
735 |
-
}
|
736 |
-
if ( ! $this->options['is_update_dates']) { // preserve date of already existing article when duplicate is found
|
737 |
-
$articleData['post_date'] = $post_to_update->post_date;
|
738 |
-
$articleData['post_date_gmt'] = $post_to_update->post_date_gmt;
|
739 |
-
}
|
740 |
-
if ( ! $this->options['is_update_status']) { // preserve status and trashed flag
|
741 |
-
$articleData['post_status'] = $post_to_update->post_status;
|
742 |
-
}
|
743 |
-
if ( ! $this->options['is_update_content']){
|
744 |
-
$articleData['post_content'] = $post_to_update->post_content;
|
745 |
-
}
|
746 |
-
if ( ! $this->options['is_update_title']){
|
747 |
-
$articleData['post_title'] = $post_to_update->post_title;
|
748 |
-
}
|
749 |
-
if ( ! $this->options['is_update_slug']){
|
750 |
-
$articleData['post_name'] = $post_to_update->post_name;
|
751 |
-
}
|
752 |
-
if ( ! $this->options['is_update_excerpt']){
|
753 |
-
$articleData['post_excerpt'] = $post_to_update->post_excerpt;
|
754 |
-
}
|
755 |
-
if ( ! $this->options['is_update_menu_order']){
|
756 |
-
$articleData['menu_order'] = $post_to_update->menu_order;
|
757 |
-
}
|
758 |
-
if ( ! $this->options['is_update_parent']){
|
759 |
-
$articleData['post_parent'] = $post_to_update->post_parent;
|
760 |
}
|
761 |
-
|
762 |
-
$articleData['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
763 |
}
|
764 |
-
|
|
|
765 |
$articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update);
|
766 |
|
767 |
}
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
774 |
}
|
775 |
}
|
776 |
elseif ( ! $postRecord->isEmpty() ){
|
777 |
|
778 |
// existing post not found though it's track was found... clear the leftover, plugin will continue to treat record as new
|
779 |
-
$postRecord->
|
780 |
|
781 |
}
|
782 |
|
@@ -786,10 +793,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
786 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
787 |
|
788 |
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by do not create new posts option.', 'pmxi_plugin'));
|
789 |
-
$logger and
|
790 |
-
$logger and
|
791 |
$skipped++;
|
792 |
-
|
793 |
continue;
|
794 |
}
|
795 |
|
@@ -858,7 +865,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
858 |
$dest->insert();
|
859 |
} else {
|
860 |
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to create cloaked link for %s', 'pmxi_plugin'), $url));
|
861 |
-
$logger and
|
862 |
$link = NULL;
|
863 |
}
|
864 |
}
|
@@ -870,12 +877,25 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
870 |
}
|
871 |
}
|
872 |
|
873 |
-
// insert article being imported
|
874 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
875 |
|
876 |
if (is_wp_error($pid)) {
|
877 |
$logger and call_user_func($logger, __('<b>ERROR</b>', 'pmxi_plugin') . ': ' . $pid->get_error_message());
|
878 |
-
$logger and
|
879 |
} else {
|
880 |
|
881 |
if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
|
@@ -888,83 +908,17 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
888 |
))->insert();
|
889 |
|
890 |
$postRecord->set(array('iteration' => $this->iteration))->update();
|
|
|
|
|
891 |
}
|
892 |
|
893 |
// [post format]
|
894 |
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ){
|
895 |
-
set_post_format($pid, $this->options['post_format'] );
|
|
|
896 |
}
|
897 |
// [/post format]
|
898 |
-
|
899 |
-
// [custom fields]
|
900 |
-
if (empty($articleData['ID']) or $this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_custom_fields']) or ($this->options['update_all_data'] == 'no' and $this->options['is_update_attributes'])) {
|
901 |
-
|
902 |
-
// Delete all meta keys
|
903 |
-
if ( ! empty($articleData['ID']) ) {
|
904 |
-
|
905 |
-
// Get all existing meta keys
|
906 |
-
$existing_meta_keys = array(); foreach (get_post_meta($pid, '') as $cur_meta_key => $cur_meta_val) $existing_meta_keys[] = $cur_meta_key;
|
907 |
-
|
908 |
-
// delete keys which are no longer correspond to import settings
|
909 |
-
foreach ($existing_meta_keys as $cur_meta_key) {
|
910 |
-
|
911 |
-
// Do not delete post meta for features image
|
912 |
-
if ( in_array($cur_meta_key, array('_thumbnail_id','_product_image_gallery')) ) continue;
|
913 |
-
|
914 |
-
$field_to_delete = true;
|
915 |
-
|
916 |
-
// apply addons filters
|
917 |
-
if ( ! apply_filters('pmxi_custom_field_to_delete', $field_to_delete, $pid, $post_type, $this->options, $cur_meta_key) ) continue;
|
918 |
-
|
919 |
-
// Update all Custom Fields is defined
|
920 |
-
if ($this->options['update_all_data'] == 'yes' or ($this->options['update_all_data'] == 'no' and $this->options['is_update_custom_fields'] and $this->options['update_custom_fields_logic'] == "full_update")) {
|
921 |
-
delete_post_meta($pid, $cur_meta_key);
|
922 |
-
}
|
923 |
-
// Update only these Custom Fields, leave the rest alone
|
924 |
-
elseif ($this->options['update_all_data'] == 'no' and $this->options['is_update_custom_fields'] and $this->options['update_custom_fields_logic'] == "only"){
|
925 |
-
if (!empty($this->options['custom_fields_list']) and is_array($this->options['custom_fields_list']) and in_array($cur_meta_key, $this->options['custom_fields_list'])) delete_post_meta($pid, $cur_meta_key);
|
926 |
-
}
|
927 |
-
// Leave these fields alone, update all other Custom Fields
|
928 |
-
elseif ($this->options['update_all_data'] == 'no' and $this->options['is_update_custom_fields'] and $this->options['update_custom_fields_logic'] == "all_except"){
|
929 |
-
if ( empty($this->options['custom_fields_list']) or ! in_array($cur_meta_key, $this->options['custom_fields_list'])) delete_post_meta($pid, $cur_meta_key);
|
930 |
-
}
|
931 |
-
|
932 |
-
}
|
933 |
-
}
|
934 |
-
|
935 |
-
$encoded_meta = array();
|
936 |
-
|
937 |
-
foreach ($serialized_meta as $m_key => $values) { if ( empty($m_key) ) continue;
|
938 |
-
|
939 |
-
if (!empty($articleData['ID'])){
|
940 |
-
|
941 |
-
if ($this->options['update_all_data'] != 'yes'){
|
942 |
-
|
943 |
-
$field_to_update = false;
|
944 |
-
|
945 |
-
if ($this->options['is_update_custom_fields'] and $this->options['update_custom_fields_logic'] == "only" and ! empty($this->options['custom_fields_list']) and is_array($this->options['custom_fields_list']) and in_array($m_key, $this->options['custom_fields_list']) ) $field_to_update = true;
|
946 |
-
if ($this->options['is_update_custom_fields'] and $this->options['update_custom_fields_logic'] == "all_except" and ( empty($this->options['custom_fields_list']) or ! in_array($m_key, $this->options['custom_fields_list']) )) $field_to_update = true;
|
947 |
-
|
948 |
-
if ( $this->options['update_custom_fields_logic'] == "full_update" ) $field_to_update = true;
|
949 |
-
|
950 |
-
// apply addons filters
|
951 |
-
$field_to_update = apply_filters('pmxi_custom_field_to_update', $field_to_update, $post_type, $this->options, $m_key);
|
952 |
-
|
953 |
-
if ( ! $field_to_update ) continue;
|
954 |
-
|
955 |
-
}
|
956 |
-
|
957 |
-
}
|
958 |
-
|
959 |
-
update_post_meta($pid, $m_key, apply_filters('pmxi_custom_field', (is_serialized($values[$i])) ? unserialize($values[$i]) : $values[$i], $this->id));
|
960 |
-
|
961 |
-
do_action( 'pmxi_update_post_meta', $pid, $m_key, (is_serialized($values[$i])) ? unserialize($values[$i]) : $values[$i]); // hook that was triggered after post meta data updated
|
962 |
-
|
963 |
-
}
|
964 |
-
|
965 |
-
}
|
966 |
-
// [/custom fields]
|
967 |
-
|
968 |
// [addons import]
|
969 |
|
970 |
// prepare data for import
|
@@ -989,13 +943,6 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
989 |
if (function_exists($import_func)) call_user_func($import_func, $importData, $addons_data[$class]);
|
990 |
}
|
991 |
}
|
992 |
-
if ( count(PMXI_Admin_Addons::get_active_addons()) ){
|
993 |
-
$is_post_exist = get_post($pid);
|
994 |
-
if ( empty($is_post_exist) ) {
|
995 |
-
$logger and call_user_func($logger, sprintf(__('`%s` post was deleted', 'pmxi_plugin'), $articleData['post_title']));
|
996 |
-
continue;
|
997 |
-
}
|
998 |
-
}
|
999 |
|
1000 |
// [/addons import]
|
1001 |
|
@@ -1003,222 +950,278 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1003 |
if ('post' != $articleData['post_type'] and !empty($this->options['page_template'])) update_post_meta($pid, '_wp_page_template', $this->options['page_template']);
|
1004 |
|
1005 |
// [featured image]
|
1006 |
-
if ( ! empty($uploads) and false === $uploads['error'] and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_images']))) {
|
1007 |
|
1008 |
if (!empty($featured_images[$i])){
|
1009 |
-
|
1010 |
-
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
1011 |
-
|
1012 |
-
$success_images = false;
|
1013 |
-
$gallery_attachment_ids = array();
|
1014 |
|
1015 |
-
$
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
$
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1065 |
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
'post_parent' => $pid,
|
1073 |
-
) );
|
1074 |
-
|
1075 |
-
if ( $attachment_imgs ) {
|
1076 |
-
foreach ( $attachment_imgs as $attachment_img ) {
|
1077 |
-
if ($attachment_img->guid == $uploads['url'] . '/' . $image_name){
|
1078 |
-
$download_image = false;
|
1079 |
-
$success_images = true;
|
1080 |
-
if ( ! has_post_thumbnail($pid) )
|
1081 |
-
set_post_thumbnail($pid, $attachment_img->ID);
|
1082 |
-
else
|
1083 |
-
$gallery_attachment_ids[] = $attachment_img->ID;
|
1084 |
-
|
1085 |
-
$logger and call_user_func($logger, sprintf(__('<b>Image SKIPPED</b>: The image %s is always exists for the %s', 'pmxi_plugin'), basename($attachment_img->guid), $articleData['post_title']));
|
1086 |
-
}
|
1087 |
-
}
|
1088 |
-
}
|
1089 |
|
|
|
1090 |
}
|
1091 |
|
1092 |
-
|
1093 |
|
1094 |
-
|
1095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1096 |
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
$existing_attachment = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->prefix ."posts WHERE guid = '%s'", $uploads['url'] . '/' . $image_filename ) );
|
1101 |
|
1102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1103 |
|
1104 |
-
|
1105 |
-
$create_image = false;
|
1106 |
|
1107 |
-
|
1108 |
-
set_post_thumbnail($pid, $existing_attachment->ID);
|
1109 |
-
else
|
1110 |
-
$gallery_attachment_ids[] = $existing_attachment->ID;
|
1111 |
|
1112 |
-
|
|
|
1113 |
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1118 |
$download_image = false;
|
1119 |
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1120 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'pmxi_plugin'), $image_filepath));
|
1121 |
-
$logger and
|
1122 |
@unlink($image_filepath);
|
1123 |
} else {
|
1124 |
$create_image = true;
|
|
|
1125 |
}
|
1126 |
-
}
|
1127 |
-
}
|
1128 |
-
}
|
1129 |
|
1130 |
-
|
1131 |
-
|
1132 |
-
$request = get_file_curl($url, $image_filepath);
|
1133 |
-
|
1134 |
-
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
1135 |
-
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1136 |
-
} elseif( ($image_info = @getimagesize($image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1137 |
-
$create_image = true;
|
1138 |
-
}
|
1139 |
-
|
1140 |
-
if ( ! $create_image ){
|
1141 |
-
|
1142 |
-
$url = str_replace(" ", "%20", trim(pmxi_convert_encoding($img_url)));
|
1143 |
|
|
|
|
|
1144 |
$request = get_file_curl($url, $image_filepath);
|
1145 |
|
1146 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1156 |
}
|
1157 |
}
|
1158 |
}
|
1159 |
}
|
1160 |
-
}
|
1161 |
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
|
|
|
|
1177 |
|
1178 |
-
|
1179 |
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
if ( $this->options['set_image_meta_data'] ){
|
1190 |
$update_attachment_meta = array();
|
1191 |
-
if ( ! empty($img_titles[$k]) ) $update_attachment_meta['post_title'] = $img_titles[$k];
|
1192 |
-
if ( ! empty($img_captions[$k]) ) $update_attachment_meta['post_excerpt'] = $img_captions[$k];
|
1193 |
-
if ( ! empty($img_descriptions[$k]) ) $update_attachment_meta['post_content'] = $img_descriptions[$k];
|
1194 |
-
if ( ! empty($img_alts[$k]) ) update_post_meta($attid, '_wp_attachment_image_alt', $img_alts[$k]);
|
1195 |
|
1196 |
if ( ! empty($update_attachment_meta)) $this->wpdb->update( $this->wpdb->posts, $update_attachment_meta, array('ID' => $attid) );
|
1197 |
|
1198 |
-
|
1199 |
-
|
1200 |
-
do_action( 'pmxi_gallery_image', $pid, $attid, $image_filepath);
|
1201 |
-
|
1202 |
-
$success_images = true;
|
1203 |
-
if ( ! has_post_thumbnail($pid) )
|
1204 |
-
set_post_thumbnail($pid, $attid);
|
1205 |
-
else
|
1206 |
-
$gallery_attachment_ids[] = $attid;
|
1207 |
-
}
|
1208 |
-
}
|
1209 |
-
}
|
1210 |
-
}
|
1211 |
-
// Set product gallery images
|
1212 |
-
if ( $post_type == "product" and !empty($gallery_attachment_ids) )
|
1213 |
-
update_post_meta($pid, '_product_image_gallery', implode(',', $gallery_attachment_ids));
|
1214 |
-
// Create entry as Draft if no images are downloaded successfully
|
1215 |
-
if ( ! $success_images and "yes" == $this->options['create_draft'] ) $this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1216 |
|
1217 |
-
|
|
|
|
|
|
|
|
|
1218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1219 |
// Create entry as Draft if no images are downloaded successfully
|
1220 |
-
if ( "yes" == $this->options['create_draft'] )
|
1221 |
-
|
|
|
|
|
1222 |
}
|
1223 |
}
|
1224 |
// [/featured image]
|
@@ -1226,54 +1229,71 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1226 |
// [attachments]
|
1227 |
if ( ! empty($uploads) and false === $uploads['error'] and !empty($attachments[$i]) and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ($this->options['update_all_data'] == "no" and $this->options['is_update_attachments']))) {
|
1228 |
|
1229 |
-
|
1230 |
-
|
1231 |
-
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
1232 |
|
1233 |
-
|
1234 |
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
|
|
|
|
|
|
|
|
1238 |
|
1239 |
-
if (!
|
1240 |
-
foreach ($atchs as $atch_url) { if (empty($atch_url)) continue;
|
1241 |
|
1242 |
-
|
1243 |
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
$
|
1253 |
-
|
1254 |
-
|
1255 |
-
$
|
1256 |
-
|
1257 |
-
|
1258 |
|
1259 |
-
$
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
)
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
$logger and call_user_func($logger, __('
|
1271 |
-
$
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1277 |
}
|
1278 |
}
|
1279 |
}
|
@@ -1281,21 +1301,37 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1281 |
// [/attachments]
|
1282 |
|
1283 |
// [custom taxonomies]
|
1284 |
-
if (!empty($taxonomies)){
|
1285 |
|
1286 |
-
|
|
|
|
|
|
|
|
|
1287 |
|
1288 |
// Skip updating product attributes
|
1289 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1290 |
|
1291 |
if ( empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] )) {
|
|
|
|
|
|
|
|
|
|
|
|
|
1292 |
|
1293 |
if (!empty($articleData['ID'])){
|
1294 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1295 |
-
and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list']))
|
|
|
|
|
|
|
1296 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1297 |
-
and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list'])))
|
1298 |
-
|
|
|
|
|
|
|
1299 |
|
1300 |
$assign_taxes = array();
|
1301 |
|
@@ -1307,159 +1343,83 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1307 |
unset($existing_taxonomies[$tx_name][$i]);
|
1308 |
}
|
1309 |
|
1310 |
-
// create term if not exists
|
1311 |
-
if (!empty($txes[$i])):
|
1312 |
foreach ($txes[$i] as $key => $single_tax) {
|
1313 |
-
|
|
|
1314 |
|
1315 |
$parent_id = (!empty($single_tax['parent'])) ? pmxi_recursion_taxes($single_tax['parent'], $tx_name, $txes[$i], $key) : '';
|
1316 |
|
1317 |
$term = term_exists($single_tax['name'], $tx_name, (int)$parent_id);
|
1318 |
|
1319 |
if ( empty($term) and !is_wp_error($term) ){
|
1320 |
-
|
1321 |
$term = term_exists(htmlspecialchars($single_tax['name']), $tx_name, (int)$parent_id);
|
1322 |
-
if ( empty($term) and !is_wp_error($term) ){
|
1323 |
$term_attr = array('parent'=> (!empty($parent_id)) ? $parent_id : 0);
|
1324 |
$term = wp_insert_term(
|
1325 |
$single_tax['name'], // the term
|
1326 |
$tx_name, // the taxonomy
|
1327 |
$term_attr
|
1328 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1329 |
}
|
1330 |
-
}
|
1331 |
|
1332 |
if ( is_wp_error($term) ){
|
1333 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: `%s`', 'pmxi_plugin'), $term->get_error_message()));
|
1334 |
-
$logger and
|
1335 |
}
|
1336 |
-
elseif (!empty($term)) {
|
1337 |
$cat_id = $term['term_id'];
|
1338 |
if ($cat_id and $single_tax['assign'])
|
1339 |
{
|
1340 |
$term = get_term_by('id', $cat_id, $tx_name);
|
1341 |
-
if (!in_array($term->slug, $assign_taxes)) $assign_taxes[] = $term->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1342 |
}
|
1343 |
}
|
1344 |
}
|
1345 |
}
|
1346 |
endif;
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': '.$term_ids->get_error_message());
|
1352 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
1353 |
-
}
|
1354 |
-
}
|
1355 |
}
|
1356 |
}
|
1357 |
-
if (!empty($existing_taxonomies) and $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] and $this->options['update_categories_logic'] != 'full_update') {
|
|
|
1358 |
foreach ($existing_taxonomies as $tx_name => $txes) {
|
1359 |
// Skip updating product attributes
|
1360 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1361 |
|
1362 |
-
if (!empty($txes[$i]))
|
1363 |
-
$
|
1364 |
-
if (is_wp_error($term_ids)) {
|
1365 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': '.$term_ids->get_error_message());
|
1366 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
1367 |
-
}
|
1368 |
-
}
|
1369 |
}
|
1370 |
}
|
1371 |
}
|
1372 |
-
// [/custom taxonomies]
|
1373 |
-
|
1374 |
-
// [categories]
|
1375 |
-
if (!empty($cats[$i])) {
|
1376 |
-
|
1377 |
-
if ( empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] )) {
|
1378 |
-
|
1379 |
-
wp_set_object_terms( $pid, NULL, 'category' );
|
1380 |
-
|
1381 |
-
$is_update_cats = true;
|
1382 |
-
|
1383 |
-
if (!empty($articleData['ID'])){
|
1384 |
-
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1385 |
-
and is_array($this->options['taxonomies_list']) and in_array('category', $this->options['taxonomies_list'])) $is_update_cats = false;
|
1386 |
-
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1387 |
-
and is_array($this->options['taxonomies_list']) and ! in_array('category', $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))) $is_update_cats = false;
|
1388 |
-
}
|
1389 |
-
|
1390 |
-
if ($is_update_cats){
|
1391 |
-
$assign_cats = array();
|
1392 |
-
|
1393 |
-
if ($this->options['update_categories_logic'] == "add_new" and !empty($existing_cats[$i])){
|
1394 |
-
$assign_cats = $existing_cats[$i];
|
1395 |
-
unset($existing_cats[$i]);
|
1396 |
-
}
|
1397 |
-
elseif(!empty($existing_cats[$i])){
|
1398 |
-
unset($existing_cats[$i]);
|
1399 |
-
}
|
1400 |
-
|
1401 |
-
// create categories if it's doesn't exists
|
1402 |
-
foreach ($cats[$i] as $key => $single_cat) {
|
1403 |
-
|
1404 |
-
if (is_array($single_cat)){
|
1405 |
-
|
1406 |
-
$parent_id = (!empty($single_cat['parent'])) ? pmxi_recursion_taxes($single_cat['parent'], 'category', $cats[$i], $key) : '';
|
1407 |
-
|
1408 |
-
$term = term_exists($single_cat['name'], 'category', (int)$parent_id);
|
1409 |
-
|
1410 |
-
if ( empty($term) and ! is_wp_error($term) ){
|
1411 |
-
|
1412 |
-
$term = term_exists(htmlspecialchars($single_cat['name']), 'category', (int)$parent_id);
|
1413 |
-
|
1414 |
-
if ( empty($term) and ! is_wp_error($term) ){
|
1415 |
-
|
1416 |
-
$term = wp_insert_term(
|
1417 |
-
$single_cat['name'], // the term
|
1418 |
-
'category', // the taxonomy
|
1419 |
-
array('parent' => ((!empty($parent_id)) ? (int)$parent_id : 0))
|
1420 |
-
);
|
1421 |
-
|
1422 |
-
}
|
1423 |
-
}
|
1424 |
-
|
1425 |
-
if ( is_wp_error($term) ){
|
1426 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: `%s`', 'pmxi_plugin'), $term->get_error_message()));
|
1427 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
1428 |
-
}
|
1429 |
-
elseif ( ! empty($term) ) {
|
1430 |
-
$cat_id = $term['term_id'];
|
1431 |
-
if ($cat_id and $single_cat['assign'])
|
1432 |
-
{
|
1433 |
-
$term = get_term_by('id', $cat_id, 'category');
|
1434 |
-
if ( ! in_array($term->slug, $assign_cats)) $assign_cats[] = $term->slug;
|
1435 |
-
}
|
1436 |
-
}
|
1437 |
-
}
|
1438 |
-
}
|
1439 |
-
|
1440 |
-
// associate categories with post
|
1441 |
-
$cats_ids = wp_set_object_terms($pid, $assign_cats, 'category');
|
1442 |
-
if (is_wp_error($cats_ids)) {
|
1443 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': '.$cats_ids->get_error_message());
|
1444 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
1445 |
-
}
|
1446 |
-
}
|
1447 |
-
}
|
1448 |
-
}
|
1449 |
-
|
1450 |
-
if (!empty($existing_cats[$i]) and $this->options['update_all_data'] == "no" and (!$this->options['is_update_categories'] or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != 'full_update'))) {
|
1451 |
-
$cats_ids = wp_set_object_terms($pid, $existing_cats[$i], 'category');
|
1452 |
-
if (is_wp_error($cats_ids)) {
|
1453 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': '.$cats_ids->get_error_message());
|
1454 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['warnings'] = ++PMXI_Plugin::$session->data['pmxi_import']['warnings'];
|
1455 |
-
}
|
1456 |
-
}
|
1457 |
-
// [/categories]
|
1458 |
|
1459 |
if (empty($articleData['ID'])) {
|
1460 |
-
$logger and call_user_func($logger, sprintf(__('`%s`
|
1461 |
} else {
|
1462 |
-
$logger and call_user_func($logger, sprintf(__('`%s`
|
1463 |
}
|
1464 |
|
1465 |
// [addons import]
|
@@ -1483,21 +1443,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1483 |
}
|
1484 |
|
1485 |
// [/addons import]
|
1486 |
-
|
1487 |
do_action( 'pmxi_saved_post', $pid); // hook that was triggered immediately after post saved
|
1488 |
|
1489 |
if (empty($articleData['ID'])) $created++; else $updated++;
|
1490 |
|
1491 |
if ( ! $is_cron and "default" == $this->options['import_processing'] ){
|
1492 |
-
$processed_records = $created + $updated + $skipped + PMXI_Plugin::$session->
|
1493 |
$logger and call_user_func($logger, sprintf(__('<span class="processing_info"><span class="created_count">%s</span><span class="updated_count">%s</span><span class="percents_count">%s</span></span>', 'pmxi_plugin'), $created, $updated, ceil(($processed_records/$this->count) * 100)));
|
1494 |
}
|
1495 |
|
1496 |
}
|
1497 |
-
|
1498 |
do_action('pmxi_after_post_import', $this->id);
|
1499 |
|
1500 |
-
$logger and
|
1501 |
}
|
1502 |
|
1503 |
wp_cache_flush();
|
@@ -1506,21 +1466,22 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1506 |
'imported' => $created + $updated,
|
1507 |
'created' => $created,
|
1508 |
'updated' => $updated,
|
1509 |
-
'skipped' => $skipped
|
|
|
1510 |
))->update();
|
1511 |
|
1512 |
if ( ! $is_cron ){
|
1513 |
|
1514 |
-
|
1515 |
|
1516 |
-
$records_count = $this->created + $this->updated + $this->skipped + PMXI_Plugin::$session->
|
1517 |
|
1518 |
$is_import_complete = ($records_count == $this->count);
|
1519 |
|
1520 |
// Delete posts that are no longer present in your file
|
1521 |
if ( $is_import_complete and ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') {
|
1522 |
|
1523 |
-
$logger and call_user_func($logger, 'Removing previously imported posts which are no longer actual...');
|
1524 |
$postList = new PMXI_Post_List();
|
1525 |
|
1526 |
$missing_ids = array();
|
@@ -1535,25 +1496,32 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1535 |
// Instead of deletion, set Custom Field
|
1536 |
if ($this->options['is_update_missing_cf']){
|
1537 |
update_post_meta( $missingPost['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
|
|
1538 |
}
|
1539 |
|
1540 |
// Instead of deletion, change post status to Draft
|
1541 |
-
if ($this->options['set_missing_to_draft'])
|
|
|
|
|
|
|
1542 |
|
1543 |
// Delete posts that are no longer present in your file
|
1544 |
if ( ! $this->options['is_update_missing_cf'] and ! $this->options['set_missing_to_draft']){
|
1545 |
|
1546 |
// Remove attachments
|
|
|
1547 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPost['post_id'], true, 'files');
|
1548 |
// Remove images
|
|
|
1549 |
empty($this->options['is_keep_imgs']) and wp_delete_attachments($missingPost['post_id'], $this->options['download_images']);
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
|
|
1553 |
$missingRecord = new PMXI_Post_Record();
|
1554 |
$missingRecord->getById($missingPost['id'])->delete();
|
1555 |
}
|
1556 |
-
else {
|
1557 |
$sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id = " . $missingPost['post_id'] . " AND import_id = " . $missingPost['import_id'];
|
1558 |
$this->wpdb->query(
|
1559 |
$this->wpdb->prepare($sql, '')
|
@@ -1561,7 +1529,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1561 |
}
|
1562 |
|
1563 |
// Clear post's relationships
|
1564 |
-
wp_delete_object_term_relationships($missingPost['post_id'], get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
1565 |
|
1566 |
}
|
1567 |
|
@@ -1572,17 +1540,29 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1572 |
// Delete posts from database
|
1573 |
if (!empty($missing_ids) && is_array($missing_ids) and ! $this->options['is_update_missing_cf'] and ! $this->options['set_missing_to_draft']){
|
1574 |
|
|
|
1575 |
do_action('pmxi_delete_post', $missing_ids);
|
1576 |
|
1577 |
-
$
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1582 |
|
|
|
1583 |
$this->wpdb->query(
|
1584 |
$this->wpdb->prepare($sql, '')
|
1585 |
-
);
|
|
|
|
|
1586 |
}
|
1587 |
|
1588 |
}
|
@@ -1590,7 +1570,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1590 |
// Set out of stock status for missing records [Woocommerce add-on option]
|
1591 |
if ( $is_import_complete and empty($this->options['is_delete_missing']) and $post_type == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status'])) {
|
1592 |
|
1593 |
-
$logger and call_user_func($logger, 'Update stock status previously imported posts which are no longer actual...');
|
1594 |
$postList = new PMXI_Post_List();
|
1595 |
$missingPosts = $postList->getBy(array('import_id' => $this->id, 'iteration !=' => $this->iteration));
|
1596 |
if ( ! $missingPosts->isEmpty() ){
|
@@ -1604,7 +1584,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1604 |
|
1605 |
} catch (XmlImportException $e) {
|
1606 |
$logger and call_user_func($logger, __('<b>ERROR</b>', 'pmxi_plugin') . ': ' . $e->getMessage());
|
1607 |
-
$logger and
|
1608 |
}
|
1609 |
|
1610 |
$logger and $is_import_complete and call_user_func($logger, __('Cleaning temporary data...', 'pmxi_plugin'));
|
@@ -1616,8 +1596,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1616 |
$logger and call_user_func($logger, __('Deleting source XML file...', 'pmxi_plugin'));
|
1617 |
|
1618 |
// Delete chunks
|
1619 |
-
foreach (PMXI_Helper::safe_glob($uploads['
|
1620 |
-
|
|
|
1621 |
}
|
1622 |
|
1623 |
if ($this->type != "ftp"){
|
@@ -1654,6 +1635,41 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1654 |
|
1655 |
return $this;
|
1656 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1657 |
|
1658 |
public function _filter_has_cap_unfiltered_html($caps)
|
1659 |
{
|
@@ -1661,6 +1677,45 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1661 |
return $caps;
|
1662 |
}
|
1663 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1664 |
/**
|
1665 |
* Clear associations with posts
|
1666 |
* @param bool[optional] $keepPosts When set to false associated wordpress posts will be deleted as well
|
@@ -1672,25 +1727,36 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1672 |
if ( ! $keepPosts) {
|
1673 |
$ids = array();
|
1674 |
foreach ($post->getBy('import_id', $this->id)->convertRecords() as $p) {
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
|
|
|
|
1679 |
$ids[] = $p->post_id;
|
1680 |
}
|
1681 |
-
|
|
|
1682 |
|
1683 |
foreach ($ids as $id) {
|
1684 |
do_action('pmxi_delete_post', $id);
|
1685 |
-
wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
1686 |
}
|
1687 |
|
1688 |
-
$
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1694 |
|
1695 |
$this->wpdb->query(
|
1696 |
$this->wpdb->prepare($sql, '')
|
@@ -1711,18 +1777,43 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1711 |
public function deleteFiles() {
|
1712 |
$fileList = new PMXI_File_List();
|
1713 |
foreach($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {
|
1714 |
-
if ( @file_exists($f->path) )
|
|
|
|
|
1715 |
$f->delete();
|
1716 |
}
|
1717 |
return $this;
|
1718 |
}
|
1719 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1720 |
/**
|
1721 |
* @see parent::delete()
|
1722 |
* @param bool[optional] $keepPosts When set to false associated wordpress posts will be deleted as well
|
1723 |
*/
|
1724 |
public function delete($keepPosts = TRUE) {
|
1725 |
-
$this->deletePosts($keepPosts)->deleteFiles();
|
1726 |
|
1727 |
return parent::delete();
|
1728 |
}
|
4 |
|
5 |
public static $cdata = array();
|
6 |
|
7 |
+
protected $errors;
|
8 |
|
9 |
/**
|
10 |
* Some pre-processing logic, such as removing control characters from xml to prevent parsing errors
|
12 |
*/
|
13 |
public static function preprocessXml( & $xml) {
|
14 |
|
15 |
+
if ( empty(PMXI_Plugin::$session->is_csv) and empty(PMXI_Plugin::$is_csv)){
|
16 |
|
17 |
self::$cdata = array();
|
18 |
|
36 |
*/
|
37 |
public static function validateXml( & $xml, $errors = NULL) {
|
38 |
if (FALSE === $xml or '' == $xml) {
|
39 |
+
$errors and $errors->add('form-validation', __('WP All Import can\'t read your file.<br/><br/>Probably, you are trying to import an invalid XML feed. Try opening the XML feed in a web browser (Google Chrome is recommended for opening XML files) to see if there is an error message.<br/>Alternatively, run the feed through a validator: http://validator.w3.org/<br/>99% of the time, the reason for this error is because your XML feed isn\'t valid.<br/>If you are 100% sure you are importing a valid XML feed, please contact WP All Import support.', 'pmxi_plugin'));
|
40 |
} else {
|
41 |
|
42 |
PMXI_Import_Record::preprocessXml($xml);
|
64 |
}
|
65 |
}
|
66 |
else{
|
67 |
+
$errors and $errors->add('form-validation', __('Required PHP components are missing.', 'pmxi_plugin'));
|
68 |
+
$errors and $errors->add('form-validation', __('WP All Import requires the SimpleXML PHP module to be installed. This is a standard feature of PHP, and is necessary for WP All Import to read the files you are trying to import.<br/>Please contact your web hosting provider and ask them to install and activate the SimpleXML PHP module.', 'pmxi_plugin'));
|
69 |
}
|
70 |
}
|
71 |
return false;
|
79 |
parent::__construct($data);
|
80 |
$this->setTable(PMXI_Plugin::getInstance()->getTablePrefix() . 'imports');
|
81 |
$this->errors = new WP_Error();
|
82 |
+
}
|
83 |
|
84 |
+
public $post_meta_to_insert = array();
|
85 |
+
|
86 |
/**
|
87 |
* Perform import operation
|
88 |
* @param string $xml XML string to import
|
90 |
* @return PMXI_Import_Record
|
91 |
* @chainable
|
92 |
*/
|
93 |
+
public function process($xml, $logger = NULL, $chunk = false, $is_cron = false, $xpath_prefix = '', $loop = 0) {
|
|
|
94 |
add_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // do not perform special filtering for imported content
|
|
|
|
|
95 |
|
96 |
+
kses_remove_filters();
|
97 |
+
|
98 |
$cxpath = $xpath_prefix . $this->xpath;
|
99 |
|
100 |
$this->options += PMXI_Plugin::get_default_import_options(); // make sure all options are defined
|
101 |
|
102 |
$avoid_pingbacks = PMXI_Plugin::getInstance()->getOption('pingbacks');
|
103 |
|
104 |
+
$cron_sleep = (int) PMXI_Plugin::getInstance()->getOption('cron_sleep');
|
105 |
+
|
106 |
if ( $avoid_pingbacks and ! defined( 'WP_IMPORTING' ) ) define( 'WP_IMPORTING', true );
|
107 |
|
108 |
$postRecord = new PMXI_Post_Record();
|
116 |
try {
|
117 |
|
118 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', 'pmxi_plugin'));
|
119 |
+
if ( ! empty($this->options['title'])){
|
120 |
+
$titles = XmlImportParser::factory($xml, $cxpath, $this->options['title'], $file)->parse($records); $tmp_files[] = $file;
|
121 |
+
}
|
122 |
+
else{
|
123 |
+
$loop and $titles = array_fill(0, $loop, '');
|
124 |
+
}
|
125 |
|
126 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing excerpts...', 'pmxi_plugin'));
|
127 |
$post_excerpt = array();
|
128 |
+
if ( ! empty($this->options['post_excerpt']) ){
|
129 |
$post_excerpt = XmlImportParser::factory($xml, $cxpath, $this->options['post_excerpt'], $file)->parse($records); $tmp_files[] = $file;
|
130 |
}
|
131 |
else{
|
177 |
}
|
178 |
|
179 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing contents...', 'pmxi_plugin'));
|
180 |
+
if (!empty($this->options['content'])){
|
181 |
$contents = XmlImportParser::factory(
|
182 |
+
((!empty($this->options['is_keep_linebreaks']) and intval($this->options['is_keep_linebreaks'])) ? $xml : preg_replace('%\r\n?|\n%', ' ', $xml)),
|
183 |
$cxpath,
|
184 |
+
$this->options['content'],
|
185 |
$file)->parse($records
|
186 |
); $tmp_files[] = $file;
|
187 |
}
|
198 |
$time = strtotime($d);
|
199 |
if (FALSE === $time) {
|
200 |
in_array($d, $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'pmxi_plugin'), $warned[] = $d));
|
201 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
202 |
$time = time();
|
203 |
}
|
204 |
$dates[$i] = date('Y-m-d H:i:s', $time);
|
211 |
$time_start = strtotime($dates_start[$i]);
|
212 |
if (FALSE === $time_start) {
|
213 |
in_array($dates_start[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'pmxi_plugin'), $warned[] = $dates_start[$i]));
|
214 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
215 |
$time_start = time();
|
216 |
}
|
217 |
$time_end = strtotime($dates_end[$i]);
|
218 |
if (FALSE === $time_end) {
|
219 |
in_array($dates_end[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'pmxi_plugin'), $warned[] = $dates_end[$i]));
|
220 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
221 |
$time_end = time();
|
222 |
}
|
223 |
$dates[$i] = date('Y-m-d H:i:s', mt_rand($time_start, $time_end));
|
224 |
}
|
225 |
}
|
226 |
+
|
227 |
+
// [custom taxonomies]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
|
229 |
|
230 |
+
$taxonomies = array();
|
231 |
+
$exclude_taxonomies = (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type') : array('post_format');
|
232 |
+
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
233 |
+
if ( ! empty($post_taxonomies) ):
|
234 |
+
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $this->options['custom_type'] == "product")) continue;
|
235 |
+
$chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'pmxi_plugin'), $ctx->labels->name));
|
236 |
+
$tx_name = $ctx->name;
|
237 |
+
$mapping_rules = ( ! empty($this->options['tax_mapping'][$tx_name])) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
|
238 |
+
$taxonomies[$tx_name] = array();
|
239 |
+
if ( ! empty($this->options['tax_logic'][$tx_name]) ){
|
240 |
+
switch ($this->options['tax_logic'][$tx_name]){
|
241 |
+
case 'single':
|
242 |
+
if ( ! empty($this->options['tax_single_xpath'][$tx_name]) ){
|
243 |
+
$txes = XmlImportParser::factory($xml, $cxpath, str_replace('\'','"',$this->options['tax_single_xpath'][$tx_name]), $file)->parse($records); $tmp_files[] = $file;
|
244 |
+
foreach ($txes as $i => $tx) {
|
245 |
+
$taxonomies[$tx_name][$i][] = pmxi_ctx_mapping(array(
|
246 |
+
'name' => $tx,
|
247 |
+
'parent' => false,
|
248 |
+
'assign' => $this->options['tax_assing'][$tx_name],
|
249 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]))
|
250 |
+
), $mapping_rules, $tx_name);
|
251 |
+
}
|
252 |
+
}
|
253 |
+
break;
|
254 |
+
case 'multiple':
|
255 |
+
if ( ! empty($this->options['tax_multiple_xpath'][$tx_name]) ){
|
256 |
+
$txes = XmlImportParser::factory($xml, $cxpath, str_replace('\'','"',$this->options['tax_multiple_xpath'][$tx_name]), $file)->parse($records); $tmp_files[] = $file;
|
257 |
+
foreach ($txes as $i => $tx) {
|
258 |
+
$delimeted_taxonomies = explode( ! empty($this->options['tax_multiple_delim'][$tx_name]) ? $this->options['tax_multiple_delim'][$tx_name] : ',', $tx);
|
259 |
+
if ( ! empty($delimeted_taxonomies) ){
|
260 |
+
foreach ($delimeted_taxonomies as $cc) {
|
261 |
+
$taxonomies[$tx_name][$i][] = pmxi_ctx_mapping(array(
|
262 |
+
'name' => $cc,
|
263 |
+
'parent' => false,
|
264 |
+
'assign' => $this->options['tax_assing'][$tx_name],
|
265 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]))
|
266 |
+
), $mapping_rules, $tx_name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
}
|
268 |
}
|
269 |
}
|
270 |
}
|
271 |
+
break;
|
272 |
+
case 'hierarchical':
|
273 |
+
if ( ! empty($this->options['tax_hierarchical_logic'][$tx_name])){
|
274 |
+
switch ($this->options['tax_hierarchical_logic'][$tx_name]) {
|
275 |
+
case 'entire':
|
276 |
+
if (! empty($this->options['tax_hierarchical_xpath'][$tx_name])){
|
277 |
+
$txes = XmlImportParser::factory($xml, $cxpath, str_replace('\'','"',$this->options['tax_hierarchical_xpath'][$tx_name]), $file)->parse($records); $tmp_files[] = $file;
|
278 |
+
foreach ($txes as $i => $tx) {
|
279 |
+
$delimeted_taxonomies = explode( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',', $tx);
|
280 |
+
if ( ! empty($delimeted_taxonomies) ){
|
281 |
+
foreach ($delimeted_taxonomies as $j => $cc) {
|
282 |
+
$taxonomies[$tx_name][$i][] = pmxi_ctx_mapping(array(
|
283 |
+
'name' => $cc,
|
284 |
+
'parent' => (!empty($taxonomies[$tx_name][$i][$j - 1])) ? $taxonomies[$tx_name][$i][$j - 1] : false,
|
285 |
+
'assign' => $this->options['tax_assing'][$tx_name],
|
286 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]))
|
287 |
+
), $mapping_rules, $tx_name);
|
288 |
+
}
|
289 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
+
}
|
292 |
+
break;
|
293 |
+
case 'manual':
|
294 |
+
if ( ! empty($this->options['post_taxonomies'][$tx_name]) ){
|
295 |
+
$taxonomies_hierarchy = json_decode($this->options['post_taxonomies'][$tx_name], true);
|
296 |
+
|
297 |
+
foreach ($taxonomies_hierarchy as $k => $taxonomy){ if ("" == $taxonomy['xpath']) continue;
|
298 |
+
$txes_raw = XmlImportParser::factory($xml, $cxpath, str_replace('\'','"',$taxonomy['xpath']), $file)->parse($records); $tmp_files[] = $file;
|
299 |
+
$warned = array();
|
300 |
|
301 |
+
foreach ($txes_raw as $i => $cc) {
|
302 |
+
if (empty($taxonomies_hierarchy[$k]['txn_names'][$i])) $taxonomies_hierarchy[$k]['txn_names'][$i] = array();
|
303 |
+
if (empty($taxonomies[$tx_name][$i])) $taxonomies[$tx_name][$i] = array();
|
304 |
+
$count_cats = count($taxonomies[$tx_name][$i]);
|
305 |
+
|
306 |
+
if (!empty($taxonomy['parent_id'])) {
|
307 |
+
foreach ($taxonomies_hierarchy as $key => $value){
|
308 |
+
if ($value['item_id'] == $taxonomy['parent_id'] and !empty($value['txn_names'][$i])){
|
309 |
+
foreach ($value['txn_names'][$i] as $parent) {
|
310 |
+
$taxonomies[$tx_name][$i][] = pmxi_ctx_mapping(array(
|
311 |
+
'name' => trim($cc),
|
312 |
+
'parent' => $parent,
|
313 |
+
'assign' => $this->options['tax_assing'][$tx_name],
|
314 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]))
|
315 |
+
), $mapping_rules, $tx_name);
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
else {
|
321 |
+
$taxonomies[$tx_name][$i][] = pmxi_ctx_mapping(array(
|
322 |
+
'name' => trim($cc),
|
323 |
+
'parent' => false,
|
324 |
+
'assign' => $this->options['tax_assing'][$tx_name],
|
325 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]))
|
326 |
+
), $mapping_rules, $tx_name);
|
327 |
+
}
|
328 |
+
|
329 |
+
if ($count_cats < count($taxonomies[$tx_name][$i])) $taxonomies_hierarchy[$k]['txn_names'][$i][] = $taxonomies[$tx_name][$i][count($taxonomies[$tx_name][$i]) - 1];
|
330 |
+
}
|
331 |
+
}
|
332 |
+
}
|
333 |
+
break;
|
334 |
+
|
335 |
+
default:
|
336 |
+
|
337 |
+
break;
|
338 |
}
|
339 |
}
|
340 |
+
break;
|
341 |
+
|
342 |
+
default:
|
343 |
+
|
344 |
+
break;
|
345 |
}
|
346 |
}
|
347 |
+
endforeach;
|
348 |
+
endif;
|
349 |
+
// [/custom taxonomies]
|
350 |
|
351 |
+
// Composing featured images
|
352 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
353 |
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': ' . $uploads['error']);
|
354 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>: No featured images will be created. Uploads folder is not found.', 'pmxi_plugin'));
|
355 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
356 |
} else {
|
357 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for featured images...', 'pmxi_plugin'));
|
358 |
$featured_images = array();
|
359 |
+
if ( "no" == $this->options['download_images']){
|
360 |
+
if ($this->options['featured_image']) {
|
361 |
+
$featured_images = XmlImportParser::factory($xml, $cxpath, $this->options['featured_image'], $file)->parse($records); $tmp_files[] = $file;
|
362 |
+
} else {
|
363 |
+
count($titles) and $featured_images = array_fill(0, count($titles), '');
|
364 |
+
}
|
365 |
}
|
366 |
+
else{
|
367 |
+
if ($this->options['download_featured_image']) {
|
368 |
+
$featured_images = XmlImportParser::factory($xml, $cxpath, $this->options['download_featured_image'], $file)->parse($records); $tmp_files[] = $file;
|
369 |
+
} else {
|
370 |
+
count($titles) and $featured_images = array_fill(0, count($titles), '');
|
371 |
+
}
|
372 |
+
}
|
373 |
}
|
374 |
|
375 |
+
// Composing images meta titles
|
376 |
+
if ( $this->options['set_image_meta_title'] ){
|
|
|
|
|
|
|
377 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (titles)...', 'pmxi_plugin'));
|
378 |
$image_meta_titles = array();
|
379 |
|
382 |
} else {
|
383 |
count($titles) and $image_meta_titles = array_fill(0, count($titles), '');
|
384 |
}
|
385 |
+
}
|
386 |
|
387 |
+
// Composing images meta captions
|
388 |
+
if ( $this->options['set_image_meta_caption'] ){
|
389 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (captions)...', 'pmxi_plugin'));
|
390 |
$image_meta_captions = array();
|
391 |
if ($this->options['image_meta_caption']) {
|
393 |
} else {
|
394 |
count($titles) and $image_meta_captions = array_fill(0, count($titles), '');
|
395 |
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// Composing images meta alt text
|
399 |
+
if ( $this->options['set_image_meta_alt'] ){
|
400 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (alt text)...', 'pmxi_plugin'));
|
401 |
$image_meta_alts = array();
|
402 |
if ($this->options['image_meta_alt']) {
|
404 |
} else {
|
405 |
count($titles) and $image_meta_alts = array_fill(0, count($titles), '');
|
406 |
}
|
407 |
+
}
|
408 |
+
|
409 |
+
// Composing images meta description
|
410 |
+
if ( $this->options['set_image_meta_description'] ){
|
411 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (description)...', 'pmxi_plugin'));
|
412 |
$image_meta_descriptions = array();
|
413 |
if ($this->options['image_meta_description']) {
|
417 |
}
|
418 |
}
|
419 |
|
420 |
+
if ( "yes" == $this->options['download_images'] ){
|
421 |
+
// Composing images suffix
|
422 |
+
$chunk == 1 and $this->options['auto_rename_images'] and $logger and call_user_func($logger, __('Composing images suffix...', 'pmxi_plugin'));
|
423 |
+
$auto_rename_images = array();
|
424 |
+
if ( $this->options['auto_rename_images'] and ! empty($this->options['auto_rename_images_suffix'])){
|
425 |
+
$auto_rename_images = XmlImportParser::factory($xml, $cxpath, $this->options['auto_rename_images_suffix'], $file)->parse($records); $tmp_files[] = $file;
|
426 |
+
}
|
427 |
+
else{
|
428 |
+
count($titles) and $auto_rename_images = array_fill(0, count($titles), '');
|
429 |
+
}
|
430 |
+
|
431 |
+
// Composing images extensions
|
432 |
+
$chunk == 1 and $this->options['auto_set_extension'] and $logger and call_user_func($logger, __('Composing images extensions...', 'pmxi_plugin'));
|
433 |
+
$auto_extensions = array();
|
434 |
+
if ( $this->options['auto_set_extension'] and ! empty($this->options['new_extension'])){
|
435 |
+
$auto_extensions = XmlImportParser::factory($xml, $cxpath, $this->options['new_extension'], $file)->parse($records); $tmp_files[] = $file;
|
436 |
+
}
|
437 |
+
else{
|
438 |
+
count($titles) and $auto_extensions = array_fill(0, count($titles), '');
|
439 |
+
}
|
440 |
}
|
441 |
|
442 |
+
// Composing attachments
|
443 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
444 |
$logger and call_user_func($logger, __('<b>WARNING</b>', 'pmxi_plugin') . ': ' . $uploads['error']);
|
445 |
$logger and call_user_func($logger, __('<b>WARNING</b>: No attachments will be created', 'pmxi_plugin'));
|
446 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
447 |
} else {
|
448 |
$chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for attachments files...', 'pmxi_plugin'));
|
449 |
$attachments = array();
|
480 |
$chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'pmxi_plugin'));
|
481 |
|
482 |
if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
|
483 |
+
$post_type = $this->options['custom_type'];
|
484 |
} else {
|
485 |
$post_type = $this->options['type'];
|
486 |
}
|
487 |
|
488 |
+
$custom_type_details = get_post_type_object( $post_type );
|
489 |
+
|
490 |
$addons = array();
|
491 |
$addons_data = array();
|
492 |
|
493 |
// data parsing for WP All Import add-ons
|
494 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Data parsing via add-ons...', 'pmxi_plugin'));
|
495 |
$parsingData = array(
|
496 |
'import' => $this,
|
497 |
'count' => count($titles),
|
520 |
$specified_records = array();
|
521 |
|
522 |
if ($this->options['is_import_specified']) {
|
523 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Calculate specified records to import...', 'pmxi_plugin'));
|
524 |
foreach (preg_split('% *, *%', $this->options['import_specified'], -1, PREG_SPLIT_NO_EMPTY) as $chank) {
|
525 |
if (preg_match('%^(\d+)-(\d+)$%', $chank, $mtch)) {
|
526 |
$specified_records = array_merge($specified_records, range(intval($mtch[1]), intval($mtch[2])));
|
531 |
|
532 |
}
|
533 |
|
534 |
+
foreach ($titles as $i => $void) {
|
535 |
+
|
536 |
+
if ($is_cron and $cron_sleep) sleep($cron_sleep);
|
537 |
+
|
538 |
+
$logger and call_user_func($logger, __('---', 'pmxi_plugin'));
|
539 |
+
$logger and call_user_func($logger, sprintf(__('Record #%s', 'pmxi_plugin'), $this->imported + $i + 1));
|
540 |
|
541 |
wp_cache_flush();
|
542 |
|
543 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_before_post_import ...', 'pmxi_plugin'));
|
544 |
do_action('pmxi_before_post_import', $this->id);
|
545 |
|
546 |
+
if ( empty($titles[$i]) ) {
|
547 |
+
if ( ! empty($addons_data['PMWI_Plugin']) and !empty($addons_data['PMWI_Plugin']['single_product_parent_ID'][$i]) ){
|
548 |
$titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
|
549 |
+
}
|
550 |
else{
|
551 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>: title is empty.', 'pmxi_plugin'));
|
552 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
|
|
|
|
|
|
|
|
553 |
}
|
554 |
}
|
555 |
|
556 |
+
if ( $this->options['custom_type'] == 'import_users' ){
|
557 |
+
$articleData = array(
|
558 |
+
'user_pass' => $addons_data['PMUI_Plugin']['pmui_pass'][$i],
|
559 |
+
'user_login' => $addons_data['PMUI_Plugin']['pmui_logins'][$i],
|
560 |
+
'user_nicename' => $addons_data['PMUI_Plugin']['pmui_nicename'][$i],
|
561 |
+
'user_url' => $addons_data['PMUI_Plugin']['pmui_url'][$i],
|
562 |
+
'user_email' => $addons_data['PMUI_Plugin']['pmui_email'][$i],
|
563 |
+
'display_name' => $addons_data['PMUI_Plugin']['pmui_display_name'][$i],
|
564 |
+
'user_registered' => $addons_data['PMUI_Plugin']['pmui_registered'][$i],
|
565 |
+
'first_name' => $addons_data['PMUI_Plugin']['pmui_first_name'][$i],
|
566 |
+
'last_name' => $addons_data['PMUI_Plugin']['pmui_last_name'][$i],
|
567 |
+
'description' => $addons_data['PMUI_Plugin']['pmui_description'][$i],
|
568 |
+
'nickname' => $addons_data['PMUI_Plugin']['pmui_nickname'][$i],
|
569 |
+
'role' => ('' == $addons_data['PMUI_Plugin']['pmui_role'][$i]) ? 'subscriber' : $addons_data['PMUI_Plugin']['pmui_role'][$i],
|
570 |
+
);
|
571 |
+
$logger and call_user_func($logger, sprintf(__('Combine all data for user %s...', 'pmxi_plugin'), $articleData['user_login']));
|
572 |
+
}
|
573 |
+
else {
|
574 |
+
$articleData = array(
|
575 |
+
'post_type' => $post_type,
|
576 |
+
'post_status' => ("xpath" == $this->options['status']) ? $post_status[$i] : $this->options['status'],
|
577 |
+
'comment_status' => $this->options['comment_status'],
|
578 |
+
'ping_status' => $this->options['ping_status'],
|
579 |
+
'post_title' => (!empty($this->options['is_leave_html'])) ? html_entity_decode($titles[$i]) : $titles[$i],
|
580 |
+
'post_excerpt' => apply_filters('pmxi_the_excerpt', ((!empty($this->options['is_leave_html'])) ? html_entity_decode($post_excerpt[$i]) : $post_excerpt[$i]), $this->id),
|
581 |
+
'post_name' => $post_slug[$i],
|
582 |
+
'post_content' => apply_filters('pmxi_the_content', ((!empty($this->options['is_leave_html'])) ? html_entity_decode($contents[$i]) : $contents[$i]), $this->id),
|
583 |
+
'post_date' => $dates[$i],
|
584 |
+
'post_date_gmt' => get_gmt_from_date($dates[$i]),
|
585 |
+
'post_author' => $post_author[$i],
|
586 |
+
'menu_order' => (int) $menu_order[$i],
|
587 |
+
'post_parent' => (int) $this->options['parent']
|
588 |
+
);
|
589 |
+
$logger and call_user_func($logger, sprintf(__('Combine all data for post `%s`...', 'pmxi_plugin'), $articleData['post_title']));
|
590 |
+
}
|
591 |
|
592 |
// Re-import Records Matching
|
593 |
$post_to_update = false; $post_to_update_id = false;
|
594 |
|
595 |
// if Auto Matching re-import option selected
|
596 |
+
if ( "manual" != $this->options['duplicate_matching'] ){
|
597 |
|
598 |
+
// find corresponding article among previously imported
|
599 |
+
$logger and call_user_func($logger, sprintf(__('Find corresponding article among previously imported for post `%s`...', 'pmxi_plugin'), $articleData['post_title']));
|
600 |
$postRecord->clear();
|
601 |
$postRecord->getBy(array(
|
602 |
'unique_key' => $unique_keys[$i],
|
603 |
'import_id' => $this->id,
|
604 |
));
|
605 |
|
606 |
+
if ( ! $postRecord->isEmpty() ) {
|
607 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post was founded for post %s with unique key `%s`...', 'pmxi_plugin'), $articleData['post_title'], $unique_keys[$i]));
|
608 |
+
if ( $this->options['custom_type'] == 'import_users'){
|
609 |
+
$post_to_update = get_user_by('id', $post_to_update_id = $postRecord->post_id);
|
610 |
+
}
|
611 |
+
else{
|
612 |
+
$post_to_update = get_post($post_to_update_id = $postRecord->post_id);
|
613 |
+
}
|
614 |
+
}
|
615 |
+
else{
|
616 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'t founded with unique key `%s`...', 'pmxi_plugin'), $unique_keys[$i]));
|
617 |
+
}
|
618 |
|
619 |
// if Manual Matching re-import option seleted
|
620 |
} else {
|
626 |
else{
|
627 |
count($titles) and $custom_duplicate_name = $custom_duplicate_value = array_fill(0, count($titles), '');
|
628 |
}
|
629 |
+
|
630 |
+
$logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'pmxi_plugin'), $articleData['post_title']));
|
631 |
// handle duplicates according to import settings
|
632 |
if ($duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'])) {
|
633 |
+
$duplicate_id = array_shift($duplicates);
|
634 |
+
if ($duplicate_id) {
|
635 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post was founded for post `%s`...', 'pmxi_plugin'), $articleData['post_title']));
|
636 |
+
if ( $this->options['custom_type'] == 'import_users'){
|
637 |
+
$post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
|
638 |
+
}
|
639 |
+
else{
|
640 |
+
$post_to_update = get_post($post_to_update_id = $duplicate_id);
|
641 |
+
}
|
642 |
+
}
|
643 |
+
else{
|
644 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'n founded for post `%s`...', 'pmxi_plugin'), $articleData['post_title']));
|
645 |
+
}
|
646 |
}
|
647 |
}
|
648 |
|
649 |
+
if ( ! empty($specified_records) ) {
|
650 |
|
651 |
if ( ! in_array($created + $updated + $skipped + 1, $specified_records) ){
|
652 |
|
654 |
|
655 |
$skipped++;
|
656 |
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'pmxi_plugin'));
|
657 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
658 |
+
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
659 |
+
PMXI_Plugin::$session->save_data();
|
660 |
continue;
|
661 |
}
|
662 |
}
|
664 |
// Duplicate record is founded
|
665 |
if ($post_to_update){
|
666 |
|
667 |
+
//$logger and call_user_func($logger, sprintf(__('Duplicate record is founded for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
668 |
+
|
669 |
// Do not update already existing records option selected
|
670 |
if ("yes" == $this->options['is_keep_former_posts']) {
|
671 |
|
675 |
|
676 |
$skipped++;
|
677 |
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
678 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
679 |
+
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
680 |
+
PMXI_Plugin::$session->save_data();
|
681 |
continue;
|
682 |
}
|
683 |
|
684 |
$articleData['ID'] = $post_to_update_id;
|
685 |
// Choose which data to update
|
686 |
if ( $this->options['update_all_data'] == 'no' ){
|
687 |
+
|
688 |
+
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
689 |
+
|
690 |
+
// preserve date of already existing article when duplicate is found
|
691 |
+
if ( ! $this->options['is_update_categories'] or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
|
692 |
+
$logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
693 |
+
$existing_taxonomies = array();
|
694 |
+
foreach (array_keys($taxonomies) as $tx_name) {
|
695 |
+
$txes_list = get_the_terms($articleData['ID'], $tx_name);
|
696 |
+
if (is_wp_error($txes_list)) {
|
697 |
+
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to get current taxonomies for article #%d, updating with those read from XML file', 'pmxi_plugin'), $articleData['ID']));
|
698 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
699 |
} else {
|
700 |
+
$txes_new = array();
|
701 |
+
if (!empty($txes_list)):
|
702 |
+
foreach ($txes_list as $t) {
|
703 |
+
$txes_new[] = $t->term_taxonomy_id;
|
704 |
+
}
|
705 |
+
endif;
|
706 |
+
$existing_taxonomies[$tx_name][$i] = $txes_new;
|
707 |
}
|
708 |
+
}
|
709 |
+
}
|
710 |
+
|
711 |
+
if ( ! $this->options['is_update_dates']) { // preserve date of already existing article when duplicate is found
|
712 |
+
$articleData['post_date'] = $post_to_update->post_date;
|
713 |
+
$articleData['post_date_gmt'] = $post_to_update->post_date_gmt;
|
714 |
+
$logger and call_user_func($logger, sprintf(__('Preserve date of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
715 |
+
}
|
716 |
+
if ( ! $this->options['is_update_status']) { // preserve status and trashed flag
|
717 |
+
$articleData['post_status'] = $post_to_update->post_status;
|
718 |
+
$logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
719 |
+
}
|
720 |
+
if ( ! $this->options['is_update_content']){
|
721 |
+
$articleData['post_content'] = $post_to_update->post_content;
|
722 |
+
$logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
723 |
+
}
|
724 |
+
if ( ! $this->options['is_update_title']){
|
725 |
+
$articleData['post_title'] = $post_to_update->post_title;
|
726 |
+
$logger and call_user_func($logger, sprintf(__('Preserve title of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
727 |
+
}
|
728 |
+
if ( ! $this->options['is_update_slug']){
|
729 |
+
$articleData['post_name'] = $post_to_update->post_name;
|
730 |
+
$logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
731 |
+
}
|
732 |
+
if ( ! $this->options['is_update_excerpt']){
|
733 |
+
$articleData['post_excerpt'] = $post_to_update->post_excerpt;
|
734 |
+
$logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
735 |
+
}
|
736 |
+
if ( ! $this->options['is_update_menu_order']){
|
737 |
+
$articleData['menu_order'] = $post_to_update->menu_order;
|
738 |
+
$logger and call_user_func($logger, sprintf(__('Preserve menu order of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
739 |
+
}
|
740 |
+
if ( ! $this->options['is_update_parent']){
|
741 |
+
$articleData['post_parent'] = $post_to_update->post_parent;
|
742 |
+
$logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
743 |
+
}
|
744 |
+
if ( ! $this->options['is_update_author']){
|
745 |
+
$articleData['post_author'] = $post_to_update->post_author;
|
746 |
+
$logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
747 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
748 |
}
|
749 |
+
else {
|
750 |
+
if ( ! $this->options['is_update_first_name'] ) $articleData['first_name'] = $post_to_update->first_name;
|
751 |
+
if ( ! $this->options['is_update_last_name'] ) $articleData['last_name'] = $post_to_update->last_name;
|
752 |
+
if ( ! $this->options['is_update_role'] ) unset($articleData['role']);
|
753 |
+
if ( ! $this->options['is_update_nickname'] ) $articleData['nickname'] = get_user_meta($post_to_update->ID, 'nickname', true);
|
754 |
+
if ( ! $this->options['is_update_description'] ) $articleData['description'] = get_user_meta($post_to_update->ID, 'description', true);
|
755 |
+
if ( ! $this->options['is_update_login'] ) $articleData['user_login'] = $post_to_update->user_login;
|
756 |
+
if ( ! $this->options['is_update_password'] ) unset($articleData['user_pass']);
|
757 |
+
if ( ! $this->options['is_update_nicename'] ) $articleData['user_nicename'] = $post_to_update->user_nicename;
|
758 |
+
if ( ! $this->options['is_update_email'] ) $articleData['user_email'] = $post_to_update->user_email;
|
759 |
+
if ( ! $this->options['is_update_registered'] ) $articleData['user_registered'] = $post_to_update->user_registered;
|
760 |
+
if ( ! $this->options['is_update_display_name'] ) $articleData['display_name'] = $post_to_update->display_name;
|
761 |
+
if ( ! $this->options['is_update_url'] ) $articleData['user_url'] = $post_to_update->user_url;
|
762 |
}
|
763 |
+
|
764 |
+
$logger and call_user_func($logger, sprintf(__('Applying filter `pmxi_article_data` for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
765 |
$articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update);
|
766 |
|
767 |
}
|
768 |
+
|
769 |
+
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
770 |
+
|
771 |
+
if ( $this->options['update_all_data'] == 'yes' or ( $this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
|
772 |
+
$logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
773 |
+
wp_delete_attachments($articleData['ID'], true, 'files');
|
774 |
+
}
|
775 |
+
// handle obsolete attachments (i.e. delete or keep) according to import settings
|
776 |
+
if ( $this->options['update_all_data'] == 'yes' or ( $this->options['update_all_data'] == 'no' and $this->options['is_update_images'] and $this->options['update_images_logic'] == "full_update")){
|
777 |
+
$logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
778 |
+
wp_delete_attachments($articleData['ID'], $this->options['download_images'], 'images');
|
779 |
+
}
|
780 |
+
|
781 |
}
|
782 |
}
|
783 |
elseif ( ! $postRecord->isEmpty() ){
|
784 |
|
785 |
// existing post not found though it's track was found... clear the leftover, plugin will continue to treat record as new
|
786 |
+
$postRecord->clear();
|
787 |
|
788 |
}
|
789 |
|
793 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
794 |
|
795 |
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by do not create new posts option.', 'pmxi_plugin'));
|
796 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
797 |
+
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
798 |
$skipped++;
|
799 |
+
PMXI_Plugin::$session->save_data();
|
800 |
continue;
|
801 |
}
|
802 |
|
865 |
$dest->insert();
|
866 |
} else {
|
867 |
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to create cloaked link for %s', 'pmxi_plugin'), $url));
|
868 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
869 |
$link = NULL;
|
870 |
}
|
871 |
}
|
877 |
}
|
878 |
}
|
879 |
|
880 |
+
// insert article being imported
|
881 |
+
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
882 |
+
if (empty($articleData['ID'])){
|
883 |
+
$logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', 'pmxi_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
|
884 |
+
}
|
885 |
+
else{
|
886 |
+
$logger and call_user_func($logger, sprintf(__('<b>UPDATING</b> `%s` `%s`', 'pmxi_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
|
887 |
+
}
|
888 |
+
|
889 |
+
$pid = ($this->options['is_fast_mode']) ? pmxi_insert_post($articleData, true) : wp_insert_post($articleData, true);
|
890 |
+
}
|
891 |
+
else{
|
892 |
+
$pid = (empty($articleData['ID'])) ? wp_insert_user( $articleData ) : wp_update_user( $articleData );
|
893 |
+
$articleData['post_title'] = $articleData['user_login'];
|
894 |
+
}
|
895 |
|
896 |
if (is_wp_error($pid)) {
|
897 |
$logger and call_user_func($logger, __('<b>ERROR</b>', 'pmxi_plugin') . ': ' . $pid->get_error_message());
|
898 |
+
$logger and !$is_cron and PMXI_Plugin::$session->errors++;
|
899 |
} else {
|
900 |
|
901 |
if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
|
908 |
))->insert();
|
909 |
|
910 |
$postRecord->set(array('iteration' => $this->iteration))->update();
|
911 |
+
|
912 |
+
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with current import ...', 'pmxi_plugin'), $articleData['post_title']));
|
913 |
}
|
914 |
|
915 |
// [post format]
|
916 |
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ){
|
917 |
+
set_post_format($pid, $this->options['post_format'] );
|
918 |
+
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', 'pmxi_plugin'), $articleData['post_title'], (!empty($this->options['post_format'])) ? $this->options['post_format'] : 'Standart'));
|
919 |
}
|
920 |
// [/post format]
|
921 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
922 |
// [addons import]
|
923 |
|
924 |
// prepare data for import
|
943 |
if (function_exists($import_func)) call_user_func($import_func, $importData, $addons_data[$class]);
|
944 |
}
|
945 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
|
947 |
// [/addons import]
|
948 |
|
950 |
if ('post' != $articleData['post_type'] and !empty($this->options['page_template'])) update_post_meta($pid, '_wp_page_template', $this->options['page_template']);
|
951 |
|
952 |
// [featured image]
|
953 |
+
if ( ! empty($uploads) and false === $uploads['error'] and $articleData['post_type'] == "product" and class_exists('PMWI_Plugin') and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_images']))) {
|
954 |
|
955 |
if (!empty($featured_images[$i])){
|
|
|
|
|
|
|
|
|
|
|
956 |
|
957 |
+
$targetDir = $uploads['path'];
|
958 |
+
$targetUrl = $uploads['url'];
|
959 |
+
|
960 |
+
$logger and call_user_func($logger, __('<b>IMAGES:</b>', 'pmxi_plugin'));
|
961 |
+
|
962 |
+
if ( ! @is_writable($targetDir) ){
|
963 |
+
|
964 |
+
$logger and call_user_func($logger, sprintf(__('<b>ERROR</b>: Target directory %s is not writable', 'pmxi_plugin'), $targetDir));
|
965 |
+
|
966 |
+
}
|
967 |
+
else{
|
968 |
+
|
969 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
970 |
+
|
971 |
+
$success_images = false;
|
972 |
+
$gallery_attachment_ids = array();
|
973 |
+
$imgs = array();
|
974 |
+
|
975 |
+
$featured_delim = ( "yes" == $this->options['download_images'] ) ? $this->options['download_featured_delim'] : $this->options['featured_delim'];
|
976 |
+
|
977 |
+
$line_imgs = explode("\n", $featured_images[$i]);
|
978 |
+
if ( ! empty($line_imgs) )
|
979 |
+
foreach ($line_imgs as $line_img)
|
980 |
+
$imgs = array_merge($imgs, ( ! empty($featured_delim) ) ? str_getcsv($line_img, $featured_delim) : array($line_img) );
|
981 |
+
|
982 |
+
if (!empty($imgs)) {
|
983 |
+
|
984 |
+
if ( $this->options['set_image_meta_title'] ){
|
985 |
+
$img_titles = array();
|
986 |
+
$line_img_titles = explode("\n", $image_meta_titles[$i]);
|
987 |
+
if ( ! empty($line_img_titles) )
|
988 |
+
foreach ($line_img_titles as $line_img_title)
|
989 |
+
$img_titles = array_merge($img_titles, ( ! empty($this->options['image_meta_title_delim']) ) ? str_getcsv($line_img_title, $this->options['image_meta_title_delim']) : array($line_img_title) );
|
990 |
+
|
991 |
+
}
|
992 |
+
if ( $this->options['set_image_meta_caption'] ){
|
993 |
+
$img_captions = array();
|
994 |
+
$line_img_captions = explode("\n", $image_meta_captions[$i]);
|
995 |
+
if ( ! empty($line_img_captions) )
|
996 |
+
foreach ($line_img_captions as $line_img_caption)
|
997 |
+
$img_captions = array_merge($img_captions, ( ! empty($this->options['image_meta_caption_delim']) ) ? str_getcsv($line_img_caption, $this->options['image_meta_caption_delim']) : array($line_img_caption) );
|
998 |
+
|
999 |
+
}
|
1000 |
+
if ( $this->options['set_image_meta_alt'] ){
|
1001 |
+
$img_alts = array();
|
1002 |
+
$line_img_alts = explode("\n", $image_meta_alts[$i]);
|
1003 |
+
if ( ! empty($line_img_alts) )
|
1004 |
+
foreach ($line_img_alts as $line_img_alt)
|
1005 |
+
$img_alts = array_merge($img_alts, ( ! empty($this->options['image_meta_alt_delim']) ) ? str_getcsv($line_img_alt, $this->options['image_meta_alt_delim']) : array($line_img_alt) );
|
1006 |
+
|
1007 |
+
}
|
1008 |
+
if ( $this->options['set_image_meta_description'] ){
|
1009 |
+
$img_descriptions = array();
|
1010 |
+
$line_img_descriptions = explode("\n", $image_meta_alts[$i]);
|
1011 |
+
if ( ! empty($line_img_descriptions) )
|
1012 |
+
foreach ($line_img_descriptions as $line_img_description)
|
1013 |
+
$img_descriptions = array_merge($img_descriptions, ( ! empty($this->options['image_meta_description_delim']) ) ? str_getcsv($line_img_description, $this->options['image_meta_description_delim']) : array($line_img_description) );
|
1014 |
+
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
foreach ($imgs as $k => $img_url) { if (empty($img_url)) continue;
|
1018 |
+
|
1019 |
+
$url = str_replace(" ", "%20", trim($img_url));
|
1020 |
+
$bn = preg_replace('/[\\?|&].*/', '', basename($url));
|
1021 |
|
1022 |
+
if ( "yes" == $this->options['download_images'] and ! empty($auto_extensions[$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions[$i])){
|
1023 |
+
$img_ext = $auto_extensions[$i];
|
1024 |
+
}
|
1025 |
+
else {
|
1026 |
+
$img_ext = pmxi_getExtensionFromStr($url);
|
1027 |
+
$default_extension = pmxi_getExtension($bn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1028 |
|
1029 |
+
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
1030 |
}
|
1031 |
|
1032 |
+
$logger and call_user_func($logger, sprintf(__('- Importing image `%s` for `%s` ...', 'pmxi_plugin'), $img_url, $articleData['post_title']));
|
1033 |
|
1034 |
+
// generate local file name
|
1035 |
+
$image_name = urldecode(($this->options['auto_rename_images'] and "" != $auto_rename_images[$i]) ? sanitize_file_name(($img_ext) ? str_replace("." . $default_extension, "", $auto_rename_images[$i]) : $auto_rename_images[$i]) : sanitize_file_name((($img_ext) ? str_replace("." . $default_extension, "", $bn) : $bn))) . (("" != $img_ext) ? '.' . $img_ext : '');
|
1036 |
+
|
1037 |
+
// if wizard store image data to custom field
|
1038 |
+
$create_image = false;
|
1039 |
+
$download_image = true;
|
1040 |
+
|
1041 |
+
if (base64_decode($url, true) !== false){
|
1042 |
+
$img = @imagecreatefromstring(base64_decode($url));
|
1043 |
+
if($img)
|
1044 |
+
{
|
1045 |
+
$logger and call_user_func($logger, __('- Founded base64_encoded image', 'pmxi_plugin'));
|
1046 |
+
|
1047 |
+
$image_filename = md5(time()) . '.jpg';
|
1048 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
1049 |
+
imagejpeg($img, $image_filepath);
|
1050 |
+
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1051 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'pmxi_plugin'), $image_filepath));
|
1052 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1053 |
+
} else {
|
1054 |
+
$create_image = true;
|
1055 |
+
}
|
1056 |
+
}
|
1057 |
+
}
|
1058 |
+
else {
|
1059 |
+
|
1060 |
+
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1061 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
1062 |
+
|
1063 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` will be saved with name `%s` ...', 'pmxi_plugin'), $img_url, $image_filename));
|
1064 |
|
1065 |
+
// keep existing and add newest images
|
1066 |
+
if ( ! empty($articleData['ID']) and $this->options['is_update_images'] and $this->options['update_images_logic'] == "add_new" and $this->options['update_all_data'] == "no"){
|
|
|
|
|
1067 |
|
1068 |
+
$logger and call_user_func($logger, __('- Keep existing and add newest images ...', 'pmxi_plugin'));
|
1069 |
+
|
1070 |
+
$attachment_imgs = get_posts( array(
|
1071 |
+
'post_type' => 'attachment',
|
1072 |
+
'posts_per_page' => -1,
|
1073 |
+
'post_parent' => $pid,
|
1074 |
+
) );
|
1075 |
+
|
1076 |
+
if ( $attachment_imgs ) {
|
1077 |
+
foreach ( $attachment_imgs as $attachment_img ) {
|
1078 |
+
if ($attachment_img->guid == $targetUrl . '/' . $image_name){
|
1079 |
+
$download_image = false;
|
1080 |
+
$success_images = true;
|
1081 |
+
if ( ! has_post_thumbnail($pid) and $this->options['is_featured'] )
|
1082 |
+
set_post_thumbnail($pid, $attachment_img->ID);
|
1083 |
+
elseif ( ! in_array($attachment_img->ID, $gallery_attachment_ids))
|
1084 |
+
$gallery_attachment_ids[] = $attachment_img->ID;
|
1085 |
+
|
1086 |
+
$logger and call_user_func($logger, sprintf(__('- <b>Image SKIPPED</b>: The image %s is always exists for the `%s`', 'pmxi_plugin'), basename($attachment_img->guid), $articleData['post_title']));
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
}
|
1090 |
|
1091 |
+
}
|
|
|
1092 |
|
1093 |
+
if ($download_image){
|
|
|
|
|
|
|
1094 |
|
1095 |
+
// do not download images
|
1096 |
+
if ( "yes" != $this->options['download_images'] ){
|
1097 |
|
1098 |
+
$logger and call_user_func($logger, sprintf(__('- Trying to find existing image for `%s` in attachments ...', 'pmxi_plugin'), $image_filename));
|
1099 |
+
|
1100 |
+
$image_filename = $image_name;
|
1101 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
1102 |
+
|
1103 |
+
|
1104 |
+
$wpai_uploads = $uploads['basedir'] . '/wpallimport/files/';
|
1105 |
+
$wpai_image_path = $wpai_uploads . $image_name;
|
1106 |
+
|
1107 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` in `%s` folder', 'pmxi_plugin'), $wpai_image_path, $wpai_uploads));
|
1108 |
+
|
1109 |
+
if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
|
1110 |
$download_image = false;
|
1111 |
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1112 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'pmxi_plugin'), $image_filepath));
|
1113 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1114 |
@unlink($image_filepath);
|
1115 |
} else {
|
1116 |
$create_image = true;
|
1117 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully founded', 'pmxi_plugin'), $wpai_image_path));
|
1118 |
}
|
1119 |
+
}
|
1120 |
+
}
|
|
|
1121 |
|
1122 |
+
if ($download_image){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1123 |
|
1124 |
+
$logger and call_user_func($logger, sprintf(__('- Downloading image from `%s`', 'pmxi_plugin'), $url));
|
1125 |
+
|
1126 |
$request = get_file_curl($url, $image_filepath);
|
1127 |
|
1128 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
1129 |
+
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1130 |
+
} elseif( ($image_info = @getimagesize($image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1131 |
+
$create_image = true;
|
1132 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'pmxi_plugin'), $url));
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
if ( ! $create_image ){
|
1136 |
+
|
1137 |
+
$url = str_replace(" ", "%20", trim(pmxi_convert_encoding($img_url)));
|
1138 |
+
|
1139 |
+
$request = get_file_curl($url, $image_filepath);
|
1140 |
+
|
1141 |
+
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
1142 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s cannot be saved locally as %s', 'pmxi_plugin'), $url, $image_filepath));
|
1143 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1144 |
+
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1145 |
+
} elseif( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1146 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'pmxi_plugin'), $url));
|
1147 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1148 |
+
@unlink($image_filepath);
|
1149 |
+
} else {
|
1150 |
+
$create_image = true;
|
1151 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'pmxi_plugin'), $url));
|
1152 |
+
}
|
1153 |
}
|
1154 |
}
|
1155 |
}
|
1156 |
}
|
|
|
1157 |
|
1158 |
+
if ($create_image){
|
1159 |
+
|
1160 |
+
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for image `%s`', 'pmxi_plugin'), $targetUrl . '/' . $image_filename));
|
1161 |
+
|
1162 |
+
$attachment = array(
|
1163 |
+
'post_mime_type' => image_type_to_mime_type($image_info[2]),
|
1164 |
+
'guid' => $targetUrl . '/' . $image_filename,
|
1165 |
+
'post_title' => $image_filename,
|
1166 |
+
'post_content' => '',
|
1167 |
+
'post_author' => $post_author[$i],
|
1168 |
+
);
|
1169 |
+
if (($image_meta = wp_read_image_metadata($image_filepath))) {
|
1170 |
+
if (trim($image_meta['title']) && ! is_numeric(sanitize_title($image_meta['title'])))
|
1171 |
+
$attachment['post_title'] = $image_meta['title'];
|
1172 |
+
if (trim($image_meta['caption']))
|
1173 |
+
$attachment['post_content'] = $image_meta['caption'];
|
1174 |
+
}
|
1175 |
|
1176 |
+
$attid = ($this->options['is_fast_mode']) ? pmxi_insert_attachment($attachment, $image_filepath, $pid) : wp_insert_attachment($attachment, $image_filepath, $pid);
|
1177 |
|
1178 |
+
if (is_wp_error($attid)) {
|
1179 |
+
$logger and call_user_func($logger, __('- <b>WARNING</b>', 'pmxi_plugin') . ': ' . $attid->get_error_message());
|
1180 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1181 |
+
} else {
|
1182 |
+
// you must first include the image.php file
|
1183 |
+
// for the function wp_generate_attachment_metadata() to work
|
1184 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
1185 |
+
wp_update_attachment_metadata($attid, wp_generate_attachment_metadata($attid, $image_filepath));
|
1186 |
+
|
|
|
1187 |
$update_attachment_meta = array();
|
1188 |
+
if ( $this->options['set_image_meta_title'] and ! empty($img_titles[$k]) ) $update_attachment_meta['post_title'] = $img_titles[$k];
|
1189 |
+
if ( $this->options['set_image_meta_caption'] and ! empty($img_captions[$k]) ) $update_attachment_meta['post_excerpt'] = $img_captions[$k];
|
1190 |
+
if ( $this->options['set_image_meta_description'] and ! empty($img_descriptions[$k]) ) $update_attachment_meta['post_content'] = $img_descriptions[$k];
|
1191 |
+
if ( $this->options['set_image_meta_alt'] and ! empty($img_alts[$k]) ) update_post_meta($attid, '_wp_attachment_image_alt', $img_alts[$k]);
|
1192 |
|
1193 |
if ( ! empty($update_attachment_meta)) $this->wpdb->update( $this->wpdb->posts, $update_attachment_meta, array('ID' => $attid) );
|
1194 |
|
1195 |
+
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_gallery_image', 'pmxi_plugin'));
|
1196 |
+
do_action( 'pmxi_gallery_image', $pid, $attid, $image_filepath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1197 |
|
1198 |
+
$success_images = true;
|
1199 |
+
if ( ! has_post_thumbnail($pid) and $this->options['is_featured'] )
|
1200 |
+
set_post_thumbnail($pid, $attid);
|
1201 |
+
elseif ( ! in_array($attid, $gallery_attachment_ids))
|
1202 |
+
$gallery_attachment_ids[] = $attid;
|
1203 |
|
1204 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for image `%s`', 'pmxi_plugin'), $targetUrl . '/' . $image_filename));
|
1205 |
+
}
|
1206 |
+
}
|
1207 |
+
}
|
1208 |
+
}
|
1209 |
+
// Set product gallery images
|
1210 |
+
if ( $post_type == "product" and !empty($gallery_attachment_ids) )
|
1211 |
+
update_post_meta($pid, '_product_image_gallery', implode(',', $gallery_attachment_ids));
|
1212 |
+
// Create entry as Draft if no images are downloaded successfully
|
1213 |
+
if ( ! $success_images and "yes" == $this->options['create_draft'] ) {
|
1214 |
+
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1215 |
+
$logger and call_user_func($logger, sprintf(__('- Post `%s` saved as Draft, because no images are downloaded successfully', 'pmxi_plugin'), $articleData['post_title']));
|
1216 |
+
}
|
1217 |
+
}
|
1218 |
+
}
|
1219 |
+
else{
|
1220 |
// Create entry as Draft if no images are downloaded successfully
|
1221 |
+
if ( "yes" == $this->options['create_draft'] ){
|
1222 |
+
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1223 |
+
$logger and call_user_func($logger, sprintf(__('Post `%s` saved as Draft, because no images are downloaded successfully', 'pmxi_plugin'), $articleData['post_title']));
|
1224 |
+
}
|
1225 |
}
|
1226 |
}
|
1227 |
// [/featured image]
|
1229 |
// [attachments]
|
1230 |
if ( ! empty($uploads) and false === $uploads['error'] and !empty($attachments[$i]) and (empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ($this->options['update_all_data'] == "no" and $this->options['is_update_attachments']))) {
|
1231 |
|
1232 |
+
$targetDir = $uploads['path'];
|
1233 |
+
$targetUrl = $uploads['url'];
|
|
|
1234 |
|
1235 |
+
$logger and call_user_func($logger, __('<b>ATTACHMENTS:</b>', 'pmxi_plugin'));
|
1236 |
|
1237 |
+
if ( ! @is_writable($targetDir) ){
|
1238 |
+
$logger and call_user_func($logger, sprintf(__('- <b>ERROR</b>: Target directory %s is not writable', 'pmxi_plugin'), trim($targetDir)));
|
1239 |
+
}
|
1240 |
+
else{
|
1241 |
+
// you must first include the image.php file
|
1242 |
+
// for the function wp_generate_attachment_metadata() to work
|
1243 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
1244 |
|
1245 |
+
if ( ! is_array($attachments[$i]) ) $attachments[$i] = array($attachments[$i]);
|
|
|
1246 |
|
1247 |
+
$logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'pmxi_plugin'), $articleData['post_title']));
|
1248 |
|
1249 |
+
foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
|
1250 |
+
|
1251 |
+
$atchs = str_getcsv($attachment, $this->options['atch_delim']);
|
1252 |
+
|
1253 |
+
if ( ! empty($atchs) ) {
|
1254 |
+
|
1255 |
+
foreach ($atchs as $atch_url) { if (empty($atch_url)) continue;
|
1256 |
+
|
1257 |
+
$atch_url = str_replace(" ", "%20", trim($atch_url));
|
1258 |
+
|
1259 |
+
$attachment_filename = wp_unique_filename($targetDir, urldecode(basename(parse_url(trim($atch_url), PHP_URL_PATH))));
|
1260 |
+
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
1261 |
+
|
1262 |
+
$logger and call_user_func($logger, sprintf(__('- Filename for attachment was generated as %s', 'pmxi_plugin'), $attachment_filename));
|
1263 |
|
1264 |
+
$request = get_file_curl(trim($atch_url), $attachment_filepath);
|
1265 |
+
|
1266 |
+
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($attachment_filepath, @file_get_contents(trim($atch_url)))) {
|
1267 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Attachment file %s cannot be saved locally as %s', 'pmxi_plugin'), trim($atch_url), $attachment_filepath));
|
1268 |
+
is_wp_error($request) and $logger and call_user_func($logger, sprintf(__('- <b>WP Error</b>: %s', 'pmxi_plugin'), $request->get_error_message()));
|
1269 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1270 |
+
unlink($attachment_filepath); // delete file since failed upload may result in empty file created
|
1271 |
+
} elseif( ! $wp_filetype = wp_check_filetype(basename($attachment_filename), null )) {
|
1272 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Can\'t detect attachment file type %s', 'pmxi_plugin'), trim($atch_url)));
|
1273 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1274 |
+
} else {
|
1275 |
+
$logger and call_user_func($logger, sprintf(__('- File %s has been successfully downloaded', 'pmxi_plugin'), $atch_url));
|
1276 |
+
$attachment_data = array(
|
1277 |
+
'guid' => $targetUrl . '/' . basename($attachment_filepath),
|
1278 |
+
'post_mime_type' => $wp_filetype['type'],
|
1279 |
+
'post_title' => preg_replace('/\.[^.]+$/', '', basename($attachment_filepath)),
|
1280 |
+
'post_content' => '',
|
1281 |
+
'post_status' => 'inherit',
|
1282 |
+
'post_author' => $post_author[$i],
|
1283 |
+
);
|
1284 |
+
$attach_id = ($this->options['is_fast_mode']) ? pmxi_insert_attachment( $attachment_data, $attachment_filepath, $pid ) : wp_insert_attachment( $attachment_data, $attachment_filepath, $pid );
|
1285 |
+
|
1286 |
+
if (is_wp_error($attach_id)) {
|
1287 |
+
$logger and call_user_func($logger, __('- <b>WARNING</b>', 'pmxi_plugin') . ': ' . $pid->get_error_message());
|
1288 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1289 |
+
} else {
|
1290 |
+
wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $attachment_filepath));
|
1291 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for post `%s`', 'pmxi_plugin'), $articleData['post_title']));
|
1292 |
+
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'pmxi_plugin'));
|
1293 |
+
do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $attachment_filepath);
|
1294 |
+
}
|
1295 |
+
}
|
1296 |
+
}
|
1297 |
}
|
1298 |
}
|
1299 |
}
|
1301 |
// [/attachments]
|
1302 |
|
1303 |
// [custom taxonomies]
|
1304 |
+
if ( ! empty($taxonomies) ){
|
1305 |
|
1306 |
+
$logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', 'pmxi_plugin'));
|
1307 |
+
|
1308 |
+
$custom_type = get_post_type_object( $this->options['custom_type'] );
|
1309 |
+
|
1310 |
+
foreach ($taxonomies as $tx_name => $txes) {
|
1311 |
|
1312 |
// Skip updating product attributes
|
1313 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1314 |
|
1315 |
if ( empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] )) {
|
1316 |
+
|
1317 |
+
$logger and call_user_func($logger, sprintf(__('- Importing taxonomy `%s` ...', 'pmxi_plugin'), $tx_name));
|
1318 |
+
|
1319 |
+
if ( ! empty($this->options['tax_logic'][$tx_name]) and $this->options['tax_logic'][$tx_name] == 'hierarchical' and ! empty($this->options['tax_hierarchical_logic'][$tx_name]) and $this->options['tax_hierarchical_logic'][$tx_name] == 'entire'){
|
1320 |
+
$logger and call_user_func($logger, sprintf(__('- Auto-nest enabled with separator `%s` ...', 'pmxi_plugin'), ( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',')));
|
1321 |
+
}
|
1322 |
|
1323 |
if (!empty($articleData['ID'])){
|
1324 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1325 |
+
and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){
|
1326 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Leave these taxonomies alone, update all others`...', 'pmxi_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name']));
|
1327 |
+
continue;
|
1328 |
+
}
|
1329 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1330 |
+
and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){
|
1331 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Update only these taxonomies, leave the rest alone`...', 'pmxi_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name']));
|
1332 |
+
continue;
|
1333 |
+
}
|
1334 |
+
}
|
1335 |
|
1336 |
$assign_taxes = array();
|
1337 |
|
1343 |
unset($existing_taxonomies[$tx_name][$i]);
|
1344 |
}
|
1345 |
|
1346 |
+
// create term if not exists
|
1347 |
+
if ( ! empty($txes[$i]) ):
|
1348 |
foreach ($txes[$i] as $key => $single_tax) {
|
1349 |
+
$is_created_term = false;
|
1350 |
+
if (is_array($single_tax) and ! empty($single_tax['name'])){
|
1351 |
|
1352 |
$parent_id = (!empty($single_tax['parent'])) ? pmxi_recursion_taxes($single_tax['parent'], $tx_name, $txes[$i], $key) : '';
|
1353 |
|
1354 |
$term = term_exists($single_tax['name'], $tx_name, (int)$parent_id);
|
1355 |
|
1356 |
if ( empty($term) and !is_wp_error($term) ){
|
|
|
1357 |
$term = term_exists(htmlspecialchars($single_tax['name']), $tx_name, (int)$parent_id);
|
1358 |
+
if ( empty($term) and !is_wp_error($term) ){
|
1359 |
$term_attr = array('parent'=> (!empty($parent_id)) ? $parent_id : 0);
|
1360 |
$term = wp_insert_term(
|
1361 |
$single_tax['name'], // the term
|
1362 |
$tx_name, // the taxonomy
|
1363 |
$term_attr
|
1364 |
);
|
1365 |
+
if ( ! is_wp_error($term) ){
|
1366 |
+
$is_created_term = true;
|
1367 |
+
if ( empty($parent_id) ){
|
1368 |
+
$logger and call_user_func($logger, sprintf(__('- Creating parent %s %s `%s` ...', 'pmxi_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name']));
|
1369 |
+
}
|
1370 |
+
else{
|
1371 |
+
$logger and call_user_func($logger, sprintf(__('- Creating child %s %s for %s named `%s` ...', 'pmxi_plugin'), $custom_type->labels->singular_name, $tx_name, (is_array($single_tax['parent']) ? $single_tax['parent']['name'] : $single_tax['parent']), $single_tax['name']));
|
1372 |
+
}
|
1373 |
+
}
|
1374 |
}
|
1375 |
+
}
|
1376 |
|
1377 |
if ( is_wp_error($term) ){
|
1378 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: `%s`', 'pmxi_plugin'), $term->get_error_message()));
|
1379 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1380 |
}
|
1381 |
+
elseif ( ! empty($term)) {
|
1382 |
$cat_id = $term['term_id'];
|
1383 |
if ($cat_id and $single_tax['assign'])
|
1384 |
{
|
1385 |
$term = get_term_by('id', $cat_id, $tx_name);
|
1386 |
+
if (!in_array($term->slug, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;
|
1387 |
+
if (!$is_created_term){
|
1388 |
+
if ( empty($parent_id) ){
|
1389 |
+
$logger and call_user_func($logger, sprintf(__('- Attempted to create parent %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'pmxi_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name'], $custom_type->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));
|
1390 |
+
}
|
1391 |
+
else{
|
1392 |
+
$logger and call_user_func($logger, sprintf(__('- Attempted to create child %s %s `%s`, duplicate detected. Importing %s to existing `%s` %s, ID %d, slug `%s` ...', 'pmxi_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name'], $custom_type->labels->singular_name, $term->name, $tx_name, $term->term_id, $term->slug));
|
1393 |
+
}
|
1394 |
+
}
|
1395 |
}
|
1396 |
}
|
1397 |
}
|
1398 |
}
|
1399 |
endif;
|
1400 |
+
|
1401 |
+
// associate taxes with post
|
1402 |
+
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger);
|
1403 |
+
|
|
|
|
|
|
|
|
|
1404 |
}
|
1405 |
}
|
1406 |
+
if ( ! empty($existing_taxonomies) and $this->options['update_all_data'] == "no" and ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != 'full_update') or !$this->options['is_update_categories']) {
|
1407 |
+
|
1408 |
foreach ($existing_taxonomies as $tx_name => $txes) {
|
1409 |
// Skip updating product attributes
|
1410 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1411 |
|
1412 |
+
if (!empty($txes[$i]))
|
1413 |
+
$this->associate_terms($pid, $txes[$i], $tx_name, $logger);
|
|
|
|
|
|
|
|
|
|
|
1414 |
}
|
1415 |
}
|
1416 |
}
|
1417 |
+
// [/custom taxonomies]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1418 |
|
1419 |
if (empty($articleData['ID'])) {
|
1420 |
+
$logger and call_user_func($logger, sprintf(__('<b>CREATED</b> `%s` `%s` (ID: %s)', 'pmxi_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name, $pid));
|
1421 |
} else {
|
1422 |
+
$logger and call_user_func($logger, sprintf(__('<b>UPDATED</b> `%s` `%s` (ID: %s)', 'pmxi_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name, $pid));
|
1423 |
}
|
1424 |
|
1425 |
// [addons import]
|
1443 |
}
|
1444 |
|
1445 |
// [/addons import]
|
1446 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', 'pmxi_plugin'));
|
1447 |
do_action( 'pmxi_saved_post', $pid); // hook that was triggered immediately after post saved
|
1448 |
|
1449 |
if (empty($articleData['ID'])) $created++; else $updated++;
|
1450 |
|
1451 |
if ( ! $is_cron and "default" == $this->options['import_processing'] ){
|
1452 |
+
$processed_records = $created + $updated + $skipped + PMXI_Plugin::$session->errors;
|
1453 |
$logger and call_user_func($logger, sprintf(__('<span class="processing_info"><span class="created_count">%s</span><span class="updated_count">%s</span><span class="percents_count">%s</span></span>', 'pmxi_plugin'), $created, $updated, ceil(($processed_records/$this->count) * 100)));
|
1454 |
}
|
1455 |
|
1456 |
}
|
1457 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_after_post_import', 'pmxi_plugin'));
|
1458 |
do_action('pmxi_after_post_import', $this->id);
|
1459 |
|
1460 |
+
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1461 |
}
|
1462 |
|
1463 |
wp_cache_flush();
|
1466 |
'imported' => $created + $updated,
|
1467 |
'created' => $created,
|
1468 |
'updated' => $updated,
|
1469 |
+
'skipped' => $skipped,
|
1470 |
+
'last_activity' => date('Y-m-d H:i:s')
|
1471 |
))->update();
|
1472 |
|
1473 |
if ( ! $is_cron ){
|
1474 |
|
1475 |
+
PMXI_Plugin::$session->save_data();
|
1476 |
|
1477 |
+
$records_count = $this->created + $this->updated + $this->skipped + PMXI_Plugin::$session->errors;
|
1478 |
|
1479 |
$is_import_complete = ($records_count == $this->count);
|
1480 |
|
1481 |
// Delete posts that are no longer present in your file
|
1482 |
if ( $is_import_complete and ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') {
|
1483 |
|
1484 |
+
$logger and call_user_func($logger, __('Removing previously imported posts which are no longer actual...', 'pmxi_plugin'));
|
1485 |
$postList = new PMXI_Post_List();
|
1486 |
|
1487 |
$missing_ids = array();
|
1496 |
// Instead of deletion, set Custom Field
|
1497 |
if ($this->options['is_update_missing_cf']){
|
1498 |
update_post_meta( $missingPost['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
1499 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion post `%s`, set Custom Field `%s` to value `%s`', 'pmxi_plugin'), $articleData['post_title'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
1500 |
}
|
1501 |
|
1502 |
// Instead of deletion, change post status to Draft
|
1503 |
+
if ($this->options['set_missing_to_draft']){
|
1504 |
+
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $missingPost['post_id']) );
|
1505 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion, change post `%s` status to Draft', 'pmxi_plugin'), $articleData['post_title']));
|
1506 |
+
}
|
1507 |
|
1508 |
// Delete posts that are no longer present in your file
|
1509 |
if ( ! $this->options['is_update_missing_cf'] and ! $this->options['set_missing_to_draft']){
|
1510 |
|
1511 |
// Remove attachments
|
1512 |
+
$logger and call_user_func($logger, __('Deleting attachments...', 'pmxi_plugin'));
|
1513 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($missingPost['post_id'], true, 'files');
|
1514 |
// Remove images
|
1515 |
+
$logger and call_user_func($logger, __('Deleting images...', 'pmxi_plugin'));
|
1516 |
empty($this->options['is_keep_imgs']) and wp_delete_attachments($missingPost['post_id'], $this->options['download_images']);
|
1517 |
+
|
1518 |
+
$logger and call_user_func($logger, sprintf(__('Deleting post `%s` from pmxi_posts table', 'pmxi_plugin'), $missingPost['post_id']));
|
1519 |
+
if ( ! empty($missingPost['id'])){
|
1520 |
+
// Delete record form pmxi_posts
|
1521 |
$missingRecord = new PMXI_Post_Record();
|
1522 |
$missingRecord->getById($missingPost['id'])->delete();
|
1523 |
}
|
1524 |
+
else {
|
1525 |
$sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id = " . $missingPost['post_id'] . " AND import_id = " . $missingPost['import_id'];
|
1526 |
$this->wpdb->query(
|
1527 |
$this->wpdb->prepare($sql, '')
|
1529 |
}
|
1530 |
|
1531 |
// Clear post's relationships
|
1532 |
+
if ( $post_type != "import_users" ) wp_delete_object_term_relationships($missingPost['post_id'], get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
1533 |
|
1534 |
}
|
1535 |
|
1540 |
// Delete posts from database
|
1541 |
if (!empty($missing_ids) && is_array($missing_ids) and ! $this->options['is_update_missing_cf'] and ! $this->options['set_missing_to_draft']){
|
1542 |
|
1543 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_delete_post', 'pmxi_plugin'));
|
1544 |
do_action('pmxi_delete_post', $missing_ids);
|
1545 |
|
1546 |
+
if ( $this->options['custom_type'] == "import_users" ){
|
1547 |
+
$sql = "delete a,b
|
1548 |
+
FROM ".$this->wpdb->users." a
|
1549 |
+
LEFT JOIN ".$this->wpdb->usermeta." b ON ( a.ID = b.user_id )
|
1550 |
+
WHERE a.ID IN (".implode(',', $missing_ids).");";
|
1551 |
+
}
|
1552 |
+
else {
|
1553 |
+
$sql = "delete a,b,c
|
1554 |
+
FROM ".$this->wpdb->posts." a
|
1555 |
+
LEFT JOIN ".$this->wpdb->term_relationships." b ON ( a.ID = b.object_id )
|
1556 |
+
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
1557 |
+
WHERE a.ID IN (".implode(',', $missing_ids).");";
|
1558 |
+
}
|
1559 |
|
1560 |
+
$logger and call_user_func($logger, __('Deleting posts from database', 'pmxi_plugin'));
|
1561 |
$this->wpdb->query(
|
1562 |
$this->wpdb->prepare($sql, '')
|
1563 |
+
);
|
1564 |
+
|
1565 |
+
$this->set(array('deleted' => count($missing_ids)))->update();
|
1566 |
}
|
1567 |
|
1568 |
}
|
1570 |
// Set out of stock status for missing records [Woocommerce add-on option]
|
1571 |
if ( $is_import_complete and empty($this->options['is_delete_missing']) and $post_type == "product" and class_exists('PMWI_Plugin') and !empty($this->options['missing_records_stock_status'])) {
|
1572 |
|
1573 |
+
$logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'pmxi_plugin'));
|
1574 |
$postList = new PMXI_Post_List();
|
1575 |
$missingPosts = $postList->getBy(array('import_id' => $this->id, 'iteration !=' => $this->iteration));
|
1576 |
if ( ! $missingPosts->isEmpty() ){
|
1584 |
|
1585 |
} catch (XmlImportException $e) {
|
1586 |
$logger and call_user_func($logger, __('<b>ERROR</b>', 'pmxi_plugin') . ': ' . $e->getMessage());
|
1587 |
+
$logger and !$is_cron and PMXI_Plugin::$session->errors++;
|
1588 |
}
|
1589 |
|
1590 |
$logger and $is_import_complete and call_user_func($logger, __('Cleaning temporary data...', 'pmxi_plugin'));
|
1596 |
$logger and call_user_func($logger, __('Deleting source XML file...', 'pmxi_plugin'));
|
1597 |
|
1598 |
// Delete chunks
|
1599 |
+
foreach (PMXI_Helper::safe_glob($uploads['basedir'] . '/wpallimport/temp/pmxi_chunk_*', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
1600 |
+
$logger and call_user_func($logger, __('Deleting chunks files...', 'pmxi_plugin'));
|
1601 |
+
@file_exists($filePath) and pmxi_remove_source($filePath, false);
|
1602 |
}
|
1603 |
|
1604 |
if ($this->type != "ftp"){
|
1635 |
|
1636 |
return $this;
|
1637 |
}
|
1638 |
+
|
1639 |
+
protected function pushmeta($pid, $meta_key, $meta_value){
|
1640 |
+
|
1641 |
+
if (empty($meta_key)) return;
|
1642 |
+
|
1643 |
+
$this->post_meta_to_insert[] = array(
|
1644 |
+
'meta_key' => $meta_key,
|
1645 |
+
'meta_value' => $meta_value,
|
1646 |
+
'pid' => $pid
|
1647 |
+
);
|
1648 |
+
|
1649 |
+
}
|
1650 |
+
|
1651 |
+
protected function executeSQL(){
|
1652 |
+
|
1653 |
+
$import_entry = ( $this->options['custom_type'] == 'import_users') ? 'user' : 'post';
|
1654 |
+
|
1655 |
+
// prepare bulk SQL query
|
1656 |
+
$meta_table = _get_meta_table( $import_entry );
|
1657 |
+
|
1658 |
+
if ( $this->post_meta_to_insert ){
|
1659 |
+
$values = array();
|
1660 |
+
$already_added = array();
|
1661 |
+
|
1662 |
+
foreach (array_reverse($this->post_meta_to_insert) as $key => $value) {
|
1663 |
+
if ( ! empty($value['meta_key']) and ! in_array($value['pid'] . '-' . $value['meta_key'], $already_added) ){
|
1664 |
+
$already_added[] = $value['pid'] . '-' . $value['meta_key'];
|
1665 |
+
$values[] = '(' . $value['pid'] . ',"' . $value['meta_key'] . '",\'' . maybe_serialize($value['meta_value']) .'\')';
|
1666 |
+
}
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
$this->wpdb->query("INSERT INTO $meta_table (`" . $import_entry . "_id`, `meta_key`, `meta_value`) VALUES " . implode(',', $values));
|
1670 |
+
$this->post_meta_to_insert = array();
|
1671 |
+
}
|
1672 |
+
}
|
1673 |
|
1674 |
public function _filter_has_cap_unfiltered_html($caps)
|
1675 |
{
|
1677 |
return $caps;
|
1678 |
}
|
1679 |
|
1680 |
+
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger){
|
1681 |
+
|
1682 |
+
$terms = wp_get_object_terms( $pid, $tx_name );
|
1683 |
+
$term_ids = array();
|
1684 |
+
|
1685 |
+
if ( ! empty($terms) ){
|
1686 |
+
if ( ! is_wp_error( $terms ) ) {
|
1687 |
+
foreach ($terms as $term_info) {
|
1688 |
+
$term_ids[] = $term_info->term_taxonomy_id;
|
1689 |
+
$this->wpdb->query( $this->wpdb->prepare("UPDATE {$this->wpdb->term_taxonomy} SET count = count - 1 WHERE term_taxonomy_id = %d", $term_info->term_taxonomy_id) );
|
1690 |
+
}
|
1691 |
+
$in_tt_ids = "'" . implode( "', '", $term_ids ) . "'";
|
1692 |
+
$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 ) );
|
1693 |
+
}
|
1694 |
+
}
|
1695 |
+
|
1696 |
+
if (empty($assign_taxes)) return;
|
1697 |
+
|
1698 |
+
foreach ($assign_taxes as $tt) {
|
1699 |
+
$this->wpdb->insert( $this->wpdb->term_relationships, array( 'object_id' => $pid, 'term_taxonomy_id' => $tt ) );
|
1700 |
+
$this->wpdb->query( "UPDATE {$this->wpdb->term_taxonomy} SET count = count + 1 WHERE term_taxonomy_id = $tt" );
|
1701 |
+
}
|
1702 |
+
|
1703 |
+
$values = array();
|
1704 |
+
$term_order = 0;
|
1705 |
+
foreach ( $assign_taxes as $tt )
|
1706 |
+
$values[] = $this->wpdb->prepare( "(%d, %d, %d)", $pid, $tt, ++$term_order);
|
1707 |
+
|
1708 |
+
|
1709 |
+
if ( $values ){
|
1710 |
+
if ( false === $this->wpdb->query( "INSERT INTO {$this->wpdb->term_relationships} (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) ){
|
1711 |
+
$logger and call_user_func($logger, __('<b>ERROR</b> Could not insert term relationship into the database', 'pmxi_plugin') . ': '. $this->wpdb->last_error);
|
1712 |
+
$logger and PMXI_Plugin::$session['pmxi_import']['errors'] = ++PMXI_Plugin::$session->data['pmxi_import']['errors'];
|
1713 |
+
}
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
wp_cache_delete( $pid, $tx_name . '_relationships' );
|
1717 |
+
}
|
1718 |
+
|
1719 |
/**
|
1720 |
* Clear associations with posts
|
1721 |
* @param bool[optional] $keepPosts When set to false associated wordpress posts will be deleted as well
|
1727 |
if ( ! $keepPosts) {
|
1728 |
$ids = array();
|
1729 |
foreach ($post->getBy('import_id', $this->id)->convertRecords() as $p) {
|
1730 |
+
if ( $this->options['custom_type'] == 'import_users' ){
|
1731 |
+
// Remove attachments
|
1732 |
+
empty($this->options['is_keep_attachments']) and wp_delete_attachments($p->post_id, true, 'files');
|
1733 |
+
// Remove images
|
1734 |
+
empty($this->options['is_keep_imgs']) and wp_delete_attachments($p->post_id, $this->options['download_images']);
|
1735 |
+
}
|
1736 |
$ids[] = $p->post_id;
|
1737 |
}
|
1738 |
+
|
1739 |
+
if ( ! empty($ids) ){
|
1740 |
|
1741 |
foreach ($ids as $id) {
|
1742 |
do_action('pmxi_delete_post', $id);
|
1743 |
+
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'));
|
1744 |
}
|
1745 |
|
1746 |
+
if ( $this->options['custom_type'] == 'import_users' ){
|
1747 |
+
$sql = "delete a,b
|
1748 |
+
FROM ".$this->wpdb->users." a
|
1749 |
+
LEFT JOIN ".$this->wpdb->usermeta." b ON ( a.ID = b.user_id )
|
1750 |
+
WHERE a.ID IN (".implode(',', $ids).");";
|
1751 |
+
}
|
1752 |
+
else {
|
1753 |
+
$sql = "delete a,b,c
|
1754 |
+
FROM ".$this->wpdb->posts." a
|
1755 |
+
LEFT JOIN ".$this->wpdb->term_relationships." b ON ( a.ID = b.object_id )
|
1756 |
+
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
1757 |
+
LEFT JOIN ".$this->wpdb->posts." d ON ( a.ID = d.post_parent )
|
1758 |
+
WHERE a.ID IN (".implode(',', $ids).");";
|
1759 |
+
}
|
1760 |
|
1761 |
$this->wpdb->query(
|
1762 |
$this->wpdb->prepare($sql, '')
|
1777 |
public function deleteFiles() {
|
1778 |
$fileList = new PMXI_File_List();
|
1779 |
foreach($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {
|
1780 |
+
if ( @file_exists($f->path) ){
|
1781 |
+
pmxi_remove_source($f->path);
|
1782 |
+
}
|
1783 |
$f->delete();
|
1784 |
}
|
1785 |
return $this;
|
1786 |
}
|
1787 |
+
/**
|
1788 |
+
* Delete associated history logs
|
1789 |
+
* @return PMXI_Import_Record
|
1790 |
+
* @chainable
|
1791 |
+
*/
|
1792 |
+
public function deleteHistories(){
|
1793 |
+
$historyList = new PMXI_History_List();
|
1794 |
+
foreach ($historyList->getBy('import_id', $this->id)->convertRecords() as $h) {
|
1795 |
+
$h->delete();
|
1796 |
+
}
|
1797 |
+
return $this;
|
1798 |
+
}
|
1799 |
+
/**
|
1800 |
+
* Delete associated sub imports
|
1801 |
+
* @return PMXI_Import_Record
|
1802 |
+
* @chainable
|
1803 |
+
*/
|
1804 |
+
public function deleteChildren($keepPosts = TRUE){
|
1805 |
+
$importList = new PMXI_Import_List();
|
1806 |
+
foreach ($importList->getBy('parent_import_id', $this->id)->convertRecords() as $i) {
|
1807 |
+
$i->delete($keepPosts);
|
1808 |
+
}
|
1809 |
+
return $this;
|
1810 |
+
}
|
1811 |
/**
|
1812 |
* @see parent::delete()
|
1813 |
* @param bool[optional] $keepPosts When set to false associated wordpress posts will be deleted as well
|
1814 |
*/
|
1815 |
public function delete($keepPosts = TRUE) {
|
1816 |
+
$this->deletePosts($keepPosts)->deleteFiles()->deleteHistories()->deleteChildren($keepPosts);
|
1817 |
|
1818 |
return parent::delete();
|
1819 |
}
|
models/model.php
CHANGED
@@ -135,7 +135,7 @@ abstract class PMXI_Model extends ArrayObject {
|
|
135 |
} else {
|
136 |
if ( ! preg_match('%^(.+?) *(=|<>|!=|<|>|<=|>=| (NOT +)?(IN|(LIKE|REGEXP|RLIKE)( BINARY)?))?$%i', trim($key), $mtch)) {
|
137 |
throw new Exception('Wrong field name format.');
|
138 |
-
}
|
139 |
$key = $mtch[1];
|
140 |
if (is_array($val) and (empty($mtch[2]) or 'IN' == strtoupper($mtch[4]))) {
|
141 |
$op = empty($mtch[2]) ? 'IN' : strtoupper(trim($mtch[2]));
|
@@ -145,7 +145,7 @@ abstract class PMXI_Model extends ArrayObject {
|
|
145 |
$where[] = $this->wpdb->prepare("$key $op %s", $val);
|
146 |
}
|
147 |
}
|
148 |
-
}
|
149 |
return implode(" $operator ", $where);
|
150 |
}
|
151 |
|
135 |
} else {
|
136 |
if ( ! preg_match('%^(.+?) *(=|<>|!=|<|>|<=|>=| (NOT +)?(IN|(LIKE|REGEXP|RLIKE)( BINARY)?))?$%i', trim($key), $mtch)) {
|
137 |
throw new Exception('Wrong field name format.');
|
138 |
+
}
|
139 |
$key = $mtch[1];
|
140 |
if (is_array($val) and (empty($mtch[2]) or 'IN' == strtoupper($mtch[4]))) {
|
141 |
$op = empty($mtch[2]) ? 'IN' : strtoupper(trim($mtch[2]));
|
145 |
$where[] = $this->wpdb->prepare("$key $op %s", $val);
|
146 |
}
|
147 |
}
|
148 |
+
}
|
149 |
return implode(" $operator ", $where);
|
150 |
}
|
151 |
|
models/model/list.php
CHANGED
@@ -78,7 +78,7 @@ class PMXI_Model_List extends PMXI_Model {
|
|
78 |
$sql = "SELECT SQL_CALC_FOUND_ROWS $this->what $sql LIMIT " . intval(($page - 1) * $perPage) . ", " . intval($perPage);
|
79 |
} else {
|
80 |
$sql = "SELECT $this->what $sql";
|
81 |
-
}
|
82 |
$result = $this->wpdb->get_results($sql, ARRAY_A);
|
83 |
if (is_array($result)) {
|
84 |
foreach ($result as $i => $row) {
|
78 |
$sql = "SELECT SQL_CALC_FOUND_ROWS $this->what $sql LIMIT " . intval(($page - 1) * $perPage) . ", " . intval($perPage);
|
79 |
} else {
|
80 |
$sql = "SELECT $this->what $sql";
|
81 |
+
}
|
82 |
$result = $this->wpdb->get_results($sql, ARRAY_A);
|
83 |
if (is_array($result)) {
|
84 |
foreach ($result as $i => $row) {
|
plugin.php
CHANGED
@@ -3,13 +3,10 @@
|
|
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.1
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
10 |
-
if( ! defined( 'PMXI_SESSION_COOKIE' ) )
|
11 |
-
define( 'PMXI_SESSION_COOKIE', '_pmxi_session' );
|
12 |
-
|
13 |
/**
|
14 |
* Plugin root dir with forward slashes as directory separator regardless of actuall DIRECTORY_SEPARATOR value
|
15 |
* @var string
|
@@ -28,7 +25,7 @@ define('PMXI_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
|
|
28 |
*/
|
29 |
define('PMXI_PREFIX', 'pmxi_');
|
30 |
|
31 |
-
define('PMXI_VERSION', '3.1
|
32 |
|
33 |
define('PMXI_EDITION', 'free');
|
34 |
|
@@ -77,9 +74,9 @@ final class PMXI_Plugin {
|
|
77 |
*/
|
78 |
const LARGE_SIZE = 0; // all files will importing in large import mode
|
79 |
|
80 |
-
public static $session;
|
81 |
|
82 |
-
public static $encodings = array('UTF-8','UTF-16','Windows-1250','Windows-1251','Windows-1252','Windows-1253','Windows-1254','Windows-1255','Windows-1256','Windows-1257','Windows-1258','ISO-8859-1','ISO-8859-2','ISO-8859-3','ISO-8859-4','ISO-8859-5','ISO-8859-6','ISO-8859-7','ISO-8859-8','ISO-8859-9','ISO-8859-10', 'KOI8-R', 'KOI8-U');
|
83 |
|
84 |
public static $is_csv = false;
|
85 |
|
@@ -96,10 +93,6 @@ final class PMXI_Plugin {
|
|
96 |
return self::$instance;
|
97 |
}
|
98 |
|
99 |
-
static public function getEddName(){
|
100 |
-
return 'WP All Import';
|
101 |
-
}
|
102 |
-
|
103 |
/**
|
104 |
* Common logic for requestin plugin info fields
|
105 |
*/
|
@@ -173,7 +166,7 @@ final class PMXI_Plugin {
|
|
173 |
* @param string $rootDir Plugin root dir
|
174 |
* @param string $pluginFilePath Plugin main file
|
175 |
*/
|
176 |
-
protected function __construct() {
|
177 |
|
178 |
$this->load_plugin_textdomain();
|
179 |
|
@@ -186,14 +179,22 @@ final class PMXI_Plugin {
|
|
186 |
// register helpers
|
187 |
if (is_dir(self::ROOT_DIR . '/helpers')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
188 |
require_once $filePath;
|
189 |
-
}
|
190 |
|
191 |
// create history folder
|
192 |
$uploads = wp_upload_dir();
|
193 |
-
if (!is_dir($uploads['basedir'] . '/wpallimport_history')) wp_mkdir_p($uploads['basedir'] . '/wpallimport_history');
|
194 |
-
// create logs folder
|
195 |
-
if (!is_dir($uploads['basedir'] . '/wpallimport_logs')) wp_mkdir_p($uploads['basedir'] . '/wpallimport_logs');
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
// init plugin options
|
198 |
$option_name = get_class($this) . '_Options';
|
199 |
$options_default = PMXI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray();
|
@@ -236,84 +237,179 @@ final class PMXI_Plugin {
|
|
236 |
if (is_dir(self::ROOT_DIR . '/shortcodes')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/shortcodes/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
237 |
$tag = strtolower(str_replace('/', '_', preg_replace('%^' . preg_quote(self::ROOT_DIR . '/shortcodes/', '%') . '|\.php$%', '', $filePath)));
|
238 |
add_shortcode($tag, array($this, 'shortcodeDispatcher'));
|
239 |
-
}
|
240 |
|
241 |
// register admin page pre-dispatcher
|
242 |
-
add_action('admin_init', array($this, '__adminInit')
|
243 |
add_action('admin_init', array($this, '_fix_options'));
|
244 |
-
|
245 |
-
global $wpdb;
|
246 |
-
|
247 |
-
if (function_exists('is_multisite') && is_multisite()) {
|
248 |
-
// check if it is a network activation - if so, run the activation function for each blog id
|
249 |
-
if (isset($_GET['networkwide']) && ($_GET['networkwide'] == 1)) {
|
250 |
-
$old_blog = $wpdb->blogid;
|
251 |
-
// Get all blog ids
|
252 |
-
$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
253 |
-
foreach ($blogids as $blog_id) {
|
254 |
-
switch_to_blog($blog_id);
|
255 |
-
$this->__add_feed_type_fix(); // feature to version 2.22
|
256 |
-
}
|
257 |
-
switch_to_blog($old_blog);
|
258 |
-
return;
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
$this->__add_feed_type_fix(); // feature to version 2.22
|
263 |
}
|
264 |
|
265 |
/**
|
266 |
* convert imports options
|
267 |
-
* compatibility with version
|
268 |
*/
|
269 |
public function _fix_options(){
|
|
|
270 |
$imports = new PMXI_Import_List();
|
271 |
-
$post
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
$options['is_update_custom_fields'] = ( ! empty($options['keep_custom_fields'])) ? 0 : 1;
|
294 |
-
if ("" != $options['keep_custom_fields_specific'] or "" != $options['keep_custom_fields_except']){
|
295 |
-
$options['custom_fields_list'] = ( ! empty($options['keep_custom_fields'])) ? explode(',', $options['keep_custom_fields_except']) : explode(',', $options['keep_custom_fields_specific']);
|
296 |
-
$options['update_custom_fields_logic'] = ( ! empty($options['is_update_custom_fields'])) ? 'only' : 'all_except';
|
297 |
-
}
|
298 |
-
if ( ! empty($options['is_keep_categories']) and ! empty($options['is_add_newest_categories'])){
|
299 |
-
$options['is_update_categories'] = 1;
|
300 |
-
$options['update_categories_logic'] = 'add_new';
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
-
$options['converted_options'] = 1;
|
304 |
-
$imp->set(array(
|
305 |
-
'options' => $options
|
306 |
-
))->update();
|
307 |
|
308 |
}
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
/**
|
314 |
* pre-dispatching logic for admin page controllers
|
315 |
*/
|
316 |
public function __adminInit() {
|
|
|
|
|
317 |
|
318 |
$input = new PMXI_Input();
|
319 |
$page = strtolower($input->getpost('page', ''));
|
@@ -341,7 +437,7 @@ final class PMXI_Plugin {
|
|
341 |
'is_user' => is_user_admin(),
|
342 |
);
|
343 |
add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
|
344 |
-
add_filter('admin_body_class', create_function('', 'return "' .
|
345 |
|
346 |
$controller = new $controllerName();
|
347 |
if ( ! $controller instanceof PMXI_Controller_Admin) {
|
@@ -364,6 +460,7 @@ final class PMXI_Plugin {
|
|
364 |
}
|
365 |
|
366 |
}
|
|
|
367 |
}
|
368 |
|
369 |
/**
|
@@ -394,7 +491,6 @@ final class PMXI_Plugin {
|
|
394 |
* @param string[optional] $page When $page set to empty string ealier buffered content is outputted, otherwise controller is called based on $page value
|
395 |
*/
|
396 |
public function adminDispatcher($page = '', $action = 'index') {
|
397 |
-
|
398 |
if ('' === $page) {
|
399 |
if ( ! is_null(self::$buffer)) {
|
400 |
echo '<div class="wrap">';
|
@@ -451,8 +547,8 @@ final class PMXI_Plugin {
|
|
451 |
return TRUE;
|
452 |
}
|
453 |
}
|
454 |
-
}
|
455 |
-
|
456 |
return FALSE;
|
457 |
}
|
458 |
|
@@ -514,8 +610,7 @@ final class PMXI_Plugin {
|
|
514 |
foreach ($blogids as $blog_id) {
|
515 |
switch_to_blog($blog_id);
|
516 |
require self::ROOT_DIR . '/schema.php';
|
517 |
-
dbDelta($plugin_queries);
|
518 |
-
//$this->__ver_1_04_transition_fix();
|
519 |
|
520 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
521 |
|
@@ -531,6 +626,8 @@ final class PMXI_Plugin {
|
|
531 |
|
532 |
$this->__ver_1_04_transition_fix();
|
533 |
|
|
|
|
|
534 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
535 |
|
536 |
$post = new PMXI_Post_Record();
|
@@ -557,14 +654,14 @@ final class PMXI_Plugin {
|
|
557 |
* NOTE: the function can be removed when plugin version progress and it's sure matter nobody has ver 1.03
|
558 |
*/
|
559 |
public function __ver_1_04_transition_fix() {
|
560 |
-
$uploads = wp_upload_dir();
|
561 |
|
562 |
-
if ( ! is_dir($uploads['basedir'] . '/
|
563 |
-
die(sprintf(__('Uploads folder %s must be writable', 'pmxi_plugin'), $uploads['basedir'] . '/
|
564 |
}
|
565 |
|
566 |
-
if ( ! is_dir($uploads['basedir'] . '/
|
567 |
-
die(sprintf(__('Uploads folder %s must be writable', 'pmxi_plugin'), $uploads['basedir'] . '/
|
568 |
}
|
569 |
|
570 |
$table = $table = $this->getTablePrefix() . 'files';
|
@@ -593,15 +690,39 @@ final class PMXI_Plugin {
|
|
593 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
594 |
$parent_import_id = false;
|
595 |
$iteration = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
|
597 |
// Check if field exists
|
598 |
foreach ($tablefields as $tablefield) {
|
599 |
if ('parent_import_id' == $tablefield->Field) $parent_import_id = true;
|
600 |
if ('iteration' == $tablefield->Field) $iteration = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
}
|
602 |
|
603 |
if (!$parent_import_id) $wpdb->query("ALTER TABLE {$table} ADD `parent_import_id` BIGINT(20) NOT NULL DEFAULT 0;");
|
604 |
if (!$iteration) $wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
|
606 |
$table = $this->getTablePrefix() . 'posts';
|
607 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
@@ -613,6 +734,23 @@ final class PMXI_Plugin {
|
|
613 |
}
|
614 |
|
615 |
if (!$iteration) $wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
}
|
617 |
|
618 |
/**
|
@@ -622,13 +760,9 @@ final class PMXI_Plugin {
|
|
622 |
public static function get_default_import_options() {
|
623 |
return array(
|
624 |
'type' => 'post',
|
625 |
-
'
|
626 |
-
'
|
627 |
-
'
|
628 |
-
'tags_delim' => ',',
|
629 |
-
'categories_delim' => ',',
|
630 |
-
'categories_auto_nested' => 0,
|
631 |
-
'featured_delim' => '',
|
632 |
'atch_delim' => ',',
|
633 |
'post_taxonomies' => array(),
|
634 |
'parent' => 0,
|
@@ -643,20 +777,22 @@ final class PMXI_Plugin {
|
|
643 |
'custom_name' => array(),
|
644 |
'custom_value' => array(),
|
645 |
'custom_format' => array(),
|
|
|
646 |
'serialized_values' => array(),
|
|
|
647 |
'comment_status' => 'open',
|
648 |
'ping_status' => 'open',
|
649 |
'create_draft' => 'no',
|
650 |
'author' => '',
|
651 |
'post_excerpt' => '',
|
652 |
-
'post_slug' => '',
|
653 |
-
'featured_image' => '',
|
654 |
'attachments' => '',
|
655 |
'is_import_specified' => 0,
|
656 |
'import_specified' => '',
|
657 |
'is_delete_source' => 0,
|
658 |
'is_cloak' => 0,
|
659 |
'unique_key' => '',
|
|
|
660 |
'feed_type' => 'auto',
|
661 |
|
662 |
'create_new_records' => 1,
|
@@ -673,6 +809,7 @@ final class PMXI_Plugin {
|
|
673 |
'is_update_slug' => 1,
|
674 |
'is_update_excerpt' => 1,
|
675 |
'is_update_categories' => 1,
|
|
|
676 |
'update_categories_logic' => 'full_update',
|
677 |
'taxonomies_list' => array(),
|
678 |
'taxonomies_only_list' => array(),
|
@@ -682,7 +819,6 @@ final class PMXI_Plugin {
|
|
682 |
'update_images_logic' => 'full_update',
|
683 |
'is_update_dates' => 1,
|
684 |
'is_update_menu_order' => 1,
|
685 |
-
'is_update_post_author' => 1,
|
686 |
'is_update_parent' => 1,
|
687 |
'is_keep_attachments' => 0,
|
688 |
'is_keep_imgs' => 0,
|
@@ -707,23 +843,51 @@ final class PMXI_Plugin {
|
|
707 |
'images_name' => 'filename',
|
708 |
'post_format' => 'standard',
|
709 |
'encoding' => 'UTF-8',
|
710 |
-
'delimiter' => '',
|
711 |
-
'set_image_meta_data' => 0,
|
712 |
'image_meta_title' => '',
|
713 |
-
'image_meta_title_delim' => '',
|
714 |
'image_meta_caption' => '',
|
715 |
-
'image_meta_caption_delim' => '',
|
716 |
'image_meta_alt' => '',
|
717 |
-
'image_meta_alt_delim' => '',
|
718 |
'image_meta_description' => '',
|
719 |
-
'image_meta_description_delim' => '',
|
720 |
'status_xpath' => '',
|
721 |
-
'download_images' =>
|
722 |
'converted_options' => 0,
|
723 |
'update_all_data' => 'yes',
|
724 |
'is_fast_mode' => 0,
|
725 |
'chuncking' => 1,
|
726 |
-
'import_processing' => 'ajax'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
727 |
);
|
728 |
}
|
729 |
|
@@ -750,4 +914,5 @@ final class PMXI_Plugin {
|
|
750 |
|
751 |
}
|
752 |
|
753 |
-
PMXI_Plugin::getInstance();
|
|
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.2.1
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
|
|
|
|
|
|
10 |
/**
|
11 |
* Plugin root dir with forward slashes as directory separator regardless of actuall DIRECTORY_SEPARATOR value
|
12 |
* @var string
|
25 |
*/
|
26 |
define('PMXI_PREFIX', 'pmxi_');
|
27 |
|
28 |
+
define('PMXI_VERSION', '3.2.1');
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
74 |
*/
|
75 |
const LARGE_SIZE = 0; // all files will importing in large import mode
|
76 |
|
77 |
+
public static $session = null;
|
78 |
|
79 |
+
public static $encodings = array('UTF-8', 'UTF-16', 'Windows-1250', 'Windows-1251', 'Windows-1252', 'Windows-1253', 'Windows-1254', 'Windows-1255', 'Windows-1256', 'Windows-1257', 'Windows-1258', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9', 'ISO-8859-10', 'KOI8-R', 'KOI8-U');
|
80 |
|
81 |
public static $is_csv = false;
|
82 |
|
93 |
return self::$instance;
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* Common logic for requestin plugin info fields
|
98 |
*/
|
166 |
* @param string $rootDir Plugin root dir
|
167 |
* @param string $pluginFilePath Plugin main file
|
168 |
*/
|
169 |
+
protected function __construct() {
|
170 |
|
171 |
$this->load_plugin_textdomain();
|
172 |
|
179 |
// register helpers
|
180 |
if (is_dir(self::ROOT_DIR . '/helpers')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/helpers/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
181 |
require_once $filePath;
|
182 |
+
}
|
183 |
|
184 |
// create history folder
|
185 |
$uploads = wp_upload_dir();
|
|
|
|
|
|
|
186 |
|
187 |
+
$wpallimportDirs = array('wpallimport', 'wpallimport/logs', 'wpallimport/files', 'wpallimport/temp', 'wpallimport/uploads');
|
188 |
+
|
189 |
+
foreach ($wpallimportDirs as $dir) {
|
190 |
+
|
191 |
+
if ( !is_dir($uploads['basedir'] . '/' . $dir)) wp_mkdir_p($uploads['basedir'] . '/' . $dir);
|
192 |
+
|
193 |
+
if ( ! @file_exists($uploads['basedir'] . '/' . $dir . '/index.php') )
|
194 |
+
@touch( $uploads['basedir'] . '/' . $dir . '/index.php' );
|
195 |
+
|
196 |
+
}
|
197 |
+
|
198 |
// init plugin options
|
199 |
$option_name = get_class($this) . '_Options';
|
200 |
$options_default = PMXI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray();
|
237 |
if (is_dir(self::ROOT_DIR . '/shortcodes')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/shortcodes/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
238 |
$tag = strtolower(str_replace('/', '_', preg_replace('%^' . preg_quote(self::ROOT_DIR . '/shortcodes/', '%') . '|\.php$%', '', $filePath)));
|
239 |
add_shortcode($tag, array($this, 'shortcodeDispatcher'));
|
240 |
+
}
|
241 |
|
242 |
// register admin page pre-dispatcher
|
243 |
+
add_action('admin_init', array($this, '__adminInit'));
|
244 |
add_action('admin_init', array($this, '_fix_options'));
|
245 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
|
248 |
/**
|
249 |
* convert imports options
|
250 |
+
* compatibility with version 4.0
|
251 |
*/
|
252 |
public function _fix_options(){
|
253 |
+
|
254 |
$imports = new PMXI_Import_List();
|
255 |
+
$post = new PMXI_Post_Record();
|
256 |
+
|
257 |
+
$templates = new PMXI_Template_List();
|
258 |
+
$template = new PMXI_Template_Record();
|
259 |
+
|
260 |
+
$is_migrated = get_option('pmxi_is_migrated');
|
261 |
+
|
262 |
+
$uploads = wp_upload_dir();
|
263 |
|
264 |
+
if ( empty($is_migrated) or version_compare($is_migrated, PMXI_VERSION) < 0 ){
|
265 |
+
|
266 |
+
if ( empty($is_migrated) ){ // plugin version less than 3.2.0
|
267 |
+
|
268 |
+
pmxi_rmdir($uploads['basedir'] . '/wpallimport_history');
|
269 |
+
pmxi_rmdir($uploads['basedir'] . '/wpallimport_logs');
|
270 |
+
|
271 |
+
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
272 |
+
|
273 |
+
$imp->getById($imp->id);
|
274 |
+
|
275 |
+
if ( ! $imp->isEmpty() and ! empty($imp->template)){
|
276 |
+
|
277 |
+
$options = array_merge($imp->options, $imp->template);
|
278 |
+
|
279 |
+
$this->__ver_4_transition_fix($options);
|
280 |
+
|
281 |
+
$imp->set(array(
|
282 |
+
'options' => $options
|
283 |
+
))->update();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
|
285 |
+
if ($imp->type == 'file'){
|
286 |
+
$imp->set(array(
|
287 |
+
'path' => $uploads['basedir'] . '/wpallimport/files/' . basename($imp->path)
|
288 |
+
))->update();
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
foreach ($templates->setColumns($templates->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $tpl){
|
294 |
+
|
295 |
+
$tpl->getById($tpl->id);
|
296 |
+
|
297 |
+
if ( ! $tpl->isEmpty() and ! empty($tpl->title) ) {
|
298 |
+
|
299 |
+
$opt = ( empty($tpl->options) ) ? array() : $tpl->options;
|
300 |
+
|
301 |
+
$options = array_merge($opt, array(
|
302 |
+
'title' => $tpl->title,
|
303 |
+
'content' => $tpl->content,
|
304 |
+
'is_keep_linebreaks' => $tpl->is_keep_linebreaks,
|
305 |
+
'is_leave_html' => $tpl->is_leave_html,
|
306 |
+
'fix_characters' => $tpl->fix_characters
|
307 |
+
));
|
308 |
+
|
309 |
+
$this->__ver_4_transition_fix($options);
|
310 |
+
|
311 |
+
$tpl->set(array(
|
312 |
+
'options' => $options
|
313 |
+
))->update();
|
314 |
+
|
315 |
+
}
|
316 |
+
|
317 |
}
|
|
|
|
|
|
|
|
|
318 |
|
319 |
}
|
320 |
+
else {
|
321 |
+
|
322 |
+
// migration fixes for vesions
|
323 |
+
switch ($is_migrated) {
|
324 |
+
|
325 |
+
case '3.2.0 RC1':
|
326 |
+
# code..
|
327 |
+
break;
|
328 |
+
|
329 |
+
case '3.2.1':
|
330 |
+
# code..
|
331 |
+
break;
|
332 |
+
|
333 |
+
default:
|
334 |
+
# code...
|
335 |
+
break;
|
336 |
+
}
|
337 |
+
|
338 |
+
}
|
339 |
+
update_option('pmxi_is_migrated', PMXI_VERSION);
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
public function __ver_4_transition_fix( &$options ){
|
344 |
|
345 |
+
$options['wizard_type'] = ($options['duplicate_matching'] == 'auto') ? 'new' : 'matching';
|
346 |
+
|
347 |
+
if ($options['download_images']){
|
348 |
+
$options['download_images'] = 'yes';
|
349 |
+
$options['download_featured_image'] = $options['featured_image'];
|
350 |
+
$options['featured_image'] = '';
|
351 |
+
$options['download_featured_delim'] = $options['featured_delim'];
|
352 |
+
$options['featured_delim'] = '';
|
353 |
+
}
|
354 |
+
|
355 |
+
if ($options['set_image_meta_data']){
|
356 |
+
$options['set_image_meta_title'] = 1;
|
357 |
+
$options['set_image_meta_caption'] = 1;
|
358 |
+
$options['set_image_meta_alt'] = 1;
|
359 |
+
$options['set_image_meta_description'] = 1;
|
360 |
+
}
|
361 |
+
|
362 |
+
if ("" == $options['custom_type']) $options['custom_type'] = $options['type'];
|
363 |
+
|
364 |
+
$exclude_taxonomies = (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type') : array('post_format');
|
365 |
+
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
366 |
+
|
367 |
+
$options['tax_logic'] = array();
|
368 |
+
$options['tax_assing'] = array();
|
369 |
+
$options['tax_multiple_xpath'] = array();
|
370 |
+
$options['tax_multiple_delim'] = array();
|
371 |
+
$options['tax_hierarchical_logic'] = array();
|
372 |
+
|
373 |
+
if ( ! empty($post_taxonomies)):
|
374 |
+
foreach ($post_taxonomies as $ctx):
|
375 |
+
|
376 |
+
$options['tax_logic'][$ctx->name] = ($ctx->hierarchical) ? 'hierarchical' : 'multiple';
|
377 |
+
|
378 |
+
if ($ctx->name == 'category'){
|
379 |
+
$options['post_taxonomies']['category'] = $options['categories'];
|
380 |
+
}
|
381 |
+
elseif ($ctx->name == 'post_tag' ){
|
382 |
+
$options['tax_assing']['post_tag'] = 1;
|
383 |
+
$options['tax_multiple_xpath']['post_tag'] = $options['tags'];
|
384 |
+
$options['tax_multiple_delim']['post_tag'] = $options['tags_delim'];
|
385 |
+
}
|
386 |
+
|
387 |
+
if ( ! empty($options['post_taxonomies'][$ctx->name])){
|
388 |
+
|
389 |
+
$taxonomies_hierarchy = json_decode($options['post_taxonomies'][$ctx->name], true);
|
390 |
+
$options['tax_assing'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['assign'])) ? 1 : 0;
|
391 |
+
|
392 |
+
if ($options['tax_logic'][$ctx->name] == 'multiple') {
|
393 |
+
$options['tax_multiple_xpath'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['xpath'])) ? $taxonomies_hierarchy[0]['xpath'] : '';
|
394 |
+
$options['tax_multiple_delim'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['delim'])) ? $taxonomies_hierarchy[0]['delim'] : '';
|
395 |
+
}
|
396 |
+
else{
|
397 |
+
|
398 |
+
$options['tax_hierarchical_logic'][$ctx->name] = 'manual';
|
399 |
+
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
endforeach;
|
404 |
+
endif;
|
405 |
}
|
406 |
|
407 |
/**
|
408 |
* pre-dispatching logic for admin page controllers
|
409 |
*/
|
410 |
public function __adminInit() {
|
411 |
+
|
412 |
+
self::$session = new PMXI_Handler();
|
413 |
|
414 |
$input = new PMXI_Input();
|
415 |
$page = strtolower($input->getpost('page', ''));
|
437 |
'is_user' => is_user_admin(),
|
438 |
);
|
439 |
add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
|
440 |
+
add_filter('admin_body_class', create_function('', 'return "' . 'wpallimport-plugin";'));
|
441 |
|
442 |
$controller = new $controllerName();
|
443 |
if ( ! $controller instanceof PMXI_Controller_Admin) {
|
460 |
}
|
461 |
|
462 |
}
|
463 |
+
|
464 |
}
|
465 |
|
466 |
/**
|
491 |
* @param string[optional] $page When $page set to empty string ealier buffered content is outputted, otherwise controller is called based on $page value
|
492 |
*/
|
493 |
public function adminDispatcher($page = '', $action = 'index') {
|
|
|
494 |
if ('' === $page) {
|
495 |
if ( ! is_null(self::$buffer)) {
|
496 |
echo '<div class="wrap">';
|
547 |
return TRUE;
|
548 |
}
|
549 |
}
|
550 |
+
}
|
551 |
+
|
552 |
return FALSE;
|
553 |
}
|
554 |
|
610 |
foreach ($blogids as $blog_id) {
|
611 |
switch_to_blog($blog_id);
|
612 |
require self::ROOT_DIR . '/schema.php';
|
613 |
+
dbDelta($plugin_queries);
|
|
|
614 |
|
615 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
616 |
|
626 |
|
627 |
$this->__ver_1_04_transition_fix();
|
628 |
|
629 |
+
$this->__add_feed_type_fix(); // feature to version 2.22
|
630 |
+
|
631 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
632 |
|
633 |
$post = new PMXI_Post_Record();
|
654 |
* NOTE: the function can be removed when plugin version progress and it's sure matter nobody has ver 1.03
|
655 |
*/
|
656 |
public function __ver_1_04_transition_fix() {
|
657 |
+
$uploads = wp_upload_dir();
|
658 |
|
659 |
+
if ( ! is_dir($uploads['basedir'] . '/wpallimport/logs') or ! is_writable($uploads['basedir'] . '/wpallimport/logs')) {
|
660 |
+
die(sprintf(__('Uploads folder %s must be writable', 'pmxi_plugin'), $uploads['basedir'] . '/wpallimport/logs'));
|
661 |
}
|
662 |
|
663 |
+
if ( ! is_dir($uploads['basedir'] . '/wpallimport') or ! is_writable($uploads['basedir'] . '/wpallimport')) {
|
664 |
+
die(sprintf(__('Uploads folder %s must be writable', 'pmxi_plugin'), $uploads['basedir'] . '/wpallimport'));
|
665 |
}
|
666 |
|
667 |
$table = $table = $this->getTablePrefix() . 'files';
|
690 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
691 |
$parent_import_id = false;
|
692 |
$iteration = false;
|
693 |
+
$deleted = false;
|
694 |
+
$executing = false;
|
695 |
+
$canceled = false;
|
696 |
+
$canceled_on = false;
|
697 |
+
$failed = false;
|
698 |
+
$failed_on = false;
|
699 |
+
$settings_update_on = false;
|
700 |
+
$last_activity = false;
|
701 |
|
702 |
// Check if field exists
|
703 |
foreach ($tablefields as $tablefield) {
|
704 |
if ('parent_import_id' == $tablefield->Field) $parent_import_id = true;
|
705 |
if ('iteration' == $tablefield->Field) $iteration = true;
|
706 |
+
if ('deleted' == $tablefield->Field) $deleted = true;
|
707 |
+
if ('executing' == $tablefield->Field) $executing = true;
|
708 |
+
if ('canceled' == $tablefield->Field) $canceled = true;
|
709 |
+
if ('canceled_on' == $tablefield->Field) $canceled_on = true;
|
710 |
+
if ('failed' == $tablefield->Field) $failed = true;
|
711 |
+
if ('failed_on' == $tablefield->Field) $failed_on = true;
|
712 |
+
if ('settings_update_on' == $tablefield->Field) $settings_update_on = true;
|
713 |
+
if ('last_activity' == $tablefield->Field) $last_activity = true;
|
714 |
}
|
715 |
|
716 |
if (!$parent_import_id) $wpdb->query("ALTER TABLE {$table} ADD `parent_import_id` BIGINT(20) NOT NULL DEFAULT 0;");
|
717 |
if (!$iteration) $wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
718 |
+
if (!$deleted) $wpdb->query("ALTER TABLE {$table} ADD `deleted` BIGINT(20) NOT NULL DEFAULT 0;");
|
719 |
+
if (!$executing) $wpdb->query("ALTER TABLE {$table} ADD `executing` BOOL NOT NULL DEFAULT 0;");
|
720 |
+
if (!$canceled) $wpdb->query("ALTER TABLE {$table} ADD `canceled` BOOL NOT NULL DEFAULT 0;");
|
721 |
+
if (!$canceled_on) $wpdb->query("ALTER TABLE {$table} ADD `canceled_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
722 |
+
if (!$failed) $wpdb->query("ALTER TABLE {$table} ADD `failed` BOOL NOT NULL DEFAULT 0;");
|
723 |
+
if (!$failed_on) $wpdb->query("ALTER TABLE {$table} ADD `failed_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
724 |
+
if (!$settings_update_on) $wpdb->query("ALTER TABLE {$table} ADD `settings_update_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
725 |
+
if (!$last_activity) $wpdb->query("ALTER TABLE {$table} ADD `last_activity` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
726 |
|
727 |
$table = $this->getTablePrefix() . 'posts';
|
728 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
734 |
}
|
735 |
|
736 |
if (!$iteration) $wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
737 |
+
|
738 |
+
if ( ! empty($wpdb->charset))
|
739 |
+
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
740 |
+
if ( ! empty($wpdb->collate))
|
741 |
+
$charset_collate .= " COLLATE $wpdb->collate";
|
742 |
+
|
743 |
+
$table_prefix = $this->getTablePrefix();
|
744 |
+
|
745 |
+
$wpdb->query("CREATE TABLE IF NOT EXISTS {$table_prefix}history (
|
746 |
+
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
747 |
+
import_id BIGINT(20) UNSIGNED NOT NULL,
|
748 |
+
type ENUM('manual','processing','trigger','continue','') NOT NULL DEFAULT '',
|
749 |
+
time_run TEXT,
|
750 |
+
date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
751 |
+
summary TEXT,
|
752 |
+
PRIMARY KEY (id)
|
753 |
+
) $charset_collate;");
|
754 |
}
|
755 |
|
756 |
/**
|
760 |
public static function get_default_import_options() {
|
761 |
return array(
|
762 |
'type' => 'post',
|
763 |
+
'wizard_type' => 'new',
|
764 |
+
'custom_type' => '',
|
765 |
+
'featured_delim' => ',',
|
|
|
|
|
|
|
|
|
766 |
'atch_delim' => ',',
|
767 |
'post_taxonomies' => array(),
|
768 |
'parent' => 0,
|
777 |
'custom_name' => array(),
|
778 |
'custom_value' => array(),
|
779 |
'custom_format' => array(),
|
780 |
+
'custom_mapping' => array(),
|
781 |
'serialized_values' => array(),
|
782 |
+
'custom_mapping_rules' => array(),
|
783 |
'comment_status' => 'open',
|
784 |
'ping_status' => 'open',
|
785 |
'create_draft' => 'no',
|
786 |
'author' => '',
|
787 |
'post_excerpt' => '',
|
788 |
+
'post_slug' => '',
|
|
|
789 |
'attachments' => '',
|
790 |
'is_import_specified' => 0,
|
791 |
'import_specified' => '',
|
792 |
'is_delete_source' => 0,
|
793 |
'is_cloak' => 0,
|
794 |
'unique_key' => '',
|
795 |
+
'tmp_unique_key' => '',
|
796 |
'feed_type' => 'auto',
|
797 |
|
798 |
'create_new_records' => 1,
|
809 |
'is_update_slug' => 1,
|
810 |
'is_update_excerpt' => 1,
|
811 |
'is_update_categories' => 1,
|
812 |
+
'is_update_author' => 1,
|
813 |
'update_categories_logic' => 'full_update',
|
814 |
'taxonomies_list' => array(),
|
815 |
'taxonomies_only_list' => array(),
|
819 |
'update_images_logic' => 'full_update',
|
820 |
'is_update_dates' => 1,
|
821 |
'is_update_menu_order' => 1,
|
|
|
822 |
'is_update_parent' => 1,
|
823 |
'is_keep_attachments' => 0,
|
824 |
'is_keep_imgs' => 0,
|
843 |
'images_name' => 'filename',
|
844 |
'post_format' => 'standard',
|
845 |
'encoding' => 'UTF-8',
|
846 |
+
'delimiter' => '',
|
|
|
847 |
'image_meta_title' => '',
|
848 |
+
'image_meta_title_delim' => ',',
|
849 |
'image_meta_caption' => '',
|
850 |
+
'image_meta_caption_delim' => ',',
|
851 |
'image_meta_alt' => '',
|
852 |
+
'image_meta_alt_delim' => ',',
|
853 |
'image_meta_description' => '',
|
854 |
+
'image_meta_description_delim' => ',',
|
855 |
'status_xpath' => '',
|
856 |
+
'download_images' => 'yes',
|
857 |
'converted_options' => 0,
|
858 |
'update_all_data' => 'yes',
|
859 |
'is_fast_mode' => 0,
|
860 |
'chuncking' => 1,
|
861 |
+
'import_processing' => 'ajax',
|
862 |
+
|
863 |
+
'title' => '',
|
864 |
+
'content' => '',
|
865 |
+
'name' => '',
|
866 |
+
'is_keep_linebreaks' => 0,
|
867 |
+
'is_leave_html' => 0,
|
868 |
+
'fix_characters' => 0,
|
869 |
+
|
870 |
+
'featured_image' => '',
|
871 |
+
'download_featured_image' => '',
|
872 |
+
'download_featured_delim' => ',',
|
873 |
+
'is_featured' => 1,
|
874 |
+
'set_image_meta_title' => 0,
|
875 |
+
'set_image_meta_caption' => 0,
|
876 |
+
'set_image_meta_alt' => 0,
|
877 |
+
'set_image_meta_description' => 0,
|
878 |
+
'auto_set_extension' => 0,
|
879 |
+
'new_extension' => '',
|
880 |
+
'tax_logic' => array(),
|
881 |
+
'tax_assing' => array(),
|
882 |
+
'tax_single_xpath' => array(),
|
883 |
+
'tax_multiple_xpath' => array(),
|
884 |
+
'tax_hierarchical_xpath' => array(),
|
885 |
+
'tax_multiple_delim' => array(),
|
886 |
+
'tax_hierarchical_delim' => array(),
|
887 |
+
'tax_hierarchical_logic' => array(),
|
888 |
+
'tax_enable_mapping' => array(),
|
889 |
+
'tax_mapping' => array(),
|
890 |
+
'nested_files' => array()
|
891 |
);
|
892 |
}
|
893 |
|
914 |
|
915 |
}
|
916 |
|
917 |
+
PMXI_Plugin::getInstance();
|
918 |
+
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: soflyy
|
|
3 |
Tags: wordpress, xml, csv, datafeed, import
|
4 |
Requires at least: 3.6.1
|
5 |
Tested up to: 4.0
|
6 |
-
Stable tag: 3.1
|
7 |
|
8 |
WP All Import is an extremely powerful plugin that makes it easy to import any XML or CSV file to WordPress.
|
9 |
|
@@ -87,6 +87,21 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
|
|
87 |
|
88 |
== Changelog ==
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
= 3.1.5 =
|
91 |
* fixed pmxi_delete_post action
|
92 |
* fixed import menu order & post parent for pages
|
3 |
Tags: wordpress, xml, csv, datafeed, import
|
4 |
Requires at least: 3.6.1
|
5 |
Tested up to: 4.0
|
6 |
+
Stable tag: 3.2.1
|
7 |
|
8 |
WP All Import is an extremely powerful plugin that makes it easy to import any XML or CSV file to WordPress.
|
9 |
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
+
= 3.2.1 =
|
91 |
+
* fixed updating import settings
|
92 |
+
|
93 |
+
= 3.2.0 =
|
94 |
+
* IMPORTANT: WP All Import v4 (3.2.0) is a MAJOR update. Read this post before upgrading: (http://www.wpallimport.com/2014/11/free-version-wordpress-org-update-information)
|
95 |
+
* speed up the import of taxonomies/categories
|
96 |
+
* added taxonomies/categories mapping feature
|
97 |
+
* added custom fields auto-detection feature
|
98 |
+
* added custom fields mapping feature
|
99 |
+
* added images/taxonomies preview feature
|
100 |
+
* added unofficial support for more file formats - json & sql
|
101 |
+
* added new setting (secure mode) to protect your files
|
102 |
+
* better import logs
|
103 |
+
* updated design
|
104 |
+
|
105 |
= 3.1.5 =
|
106 |
* fixed pmxi_delete_post action
|
107 |
* fixed import menu order & post parent for pages
|
schema.php
CHANGED
@@ -27,14 +27,14 @@ $table_prefix = PMXI_Plugin::getInstance()->getTablePrefix();
|
|
27 |
$plugin_queries = <<<SCHEMA
|
28 |
CREATE TABLE {$table_prefix}templates (
|
29 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
30 |
-
options TEXT,
|
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;
|
@@ -46,14 +46,12 @@ CREATE TABLE {$table_prefix}imports (
|
|
46 |
type VARCHAR(32) NOT NULL DEFAULT '',
|
47 |
feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
|
48 |
path TEXT,
|
49 |
-
xpath TEXT,
|
50 |
-
|
51 |
-
|
52 |
-
scheduled VARCHAR(64) NOT NULL DEFAULT '',
|
53 |
-
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
54 |
-
large_import ENUM('Yes','No') NOT NULL DEFAULT 'No',
|
55 |
root_element VARCHAR(255) DEFAULT '',
|
56 |
processing BOOL NOT NULL DEFAULT 0,
|
|
|
57 |
triggered BOOL NOT NULL DEFAULT 0,
|
58 |
queue_chunk_number BIGINT(20) NOT NULL DEFAULT 0,
|
59 |
first_import TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
@@ -62,6 +60,13 @@ CREATE TABLE {$table_prefix}imports (
|
|
62 |
created BIGINT(20) NOT NULL DEFAULT 0,
|
63 |
updated BIGINT(20) NOT NULL DEFAULT 0,
|
64 |
skipped BIGINT(20) NOT NULL DEFAULT 0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
iteration BIGINT(20) NOT NULL DEFAULT 0,
|
66 |
PRIMARY KEY (id)
|
67 |
) $charset_collate;
|
@@ -82,4 +87,13 @@ CREATE TABLE {$table_prefix}files (
|
|
82 |
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
83 |
PRIMARY KEY (id)
|
84 |
) $charset_collate;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
SCHEMA;
|
27 |
$plugin_queries = <<<SCHEMA
|
28 |
CREATE TABLE {$table_prefix}templates (
|
29 |
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
30 |
+
options TEXT,
|
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;
|
46 |
type VARCHAR(32) NOT NULL DEFAULT '',
|
47 |
feed_type ENUM('xml','csv','zip','gz','') NOT NULL DEFAULT '',
|
48 |
path TEXT,
|
49 |
+
xpath TEXT,
|
50 |
+
options TEXT,
|
51 |
+
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
|
|
|
|
|
|
52 |
root_element VARCHAR(255) DEFAULT '',
|
53 |
processing BOOL NOT NULL DEFAULT 0,
|
54 |
+
executing BOOL NOT NULL DEFAULT 0,
|
55 |
triggered BOOL NOT NULL DEFAULT 0,
|
56 |
queue_chunk_number BIGINT(20) NOT NULL DEFAULT 0,
|
57 |
first_import TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
60 |
created BIGINT(20) NOT NULL DEFAULT 0,
|
61 |
updated BIGINT(20) NOT NULL DEFAULT 0,
|
62 |
skipped BIGINT(20) NOT NULL DEFAULT 0,
|
63 |
+
deleted BIGINT(20) NOT NULL DEFAULT 0,
|
64 |
+
canceled BOOL NOT NULL DEFAULT 0,
|
65 |
+
canceled_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
66 |
+
failed BOOL NOT NULL DEFAULT 0,
|
67 |
+
failed_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
68 |
+
settings_update_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
69 |
+
last_activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
70 |
iteration BIGINT(20) NOT NULL DEFAULT 0,
|
71 |
PRIMARY KEY (id)
|
72 |
) $charset_collate;
|
87 |
registered_on DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
88 |
PRIMARY KEY (id)
|
89 |
) $charset_collate;
|
90 |
+
CREATE TABLE {$table_prefix}history (
|
91 |
+
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
92 |
+
import_id BIGINT(20) UNSIGNED NOT NULL,
|
93 |
+
type ENUM('manual','processing','trigger','continue','') NOT NULL DEFAULT '',
|
94 |
+
time_run TEXT,
|
95 |
+
date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
96 |
+
summary TEXT,
|
97 |
+
PRIMARY KEY (id)
|
98 |
+
) $charset_collate;
|
99 |
SCHEMA;
|
shortcodes/.gitkeep
ADDED
File without changes
|
static/css/admin-wp-3.8.css
CHANGED
@@ -1,23 +1,22 @@
|
|
1 |
-
.
|
|
|
|
|
|
|
2 |
font-size: 12px !important;
|
3 |
}
|
4 |
-
.
|
5 |
-
top: 14px !important;
|
6 |
-
float: left;
|
7 |
-
}
|
8 |
-
.pmxi_plugin .submit-buttons .large_button{
|
9 |
font-size: 14px !important;
|
10 |
}
|
11 |
-
.
|
12 |
-
vertical-align: baseline !important;
|
13 |
-
}
|
14 |
-
.pmxi_plugin #titlediv #titlewrap{
|
15 |
font-size: 13px !important;
|
16 |
}
|
17 |
-
.
|
18 |
-
color: #
|
|
|
|
|
|
|
19 |
}
|
20 |
-
.
|
21 |
padding-bottom: 0;
|
22 |
border-bottom: 1px solid #ccc;
|
23 |
margin-bottom: 10px;
|
1 |
+
.wpallimport-plugin textarea,
|
2 |
+
.wpallimport-plugin select,
|
3 |
+
.wpallimport-plugin p,
|
4 |
+
.wpallimport-plugin .wp_attachment_details label[for="content"]{
|
5 |
font-size: 12px !important;
|
6 |
}
|
7 |
+
.wpallimport-plugin .submit-buttons .large_button{
|
|
|
|
|
|
|
|
|
8 |
font-size: 14px !important;
|
9 |
}
|
10 |
+
.wpallimport-plugin #titlediv #titlewrap{
|
|
|
|
|
|
|
11 |
font-size: 13px !important;
|
12 |
}
|
13 |
+
.wpallimport-plugin #titlediv #wpallimport-title{
|
14 |
+
color: #333;
|
15 |
+
height: 40px !important;
|
16 |
+
font-size: 1.7em;
|
17 |
+
line-height: 26px !important;
|
18 |
}
|
19 |
+
.wpallimport-plugin h2.woo-nav-tab-wrapper{
|
20 |
padding-bottom: 0;
|
21 |
border-bottom: 1px solid #ccc;
|
22 |
margin-bottom: 10px;
|
static/css/admin-wp-4.0.css
ADDED
File without changes
|
static/css/admin.css
CHANGED
@@ -1,17 +1,20 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
height: 1px;
|
4 |
border-width: 0px;
|
5 |
color: #ddd;
|
6 |
background-color: #ddd;
|
7 |
margin-bottom: 15px;
|
8 |
}
|
9 |
-
.
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
}
|
14 |
-
.pmxi_plugin a.help {
|
15 |
overflow: hidden;
|
16 |
text-indent: -99999px;
|
17 |
display: inline-block;
|
@@ -21,11 +24,13 @@
|
|
21 |
background-image: url("../img/help.png");
|
22 |
vertical-align: middle;
|
23 |
margin-left: 5px;
|
|
|
|
|
24 |
}
|
25 |
-
.
|
26 |
width: 8em;
|
27 |
}
|
28 |
-
.
|
29 |
background-image: url("../img/date-picker.gif");
|
30 |
background-repeat: no-repeat;
|
31 |
cursor: pointer;
|
@@ -35,522 +40,395 @@
|
|
35 |
height: 18px;
|
36 |
vertical-align: middle;
|
37 |
}
|
38 |
-
.
|
39 |
font-style: italic;
|
40 |
display: none;
|
41 |
}
|
42 |
-
.
|
43 |
-
max-width: 700px;
|
44 |
-
}
|
45 |
-
.pmxi_plugin .loading {
|
46 |
cursor: progress;
|
47 |
background-repeat: no-repeat;
|
48 |
background-position: center;
|
49 |
}
|
50 |
-
.
|
51 |
-
background-image: url("../img/loading.
|
52 |
background-repeat: no-repeat;
|
53 |
-
background-position: 50%
|
54 |
-
|
55 |
-
.pmxi_plugin a.add-new {
|
56 |
-
font-size: 18px;
|
57 |
-
background-color: #eee;
|
58 |
-
cursor: pointer;
|
59 |
-
padding: 6px 10px 6px 10px;
|
60 |
-
line-height: normal;
|
61 |
-
font-style: normal;
|
62 |
-
color: #464646;
|
63 |
-
border-color: #bbb;
|
64 |
-
-moz-border-radius: 4px 4px 4px 4px;
|
65 |
-
border-radius: 4px;
|
66 |
-
border-style: solid;
|
67 |
-
border-width: 1px;
|
68 |
-
/*font-family: "Lucida Grande",Verdana,Arial,"Bitstream Vera Sans",sans-serif;*/
|
69 |
-
text-decoration: none;
|
70 |
}
|
71 |
-
.
|
72 |
-
|
73 |
-
|
|
|
|
|
74 |
}
|
75 |
-
.
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
font-size:
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
}
|
89 |
-
.
|
90 |
-
|
91 |
-
|
|
|
92 |
}
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
-
|
98 |
-
|
99 |
-
clear: both;
|
100 |
-
border-collapse: collapse;
|
101 |
-
min-width: 770px;
|
102 |
-
width: 100%;
|
103 |
}
|
104 |
-
.
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
108 |
}
|
109 |
-
.
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
-
.
|
114 |
-
|
115 |
-
width: 25%;
|
116 |
-
min-width: 260px;
|
117 |
-
position: relative;
|
118 |
}
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
.pmxi_plugin table.layout td.left hr {
|
124 |
-
clear: both;
|
125 |
-
}
|
126 |
-
.pmxi_plugin.no-js table.layout td.left > h2:first-child {
|
127 |
-
margin-top: 0px;
|
128 |
-
}
|
129 |
-
.pmxi_plugin table.layout div.left {
|
130 |
-
min-width: 490px;
|
131 |
-
width: 70%;
|
132 |
-
float: left;
|
133 |
}
|
134 |
-
.
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
139 |
float: right;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
.
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
-
/*@*/
|
148 |
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
-
.
|
155 |
-
|
|
|
|
|
|
|
156 |
}
|
157 |
-
.
|
158 |
-
|
|
|
159 |
}
|
160 |
-
.
|
161 |
-
|
162 |
-
|
163 |
-
font-size:
|
|
|
|
|
164 |
}
|
165 |
-
.
|
166 |
-
|
167 |
-
|
|
|
168 |
}
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
}
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
-
|
180 |
-
|
181 |
-
/*@+ Choose Elements form */
|
182 |
-
.pmxi_plugin form.choose-elements input[type="text"] {
|
183 |
-
width: 100%;
|
184 |
-
max-width: 300px;
|
185 |
-
min-width: 150px;
|
186 |
-
}
|
187 |
-
/*@*/
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
192 |
}
|
193 |
-
.
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
-
|
198 |
-
|
199 |
-
}
|
200 |
-
|
201 |
-
.pmxi_plugin #poststuff form.template h3 {
|
202 |
-
margin: 1em 0 5px 2px;
|
203 |
-
font-size: 1.17em;
|
204 |
-
padding: 0px;
|
205 |
-
}
|
206 |
-
.pmxi_plugin #post-preview {
|
207 |
-
font-size: 12px;
|
208 |
}
|
209 |
-
.
|
210 |
-
|
211 |
}
|
212 |
-
.
|
213 |
-
display:
|
214 |
-
|
215 |
-
|
216 |
-
font-weight: normal;
|
217 |
}
|
218 |
-
|
219 |
-
|
220 |
-
/*@+ Options form */
|
221 |
-
.pmxi_plugin form.options.edit {
|
222 |
-
/*width: 700px;*/
|
223 |
}
|
224 |
|
225 |
-
.
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
.pmxi_plugin .post-type-container.selected,
|
231 |
-
.pmxi_plugin .file-type-container.selected {
|
232 |
-
background-color: #F1F1F1;
|
233 |
-
border: 1px solid #ccc;
|
234 |
-
padding-bottom: 10px;
|
235 |
}
|
236 |
-
.
|
237 |
-
|
238 |
-
margin: 0px 0px;
|
239 |
}
|
240 |
-
.
|
241 |
-
|
242 |
-
margin: 5px 0 0 20px;
|
243 |
}
|
244 |
|
245 |
-
.
|
246 |
-
|
247 |
-
margin-top: 0px;
|
248 |
-
}
|
249 |
-
.pmxi_plugin .post-type-options table.form-table {
|
250 |
-
max-width: 500px;
|
251 |
-
}
|
252 |
-
.pmxi_plugin .post-type-options table.form-table td.delim {
|
253 |
-
width: 50px;
|
254 |
-
position: relative;
|
255 |
-
display: block;
|
256 |
-
}
|
257 |
-
.pmxi_plugin .post-type-options table.form-table td.delim input {
|
258 |
-
width: 20px;
|
259 |
-
}
|
260 |
-
.pmxi_plugin table.form-table.custom-params {
|
261 |
-
max-width: 700px;
|
262 |
}
|
263 |
-
|
264 |
-
|
265 |
-
/*padding: 0;*/
|
266 |
-
vertical-align: top;
|
267 |
-
}
|
268 |
-
.pmxi_plugin .post-type-options table.form-table th {
|
269 |
-
width: 100px;
|
270 |
-
}
|
271 |
-
.pmxi_plugin .post-type-options table.form-table select {
|
272 |
-
max-width: 300px;
|
273 |
-
width:300px;
|
274 |
-
}
|
275 |
-
.pmxi_plugin table.form-table thead td {
|
276 |
-
font-weight: bold;
|
277 |
-
}
|
278 |
-
.pmxi_plugin table.form-table.custom-params input {
|
279 |
-
margin-left: 0;
|
280 |
-
}
|
281 |
-
.pmxi_plugin table.form-table tr.template, .pmxi_plugin table.form-table ol li.template {
|
282 |
-
display: none;
|
283 |
-
}
|
284 |
-
/*@*/
|
285 |
-
|
286 |
-
/*@+ XML representation */
|
287 |
-
.pmxi_plugin .tag {
|
288 |
-
background-color: #fff;
|
289 |
-
position: absolute;
|
290 |
-
width:95%;
|
291 |
-
top: 0;
|
292 |
-
margin-top: 45px;
|
293 |
-
border-top: 1px solid #DFDFDF;
|
294 |
-
-moz-border-radius-topleft: 4px;
|
295 |
-
-webkit-border-top-left-radius: 4px;
|
296 |
-
border-top-left-radius: 4px;
|
297 |
-
-moz-border-radius-topright: 4px;
|
298 |
-
-webkit-border-top-right-radius: 4px;
|
299 |
-
border-top-right-radius: 4px;
|
300 |
}
|
301 |
|
302 |
-
.
|
303 |
-
|
|
|
|
|
304 |
}
|
305 |
-
.pmxi_plugin .tag .title {
|
306 |
-
font-weight: bold;
|
307 |
-
padding: 6px 8px;
|
308 |
-
color: #464646;
|
309 |
-
background: #DFDFDF;
|
310 |
-
font-size: 12px;
|
311 |
-
border-top: 1px solid #DFDFDF;
|
312 |
-
-moz-border-radius-topleft: 4px;
|
313 |
-
-webkit-border-top-left-radius: 4px;
|
314 |
-
border-top-left-radius: 4px;
|
315 |
-
-moz-border-radius-topright: 4px;
|
316 |
-
-webkit-border-top-right-radius: 4px;
|
317 |
-
border-top-right-radius: 4px;
|
318 |
-
}
|
319 |
-
.pmxi_plugin .tag .xml {
|
320 |
-
max-height: 525px;
|
321 |
-
overflow: auto;
|
322 |
-
border: 1px solid #DFDFDF;
|
323 |
-
border-top:none;
|
324 |
-
-moz-border-radius-bottomright: 4px;
|
325 |
-
-webkit-border-bottom-right-radius: 4px;
|
326 |
-
border-bottom-right-radius: 4px;
|
327 |
-
-moz-border-radius-bottomleft: 4px;
|
328 |
-
-webkit-border-bottom-left-radius: 4px;
|
329 |
-
border-bottom-left-radius: 4px;
|
330 |
-
}
|
331 |
-
.pmxi_plugin .tag .navigation {
|
332 |
-
float: right;
|
333 |
-
margin: 2px -12px 0 0;
|
334 |
-
}
|
335 |
-
.pmxi_plugin .tag .navigation a,
|
336 |
-
.pmxi_plugin .tag .navigation span {
|
337 |
-
font-weight: bold;
|
338 |
-
padding: 0 12px;
|
339 |
-
text-decoration: none;
|
340 |
-
}
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
}
|
349 |
}
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
}
|
354 |
-
.
|
355 |
-
|
356 |
-
|
|
|
357 |
}
|
358 |
-
|
359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
}
|
361 |
-
.
|
362 |
-
|
|
|
363 |
}
|
364 |
-
.
|
365 |
-
|
|
|
366 |
}
|
367 |
-
.
|
368 |
-
|
369 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
}
|
371 |
-
.
|
372 |
-
|
|
|
|
|
|
|
373 |
}
|
374 |
-
.
|
375 |
-
|
376 |
-
font-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
}
|
378 |
-
.
|
379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
380 |
}
|
381 |
-
.
|
382 |
-
|
383 |
-
|
|
|
|
|
|
|
384 |
}
|
385 |
-
.
|
386 |
-
|
|
|
387 |
}
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
-moz-user-select: none;
|
393 |
-
-khtml-user-select: none;
|
394 |
-
-webkit-user-select: none;
|
395 |
-
user-select: none;
|
396 |
-
cursor: pointer;
|
397 |
-
font-family: monospace;
|
398 |
-
line-height: 100%;
|
399 |
-
text-align: left;
|
400 |
-
color: red;
|
401 |
-
}
|
402 |
-
.xml-more {
|
403 |
-
color: red;
|
404 |
-
font-size: 80%;
|
405 |
-
}
|
406 |
-
.xml.resetable .xml-element.lvl-mod4-3 > .xml-content {
|
407 |
-
margin-left: -59px;
|
408 |
-
margin-right: -8px;
|
409 |
-
background-color: #fff;
|
410 |
-
border: 1px dashed #906;
|
411 |
-
border-left: 2px solid #906;
|
412 |
-
border-right: none;
|
413 |
-
}
|
414 |
-
.xml.resetable .xml-element.lvl-mod4-3 > .xml-content.short {
|
415 |
-
margin-left: 0;
|
416 |
-
margin-right: 0;
|
417 |
-
border: none;
|
418 |
-
background-color: inherit;
|
419 |
-
}
|
420 |
-
/* xml table representation */
|
421 |
-
tr.xml-element.selected .xml-tag.opening .xml-tag-name {
|
422 |
-
background-color: #B5E61D;
|
423 |
-
}
|
424 |
-
table.xml td {
|
425 |
-
padding-left: 20px;
|
426 |
-
}
|
427 |
-
table.xml td:first-child {
|
428 |
-
width: 1px;
|
429 |
-
padding-left: 0px;
|
430 |
-
}
|
431 |
-
|
432 |
-
table.xml,
|
433 |
-
table.xml table {
|
434 |
-
width: 100%;
|
435 |
-
border-collapse:collapse;
|
436 |
-
border-spacing:0;
|
437 |
-
}
|
438 |
-
/*@*/
|
439 |
-
|
440 |
-
/*@+ table list */
|
441 |
-
.pmxi_plugin table.widefat th {
|
442 |
-
white-space: nowrap;
|
443 |
-
}
|
444 |
-
.pmxi_plugin table.widefat th.ASC a {
|
445 |
-
background-image: url("../img/screen-options-right-up.gif");
|
446 |
-
background-repeat: no-repeat;
|
447 |
-
background-position: right center;
|
448 |
-
padding-right: 19px;
|
449 |
-
}
|
450 |
-
.pmxi_plugin table.widefat th.DESC a {
|
451 |
-
background-image: url("../img/screen-options-right.gif");
|
452 |
-
background-repeat: no-repeat;
|
453 |
-
background-position: right center;
|
454 |
-
padding-right: 19px;
|
455 |
-
}
|
456 |
-
|
457 |
-
.pmxi_plugin table.widefat.pmxi-admin-imports th.column-id {
|
458 |
-
width: 35px;
|
459 |
-
}
|
460 |
-
.pmxi_plugin table.widefat.pmxi-admin-imports th.column-scheduled {
|
461 |
-
width: 85px;
|
462 |
-
}
|
463 |
-
.pmxi_plugin table.widefat.pmxi-admin-imports th.column-registered_on {
|
464 |
-
width: 130px;
|
465 |
-
}
|
466 |
-
.pmxi_plugin table.widefat.pmxi-admin-imports th.column-post_count {
|
467 |
-
width: 105px;
|
468 |
-
}
|
469 |
-
/*@*/
|
470 |
-
|
471 |
-
/*@+ fixes */
|
472 |
-
.pmxi_plugin input[type="file"] {
|
473 |
-
padding: 0; /* FIX height or <input type="file" /> for Safari & Chrome */
|
474 |
-
}
|
475 |
-
.pmxi_plugin .ui-widget-overlay {
|
476 |
-
position: fixed !important; /* FIX: modal dialog overlay in IE 8 */
|
477 |
-
background-color: #aaa !important; /* FIX: overlay color */
|
478 |
-
}
|
479 |
-
.pmxi_plugin .ui-dialog {
|
480 |
-
position: absolute !important; /* FIX: for wordpress 3.1 not to add empty space */
|
481 |
-
z-index: 999999;
|
482 |
-
}
|
483 |
-
.pmxi_plugin .ui-autocomplete {
|
484 |
-
position: absolute;
|
485 |
-
border-color: #ccc #444 #444 #aaa;
|
486 |
-
cursor: default;
|
487 |
-
-moz-border-radius: 0;
|
488 |
-
border-radius: 0;
|
489 |
-
max-height: 200px;
|
490 |
-
max-width: 700px;
|
491 |
-
overflow-y: auto;
|
492 |
-
overflow-x: hidden;
|
493 |
-
white-space: nowrap;
|
494 |
-
font-size: 11px;
|
495 |
-
}
|
496 |
-
.pmxi_plugin .ui-autocomplete .ui-menu-item {
|
497 |
-
padding: 0;
|
498 |
-
margin: 0;
|
499 |
-
}
|
500 |
-
.pmxi_plugin .ui-autocomplete .ui-menu-item a {
|
501 |
-
display: block;
|
502 |
-
padding: 2px;
|
503 |
-
padding-right: 20px; /* space for scroll bar */
|
504 |
-
font-size: 11px;
|
505 |
-
border: none;
|
506 |
-
-moz-border-radius: 0;
|
507 |
-
border-radius: 0;
|
508 |
-
}
|
509 |
-
.pmxi_plugin .ui-autocomplete .ui-menu-item a.ui-state-hover {
|
510 |
-
background: #39f;
|
511 |
-
color: #fff;
|
512 |
-
}
|
513 |
-
.pmxi_plugin input.autocomplete {
|
514 |
-
background: url("../img/down.gif") no-repeat right top #fff;
|
515 |
-
padding-right: 20px;
|
516 |
-
cursor: default;
|
517 |
-
font-size: 11px !important;
|
518 |
-
}
|
519 |
-
/*@*/
|
520 |
-
|
521 |
-
.pmxi_plugin .taglines{
|
522 |
-
font-size:13px;
|
523 |
-
font-style: italic;
|
524 |
-
display: block;
|
525 |
-
color: #777;
|
526 |
-
}
|
527 |
-
|
528 |
-
.pmxi_plugin #process{ display:none; }
|
529 |
-
.pmxi_plugin .load-options{ float:right; font-size:13px; position: relative; top: -30px; }
|
530 |
-
.pmxi_plugin form.options table.layout td.right{
|
531 |
-
width: 25%;
|
532 |
-
}
|
533 |
-
.pmxi_plugin .drag-element{
|
534 |
-
background: url("../img/drag.png") top right no-repeat;
|
535 |
-
cursor: pointer;
|
536 |
-
padding-left: 25px;
|
537 |
-
background-position: 0px 1px;
|
538 |
-
}
|
539 |
-
.sortable li{ position: relative;}
|
540 |
-
.pmxi_plugin ol{
|
541 |
-
margin-top: 6px;
|
542 |
-
list-style: none;
|
543 |
-
}
|
544 |
-
.pmxi_plugin .no-margin{ margin:0px; }
|
545 |
-
.pmxi_plugin .icon-item, .pmxi_plugin .add-new-custom, .pmxi_plugin .add-new-key{
|
546 |
display: inline-block;
|
547 |
width: 16px;
|
548 |
height: 16px;
|
549 |
margin: 0px 3px;
|
550 |
}
|
551 |
-
.
|
552 |
-
|
553 |
-
|
|
|
|
|
|
|
554 |
height:25px;
|
555 |
padding-left: 20px;
|
556 |
color:#21759B;
|
@@ -558,735 +436,1031 @@ table.xml table {
|
|
558 |
padding-top: 2px;
|
559 |
text-decoration: underline;
|
560 |
display: block;
|
561 |
-
margin: 0 auto;
|
562 |
}
|
563 |
|
564 |
-
.
|
565 |
-
background: url("../img/
|
566 |
-
top:
|
567 |
-
right:
|
568 |
position: absolute;
|
|
|
|
|
569 |
}
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
.pmxi_plugin .fs11 { font-size:11px; }
|
574 |
-
|
575 |
-
.pmxi_plugin .rel { position: relative; }
|
576 |
-
|
577 |
-
#type_meta_select{ margin-bottom: 10px; height:1.8em; }
|
578 |
-
|
579 |
-
.upload_process{
|
580 |
-
border: none;
|
581 |
-
padding: 1px;
|
582 |
-
}
|
583 |
-
|
584 |
-
#large_import_xpath{ display:none; }
|
585 |
-
#large_import{ margin:0px 5px; }
|
586 |
-
#download_pmxi_log{
|
587 |
-
cursor: pointer;
|
588 |
-
margin: 5px 0;
|
589 |
-
display: none;
|
590 |
}
|
591 |
-
.
|
592 |
-
|
593 |
}
|
594 |
-
|
595 |
-
|
596 |
-
}*/
|
597 |
-
.pmxi_plugin #processbar{
|
598 |
-
text-align: center;
|
599 |
-
visibility: hidden;
|
600 |
-
height: 37px;
|
601 |
-
padding-top: 18px;
|
602 |
-
margin-bottom: 20px;
|
603 |
-
border: 1px solid #AAAAAA;
|
604 |
-
color: #222222;
|
605 |
position: relative;
|
606 |
}
|
607 |
-
.
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
}
|
615 |
-
.
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
}
|
621 |
-
.pmxi_plugin #right_progress{ float:right; padding-right: 5px; }
|
622 |
-
.pmxi_plugin #left_progress{ float:left; padding-left: 5px; }
|
623 |
-
.pmxi_plugin #existing_meta_keys{
|
624 |
-
margin-bottom: 10px;
|
625 |
-
padding: 2px;
|
626 |
-
width: 580px;
|
627 |
-
}
|
628 |
-
.pmxi_plugin #pmxi_tabs{
|
629 |
-
/*display: none;*/
|
630 |
-
padding-bottom: 20px;
|
631 |
-
-moz-border-radius: 4px;
|
632 |
-
-khtml-border-radius: 4px;
|
633 |
-
-webkit-border-radius: 4px;
|
634 |
-
border-radius: 4px;
|
635 |
}
|
636 |
-
.
|
637 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
}
|
639 |
-
.
|
640 |
-
|
641 |
-
-
|
642 |
-
|
643 |
-
|
|
|
644 |
}
|
645 |
-
.
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
-webkit-border-top-right-radius: 4px;
|
653 |
-
border-top-right-radius: 4px;
|
654 |
}
|
655 |
-
|
656 |
-
background: #
|
657 |
-
border:
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
}
|
659 |
-
.
|
660 |
-
|
661 |
-
font-size:
|
662 |
-
|
663 |
-
background: #F2FBD9;
|
664 |
}
|
665 |
-
|
666 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
667 |
}
|
668 |
-
.
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
height:25px;
|
674 |
}
|
675 |
-
.
|
676 |
-
|
677 |
-
visibility: hidden;
|
678 |
-
color: #009039;
|
679 |
-
font-size: 13px;
|
680 |
-
font-weight: bold;
|
681 |
-
margin-top: 10px;
|
682 |
-
width: 100%;
|
683 |
-
text-align: center;
|
684 |
-
border:1px solid #4297D7;
|
685 |
-moz-border-radius: 4px;
|
686 |
-khtml-border-radius: 4px;
|
687 |
-
-webkit-border-radius: 4px;
|
688 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
689 |
}
|
690 |
-
.
|
691 |
-
|
692 |
-
|
693 |
-
position: absolute;
|
694 |
-
text-align: center;
|
695 |
-
top: 8px;
|
696 |
-
width: 100%;
|
697 |
-
font-size: 12px;
|
698 |
-
color:#333;
|
699 |
}
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
|
|
|
|
|
|
|
|
705 |
}
|
706 |
-
.
|
707 |
-
|
708 |
-
/*
|
709 |
-
position: absolute;
|
710 |
-
right: -18px; */
|
711 |
}
|
712 |
-
.
|
713 |
-
|
|
|
714 |
}
|
715 |
-
|
|
|
|
|
|
|
716 |
padding: 20px;
|
717 |
width:auto;
|
718 |
}
|
719 |
-
.
|
720 |
padding: 15px;
|
721 |
}
|
722 |
-
.
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
}
|
727 |
-
.
|
728 |
-
|
729 |
-
}
|
730 |
-
.
|
731 |
padding: 0px 5px;
|
732 |
font-weight: bold;
|
733 |
}
|
734 |
-
.
|
735 |
font-size: 1.17em;
|
736 |
}
|
737 |
-
.
|
738 |
font-weight: bold;
|
739 |
color:#33AA28;
|
740 |
}
|
741 |
-
.
|
742 |
-
|
743 |
-
|
744 |
-
text-align: center;
|
745 |
}
|
746 |
-
.
|
747 |
-
|
748 |
}
|
749 |
-
.
|
750 |
-
|
751 |
-
margin-left: 5px;
|
752 |
-
padding-top: 0;
|
753 |
}
|
754 |
-
.
|
755 |
-
|
756 |
-
margin: 0 5px;
|
757 |
-
padding: 4px 10px;
|
758 |
-
width:70px;
|
759 |
-
text-align: center;
|
760 |
}
|
761 |
-
.
|
762 |
-
|
763 |
-
float: left;
|
764 |
-
/*height: 265px;*/
|
765 |
-
width:33%;
|
766 |
-
margin-bottom: 10px;
|
767 |
-
/*padding: 0 1%;*/
|
768 |
}
|
769 |
-
.
|
770 |
-
|
|
|
|
|
771 |
}
|
772 |
-
.
|
773 |
-
|
|
|
774 |
}
|
775 |
-
.
|
776 |
-
|
777 |
-
width: 50%;
|
778 |
}
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
width:25px;
|
787 |
-
text-align: center;
|
788 |
-
}
|
789 |
-
.pmxi_plugin .post_taxonomy{
|
790 |
-
margin-bottom: 15px;
|
791 |
overflow: hidden;
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
|
|
796 |
}
|
797 |
-
.
|
|
|
|
|
798 |
float: right;
|
799 |
-
|
800 |
-
|
801 |
}
|
802 |
-
.
|
803 |
-
|
804 |
}
|
805 |
-
.
|
806 |
-
|
807 |
}
|
808 |
-
.
|
|
|
|
|
809 |
display: block;
|
810 |
-
|
811 |
}
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
|
|
819 |
}
|
820 |
-
.
|
821 |
-
|
|
|
|
|
822 |
}
|
823 |
-
.
|
824 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
825 |
}
|
826 |
-
.
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
831 |
}
|
832 |
-
.pmxi-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
margin-left: 10px;
|
838 |
-
padding: 15px 25px;
|
839 |
-
text-decoration: none;
|
840 |
-
-moz-border-radius: 3px;
|
841 |
-
-khtml-border-radius: 3px;
|
842 |
-
-webkit-border-radius: 3px;
|
843 |
-
border-radius: 3px;
|
844 |
}
|
845 |
-
.
|
846 |
-
|
|
|
|
|
|
|
847 |
}
|
848 |
-
.
|
849 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
850 |
}
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
|
|
|
|
|
|
|
|
859 |
}
|
860 |
-
|
861 |
-
|
|
|
|
|
862 |
}
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
}
|
869 |
-
.
|
870 |
-
|
871 |
-
|
|
|
872 |
position: relative;
|
873 |
-
top: 3px;
|
874 |
-
}
|
875 |
-
.pmxi_plugin .separated_by{
|
876 |
float: right;
|
877 |
-
font-size: 12px;
|
878 |
-
color: #999999;
|
879 |
-
margin-right: 20px;
|
880 |
-
}
|
881 |
-
.pmxi_plugin .delim > label{
|
882 |
-
color: #999999;
|
883 |
-
font-size: 11px;
|
884 |
}
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
width: 100%;
|
889 |
}
|
890 |
-
|
891 |
-
|
892 |
-
border: 1px solid #aaa;
|
893 |
-
margin-bottom: 20px;
|
894 |
-
}
|
895 |
-
.pmxi_plugin #logbar{
|
896 |
-
padding: 5px 0px;
|
897 |
-
text-align: center;
|
898 |
-
margin: 10px 0px;
|
899 |
-
border: 1px solid #aaa;
|
900 |
-
overflow: auto;
|
901 |
-
}
|
902 |
-
.pmxi_plugin .optionsset > table:last-child{
|
903 |
-
border: none;
|
904 |
-
}
|
905 |
-
.pmxi_plugin #download_log_separator, .pmxi_plugin #download_log{
|
906 |
-
display: none;
|
907 |
}
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
912 |
}
|
913 |
-
|
914 |
-
|
915 |
-
|
|
|
|
|
916 |
}
|
917 |
-
.
|
918 |
-
|
919 |
}
|
920 |
-
.
|
921 |
-
|
922 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
923 |
}
|
924 |
-
.
|
925 |
-
|
926 |
-
margin-bottom: 20px;
|
927 |
-
padding: 10px 20px;
|
928 |
}
|
929 |
-
|
930 |
-
|
|
|
931 |
}
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
936 |
}
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
text-decoration: none;
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
}
|
953 |
-
.pmxi_plugin .action_buttons a:hover{
|
954 |
-
background: #dfdfdf;
|
955 |
-
}*/
|
956 |
-
.pmxi_plugin #current_element{
|
957 |
-
color:green;
|
958 |
}
|
959 |
-
.
|
960 |
-
|
961 |
-
display:
|
962 |
-
|
963 |
-
font-size:
|
964 |
-
|
965 |
-
margin-
|
966 |
-
|
967 |
-
padding-top: 5px;
|
968 |
text-align: center;
|
969 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
}
|
971 |
-
.
|
972 |
-
|
|
|
|
|
|
|
|
|
|
|
973 |
}
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
margin-top: 8px;
|
980 |
}
|
981 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
982 |
display: none;
|
|
|
|
|
983 |
}
|
984 |
-
.
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
-
|
989 |
-
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
}
|
1001 |
-
.pmxi_plugin .drag-element .assign_post{
|
1002 |
-
float: left;
|
1003 |
-
margin-top: 2px;
|
1004 |
-
}
|
1005 |
-
.pmxi_plugin .drag-element .widefat{
|
1006 |
-
margin-left: 1%;
|
1007 |
-
width: 85%;
|
1008 |
-
}
|
1009 |
-
.pmxi_plugin .ui-tabs-hide{
|
1010 |
-
display: none !important;
|
1011 |
-
}
|
1012 |
-
.pmxi_plugin .auto_nested{
|
1013 |
-
float: left;
|
1014 |
-
margin-left: 3px;
|
1015 |
-
}
|
1016 |
-
.pmxi_plugin .existing_meta_values{
|
1017 |
-
clear: both;
|
1018 |
-
display: block;
|
1019 |
-
margin: 15px;
|
1020 |
-
}
|
1021 |
-
.pmxi_plugin .custom-params tr td{
|
1022 |
-
width: 50%;
|
1023 |
}
|
1024 |
-
.
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1028 |
}
|
1029 |
-
.
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
padding: 0;
|
1034 |
-
|
1035 |
-
right: 10px;
|
1036 |
-
text-align: right;
|
1037 |
-
top: -35px;
|
1038 |
-
width: 100%;
|
1039 |
}
|
1040 |
-
.
|
1041 |
-
|
1042 |
-
}
|
1043 |
-
|
1044 |
-
/* Tabs */
|
1045 |
-
.pmxi_plugin .nav-tab-wrapper{
|
1046 |
-
display: none;
|
1047 |
}
|
1048 |
-
.
|
1049 |
-
|
|
|
|
|
|
|
1050 |
}
|
1051 |
-
.
|
1052 |
-
margin
|
1053 |
}
|
1054 |
-
.
|
1055 |
-
|
1056 |
}
|
1057 |
-
.
|
1058 |
-
|
1059 |
-
position: relative;
|
1060 |
-
text-align: center;
|
1061 |
-
top: -10px;
|
1062 |
-
margin-top: -55px;
|
1063 |
}
|
1064 |
-
.
|
1065 |
-
|
1066 |
}
|
1067 |
-
.
|
1068 |
-
|
1069 |
-
-
|
1070 |
-
-khtml-border-radius: 3px;
|
1071 |
-
-webkit-border-radius: 3px;
|
1072 |
-
border-radius: 3px;
|
1073 |
}
|
1074 |
-
.
|
1075 |
-
|
|
|
|
|
|
|
1076 |
}
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1080 |
}
|
1081 |
-
|
1082 |
-
|
1083 |
-
text-decoration: underline;
|
1084 |
}
|
1085 |
-
.
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
padding-top: 5px;
|
1091 |
}
|
1092 |
-
.
|
1093 |
-
|
1094 |
-
float: left;
|
1095 |
-
width: 25px !important;
|
1096 |
-
height: 25px;
|
1097 |
-
min-width: 25px !important;
|
1098 |
-
position: relative;
|
1099 |
-
top:-5px;
|
1100 |
-
padding: 0 3px;
|
1101 |
-
text-align: center;
|
1102 |
}
|
1103 |
-
.
|
1104 |
-
border: 1px solid #BBBBBB;
|
1105 |
-
-moz-border-radius: 3px;
|
1106 |
-
-khtml-border-radius: 3px;
|
1107 |
-
-webkit-border-radius: 3px;
|
1108 |
-
border-radius: 3px;
|
1109 |
-
padding: 3px 5px;
|
1110 |
-
margin-left: 10px;
|
1111 |
position: relative;
|
1112 |
-
top
|
1113 |
-
cursor: pointer;
|
1114 |
}
|
1115 |
-
.
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
|
|
|
|
|
|
|
|
|
|
1119 |
text-align: center;
|
1120 |
-
|
1121 |
-
|
|
|
1122 |
position: relative;
|
1123 |
-
margin: 0px !important;
|
1124 |
}
|
1125 |
-
.
|
1126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1127 |
}
|
1128 |
-
.
|
1129 |
-
|
|
|
|
|
|
|
1130 |
}
|
1131 |
-
.
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
|
|
1135 |
}
|
1136 |
-
.
|
1137 |
-
|
1138 |
-
|
1139 |
}
|
1140 |
-
.
|
1141 |
-
|
|
|
1142 |
}
|
1143 |
-
.
|
1144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1145 |
}
|
1146 |
-
.
|
1147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1148 |
}
|
1149 |
-
.
|
1150 |
-
|
1151 |
}
|
1152 |
-
.
|
1153 |
-
|
|
|
|
|
1154 |
}
|
1155 |
-
.
|
1156 |
-
|
1157 |
-
|
|
|
|
|
|
|
1158 |
}
|
1159 |
-
.
|
|
|
1160 |
margin-bottom: 20px;
|
|
|
1161 |
}
|
1162 |
-
.
|
1163 |
-
|
1164 |
-
padding-left: 15px;
|
1165 |
-
position: absolute;
|
1166 |
-
top: 0;
|
1167 |
}
|
1168 |
-
.
|
1169 |
-
|
1170 |
-
|
1171 |
}
|
1172 |
-
.
|
1173 |
-
margin:
|
1174 |
}
|
1175 |
-
.
|
1176 |
-
|
1177 |
-
right: 0;
|
1178 |
}
|
1179 |
-
.
|
1180 |
-
|
1181 |
}
|
1182 |
-
.
|
1183 |
-
margin-left:
|
1184 |
}
|
1185 |
-
.
|
1186 |
-
|
|
|
|
|
1187 |
}
|
1188 |
-
.
|
1189 |
-
|
1190 |
-
|
1191 |
-
width:
|
1192 |
-
border: 1px solid #BBBBBB;
|
1193 |
-
-moz-border-radius: 3px;
|
1194 |
-
-khtml-border-radius: 3px;
|
1195 |
-
-webkit-border-radius: 3px;
|
1196 |
-
border-radius: 3px;
|
1197 |
-
text-align: center;
|
1198 |
}
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
font-
|
|
|
1204 |
}
|
1205 |
-
.
|
1206 |
-
|
|
|
1207 |
}
|
1208 |
-
|
1209 |
/*--------------------------------------------------------------------------
|
1210 |
*
|
1211 |
-
*
|
1212 |
*
|
1213 |
*-------------------------------------------------------------------------*/
|
1214 |
|
1215 |
-
.
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
.pmxi_plugin .pmxi-add-on-group {
|
1220 |
-
margin-top: 20px;
|
1221 |
-
padding-top: 20px;
|
1222 |
-
border-top: #F5F5F5 solid 1px;
|
1223 |
-
}
|
1224 |
-
|
1225 |
-
.pmxi_plugin .pmxi-add-on-group:first-child {
|
1226 |
-
margin-top: 0;
|
1227 |
-
padding-top: 0;
|
1228 |
-
border-top: 0 none;
|
1229 |
-
}
|
1230 |
-
|
1231 |
-
.pmxi_plugin .pmxi-add-on {
|
1232 |
-
float: left;
|
1233 |
-
width: 220px;
|
1234 |
-
margin: 10px;
|
1235 |
-
}
|
1236 |
-
|
1237 |
-
.pmxi_plugin .pmxi-add-on h3 {
|
1238 |
-
margin-top: 0.5em;
|
1239 |
-
}
|
1240 |
-
|
1241 |
-
.pmxi_plugin .pmxi-add-on h3 a {
|
1242 |
-
color: inherit;
|
1243 |
-
text-decoration: none;
|
1244 |
-
}
|
1245 |
-
|
1246 |
-
.pmxi_plugin .pmxi-add-on .inner {
|
1247 |
-
min-height: 145px;
|
1248 |
-
}
|
1249 |
-
|
1250 |
-
.pmxi_plugin .pmxi-add-on-active .button {
|
1251 |
-
padding-left: 4px;
|
1252 |
-
}
|
1253 |
-
|
1254 |
-
.pmxi_plugin .pmxi-sprite-tick {
|
1255 |
-
width: 14px;
|
1256 |
-
height: 14px;
|
1257 |
-
margin: 4px 5px 0 0;
|
1258 |
-
background-position: 0px -300px;
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
.pmxi_plugin .wp-box {
|
1262 |
-
background: none repeat scroll 0 0 #FFFFFF;
|
1263 |
-
border: 1px solid #E1E1E1;
|
1264 |
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
1265 |
-
position: relative;
|
1266 |
}
|
1267 |
-
.
|
1268 |
-
padding: 15px;
|
1269 |
-
}
|
1270 |
-
.pmxi_plugin .wp-box .footer{
|
1271 |
-
background: none repeat scroll 0 0 #F5F5F5;
|
1272 |
-
border-top: 1px solid #E1E1E1;
|
1273 |
overflow: hidden;
|
|
|
1274 |
padding: 10px;
|
1275 |
-
|
1276 |
-
bottom:0;
|
1277 |
-
width:91%;
|
1278 |
}
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1285 |
}
|
1286 |
-
.
|
1287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1288 |
}
|
1289 |
-
.
|
1290 |
display: inline-block;
|
1291 |
height: 28px;
|
1292 |
margin: 0;
|
@@ -1295,84 +1469,1748 @@ table.xml table {
|
|
1295 |
top: 2px;
|
1296 |
width: 50px;
|
1297 |
}
|
1298 |
-
.
|
1299 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1300 |
float: right;
|
1301 |
-
|
|
|
|
|
1302 |
}
|
1303 |
-
.
|
1304 |
-
|
1305 |
-
margin:
|
1306 |
-
|
1307 |
}
|
1308 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1309 |
position: relative;
|
|
|
1310 |
}
|
1311 |
-
.
|
1312 |
-
|
1313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1314 |
}
|
1315 |
-
.
|
1316 |
-
margin:
|
|
|
|
|
|
|
|
|
|
|
1317 |
}
|
1318 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1319 |
margin-left: -55px;
|
1320 |
}
|
1321 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1322 |
float: right;
|
|
|
|
|
1323 |
}
|
1324 |
-
.
|
1325 |
-
|
|
|
|
|
1326 |
}
|
1327 |
-
.
|
1328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1329 |
}
|
1330 |
-
.
|
1331 |
-
|
|
|
|
|
|
|
1332 |
}
|
1333 |
-
.
|
1334 |
-
|
1335 |
}
|
1336 |
-
.
|
|
|
1337 |
float: left;
|
1338 |
-
|
1339 |
-
padding: 5px 0;
|
1340 |
}
|
1341 |
-
.
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1345 |
}
|
1346 |
-
.
|
1347 |
-
|
|
|
|
|
|
|
|
|
|
|
1348 |
}
|
1349 |
-
.
|
1350 |
-
width: 80%;
|
1351 |
-
|
1352 |
}
|
1353 |
-
.
|
1354 |
position: static !important;
|
1355 |
}
|
1356 |
|
1357 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1358 |
display: inline-block;
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1362 |
position: relative;
|
1363 |
-
|
1364 |
}
|
1365 |
-
.
|
1366 |
-
|
1367 |
-
border-color: #E6DB55;
|
1368 |
-
margin: 15px 0 15px;
|
1369 |
-
padding: 0 0.6em;
|
1370 |
-
-moz-border-radius: 3px 3px 3px 3px;
|
1371 |
-
border-radius: 3px;
|
1372 |
-
border-style: solid;
|
1373 |
-
border-width: 1px;
|
1374 |
}
|
1375 |
-
.
|
1376 |
-
|
1377 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1378 |
}
|
1 |
+
/*--------------------------------------------------------------------------
|
2 |
+
*
|
3 |
+
* Basic rules
|
4 |
+
*
|
5 |
+
*-------------------------------------------------------------------------*/
|
6 |
+
|
7 |
+
.wpallimport-plugin hr {
|
8 |
height: 1px;
|
9 |
border-width: 0px;
|
10 |
color: #ddd;
|
11 |
background-color: #ddd;
|
12 |
margin-bottom: 15px;
|
13 |
}
|
14 |
+
.wpallimport-plugin a:focus,
|
15 |
+
.wpallimport-plugin input:focus{ box-shadow: none; }
|
16 |
+
|
17 |
+
.wpallimport-plugin a.wpallimport-help {
|
|
|
|
|
18 |
overflow: hidden;
|
19 |
text-indent: -99999px;
|
20 |
display: inline-block;
|
24 |
background-image: url("../img/help.png");
|
25 |
vertical-align: middle;
|
26 |
margin-left: 5px;
|
27 |
+
position: relative;
|
28 |
+
top: 4px;
|
29 |
}
|
30 |
+
.wpallimport-plugin input.datepicker {
|
31 |
width: 8em;
|
32 |
}
|
33 |
+
.wpallimport-plugin button.ui-datepicker-trigger {
|
34 |
background-image: url("../img/date-picker.gif");
|
35 |
background-repeat: no-repeat;
|
36 |
cursor: pointer;
|
40 |
height: 18px;
|
41 |
vertical-align: middle;
|
42 |
}
|
43 |
+
.wpallimport-plugin .progress-msg {
|
44 |
font-style: italic;
|
45 |
display: none;
|
46 |
}
|
47 |
+
.wpallimport-plugin .loading {
|
|
|
|
|
|
|
48 |
cursor: progress;
|
49 |
background-repeat: no-repeat;
|
50 |
background-position: center;
|
51 |
}
|
52 |
+
.wpallimport-plugin .preload {
|
53 |
+
background-image: url("../img/loading-step-2.gif");
|
54 |
background-repeat: no-repeat;
|
55 |
+
background-position: 50% 10px;
|
56 |
+
min-height: 35px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
+
.wpallimport-plugin .wpallimport-preview-preload {
|
59 |
+
background-image: url("../img/loading-step-2.gif");
|
60 |
+
background-repeat: no-repeat;
|
61 |
+
background-position: 50% 20px;
|
62 |
+
height: 80px;
|
63 |
}
|
64 |
+
.wpallimport-plugin .back{
|
65 |
+
background: url("../img/ui_4.0/back.png") no-repeat scroll 8% 50% #e4e6e6;
|
66 |
+
color: #777;
|
67 |
+
display: inline-block;
|
68 |
+
font-size: 14px;
|
69 |
+
font-weight: bold;
|
70 |
+
height: 46px;
|
71 |
+
line-height: 46px;
|
72 |
+
padding: 0 30px 0 40px;
|
73 |
+
position: relative;
|
74 |
+
text-decoration: none;
|
75 |
}
|
76 |
+
.wpallimport-plugin .wpallimport-large-button{
|
77 |
+
box-shadow: none;
|
78 |
+
vertical-align:bottom !important;
|
79 |
+
height: 40px;
|
80 |
+
line-height: 39px;
|
81 |
+
/*margin-left: 10px;*/
|
82 |
+
background: url('../img/ui_4.0/continue.png') no-repeat 93% 50% #425f9a;
|
83 |
+
border: none;
|
84 |
}
|
85 |
+
.wpallimport-plugin .wpallimport-large-button:hover{
|
86 |
+
background: url('../img/ui_4.0/continue.png') no-repeat 93% 50% #425f9a;
|
87 |
+
border: none;
|
88 |
+
box-shadow: none;
|
89 |
}
|
90 |
+
|
91 |
+
/*@+ header */
|
92 |
+
.wpallimport-plugin .wpallimport-logo{
|
93 |
+
background: url('../img/ui_4.0/logo.png');
|
94 |
+
width: 60px;
|
95 |
+
height: 51px;
|
96 |
+
float: left;
|
97 |
+
margin-right: 10px;
|
98 |
}
|
99 |
+
.wpallimport-plugin .wpallimport-title{
|
100 |
+
float: left;
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
+
.wpallimport-plugin .wpallimport-title p{
|
103 |
+
font-size: 18px !important;
|
104 |
+
line-height: 16px;
|
105 |
+
color: #777;
|
106 |
+
margin-top: 0;
|
107 |
+
margin-bottom: 0;
|
108 |
}
|
109 |
+
.wpallimport-plugin .wpallimport-title h2,
|
110 |
+
.wpallimport-plugin .wpallimport-title h3{
|
111 |
+
font-size: 33px;
|
112 |
+
color: #425f9a;
|
113 |
+
font-weight: bold;
|
114 |
+
padding-top: 5px;
|
115 |
+
padding-right: 0;
|
116 |
+
margin-left: 2px;
|
117 |
}
|
118 |
+
.wpallimport-plugin .wpallimport-title h3{
|
119 |
+
margin: 5px 0;
|
|
|
|
|
|
|
120 |
}
|
121 |
+
.wpallimport-plugin .wpallimport-links{
|
122 |
+
float: right;
|
123 |
+
margin-right: 3px;
|
124 |
+
margin-top: 33px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
+
.wpallimport-plugin .wpallimport-links a{
|
127 |
+
font-size: 12px;
|
128 |
+
text-decoration: none;
|
129 |
+
}
|
130 |
+
/*.wpallimport-plugin .wpallimport-support{
|
131 |
+
color: #777;
|
132 |
float: right;
|
133 |
+
text-decoration: none;
|
134 |
+
background: url('../img/ui_4.0/support.png') 33px 12px no-repeat #fff;
|
135 |
+
display: block;
|
136 |
+
text-align: center;
|
137 |
+
border: 1px solid #ddd;
|
138 |
+
border-radius: 5px;
|
139 |
+
-moz-border-radius: 5px;
|
140 |
+
-khtml-border-radius: 5px;
|
141 |
+
-webkit-border-radius: 5px;
|
142 |
+
width: 100px;
|
143 |
+
height: 38px;
|
144 |
+
line-height: 39px;
|
145 |
+
margin-top: 8px;
|
146 |
+
padding-left: 38px;
|
147 |
+
font-size: 14px;
|
148 |
+
}*/
|
149 |
+
.wpallimport-plugin .pmxi_progress{
|
150 |
+
border-bottom: 1px solid #ddd;
|
151 |
+
-moz-border-radius-topleft: 4px;
|
152 |
+
-webkit-border-top-left-radius: 4px;
|
153 |
+
border-top-left-radius: 4px;
|
154 |
+
-moz-border-radius-topright: 4px;
|
155 |
+
-webkit-border-top-right-radius: 4px;
|
156 |
+
border-top-right-radius: 4px;
|
157 |
+
height: 76px;
|
158 |
}
|
159 |
+
.wpallimport-plugin .wpallimport-step-1 .pmxi_progress{
|
160 |
+
background: url("../img/ui_4.0/step_1_bar.png") no-repeat scroll center center / contain #f1f2f2;
|
161 |
+
}
|
162 |
+
.wpallimport-plugin .wpallimport-step-2 .pmxi_progress{
|
163 |
+
background: url("../img/ui_4.0/step_2_bar.png") no-repeat scroll center center / contain #f1f2f2;
|
164 |
+
}
|
165 |
+
.wpallimport-plugin .wpallimport-step-3 .pmxi_progress{
|
166 |
+
background: url("../img/ui_4.0/step_3_bar.png") no-repeat scroll center center / contain #f1f2f2;
|
167 |
+
}
|
168 |
+
.wpallimport-plugin .wpallimport-step-4 .pmxi_progress{
|
169 |
+
background: url("../img/ui_4.0/step_4_bar.png") no-repeat scroll center center / contain #f1f2f2;
|
170 |
+
}
|
171 |
+
.wpallimport-plugin .wpallimport-step-5 .pmxi_progress{
|
172 |
+
background: url("../img/ui_4.0/step_5_bar.png") no-repeat scroll center center / contain #f1f2f2;
|
173 |
+
}
|
174 |
+
.wpallimport-plugin .wpallimport-step-6 .pmxi_progress{
|
175 |
+
background: url("../img/ui_4.0/step_6_bar.png") no-repeat scroll center center / contain #f1f2f2;
|
176 |
}
|
|
|
177 |
|
178 |
+
.wpallimport-plugin .wpallimport-file-upload-result{
|
179 |
+
padding: 35px;
|
180 |
+
}
|
181 |
+
.wpallimport-plugin .wpallimport-step-2 .wpallimport-file-upload-result,
|
182 |
+
.wpallimport-plugin .wpallimport-step-3 .wpallimport-file-upload-result,
|
183 |
+
.wpallimport-plugin .wpallimport-step-4 .wpallimport-file-upload-result,
|
184 |
+
.wpallimport-plugin .wpallimport-step-5 .wpallimport-file-upload-result,
|
185 |
+
.wpallimport-plugin .wpallimport-step-6 .wpallimport-file-upload-result {
|
186 |
+
display: block;
|
187 |
}
|
188 |
+
.wpallimport-plugin .wpallimport-file-upload-result h2{
|
189 |
+
float: left;
|
190 |
+
padding: 0;
|
191 |
+
margin-top: 7px !important;
|
192 |
+
height: 31px;
|
193 |
}
|
194 |
+
.wpallimport-plugin .wpallimport-file-upload-result[rel=upload_type] h2{
|
195 |
+
background: url('../img/ui_4.0/cloud.png') no-repeat;
|
196 |
+
padding-left: 45px !important;
|
197 |
}
|
198 |
+
.wpallimport-plugin .wpallimport-file-upload-result[rel=url_type] h2{
|
199 |
+
background: url('../img/ui_4.0/cloud_url.png') no-repeat;
|
200 |
+
padding-left: 45px !important;
|
201 |
+
font-size: 14px;
|
202 |
+
line-height: 35px;
|
203 |
+
height: 35px;
|
204 |
}
|
205 |
+
.wpallimport-plugin .wpallimport-file-upload-result[rel=file_type] h2{
|
206 |
+
background: url('../img/ui_4.0/use_existing_green.png') no-repeat;
|
207 |
+
padding-left: 45px !important;
|
208 |
+
height: 35px;
|
209 |
}
|
210 |
+
.wpallimport-plugin .wpallimport-file-upload-result h2 .wpallimport-uploaded-file-size{
|
211 |
+
color: #777;
|
212 |
+
}
|
213 |
+
.wpallimport-plugin .wpallimport-file-upload-result a{
|
214 |
+
text-decoration: none;
|
215 |
+
font-size: 18px;
|
216 |
+
margin-top: 12px;
|
217 |
+
float: right;
|
218 |
+
margin-left: 20px;
|
219 |
+
padding-left: 25px;
|
220 |
}
|
221 |
+
.wpallimport-plugin .wpallimport-file-upload-result a:last-child{
|
222 |
+
margin-left: 0 !important;
|
223 |
+
}
|
224 |
+
.wpallimport-plugin .wpallimport-download-from-url{
|
225 |
+
background: none repeat scroll 0 0 #46ba69;
|
226 |
+
color: #fff;
|
227 |
+
display: inline-block;
|
228 |
+
font-size: 14px;
|
229 |
+
height: 19px;
|
230 |
+
padding: 15px;
|
231 |
+
position: relative;
|
232 |
+
text-decoration: none;
|
233 |
+
vertical-align: bottom;
|
234 |
+
}
|
235 |
+
.wpallimport-plugin .wpallimport-file-upload-result .wpallimport-change-uploaded-file{
|
236 |
+
color:#40acad;
|
237 |
+
}
|
238 |
+
.wpallimport-plugin .wpallimport-file-upload-result .wpallimport-change-uploaded-file:before{
|
239 |
+
color: #ddd;
|
240 |
+
content: "\f463";
|
241 |
+
float: left;
|
242 |
+
font-family: "dashicons";
|
243 |
+
font-size: 30px;
|
244 |
+
padding-right: 5px;
|
245 |
}
|
246 |
+
.wpallimport-plugin .wpallimport-file-upload-result .wpallimport-remove-uploaded-file{
|
247 |
+
color:#dd4a58;
|
248 |
+
}
|
249 |
+
.wpallimport-plugin .wpallimport-file-upload-result .wpallimport-remove-uploaded-file:before{
|
250 |
+
color: #ddd;
|
251 |
+
content: "\f335";
|
252 |
+
display: inline-block;
|
253 |
+
float: left;
|
254 |
+
font-family: "dashicons";
|
255 |
+
font-size: 32px;
|
256 |
}
|
257 |
+
/*@+*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
+
.wpallimport-plugin .wpallimport-collapsed .wpallimport-collapsed-header{
|
260 |
+
background: url('../img/ui_4.0/collapser.png') no-repeat 98% 0;
|
261 |
+
height: 30px;
|
262 |
+
padding-left: 30px;
|
263 |
+
cursor: pointer;
|
264 |
}
|
265 |
+
.wpallimport-plugin .wpallimport-collapsed .wpallimport-collapsed-header h3{
|
266 |
+
line-height: 30px;
|
267 |
+
color:#425e99;
|
268 |
+
-webkit-touch-callout: none;
|
269 |
+
-webkit-user-select: none;
|
270 |
+
-khtml-user-select: none;
|
271 |
+
-moz-user-select: none;
|
272 |
+
-ms-user-select: none;
|
273 |
+
user-select: none;
|
274 |
}
|
275 |
+
.wpallimport-plugin .wpallimport-collapsed.closed .wpallimport-collapsed-header{
|
276 |
+
background: url('../img/ui_4.0/collapser.png') no-repeat 98% -30px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
}
|
278 |
+
.wpallimport-plugin .wpallimport-collapsed.closed .wpallimport-collapsed-header h3{
|
279 |
+
color:#777;
|
280 |
}
|
281 |
+
.wpallimport-plugin .wpallimport-collapsed .wpallimport-collapsed-content{
|
282 |
+
display: none;
|
283 |
+
padding: 15px 25px 25px 25px;
|
284 |
+
position: relative;
|
|
|
285 |
}
|
286 |
+
.wpallimport-plugin .wpallimport-collapsed-content-inner{
|
287 |
+
padding: 15px 25px 25px 25px;
|
|
|
|
|
|
|
288 |
}
|
289 |
|
290 |
+
.wpallimport-plugin .step_description{
|
291 |
+
text-align: center;
|
292 |
+
overflow: hidden;
|
293 |
+
position: relative;
|
294 |
+
/*width: 1200px;*/
|
|
|
|
|
|
|
|
|
|
|
295 |
}
|
296 |
+
.wpallimport-plugin .step_description h2{
|
297 |
+
color: #425f9a;
|
|
|
298 |
}
|
299 |
+
.wpallimport-plugin .step_description h3{
|
300 |
+
color: #777;
|
|
|
301 |
}
|
302 |
|
303 |
+
.wpallimport-plugin div.input > label{
|
304 |
+
color: #000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
}
|
306 |
+
.wpallimport-plugin div.input.pmxi_checked > label{
|
307 |
+
color: #000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
}
|
309 |
|
310 |
+
.wpallimport-plugin .ajax-console div.updated{
|
311 |
+
background: none;
|
312 |
+
border: none;
|
313 |
+
box-shadow: none;
|
314 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
+
.wpallimport-plugin .wpallimport-collapsed-content a,
|
317 |
+
.wpallimport-plugin .wp-pointer-content a,
|
318 |
+
.wpallimport-plugin .wpallimport-pointer-content a,
|
319 |
+
.wpallimport-plugin .wpallimport-collapsed-content h4{
|
320 |
+
color: #40acad;
|
321 |
+
text-decoration: none;
|
|
|
322 |
}
|
323 |
+
.wpallimport-plugin div.error{
|
324 |
+
clear: both;
|
325 |
+
margin-top: 15px;
|
326 |
}
|
327 |
+
.wpallimport-plugin .wp-pointer-content ul,
|
328 |
+
.wpallimport-plugin .wpallimport-pointer-content ul{
|
329 |
+
list-style: disc inside none;
|
330 |
+
margin: 20px;
|
331 |
}
|
332 |
+
|
333 |
+
.wpallimport-plugin a.add-new {
|
334 |
+
font-size: 18px;
|
335 |
+
background-color: #eee;
|
336 |
+
cursor: pointer;
|
337 |
+
padding: 6px 10px 6px 10px;
|
338 |
+
line-height: normal;
|
339 |
+
font-style: normal;
|
340 |
+
color: #464646;
|
341 |
+
border-color: #bbb;
|
342 |
+
-moz-border-radius: 4px 4px 4px 4px;
|
343 |
+
border-radius: 4px;
|
344 |
+
border-style: solid;
|
345 |
+
border-width: 1px;
|
346 |
+
text-decoration: none;
|
347 |
}
|
348 |
+
.wpallimport-plugin a.add-new:hover {
|
349 |
+
border-color: #666666;
|
350 |
+
color: #000;
|
351 |
}
|
352 |
+
.wpallimport-plugin div.input {
|
353 |
+
/*min-height: 21px;*/
|
354 |
+
font-size: 12px !important;
|
355 |
}
|
356 |
+
.wpallimport-plugin div.input > * {
|
357 |
+
vertical-align: middle;
|
358 |
+
}
|
359 |
+
.wpallimport-plugin .wpallimport-template select,
|
360 |
+
.wpallimport-plugin .options select{
|
361 |
+
border: 1px solid #ddd;
|
362 |
+
font-size: 12px;
|
363 |
+
/*height: 25px;*/
|
364 |
+
width: auto;
|
365 |
+
padding: 2px;
|
366 |
+
color: #000;
|
367 |
}
|
368 |
+
.wpallimport-plugin .wpallimport-template input[type="text"],
|
369 |
+
.wpallimport-plugin .options input[type="text"]{
|
370 |
+
height: auto;
|
371 |
+
color: #000;
|
372 |
+
font-size: 14px;
|
373 |
}
|
374 |
+
.wpallimport-plugin .wpallimport-template .wpallimport-section select,
|
375 |
+
.wpallimport-plugin .options .wpallimport-section select{
|
376 |
+
font-size: 16px;
|
377 |
+
height: 40px;
|
378 |
+
/*padding: 10px;*/
|
379 |
+
border: 1px solid #ddd;
|
380 |
+
border-radius: 4px;
|
381 |
+
-moz-border-radius: 4px;
|
382 |
+
-khtml-border-radius: 4px;
|
383 |
+
-webkit-border-radius: 4px;
|
384 |
+
color: #777;
|
385 |
+
font-size: 15px !important;
|
386 |
+
width: 100%;
|
387 |
+
position: relative;
|
388 |
+
top: 0;
|
389 |
}
|
390 |
+
.wpallimport-plugin .wpallimport-template .wpallimport-section input[type="text"],
|
391 |
+
.wpallimport-plugin .options .wpallimport-section input[type="text"],
|
392 |
+
.wpallimport-plugin .wp-pointer-content input[type="text"]
|
393 |
+
{
|
394 |
+
font-size: 14px;
|
395 |
+
height: 40px;
|
396 |
+
border: 1px solid #ddd;
|
397 |
+
border-radius: 4px;
|
398 |
+
-moz-border-radius: 4px;
|
399 |
+
-khtml-border-radius: 4px;
|
400 |
+
-webkit-border-radius: 4px;
|
401 |
+
color: #000;
|
402 |
+
font-size: 15px;
|
403 |
+
position: relative;
|
404 |
+
top: 0;
|
405 |
}
|
406 |
+
.wpallimport-plugin .wpallimport-template select[multiple=multiple]{
|
407 |
+
height: auto !important;
|
408 |
+
}
|
409 |
+
.wpallimport-plugin .wpallimport-note {
|
410 |
+
color: #777;
|
411 |
+
font-size: 9px;
|
412 |
}
|
413 |
+
.wpallimport-plugin div.sub {
|
414 |
+
padding-left: 20px;
|
415 |
+
font-size: 12px;
|
416 |
}
|
417 |
+
|
418 |
+
.wpallimport-plugin .icon-item,
|
419 |
+
.wpallimport-plugin .add-new-custom,
|
420 |
+
.wpallimport-plugin .add-new-key{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
display: inline-block;
|
422 |
width: 16px;
|
423 |
height: 16px;
|
424 |
margin: 0px 3px;
|
425 |
}
|
426 |
+
.wpallimport-plugin .add-new-ico,
|
427 |
+
.wpallimport-plugin .add-new-custom,
|
428 |
+
.wpallimport-plugin .add-new-key{
|
429 |
+
background: url("../img/ui_4.0/add.png") no-repeat 0px 5px;
|
430 |
+
font-size: 12px;
|
431 |
+
width:100px;
|
432 |
height:25px;
|
433 |
padding-left: 20px;
|
434 |
color:#21759B;
|
436 |
padding-top: 2px;
|
437 |
text-decoration: underline;
|
438 |
display: block;
|
439 |
+
/*margin: 0 auto; */
|
440 |
}
|
441 |
|
442 |
+
.wpallimport-plugin .remove-ico{
|
443 |
+
background: url("../img/ui_4.0/trash.png") no-repeat;
|
444 |
+
top: 5px;
|
445 |
+
right: 0;
|
446 |
position: absolute;
|
447 |
+
width: 19px;
|
448 |
+
height: 22px;
|
449 |
}
|
450 |
+
.wpallimport-plugin .widefat{
|
451 |
+
background-color: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
452 |
}
|
453 |
+
.wpallimport-plugin .postbox{
|
454 |
+
margin: 0;
|
455 |
}
|
456 |
+
.wpallimport-plugin .action.remove{
|
457 |
+
display: block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
position: relative;
|
459 |
}
|
460 |
+
.wpallimport-plugin .action.remove a{
|
461 |
+
background: url("../img/ui_4.0/trash.png") no-repeat scroll 0 0 transparent;
|
462 |
+
height: 22px;
|
463 |
+
position: absolute;
|
464 |
+
right: 20px;
|
465 |
+
top:0;
|
466 |
+
width: 19px;
|
467 |
+
}
|
468 |
+
.wpallimport-plugin .drag-element{
|
469 |
+
background: url("../img/drag.png") top right no-repeat;
|
470 |
+
cursor: pointer;
|
471 |
+
padding-left: 25px;
|
472 |
+
background-position: 0px 1px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
}
|
474 |
+
.wpallimport-plugin .sortable li{ position: relative; }
|
475 |
+
.wpallimport-plugin ol{ margin-top: 6px; list-style: none; }
|
476 |
+
.wpallimport-plugin h2.wpallimport-wp-notices{ margin-top: 0px; padding: 0px; }
|
477 |
+
.wpallimport-plugin #footer-upgrade{
|
478 |
+
/*float: left !important;*/
|
479 |
+
}
|
480 |
+
.wpallimport-plugin .wpallimport-overlay {
|
481 |
+
display:none;
|
482 |
+
position:fixed;
|
483 |
+
z-index:99999;
|
484 |
+
opacity:0.7;
|
485 |
+
filter:alpha(opacity=70);
|
486 |
+
top:0;
|
487 |
+
right:0;
|
488 |
+
left:0;
|
489 |
+
bottom:0;
|
490 |
+
background:#777;
|
491 |
+
}
|
492 |
+
.wpallimport-plugin .wp-pointer{
|
493 |
+
z-index: 999999 !important;
|
494 |
+
}
|
495 |
+
.wpallimport-plugin .tipsy{
|
496 |
+
font-size: 14px !important;
|
497 |
}
|
498 |
+
.wpallimport-plugin .wpallimport-free-edition-notice{
|
499 |
+
display: block;
|
500 |
+
margin-top: 40px;
|
501 |
+
padding: 20px;
|
502 |
+
background-color: #eee;
|
503 |
+
border: 1px solid #ddd;
|
504 |
}
|
505 |
+
.wpallimport-plugin .pmxi_stars{
|
506 |
+
display: inline-block;
|
507 |
+
background: url("../img/stars.png") no-repeat;
|
508 |
+
width: 125px;
|
509 |
+
height: 24px;
|
510 |
+
position: relative;
|
511 |
+
top:10px;
|
|
|
|
|
512 |
}
|
513 |
+
.wpallimport-plugin .updated_bottom{
|
514 |
+
background-color: #FFFFE0;
|
515 |
+
border-color: #E6DB55;
|
516 |
+
margin: 15px 0 15px;
|
517 |
+
padding: 0 0.6em;
|
518 |
+
-moz-border-radius: 3px 3px 3px 3px;
|
519 |
+
border-radius: 3px;
|
520 |
+
border-style: solid;
|
521 |
+
border-width: 1px;
|
522 |
}
|
523 |
+
.wpallimport-plugin .upgrade_link{
|
524 |
+
color: #21759B !important;
|
525 |
+
font-size: 1.3em;
|
526 |
+
text-decoration: underline !important;
|
|
|
527 |
}
|
528 |
+
/*--------------------------------------------------------------------------
|
529 |
+
*
|
530 |
+
* Helpers
|
531 |
+
*
|
532 |
+
*-------------------------------------------------------------------------*/
|
533 |
+
|
534 |
+
.wpallimport-plugin .rad0{
|
535 |
+
border-radius: 0px !important;
|
536 |
+
-moz-border-radius: 0px !important;
|
537 |
+
-khtml-border-radius: 0px !important;
|
538 |
+
-webkit-border-radius: 0px !important;
|
539 |
}
|
540 |
+
.wpallimport-plugin .rad3{
|
541 |
+
border-radius: 3px;
|
542 |
+
-moz-border-radius: 3px;
|
543 |
+
-khtml-border-radius: 3px;
|
544 |
+
-webkit-border-radius: 3px;
|
|
|
545 |
}
|
546 |
+
.wpallimport-plugin .rad4{
|
547 |
+
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
-moz-border-radius: 4px;
|
549 |
-khtml-border-radius: 4px;
|
550 |
+
-webkit-border-radius: 4px;
|
551 |
+
}
|
552 |
+
.wpallimport-plugin .rad5{
|
553 |
+
border-radius: 5px;
|
554 |
+
-moz-border-radius: 5px;
|
555 |
+
-khtml-border-radius: 5px;
|
556 |
+
-webkit-border-radius: 5px;
|
557 |
+
}
|
558 |
+
.wpallimport-plugin .rad10{
|
559 |
+
border-radius: 10px;
|
560 |
+
-moz-border-radius: 10px;
|
561 |
+
-khtml-border-radius: 10px;
|
562 |
+
-webkit-border-radius: 10px;
|
563 |
+
}
|
564 |
+
.wpallimport-plugin .rad14{
|
565 |
+
border-radius: 14px;
|
566 |
+
-moz-border-radius: 14px;
|
567 |
+
-khtml-border-radius: 14px;
|
568 |
+
-webkit-border-radius: 14px;
|
569 |
+
}
|
570 |
+
.wpallimport-plugin .pl17{ padding-left: 17px; }
|
571 |
+
.wpallimport-plugin .no-margin{ margin: 0px; }
|
572 |
+
.wpallimport-plugin .hidden{ display: none; }
|
573 |
+
.wpallimport-plugin .fs11 { font-size: 11px; }
|
574 |
+
.wpallimport-plugin .rel { position: relative; }
|
575 |
+
.wpallimport-plugin .txt_center{ text-align: center; }
|
576 |
+
.wpallimport-plugin .wpallimport-clear{
|
577 |
+
display: block;
|
578 |
+
clear: both;
|
579 |
}
|
580 |
+
.wpallimport-plugin .ui-autocomplete{
|
581 |
+
max-height: 450px;
|
582 |
+
overflow: auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
583 |
}
|
584 |
+
/*--------------------------------------------------------------------------
|
585 |
+
*
|
586 |
+
* Fixes & Other Stuff
|
587 |
+
*
|
588 |
+
*-------------------------------------------------------------------------*/
|
589 |
+
|
590 |
+
/*@+ fixes */
|
591 |
+
.wpallimport-plugin input[type="file"] {
|
592 |
+
padding: 0; /* FIX height or <input type="file" /> for Safari & Chrome */
|
593 |
}
|
594 |
+
.wpallimport-plugin .ui-widget-overlay {
|
595 |
+
position: fixed !important; /* FIX: modal dialog overlay in IE 8 */
|
596 |
+
background-color: #777 !important; /* FIX: overlay color */
|
|
|
|
|
597 |
}
|
598 |
+
.wpallimport-plugin .ui-dialog {
|
599 |
+
position: absolute !important; /* FIX: for wordpress 3.1 not to add empty space */
|
600 |
+
z-index: 999999;
|
601 |
}
|
602 |
+
/*@*/
|
603 |
+
|
604 |
+
/*@+ other stuff */
|
605 |
+
.wpallimport-plugin fieldset{
|
606 |
padding: 20px;
|
607 |
width:auto;
|
608 |
}
|
609 |
+
.wpallimport-plugin .right fieldset{
|
610 |
padding: 15px;
|
611 |
}
|
612 |
+
.wpallimport-plugin .right fieldset input{
|
613 |
+
max-width:none;
|
614 |
+
padding:6px;
|
615 |
+
margin:0px
|
616 |
+
}
|
617 |
+
.wpallimport-plugin .right a{
|
618 |
+
text-decoration: underline;
|
619 |
+
}
|
620 |
+
.wpallimport-plugin fieldset legend{
|
621 |
padding: 0px 5px;
|
622 |
font-weight: bold;
|
623 |
}
|
624 |
+
.wpallimport-plugin .options fieldset legend{
|
625 |
font-size: 1.17em;
|
626 |
}
|
627 |
+
.wpallimport-plugin .matches_count{
|
628 |
font-weight: bold;
|
629 |
color:#33AA28;
|
630 |
}
|
631 |
+
.wpallimport-plugin input.small{
|
632 |
+
width:50px !important;
|
633 |
+
/*height: 30px !important;*/
|
634 |
+
text-align: center;
|
635 |
}
|
636 |
+
.wpallimport-plugin .ui-state-default a{
|
637 |
+
font-size: 13px !important;
|
638 |
}
|
639 |
+
.wpallimport-plugin #wp-content-media-buttons{
|
640 |
+
display: none;
|
|
|
|
|
641 |
}
|
642 |
+
.wpallimport-plugin .ui-tabs-hide{
|
643 |
+
display: none !important;
|
|
|
|
|
|
|
|
|
644 |
}
|
645 |
+
.wpallimport-plugin .button-primary:hover{
|
646 |
+
font-weight: normal;
|
|
|
|
|
|
|
|
|
|
|
647 |
}
|
648 |
+
.wpallimport-plugin .hndle{
|
649 |
+
padding: 7px;
|
650 |
+
margin-bottom: 0px;
|
651 |
+
cursor: default !important;
|
652 |
}
|
653 |
+
.wpallimport-plugin .inside{
|
654 |
+
margin: 0;
|
655 |
+
line-height: 20px;
|
656 |
}
|
657 |
+
.wpallimport-plugin .inside input[type="text"]{
|
658 |
+
background: #fff;
|
|
|
659 |
}
|
660 |
+
/*@*/
|
661 |
+
.wpallimport-plugin .wpallimport-created-by{
|
662 |
+
color: #888;
|
663 |
+
display: block;
|
664 |
+
line-height: 31px;
|
665 |
+
margin: 0 auto;
|
666 |
+
opacity: 0.7;
|
|
|
|
|
|
|
|
|
|
|
667 |
overflow: hidden;
|
668 |
+
text-decoration: none;
|
669 |
+
vertical-align: inherit;
|
670 |
+
width: 139px;
|
671 |
+
margin-top: 20px;
|
672 |
+
font-size: 12px;
|
673 |
}
|
674 |
+
.wpallimport-plugin .wpallimport-created-by span{
|
675 |
+
background: url('../img/soflyy-logo.png') no-repeat;
|
676 |
+
display: block;
|
677 |
float: right;
|
678 |
+
width: 72px;
|
679 |
+
height: 32px;
|
680 |
}
|
681 |
+
.wpallimport-plugin .wpallimport-created-by:hover{
|
682 |
+
opacity: 1.0;
|
683 |
}
|
684 |
+
.wpallimport-plugin .wpallimport-preload-image{
|
685 |
+
display: none;
|
686 |
}
|
687 |
+
.wpallimport-plugin .wpallimport-cdata{
|
688 |
+
color: green;
|
689 |
+
font-weight: bold;
|
690 |
display: block;
|
691 |
+
clear: both;
|
692 |
}
|
693 |
+
/*--------------------------------------------------------------------------
|
694 |
+
*
|
695 |
+
* Add-Ons
|
696 |
+
*
|
697 |
+
*-------------------------------------------------------------------------*/
|
698 |
+
|
699 |
+
.wpallimport-plugin #pmxi-add-ons {
|
700 |
+
margin-bottom: 20px;
|
701 |
}
|
702 |
+
.wpallimport-plugin .pmxi-add-on-group {
|
703 |
+
margin-top: 20px;
|
704 |
+
padding-top: 20px;
|
705 |
+
border-top: #F5F5F5 solid 1px;
|
706 |
}
|
707 |
+
.wpallimport-plugin .pmxi-add-on-group:first-child {
|
708 |
+
margin-top: 0;
|
709 |
+
padding-top: 0;
|
710 |
+
border-top: 0 none;
|
711 |
+
}
|
712 |
+
.wpallimport-plugin .pmxi-add-on {
|
713 |
+
float: left;
|
714 |
+
width: 220px;
|
715 |
+
margin: 10px;
|
716 |
}
|
717 |
+
.wpallimport-plugin .pmxi-add-on h3 {
|
718 |
+
margin-top: 0.5em;
|
719 |
+
}
|
720 |
+
.wpallimport-plugin .pmxi-add-on h3 a {
|
721 |
+
color: inherit;
|
722 |
+
text-decoration: none;
|
723 |
+
}
|
724 |
+
|
725 |
+
.wpallimport-plugin .pmxi-add-on .inner {
|
726 |
+
min-height: 145px;
|
727 |
+
}
|
728 |
+
|
729 |
+
.wpallimport-plugin .pmxi-add-on-active .button {
|
730 |
+
padding-left: 4px;
|
731 |
}
|
732 |
+
.wpallimport-plugin .pmxi-sprite-tick {
|
733 |
+
width: 14px;
|
734 |
+
height: 14px;
|
735 |
+
margin: 4px 5px 0 0;
|
736 |
+
background-position: 0px -300px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
}
|
738 |
+
.wpallimport-plugin .wp-box {
|
739 |
+
background: none repeat scroll 0 0 #FFFFFF;
|
740 |
+
border: 1px solid #E1E1E1;
|
741 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
742 |
+
position: relative;
|
743 |
}
|
744 |
+
.wpallimport-plugin .wp-box .inner {
|
745 |
+
padding: 15px;
|
746 |
+
}
|
747 |
+
.wpallimport-plugin .wp-box .footer{
|
748 |
+
background: none repeat scroll 0 0 #F5F5F5;
|
749 |
+
border-top: 1px solid #E1E1E1;
|
750 |
+
overflow: hidden;
|
751 |
+
padding: 10px;
|
752 |
+
position: absolute;
|
753 |
+
bottom:0;
|
754 |
+
width:91%;
|
755 |
+
}
|
756 |
+
|
757 |
+
#pmxi-add-ons .pmxi-add-on-title {
|
758 |
+
float: left;
|
759 |
+
width: 100%;
|
760 |
+
margin: 25px 0 25px;
|
761 |
+
border-top: #F5F5F5 solid 1px;
|
762 |
}
|
763 |
+
|
764 |
+
/*--------------------------------------------------------------------------
|
765 |
+
*
|
766 |
+
* WP All Import Layout
|
767 |
+
*
|
768 |
+
*-------------------------------------------------------------------------*/
|
769 |
+
|
770 |
+
/* 2 column wpallimport-layout */
|
771 |
+
.wpallimport-plugin table.wpallimport-layout {
|
772 |
+
clear: both;
|
773 |
+
border-collapse: collapse;
|
774 |
+
min-width: 770px;
|
775 |
}
|
776 |
+
|
777 |
+
.wpallimport-plugin .wpallimport-step-3 table.wpallimport-layout,
|
778 |
+
.wpallimport-plugin .wpallimport-step-4 table.wpallimport-layout{
|
779 |
+
width: 100%;
|
780 |
}
|
781 |
+
|
782 |
+
.wpallimport-plugin table.wpallimport-layout.wpallimport-step-1,
|
783 |
+
.wpallimport-plugin .wpallimport-step-2,
|
784 |
+
.wpallimport-plugin .wpallimport-step-3,
|
785 |
+
.wpallimport-plugin .wpallimport-step-4,
|
786 |
+
.wpallimport-plugin .wpallimport-step-5,
|
787 |
+
.wpallimport-plugin .wpallimport-step-6{
|
788 |
+
margin: 20px 0 0 0px;
|
789 |
+
}
|
790 |
+
.wpallimport-plugin table.wpallimport-layout td {
|
791 |
+
vertical-align: top;
|
792 |
+
border: none;
|
793 |
+
font-size: 12px !important;
|
794 |
+
}
|
795 |
+
.wpallimport-plugin table.wpallimport-layout td.left {
|
796 |
+
/*min-width: 490px;*/
|
797 |
+
width: 61%;
|
798 |
+
}
|
799 |
+
.wpallimport-plugin table.wpallimport-layout td.right {
|
800 |
+
padding: 0px 0 16px 20px;
|
801 |
+
width: 23%;
|
802 |
+
min-width: 260px;
|
803 |
+
position: relative;
|
804 |
+
}
|
805 |
+
.wpallimport-plugin table.wpallimport-layout td.left > h2:first-child {
|
806 |
+
margin-top: -22px;
|
807 |
+
padding: 14px 0 3px 0;
|
808 |
+
}
|
809 |
+
.wpallimport-plugin table.wpallimport-layout td.left hr {
|
810 |
+
clear: both;
|
811 |
+
}
|
812 |
+
.wpallimport-plugin.no-js table.wpallimport-layout td.left > h2:first-child {
|
813 |
+
margin-top: 0px;
|
814 |
+
}
|
815 |
+
.wpallimport-plugin table.wpallimport-layout div.left {
|
816 |
+
min-width: 490px;
|
817 |
+
width: 70%;
|
818 |
+
float: left;
|
819 |
}
|
820 |
+
.wpallimport-plugin table.wpallimport-layout div.right {
|
821 |
+
padding: 0px 0 16px 20px;
|
822 |
+
width: 25%;
|
823 |
+
/*min-width: 260px; */
|
824 |
position: relative;
|
|
|
|
|
|
|
825 |
float: right;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
826 |
}
|
827 |
+
/*@*/
|
828 |
+
|
829 |
+
.wpallimport-plugin table.wpallimport-layout.wpallimport-step-1 tr td.left{
|
830 |
width: 100%;
|
831 |
}
|
832 |
+
.wpallimport-plugin form.options table.wpallimport-layout td.right{
|
833 |
+
width: 25%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
}
|
835 |
+
|
836 |
+
.wpallimport-plugin .wpallimport-content-section{
|
837 |
+
background: #fff;
|
838 |
+
border: 1px solid #ddd;
|
839 |
+
border-radius: 4px;
|
840 |
+
-moz-border-radius: 4px;
|
841 |
+
-khtml-border-radius: 4px;
|
842 |
+
-webkit-border-radius: 4px;
|
843 |
+
margin-top: 20px;
|
844 |
+
margin-bottom: 20px;
|
845 |
+
padding-bottom: 15px;
|
846 |
}
|
847 |
+
|
848 |
+
|
849 |
+
.wpallimport-plugin table.form-table {
|
850 |
+
clear: none;
|
851 |
+
margin-top: 0px;
|
852 |
}
|
853 |
+
.wpallimport-plugin table.form-table.custom-params {
|
854 |
+
max-width: 700px;
|
855 |
}
|
856 |
+
.wpallimport-plugin table.form-table td,
|
857 |
+
.wpallimport-plugin table.form-table th {
|
858 |
+
vertical-align: top;
|
859 |
+
}
|
860 |
+
.wpallimport-plugin table.form-table thead td {
|
861 |
+
font-weight: bold;
|
862 |
+
}
|
863 |
+
.wpallimport-plugin table.form-table.custom-params input {
|
864 |
+
margin-left: 0;
|
865 |
+
}
|
866 |
+
.wpallimport-plugin table.form-table tr.template,
|
867 |
+
.wpallimport-plugin table.form-table ol li.template,
|
868 |
+
.wpallimport-plugin table.cf-form-table tr.template,
|
869 |
+
.wpallimport-plugin table.tax-form-table tr.template {
|
870 |
+
display: none;
|
871 |
+
}
|
872 |
+
|
873 |
+
.wpallimport-plugin .form-table td{
|
874 |
+
padding: 0px;
|
875 |
+
line-height: inherit !important;
|
876 |
+
}
|
877 |
+
.wpallimport-plugin form.settings .form-table td{
|
878 |
+
padding: 15px 10px;
|
879 |
+
}
|
880 |
+
.wpallimport-plugin .form-table td label,
|
881 |
+
.wpallimport-plugin .form-table td li,
|
882 |
+
.wpallimport-plugin .form-table td p{
|
883 |
+
line-height: 1.4em;
|
884 |
+
}
|
885 |
+
.wpallimport-plugin .form-table td label{
|
886 |
+
display: inline-block;
|
887 |
+
margin: 0.25em 0 0.5em !important;
|
888 |
+
}
|
889 |
+
|
890 |
+
.wpallimport-plugin div.input label,
|
891 |
+
.wpallimport-plugin .form-field{
|
892 |
+
font-size: 12px !important;
|
893 |
}
|
894 |
+
.wpallimport-plugin input[type="radio"]{
|
895 |
+
margin-left: 4px;
|
|
|
|
|
896 |
}
|
897 |
+
|
898 |
+
.wpallimport-plugin .wpallimport-wrapper{
|
899 |
+
width: 1200px;
|
900 |
}
|
901 |
+
|
902 |
+
/*--------------------------------------------------------------------------
|
903 |
+
*
|
904 |
+
* Step 1 - choose file
|
905 |
+
*
|
906 |
+
*-------------------------------------------------------------------------*/
|
907 |
+
|
908 |
+
/*@+ Choose File forms */
|
909 |
+
.wpallimport-plugin form.wpallimport-choose-file {
|
910 |
+
margin-top: 15px;
|
911 |
+
position: relative;
|
912 |
}
|
913 |
+
.wpallimport-plugin form.wpallimport-choose-file h3 {
|
914 |
+
margin-bottom: 5px;
|
915 |
+
}
|
916 |
+
.wpallimport-plugin form.wpallimport-choose-file .label {
|
917 |
+
font-size: 15px;
|
918 |
+
}
|
919 |
+
.wpallimport-plugin form.wpallimport-choose-file input[type="text"],
|
920 |
+
.wpallimport-plugin form.wpallimport-choose-file input[type="password"] {
|
921 |
+
width: 80px;
|
922 |
+
font-size: 12px;
|
923 |
+
}
|
924 |
+
.wpallimport-plugin form.wpallimport-choose-file input.regular-text,
|
925 |
+
.wpallimport-plugin form.wpallimport-choose-file select.regular-text {
|
926 |
+
width: 100%;
|
927 |
+
}
|
928 |
+
.wpallimport-plugin #wpcontent form.wpallimport-choose-file select[name="file"],
|
929 |
+
.wpallimport-plugin #wpcontent form.wpallimport-choose-file select[name="reimport"] {
|
930 |
+
font-size: 12px;
|
931 |
+
}
|
932 |
+
.wpallimport-plugin form.wpallimport-choose-file input[type="submit"].button {
|
933 |
+
/*width: 150px;*/
|
934 |
+
}
|
935 |
+
.wpallimport-plugin form.wpallimport-choose-file div.input {
|
936 |
+
margin-top: 20px;
|
937 |
+
}
|
938 |
+
.wpallimport-plugin form.wpallimport-choose-file .wpallimport-submit-buttons{
|
939 |
+
clear: both;
|
940 |
+
text-align: center;
|
941 |
+
display: none;
|
942 |
+
}
|
943 |
+
/*@*/
|
944 |
+
|
945 |
+
.wpallimport-plugin #select-files{
|
946 |
+
height:35px;
|
947 |
+
line-height: 35px;
|
948 |
+
font-size: 18px;
|
949 |
+
margin-top: 30px;
|
950 |
+
display: inline-block;
|
951 |
+
position: relative;
|
952 |
+
z-index: 0;
|
953 |
text-decoration: none;
|
954 |
+
color: #888;
|
955 |
+
background: url('../img/ui_4.0/select_files.png') no-repeat 0 2px;
|
956 |
+
padding-left: 45px;
|
|
|
|
|
|
|
|
|
|
|
|
|
957 |
}
|
958 |
+
.wpallimport-plugin .wpallimport-progress{
|
959 |
+
position: relative;
|
960 |
+
display: none;
|
961 |
+
color: #009039;
|
962 |
+
font-size: 13px;
|
963 |
+
font-weight: bold;
|
964 |
+
margin-top: 10px;
|
965 |
+
width: 100%;
|
|
|
966 |
text-align: center;
|
967 |
+
/*border:1px solid #4297D7;*/
|
968 |
+
-moz-border-radius: 8px;
|
969 |
+
-khtml-border-radius: 8px;
|
970 |
+
-webkit-border-radius: 8px;
|
971 |
+
border-radius: 8px;
|
972 |
+
}
|
973 |
+
.wpallimport-plugin #progressbar{
|
974 |
+
border: medium none;
|
975 |
+
text-align: center;
|
976 |
+
width: 100%;
|
977 |
+
font-size: 20px;
|
978 |
+
color:#000;
|
979 |
+
line-height: 35px;
|
980 |
+
margin: 20px 0;
|
981 |
}
|
982 |
+
.wpallimport-plugin #progressbar span{ color:#777; }
|
983 |
+
|
984 |
+
.wpallimport-plugin #file_name{
|
985 |
+
font-size: 16px;
|
986 |
+
font-weight: bold;
|
987 |
+
margin-left: 10px;
|
988 |
+
float: right;
|
989 |
}
|
990 |
+
|
991 |
+
|
992 |
+
.wpallimport-plugin .wpallimport-import-types{
|
993 |
+
margin: 37px 0 10px;
|
994 |
+
text-align: center;
|
|
|
995 |
}
|
996 |
+
.wpallimport-plugin .wpallimport-import-types h2,
|
997 |
+
.wpallimport-plugin .wpallimport-import-types h3{
|
998 |
+
color:#40ad6e;
|
999 |
+
font-size: 24px;
|
1000 |
+
margin-bottom: 25px;
|
1001 |
+
font-weight: normal;
|
1002 |
+
}
|
1003 |
+
.wpallimport-plugin .wpallimport-upload-type-container {
|
1004 |
display: none;
|
1005 |
+
text-align: center;
|
1006 |
+
padding: 0 55px;
|
1007 |
}
|
1008 |
+
.wpallimport-plugin a.wpallimport-import-from{
|
1009 |
+
color:#888;
|
1010 |
+
background: #f6f5f1;
|
1011 |
+
border: 1px solid #ddd;
|
1012 |
+
border-radius: 4px;
|
1013 |
+
-moz-border-radius: 4px;
|
1014 |
+
-khtml-border-radius: 4px;
|
1015 |
+
-webkit-border-radius: 4px;
|
1016 |
+
font-size: 20px;
|
1017 |
+
display: inline-block;
|
1018 |
+
height: 65px;
|
1019 |
+
width: 350px;
|
1020 |
+
text-decoration: none;
|
1021 |
+
margin: 5px;
|
1022 |
+
vertical-align: top;
|
1023 |
+
padding-top: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1024 |
}
|
1025 |
+
.wpallimport-plugin a.wpallimport-import-from.bind{
|
1026 |
+
color: #888;
|
1027 |
+
border-color: #cfceca;
|
1028 |
+
}
|
1029 |
+
.wpallimport-plugin a.wpallimport-import-from.selected{
|
1030 |
+
color:#fff;
|
1031 |
+
background: #46ba69;
|
1032 |
+
border: 1px solid #3da55c;
|
1033 |
+
}
|
1034 |
+
.wpallimport-plugin a.wpallimport-import-from span{
|
1035 |
+
display: inline-block;
|
1036 |
+
position: relative;
|
1037 |
+
}
|
1038 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-upload-type{
|
1039 |
+
padding-top: 15px;
|
1040 |
+
height: 60px;
|
1041 |
+
}
|
1042 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-upload-type span.wpallimport-icon{
|
1043 |
+
background: url('../img/ui_4.0/upload_sprite.png') 0 -30px no-repeat;
|
1044 |
+
width: 40px;
|
1045 |
+
height: 30px;
|
1046 |
+
top: 6px;
|
1047 |
+
left: -10px;
|
1048 |
+
}
|
1049 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-upload-type.selected span.wpallimport-icon{
|
1050 |
+
background: url('../img/ui_4.0/upload_sprite.png') 0 0 no-repeat;
|
1051 |
+
width: 40px;
|
1052 |
+
height: 30px;
|
1053 |
+
top: 6px;
|
1054 |
+
left: -10px;
|
1055 |
+
}
|
1056 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-url-type span.wpallimport-icon{
|
1057 |
+
background: url('../img/ui_4.0/url_sprite.png') 0 -34px no-repeat;
|
1058 |
+
width: 40px;
|
1059 |
+
height: 34px;
|
1060 |
+
top:10px;
|
1061 |
+
left: -10px;
|
1062 |
+
}
|
1063 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-url-type.selected span.wpallimport-icon{
|
1064 |
+
background: url('../img/ui_4.0/url_sprite.png') 0 0 no-repeat;
|
1065 |
+
width: 40px;
|
1066 |
+
height: 34px;
|
1067 |
+
top:10px;
|
1068 |
+
left: -10px;
|
1069 |
+
}
|
1070 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-file-type span.wpallimport-icon{
|
1071 |
+
background: url('../img/ui_4.0/file_sprite.png') 0 -34px no-repeat;
|
1072 |
+
width: 32px;
|
1073 |
+
height: 34px;
|
1074 |
+
top:10px;
|
1075 |
+
left: -10px;
|
1076 |
+
}
|
1077 |
+
.wpallimport-plugin a.wpallimport-import-from.wpallimport-file-type.selected span.wpallimport-icon{
|
1078 |
+
background: url('../img/ui_4.0/file_sprite.png') 0 0 no-repeat;
|
1079 |
+
width: 32px;
|
1080 |
+
height: 34px;
|
1081 |
+
top:10px;
|
1082 |
+
left: -10px;
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
.wpallimport-plugin .wpallimport-upload-resource-step-one,
|
1086 |
+
.wpallimport-plugin .wpallimport-file-upload-result{
|
1087 |
+
background: #fff;
|
1088 |
+
border-top: 1px solid #ddd;
|
1089 |
+
border-right: 1px solid #ddd;
|
1090 |
+
border-left: 1px solid #ddd;
|
1091 |
+
border-bottom: 1px solid #ddd;
|
1092 |
+
/*margin-bottom: 20px;*/
|
1093 |
+
padding: 20px;
|
1094 |
+
padding-top: 0;
|
1095 |
}
|
1096 |
+
.wpallimport-plugin .wpallimport-choose-post-type{
|
1097 |
+
background: #fff;
|
1098 |
+
/*border-bottom: 1px solid #ddd;
|
1099 |
+
border-right: 1px solid #ddd;
|
1100 |
+
border-left: 1px solid #ddd;
|
1101 |
+
padding: 20px;
|
1102 |
+
padding-top: 0;
|
1103 |
+
-moz-border-radius-bottomright: 4px;
|
1104 |
+
-webkit-border-bottom-right-radius: 4px;
|
1105 |
+
border-bottom-right-radius: 4px;
|
1106 |
+
-moz-border-radius-bottomleft: 4px;
|
1107 |
+
-webkit-border-bottom-left-radius: 4px;
|
1108 |
+
border-bottom-left-radius: 4px;*/
|
1109 |
+
}
|
1110 |
+
.wpallimport-plugin .wpallimport-upload-resource-step-one{
|
1111 |
+
border-top-left-radius: 4px;
|
1112 |
+
border-top-right-radius: 4px;
|
1113 |
+
border-bottom-right-radius: 4px;
|
1114 |
+
-moz-border-radius-topleft: 4px;
|
1115 |
+
-webkit-border-top-left-radius: 4px;
|
1116 |
+
-moz-border-radius-topright: 4px;
|
1117 |
+
-webkit-border-top-right-radius: 4px;
|
1118 |
+
-moz-border-radius-bottomleft: 4px;
|
1119 |
+
-webkit-border-bottom-left-radius: 4px;
|
1120 |
+
}
|
1121 |
+
.wpallimport-plugin .wpallimport-choose-post-type{ padding-top: 40px; }
|
1122 |
+
.wpallimport-plugin .wpallimport-file-upload-result{ padding-top: 30px; overflow: hidden; }
|
1123 |
+
.wpallimport-plugin .wpallimport-upload-resource-step-one{ padding-bottom: 40px; }
|
1124 |
+
.wpallimport-plugin .wpallimport-upload-resource-step-two{ display: none; }
|
1125 |
+
.wpallimport-plugin .wpallimport-upload-resource-step-two h2{
|
1126 |
+
text-align: center;
|
1127 |
+
color: #4db278;
|
1128 |
padding: 0;
|
1129 |
+
margin: 20px 0;
|
|
|
|
|
|
|
|
|
1130 |
}
|
1131 |
+
.wpallimport-plugin .dd-select{
|
1132 |
+
border: 1px solid #ddd;
|
|
|
|
|
|
|
|
|
|
|
1133 |
}
|
1134 |
+
.wpallimport-plugin #custom_type_selector,
|
1135 |
+
.wpallimport-plugin #file_selector{
|
1136 |
+
margin: 0 auto;
|
1137 |
+
margin-bottom: 20px;
|
1138 |
+
text-align: left;
|
1139 |
}
|
1140 |
+
.wpallimport-plugin .wpallimport-change-custom-type #custom_type_selector{
|
1141 |
+
margin: 0;
|
1142 |
}
|
1143 |
+
.wpallimport-plugin .wpallimport-change-custom-type #custom_type_selector .dd-option{
|
1144 |
+
padding: 10px 0 0 10px;
|
1145 |
}
|
1146 |
+
.wpallimport-plugin .wpallimport-change-custom-type #custom_type_selector .dd-select{
|
1147 |
+
padding: 5px 0 0;
|
|
|
|
|
|
|
|
|
1148 |
}
|
1149 |
+
.wpallimport-plugin #file_selector{
|
1150 |
+
margin-top: 30px;
|
1151 |
}
|
1152 |
+
.wpallimport-plugin #custom_type_selector .dd-options li,
|
1153 |
+
.wpallimport-plugin #file_selector .dd-options li{
|
1154 |
+
margin-bottom: 0;
|
|
|
|
|
|
|
1155 |
}
|
1156 |
+
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option,
|
1157 |
+
.wpallimport-plugin #file_selector .dd-options li .dd-option{
|
1158 |
+
font-size: 18px;
|
1159 |
+
color: #555;
|
1160 |
+
border: none;
|
1161 |
}
|
1162 |
+
/*.wpallimport-plugin #file_selector .dd-options li .dd-option{
|
1163 |
+
font-size: 18px;
|
1164 |
+
color: #ccc;
|
1165 |
+
border: none;
|
1166 |
+
}*/
|
1167 |
+
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option:hover,
|
1168 |
+
.wpallimport-plugin #custom_type_selector .dd-options li .dd-option-selected,
|
1169 |
+
.wpallimport-plugin #file_selector .dd-options li .dd-option:hover,
|
1170 |
+
.wpallimport-plugin #file_selector .dd-options li .dd-option-selected{
|
1171 |
+
background: #eee;
|
1172 |
+
color: #555;
|
1173 |
+
}
|
1174 |
+
/*.wpallimport-plugin #file_selector .dd-options li .dd-option:hover,
|
1175 |
+
.wpallimport-plugin #file_selector .dd-options li .dd-option-selected{
|
1176 |
+
background: #40acad;
|
1177 |
+
color: #fff;
|
1178 |
+
}*/
|
1179 |
+
.wpallimport-plugin #custom_type_selector .dd-select,
|
1180 |
+
.wpallimport-plugin #file_selector .dd-select{
|
1181 |
+
background: #fff !important;
|
1182 |
+
padding: 10px 0;
|
1183 |
+
margin-left: -5px;
|
1184 |
+
}
|
1185 |
+
.wpallimport-plugin #custom_type_selector .dd-selected,
|
1186 |
+
.wpallimport-plugin #file_selector .dd-selected{
|
1187 |
+
color: #000;
|
1188 |
+
font-weight: normal;
|
1189 |
+
font-size: 18px;
|
1190 |
+
padding: 0;
|
1191 |
+
padding: 0 10px;
|
1192 |
+
line-height: 24px;
|
1193 |
}
|
1194 |
+
.wpallimport-plugin .change_file #file_selector .dd-select{
|
1195 |
+
padding: 5px 0 0;
|
|
|
1196 |
}
|
1197 |
+
.wpallimport-plugin .change_file #file_selector .dd-options .dd-option{
|
1198 |
+
padding: 0 10px;
|
1199 |
+
}
|
1200 |
+
.wpallimport-plugin .dd-options{
|
1201 |
+
left: -5px;
|
|
|
1202 |
}
|
1203 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dd-selected-image{
|
1204 |
+
margin-left: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1205 |
}
|
1206 |
+
.wpallimport-plugin #custom_type_selector .dd-options .dd-option .dd-option-text{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1207 |
position: relative;
|
1208 |
+
top: -2px;
|
|
|
1209 |
}
|
1210 |
+
.wpallimport-plugin .wpallimport-import-to{
|
1211 |
+
background: none repeat scroll 0 0 #f6f5f1;
|
1212 |
+
border: 1px solid #ddd;
|
1213 |
+
color: #888;
|
1214 |
+
display: inline-block;
|
1215 |
+
font-size: 18px;
|
1216 |
+
height: 50px;
|
1217 |
+
line-height: 24px;
|
1218 |
+
padding-top: 25px;
|
1219 |
text-align: center;
|
1220 |
+
text-decoration: none;
|
1221 |
+
width: 360px;
|
1222 |
+
margin-right: 10px;
|
1223 |
position: relative;
|
|
|
1224 |
}
|
1225 |
+
.wpallimport-plugin .wpallimport-import-to span.wpallimport-import-to-arrow{
|
1226 |
+
display: none;
|
1227 |
+
}
|
1228 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-import-to-checked span.wpallimport-import-to-arrow{
|
1229 |
+
background: url('../img/ui_4.0/bottom_arrow.png') no-repeat;
|
1230 |
+
position: absolute;
|
1231 |
+
bottom: -12px;
|
1232 |
+
left: 48%;
|
1233 |
+
display: block;
|
1234 |
+
height: 14px;
|
1235 |
+
width: 24px;
|
1236 |
+
}
|
1237 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-import-to-checked{
|
1238 |
+
background: #38A659;
|
1239 |
+
border: 1px solid #3da55c;
|
1240 |
+
color: #fff;
|
1241 |
+
}
|
1242 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items span.wpallimport-import-to-title:before{
|
1243 |
+
content: "\f464";
|
1244 |
+
/*display: inline-block;*/
|
1245 |
+
font-family: "dashicons";
|
1246 |
+
font-size: 33px;
|
1247 |
+
left: 27%;
|
1248 |
+
line-height: 10px;
|
1249 |
+
position: absolute;
|
1250 |
+
top: 33px;
|
1251 |
+
}
|
1252 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items.wpallimport-import-to-checked span.wpallimport-import-to-title:before,
|
1253 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-to-existing-items.wpallimport-import-to-checked span.wpallimport-import-to-title:before{
|
1254 |
+
color: #a3ddb4;
|
1255 |
+
}
|
1256 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-to-existing-items span.wpallimport-import-to-title:before{
|
1257 |
+
content: "\f321";
|
1258 |
+
/*display: inline-block;*/
|
1259 |
+
font-family: "dashicons";
|
1260 |
+
font-size: 33px;
|
1261 |
+
left: 23%;
|
1262 |
+
line-height: 10px;
|
1263 |
+
position: absolute;
|
1264 |
+
top: 33px;
|
1265 |
+
}
|
1266 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon:before,
|
1267 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon:before {
|
1268 |
+
font-size: 24px;
|
1269 |
+
float: left;
|
1270 |
+
margin: 2px 5px 2px 2px;
|
1271 |
+
}
|
1272 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-post:before,
|
1273 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-post:before{
|
1274 |
+
font-family: "dashicons";
|
1275 |
+
content: "\f109";
|
1276 |
+
color: #555;
|
1277 |
+
}
|
1278 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-page:before,
|
1279 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-page:before{
|
1280 |
+
font-family: "dashicons";
|
1281 |
+
content: "\f105";
|
1282 |
+
color: #555;
|
1283 |
+
}
|
1284 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-product:before,
|
1285 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-product:before{
|
1286 |
+
font-family: "dashicons";
|
1287 |
+
content: "\f174";
|
1288 |
+
color: #555;
|
1289 |
+
margin-top: 0;
|
1290 |
}
|
1291 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-cpt:before,
|
1292 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-cpt:before{
|
1293 |
+
font-family: "dashicons";
|
1294 |
+
content: "\f333";
|
1295 |
+
color: #555;
|
1296 |
}
|
1297 |
+
.wpallimport-plugin #custom_type_selector .dd-option .dashicon-import_users:before,
|
1298 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon-import_users:before{
|
1299 |
+
font-family: "dashicons";
|
1300 |
+
content: "\f110";
|
1301 |
+
color: #555;
|
1302 |
}
|
1303 |
+
.wpallimport-plugin #custom_type_selector .dd-option:hover .dashicon:before,
|
1304 |
+
.wpallimport-plugin #custom_type_selector .dd-option-selected .dashicon:before{
|
1305 |
+
color: #555;
|
1306 |
}
|
1307 |
+
.wpallimport-plugin #custom_type_selector .dd-selected .dashicon:before{
|
1308 |
+
color:#46ba69;
|
1309 |
+
line-height: 24px;
|
1310 |
}
|
1311 |
+
.wpallimport-plugin input[name=url]{
|
1312 |
+
font-size: 18px !important;
|
1313 |
+
height: 49px;
|
1314 |
+
margin-top: 20px;
|
1315 |
+
padding: 5px;
|
1316 |
+
width: 75% !important;
|
1317 |
+
/*background: url('../img/ui_4.0/url.png') 10px -42px no-repeat;*/
|
1318 |
+
padding-left: 60px;
|
1319 |
+
border: 1px solid #ddd;
|
1320 |
+
border-radius: 4px;
|
1321 |
+
-moz-border-radius: 4px;
|
1322 |
+
-khtml-border-radius: 4px;
|
1323 |
+
-webkit-border-radius: 4px;
|
1324 |
+
color: #cfceca;
|
1325 |
+
margin-bottom: 0;
|
1326 |
}
|
1327 |
+
.wpallimport-plugin .wpallimport-url-icon:before{
|
1328 |
+
color: #cfceca;
|
1329 |
+
content: "\f103";
|
1330 |
+
font-family: "dashicons";
|
1331 |
+
font-size: 30px;
|
1332 |
+
left: 45px;
|
1333 |
+
position: relative;
|
1334 |
+
top: -14px;
|
1335 |
+
vertical-align: bottom;
|
1336 |
}
|
1337 |
+
.wpallimport-plugin .wpallimport-url-icon.focus:before{
|
1338 |
+
color: #333;
|
1339 |
}
|
1340 |
+
.wpallimport-plugin input[name=url].focus{
|
1341 |
+
background-position: 10px 8px;
|
1342 |
+
color:#333;
|
1343 |
+
font-size: 11px !important;
|
1344 |
}
|
1345 |
+
.wpallimport-plugin #plupload-ui h3{
|
1346 |
+
float: left;
|
1347 |
+
font-size: 13px;
|
1348 |
+
font-weight: normal;
|
1349 |
+
margin-bottom: 0;
|
1350 |
+
margin-top: 8px;
|
1351 |
}
|
1352 |
+
.wpallimport-plugin .wpallimport-reimported-notify{
|
1353 |
+
border: 1px solid #AFAFAF;
|
1354 |
margin-bottom: 20px;
|
1355 |
+
padding: 10px 20px;
|
1356 |
}
|
1357 |
+
.wpallimport-plugin .wpallimport-reimported-notify p span{
|
1358 |
+
color: #ccc;
|
|
|
|
|
|
|
1359 |
}
|
1360 |
+
.wpallimport-plugin .wpallimport-choose-data-type{
|
1361 |
+
text-align: center;
|
1362 |
+
margin-bottom: 30px;
|
1363 |
}
|
1364 |
+
.wpallimport-plugin #wpallimport-url-upload-status{
|
1365 |
+
margin: 10px;
|
1366 |
}
|
1367 |
+
.wpallimport-plugin .wpallimport-uploaded-file-name{
|
1368 |
+
color: #333;
|
|
|
1369 |
}
|
1370 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="new"]{
|
1371 |
+
margin-left: -13%;
|
1372 |
}
|
1373 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="matching"]{
|
1374 |
+
margin-left: -12%;
|
1375 |
}
|
1376 |
+
.wpallimport-plugin .wpallimport-extra-text-left{
|
1377 |
+
float: left;
|
1378 |
+
text-align: right;
|
1379 |
+
width: 37%;
|
1380 |
}
|
1381 |
+
.wpallimport-plugin .wpallimport-extra-text-right{
|
1382 |
+
float: right;
|
1383 |
+
text-align: left;
|
1384 |
+
width: 38%;
|
|
|
|
|
|
|
|
|
|
|
|
|
1385 |
}
|
1386 |
+
.wpallimport-plugin .wpallimport-new-records,
|
1387 |
+
.wpallimport-plugin .wpallimport-existing-records{
|
1388 |
+
display: none;
|
1389 |
+
color: #777;
|
1390 |
+
font-size: 18px;
|
1391 |
+
line-height: 50px;
|
1392 |
}
|
1393 |
+
.wpallimport-plugin .wpallimport-extra-text-below{
|
1394 |
+
max-width: 565px;
|
1395 |
+
margin: 0 auto;
|
1396 |
}
|
|
|
1397 |
/*--------------------------------------------------------------------------
|
1398 |
*
|
1399 |
+
* Step 2 - XPath filtering
|
1400 |
*
|
1401 |
*-------------------------------------------------------------------------*/
|
1402 |
|
1403 |
+
.wpallimport-plugin .wpallimport-console{
|
1404 |
+
position:relative;
|
1405 |
+
padding:0;
|
1406 |
+
display:none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1407 |
}
|
1408 |
+
.wpallimport-plugin .action_buttons{
|
|
|
|
|
|
|
|
|
|
|
1409 |
overflow: hidden;
|
1410 |
+
clear: both;
|
1411 |
padding: 10px;
|
1412 |
+
border-bottom: 1px solid #ddd;
|
|
|
|
|
1413 |
}
|
1414 |
+
.wpallimport-plugin .action_buttons .wpallimport-go-to{
|
1415 |
+
display: block;
|
1416 |
+
height: 21px;
|
1417 |
+
margin-top: 25px;
|
1418 |
+
text-decoration: none;
|
1419 |
+
width: 13px;
|
1420 |
+
}
|
1421 |
+
.wpallimport-plugin .action_buttons #prev_element{
|
1422 |
+
background: url('../img/ui_4.0/left_btn.png') no-repeat;
|
1423 |
+
margin-left: 15px;
|
1424 |
+
float: left;
|
1425 |
+
}
|
1426 |
+
.wpallimport-plugin .action_buttons #next_element{
|
1427 |
+
background: url('../img/ui_4.0/right_btn.png') no-repeat;
|
1428 |
+
margin-right: 15px;
|
1429 |
+
float: right;
|
1430 |
+
}
|
1431 |
+
.wpallimport-plugin .action_buttons .wpallimport-root-element{
|
1432 |
+
color: #46ba69;
|
1433 |
+
font-weight: bold;
|
1434 |
+
margin-top: 0;
|
1435 |
+
}
|
1436 |
+
.wpallimport-plugin input[name="delimiter"]{
|
1437 |
+
display: inline-block;
|
1438 |
+
height: 28px;
|
1439 |
+
margin: 0 3px !important;
|
1440 |
+
min-width: 28px !important;
|
1441 |
+
padding: 0 3px;
|
1442 |
+
position: relative;
|
1443 |
+
text-align: center;
|
1444 |
+
width: 28px !important;
|
1445 |
}
|
1446 |
+
.wpallimport-plugin input[name="apply_delimiter"]{
|
1447 |
+
background: none repeat scroll 0 0 #425f9a;
|
1448 |
+
border: 1px solid #425f9a;
|
1449 |
+
border-radius: 3px;
|
1450 |
+
color: #fff;
|
1451 |
+
cursor: pointer;
|
1452 |
+
height: 28px;
|
1453 |
+
margin: 0 5px !important;
|
1454 |
+
padding: 3px 10px !important;
|
1455 |
+
vertical-align: bottom;
|
1456 |
+
}
|
1457 |
+
.wpallimport-plugin .go_to{
|
1458 |
+
float: left;
|
1459 |
+
font-size: 23px;
|
1460 |
+
line-height: 38px;
|
1461 |
+
text-align: center;
|
1462 |
}
|
1463 |
+
.wpallimport-plugin #pmxi_value{
|
1464 |
display: inline-block;
|
1465 |
height: 28px;
|
1466 |
margin: 0;
|
1469 |
top: 2px;
|
1470 |
width: 50px;
|
1471 |
}
|
1472 |
+
.wpallimport-plugin #pmxi_add_rule,
|
1473 |
+
.wpallimport-plugin #apply_filters{
|
1474 |
+
background: url("../img/ui_4.0/rule.png") no-repeat scroll 10px 10px #40acad;
|
1475 |
+
border: 1px solid #3a9c9d;
|
1476 |
+
border-radius: 5px;
|
1477 |
+
-moz-border-radius: 5px;
|
1478 |
+
-khtml-border-radius: 5px;
|
1479 |
+
-webkit-border-radius: 5px;
|
1480 |
+
color: #fff;
|
1481 |
+
display: inline-block;
|
1482 |
+
font-size: 14px;
|
1483 |
+
height: 21px;
|
1484 |
+
margin: 0;
|
1485 |
float: right;
|
1486 |
+
padding: 13px 40px 10px 50px;
|
1487 |
+
text-decoration: none;
|
1488 |
+
font-weight: bold;
|
1489 |
}
|
1490 |
+
.wpallimport-plugin #apply_filters{
|
1491 |
+
float: right;
|
1492 |
+
margin-right: 25px;
|
1493 |
+
margin-top: 50px;
|
1494 |
}
|
1495 |
+
.wpallimport-plugin #pmxi_xml_element,
|
1496 |
+
.wpallimport-plugin #pmxi_rule,
|
1497 |
+
.wpallimport-plugin #pmxi_value{
|
1498 |
+
font-size: 16px;
|
1499 |
+
height: 48px;
|
1500 |
+
padding: 10px;
|
1501 |
+
border: 1px solid #ddd;
|
1502 |
+
border-radius: 5px;
|
1503 |
+
-moz-border-radius: 5px;
|
1504 |
+
-khtml-border-radius: 5px;
|
1505 |
+
-webkit-border-radius: 5px;
|
1506 |
+
color: #777;
|
1507 |
+
font-size: 15px !important;
|
1508 |
+
width: 100%;
|
1509 |
position: relative;
|
1510 |
+
top: 0;
|
1511 |
}
|
1512 |
+
.wpallimport-plugin table.xpath_filtering{
|
1513 |
+
width:100%;
|
1514 |
+
margin-top:20px;
|
1515 |
+
}
|
1516 |
+
.wpallimport-plugin table.xpath_filtering input[name=xpath]{
|
1517 |
+
font-size: 16px;
|
1518 |
+
height: 45px;
|
1519 |
+
padding: 10px;
|
1520 |
+
border: 1px solid #ddd;
|
1521 |
+
border-radius: 5px;
|
1522 |
+
-moz-border-radius: 5px;
|
1523 |
+
-khtml-border-radius: 5px;
|
1524 |
+
-webkit-border-radius: 5px;
|
1525 |
+
color: #40acad;
|
1526 |
+
font-size: 15px !important;
|
1527 |
+
width: 100%;
|
1528 |
+
position: relative;
|
1529 |
+
top: 0;
|
1530 |
+
}
|
1531 |
+
.wpallimport-plugin #filtering_rules{
|
1532 |
+
position: relative;
|
1533 |
+
padding: 0;
|
1534 |
}
|
1535 |
+
.wpallimport-plugin .filtering_rules{
|
1536 |
+
margin: 0;
|
1537 |
+
}
|
1538 |
+
.wpallimport-plugin .filtering_rules .drag-element{
|
1539 |
+
background: url('../img/ui_4.0/list.png') no-repeat 0 3px;
|
1540 |
+
padding-left: 30px;
|
1541 |
+
height: 25px;
|
1542 |
}
|
1543 |
+
.wpallimport-plugin .filtering_rules .drag-element .rule_element{
|
1544 |
+
display: inline-block;
|
1545 |
+
width: 30%;
|
1546 |
+
color:#46ba69;
|
1547 |
+
font-size: 14px;
|
1548 |
+
}
|
1549 |
+
.wpallimport-plugin .filtering_rules .drag-element .rule_as_is{
|
1550 |
+
display: inline-block;
|
1551 |
+
width: 20%;
|
1552 |
+
color:#40acad;
|
1553 |
+
font-size: 14px;
|
1554 |
+
}
|
1555 |
+
.wpallimport-plugin .filtering_rules .drag-element .rule_condition_value{
|
1556 |
+
display: inline-block;
|
1557 |
+
width: 20%;
|
1558 |
+
color:#000;
|
1559 |
+
font-size: 14px;
|
1560 |
+
}
|
1561 |
+
.wpallimport-plugin .filtering_rules .drag-element .condition{
|
1562 |
+
display: inline-block;
|
1563 |
+
width: 25%;
|
1564 |
+
color:#000;
|
1565 |
+
font-size: 14px;
|
1566 |
+
}
|
1567 |
+
.wpallimport-plugin .filtering_rules li{
|
1568 |
+
position: relative;
|
1569 |
+
padding: 10px 20px;
|
1570 |
+
margin: 0;
|
1571 |
+
border-bottom: 1px solid #ddd;
|
1572 |
+
height: 25px;
|
1573 |
+
}
|
1574 |
+
.wpallimport-plugin .filtering_rules li .remove-ico{
|
1575 |
+
right: 4%;
|
1576 |
+
top:10px;
|
1577 |
+
}
|
1578 |
+
.wpallimport-plugin .filtering_rules li .condition{
|
1579 |
+
padding: 2px;
|
1580 |
+
}
|
1581 |
+
.wpallimport-plugin .filtering_rules li .condition label{
|
1582 |
+
margin: 0px 3px;
|
1583 |
+
}
|
1584 |
+
.wpallimport-plugin .filtering_rules li strong{
|
1585 |
+
text-transform: uppercase;
|
1586 |
+
}
|
1587 |
+
.wpallimport-plugin .pmxi_group_rule{
|
1588 |
margin-left: -55px;
|
1589 |
}
|
1590 |
+
.wpallimport-plugin .rule_inputs{
|
1591 |
+
/*float: left;*/
|
1592 |
+
}
|
1593 |
+
.wpallimport-plugin .rule_inputs table tr th{
|
1594 |
+
color: #000;
|
1595 |
+
font-weight: 16px;
|
1596 |
+
text-align: left;
|
1597 |
+
}
|
1598 |
+
.wpallimport-plugin .ajax-console .founded_records{
|
1599 |
+
background: url('../img/ui_4.0/elements.png') no-repeat !important;
|
1600 |
+
padding-left: 80px;
|
1601 |
+
margin-bottom: 0;
|
1602 |
+
margin-left: 40px;
|
1603 |
+
margin-top: 35px;
|
1604 |
+
margin-bottom: 20px;
|
1605 |
+
position: relative;
|
1606 |
+
}
|
1607 |
+
.wpallimport-plugin .ajax-console .founded_records h3{
|
1608 |
+
color: #425f9a;
|
1609 |
+
margin-bottom: 0;
|
1610 |
+
margin-top: 3px;
|
1611 |
+
font-size: 22px;
|
1612 |
+
line-height: 28px;
|
1613 |
+
}
|
1614 |
+
.wpallimport-plugin .ajax-console .founded_records h4{
|
1615 |
+
color: #777;
|
1616 |
+
margin-top: 5px;
|
1617 |
+
font-size:20px;
|
1618 |
+
}
|
1619 |
+
.wpallimport-plugin .wpallimport-change-root-element{
|
1620 |
+
display: block;
|
1621 |
+
background: #f6f5f1;
|
1622 |
+
border: 1px solid #ecebe7;
|
1623 |
+
border-radius: 5px;
|
1624 |
+
-moz-border-radius: 5px;
|
1625 |
+
-khtml-border-radius: 5px;
|
1626 |
+
-webkit-border-radius: 5px;
|
1627 |
+
color: #777;
|
1628 |
+
font-size: 16px;
|
1629 |
+
text-decoration: none;
|
1630 |
+
margin: 5px 10px;
|
1631 |
+
padding: 10px;
|
1632 |
+
}
|
1633 |
+
.wpallimport-plugin .wpallimport-change-root-element:hover{
|
1634 |
+
color: #000;
|
1635 |
+
}
|
1636 |
+
.wpallimport-plugin .wpallimport-change-root-element.selected{
|
1637 |
+
background: #46ba69;
|
1638 |
+
border: 1px solid #3da55c;
|
1639 |
+
color: #fff;
|
1640 |
+
cursor: default;
|
1641 |
+
}
|
1642 |
+
.wpallimport-plugin .wpallimport-change-root-element .tag_name{
|
1643 |
+
display: inline-block;
|
1644 |
+
max-width: 87%;
|
1645 |
+
overflow: hidden;
|
1646 |
+
text-overflow: ellipsis;
|
1647 |
+
}
|
1648 |
+
.wpallimport-plugin .wpallimport-change-root-element .tag_count{
|
1649 |
+
float: right;
|
1650 |
+
background: url('../img/ui_4.0/element_arrow.png') no-repeat;
|
1651 |
+
display: inline-block;
|
1652 |
+
height: 15px;
|
1653 |
+
padding-left: 20px;
|
1654 |
+
position: relative;
|
1655 |
+
top: 2px;
|
1656 |
+
line-height: 15px;
|
1657 |
+
}
|
1658 |
+
.wpallimport-plugin .wpallimport-change-root-element.selected .tag_count{
|
1659 |
+
background: url('../img/ui_4.0/element_arrow.png') no-repeat 0px -15px;
|
1660 |
+
}
|
1661 |
+
.wpallimport-plugin .import_information{
|
1662 |
+
border-top: 1px solid #ddd;
|
1663 |
+
text-align: center;
|
1664 |
+
padding: 20px;
|
1665 |
+
}
|
1666 |
+
.wpallimport-plugin .import_information h3{
|
1667 |
+
text-align: center;
|
1668 |
+
color:#777;
|
1669 |
+
background: url('../img/ui_4.0/elements_notify.png') no-repeat;
|
1670 |
+
padding-left: 60px;
|
1671 |
+
height: 50px;
|
1672 |
+
display: inline-block;
|
1673 |
+
margin: 0 auto;
|
1674 |
+
line-height: 45px;
|
1675 |
+
}
|
1676 |
+
.wpallimport-plugin .import_information h3 span{
|
1677 |
+
color:#46ba69;
|
1678 |
+
}
|
1679 |
+
.wpallimport-plugin .wpallimport-set-csv-delimiter{
|
1680 |
+
padding-top: 5px;
|
1681 |
+
text-align: center;
|
1682 |
+
display: none;
|
1683 |
+
}
|
1684 |
+
.wpallimport-plugin #current_element{
|
1685 |
+
color:green;
|
1686 |
+
}
|
1687 |
+
.wpallimport-plugin #current_xml{ display: none;}
|
1688 |
+
.wpallimport-plugin #goto_element{
|
1689 |
+
font-size: 16px;
|
1690 |
+
height: 35px;
|
1691 |
+
margin-right: 10px;
|
1692 |
+
min-width: 50px;
|
1693 |
+
padding-top: 5px;
|
1694 |
+
text-align: center;
|
1695 |
+
width: 50px !important;
|
1696 |
+
}
|
1697 |
+
.wpallimport-plugin .wpallimport-choose-elements{
|
1698 |
+
/*width: 1200px;*/
|
1699 |
+
}
|
1700 |
+
.wpallimport-plugin .wpallimport-choose-elements table tbody tr td{
|
1701 |
+
overflow: hidden;
|
1702 |
+
}
|
1703 |
+
.wpallimport-plugin .wpallimport-elements-information{
|
1704 |
+
font-size: 20px;
|
1705 |
+
padding-top: 17px;
|
1706 |
+
margin-right: 10px;
|
1707 |
+
}
|
1708 |
+
/*--------------------------------------------------------------------------
|
1709 |
+
*
|
1710 |
+
* Step 3 - Template Builder
|
1711 |
+
*
|
1712 |
+
*-------------------------------------------------------------------------*/
|
1713 |
+
|
1714 |
+
/*@+ Template form */
|
1715 |
+
.wpallimport-plugin form.wpallimport-template.edit {
|
1716 |
+
/*width: 700px;*/
|
1717 |
+
}
|
1718 |
+
.wpallimport-plugin form.wpallimport-template .load-template {
|
1719 |
+
display: block;
|
1720 |
+
font-size: 12px;
|
1721 |
+
}
|
1722 |
+
|
1723 |
+
.wpallimport-plugin #poststuff{
|
1724 |
+
min-width: 200px;
|
1725 |
+
}
|
1726 |
+
.wpallimport-plugin #poststuff form.wpallimport-template h3 {
|
1727 |
+
margin: 1em 0 5px 2px;
|
1728 |
+
font-size: 1.17em;
|
1729 |
+
padding: 0px;
|
1730 |
+
}
|
1731 |
+
.wpallimport-plugin #post-preview {
|
1732 |
+
font-size: 12px;
|
1733 |
+
}
|
1734 |
+
.wpallimport-plugin #post-preview .error {
|
1735 |
+
margin: 5px 0;
|
1736 |
+
}
|
1737 |
+
.wpallimport-plugin h3 .header-option {
|
1738 |
+
display: block;
|
1739 |
float: right;
|
1740 |
+
font-size: 12px;
|
1741 |
+
font-weight: normal;
|
1742 |
}
|
1743 |
+
.wpallimport-plugin .builder_header{
|
1744 |
+
padding: 0 10px;
|
1745 |
+
width: 1200px;
|
1746 |
+
overflow: hidden;
|
1747 |
}
|
1748 |
+
.wpallimport-plugin .builder_header .left{
|
1749 |
+
float: left;
|
1750 |
+
}
|
1751 |
+
.wpallimport-plugin .builder_header .right{
|
1752 |
+
float:right;
|
1753 |
+
}
|
1754 |
+
.wpallimport-plugin .builder_header h3{
|
1755 |
+
color: #425F9A;
|
1756 |
+
margin-top: 0;
|
1757 |
+
font-size: 22px;
|
1758 |
+
margin-bottom: 0;
|
1759 |
+
}
|
1760 |
+
.wpallimport-plugin .builder_header h4{
|
1761 |
+
color: #777;
|
1762 |
+
margin-top: 10px;
|
1763 |
+
margin-bottom: 0;
|
1764 |
+
font-size: 18px;
|
1765 |
+
}
|
1766 |
+
.wpallimport-plugin .pmxi_option{
|
1767 |
+
padding: 3px 0;
|
1768 |
}
|
1769 |
+
.wpallimport-plugin .pmxi_option a.wpallimport-help{
|
1770 |
+
/*float: right;*/
|
1771 |
+
}
|
1772 |
+
.wpallimport-plugin .parse{
|
1773 |
+
text-decoration: none !important;
|
1774 |
}
|
1775 |
+
.wpallimport-plugin .nested_xml{
|
1776 |
+
display: none;
|
1777 |
}
|
1778 |
+
.wpallimport-plugin .nested_xml_tree{
|
1779 |
+
width: 70%;
|
1780 |
float: left;
|
1781 |
+
padding: 5px 15px;
|
|
|
1782 |
}
|
1783 |
+
.wpallimport-plugin .nested_actions{
|
1784 |
+
width:25%;
|
1785 |
+
float: right;
|
1786 |
+
}
|
1787 |
+
.wpallimport-plugin .nested_actions input[type="text"]{
|
1788 |
+
width:100%;
|
1789 |
+
padding: 7px;
|
1790 |
+
}
|
1791 |
+
.wpallimport-plugin .nested_xml_tree .green{
|
1792 |
+
color: green;
|
1793 |
+
padding-bottom: 10px;
|
1794 |
+
}
|
1795 |
+
.wpallimport-plugin .nested_xml_tree .red,
|
1796 |
+
.wpallimport-plugin .nested_msgs{
|
1797 |
+
color: red;
|
1798 |
+
padding-bottom: 10px;
|
1799 |
+
}
|
1800 |
+
.wpallimport-plugin .nested_files ul{
|
1801 |
+
list-style: decimal outside none;
|
1802 |
+
padding-left: 15px;
|
1803 |
+
}
|
1804 |
+
.wpallimport-plugin .template_input{
|
1805 |
+
margin-top: 20px;
|
1806 |
+
}
|
1807 |
+
.wpallimport-plugin .img_preloader{
|
1808 |
+
background: url("../img/preloader.gif") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
|
1809 |
+
height: 16px;
|
1810 |
+
line-height: 16px;
|
1811 |
+
padding-left: 20px;
|
1812 |
+
display: none;
|
1813 |
+
position: relative;
|
1814 |
+
}
|
1815 |
+
.wpallimport-plugin .img_success{
|
1816 |
+
background: url("../img/success.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
|
1817 |
+
height: 16px;
|
1818 |
+
line-height: 16px;
|
1819 |
+
padding-left: 20px;
|
1820 |
+
display: none;
|
1821 |
+
font-size: 10px;
|
1822 |
+
margin-bottom: 1px;
|
1823 |
+
}
|
1824 |
+
.wpallimport-plugin .img_failed{
|
1825 |
+
background: url("../img/ico-remove.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);
|
1826 |
+
line-height: 16px;
|
1827 |
+
padding-left: 20px;
|
1828 |
+
display: none;
|
1829 |
+
margin: 5px 0;
|
1830 |
+
padding-top: 1px;
|
1831 |
+
font-size: 10px;
|
1832 |
+
}
|
1833 |
+
.wpallimport-plugin .img_failed p{
|
1834 |
+
font-size: 10px !important;
|
1835 |
+
}
|
1836 |
+
.wpallimport-plugin .private_ctx{
|
1837 |
+
display: none;
|
1838 |
+
}
|
1839 |
+
.wpallimport-plugin .sub_input{
|
1840 |
+
padding-left:17px;
|
1841 |
+
margin: 5px;
|
1842 |
+
}
|
1843 |
+
.wpallimport-plugin .main_choise{
|
1844 |
+
float: left;
|
1845 |
+
margin-right: 5px;
|
1846 |
+
}
|
1847 |
+
.wpallimport-plugin .specify_cf{
|
1848 |
+
left: 25%;
|
1849 |
+
top: 8px;
|
1850 |
+
background: #40acad;
|
1851 |
+
padding: 10px;
|
1852 |
+
position: relative;
|
1853 |
+
border-radius: 4px;
|
1854 |
+
-moz-border-radius: 4px;
|
1855 |
+
-khtml-border-radius: 4px;
|
1856 |
+
-webkit-border-radius: 4px;
|
1857 |
+
color: #fff !important;
|
1858 |
+
}
|
1859 |
+
.wpallimport-plugin .set_serialize.active,
|
1860 |
+
.wpallimport-plugin .set_mapping.active{
|
1861 |
+
font-weight: bold;
|
1862 |
+
}
|
1863 |
+
.wpallimport-plugin .custom_type{
|
1864 |
+
/*margin: 0 auto; */
|
1865 |
+
}
|
1866 |
+
.wpallimport-plugin .wpallimport-custom-fields textarea{
|
1867 |
+
border: 1px solid #ddd;
|
1868 |
+
border-radius: 4px;
|
1869 |
+
-moz-border-radius: 4px;
|
1870 |
+
-khtml-border-radius: 4px;
|
1871 |
+
-webkit-border-radius: 4px;
|
1872 |
+
padding: 6px 5px;
|
1873 |
+
font-size: 15px !important;
|
1874 |
+
height: 40px;
|
1875 |
+
float: left;
|
1876 |
+
margin-right: 5px;
|
1877 |
+
line-height: 25px;
|
1878 |
+
width: 68% !important;
|
1879 |
}
|
1880 |
+
.wpallimport-plugin .wpallimport-custom-fields .wpallimport-custom-fields-actions{
|
1881 |
+
float: right;
|
1882 |
+
right: 30px;
|
1883 |
+
position: relative;
|
1884 |
+
/*padding: 0 10px;*/
|
1885 |
+
border: 1px solid #ddd;
|
1886 |
+
margin-bottom: 10px;
|
1887 |
}
|
1888 |
+
.wpallimport-plugin .wpallimport-step-3 div.custom_type{
|
1889 |
+
/*width: 80%;
|
1890 |
+
min-height: 65px;*/
|
1891 |
}
|
1892 |
+
.wpallimport-plugin span.remove{
|
1893 |
position: static !important;
|
1894 |
}
|
1895 |
|
1896 |
+
.wpallimport-plugin input[type="text"][name="tagno"]{
|
1897 |
+
margin-left: 5px;
|
1898 |
+
padding: 3px;
|
1899 |
+
width: 40px;
|
1900 |
+
border: 1px solid #BBBBBB;
|
1901 |
+
-moz-border-radius: 3px;
|
1902 |
+
-khtml-border-radius: 3px;
|
1903 |
+
-webkit-border-radius: 3px;
|
1904 |
+
border-radius: 3px;
|
1905 |
+
text-align: center;
|
1906 |
+
}
|
1907 |
+
.wpallimport-pointer-content {
|
1908 |
+
padding: 0 0 10px;
|
1909 |
+
position: relative;
|
1910 |
+
font-size: 13px;
|
1911 |
+
background: #fff;
|
1912 |
+
border: 1px solid #dfdfdf;
|
1913 |
+
-webkit-box-shadow: 0 3px 6px rgba(0,0,0,0.075);
|
1914 |
+
box-shadow: 0 3px 6px rgba(0,0,0,0.075);
|
1915 |
+
}
|
1916 |
+
#post-preview div.title{
|
1917 |
+
text-align:right;
|
1918 |
+
border-bottom: 1px solid #ccc;
|
1919 |
+
padding: 10px;
|
1920 |
+
/*font-style:italic;*/
|
1921 |
+
}
|
1922 |
+
#post-preview .wpallimport-preview-content{
|
1923 |
+
padding: 15px;
|
1924 |
+
overflow: auto;
|
1925 |
+
max-height: 350px;
|
1926 |
+
}
|
1927 |
+
#post-preview .wpallimport-preview-content .test_progress{
|
1928 |
+
clear: both;
|
1929 |
+
}
|
1930 |
+
.wpallimport-plugin .preview,
|
1931 |
+
.wpallimport-plugin .preview_images,
|
1932 |
+
.wpallimport-plugin .preview_prices,
|
1933 |
+
.wpallimport-plugin .preview_taxonomies,
|
1934 |
+
.wpallimport-plugin .parse,
|
1935 |
+
.wpallimport-plugin .test_images{
|
1936 |
+
background: #40acad;
|
1937 |
+
-moz-border-radius: 4px;
|
1938 |
+
-khtml-border-radius: 4px;
|
1939 |
+
-webkit-border-radius: 4px;
|
1940 |
+
border-radius: 4px;
|
1941 |
+
clear: both;
|
1942 |
+
color: #fff !important;
|
1943 |
+
float: right;
|
1944 |
+
font-size: 14px;
|
1945 |
+
margin: 10px 0;
|
1946 |
+
padding: 10px 20px 10px 20px;
|
1947 |
+
}
|
1948 |
+
.wpallimport-plugin .test_images{
|
1949 |
+
display: block;
|
1950 |
+
float: left;
|
1951 |
+
margin-bottom: 15px;
|
1952 |
+
margin-left: 0;
|
1953 |
+
margin-top: 0;
|
1954 |
+
}
|
1955 |
+
.wpallimport-plugin .save_popup{
|
1956 |
+
-moz-border-radius: 4px;
|
1957 |
+
-khtml-border-radius: 4px;
|
1958 |
+
-webkit-border-radius: 4px;
|
1959 |
+
border-radius: 4px;
|
1960 |
+
position: absolute;
|
1961 |
+
top: 41px;
|
1962 |
+
right: 60px;
|
1963 |
+
background: #40acad;
|
1964 |
+
padding: 10px 15px 10px 15px;
|
1965 |
+
color:#fff !important;
|
1966 |
+
}
|
1967 |
+
.wpallimport-plugin .autodetect_cf,
|
1968 |
+
.wpallimport-plugin .wpallimport-auto-detect-unique-key,
|
1969 |
+
.wpallimport-plugin .wpallimport-change-unique-key{
|
1970 |
+
-moz-border-radius: 4px;
|
1971 |
+
-khtml-border-radius: 4px;
|
1972 |
+
-webkit-border-radius: 4px;
|
1973 |
+
border-radius: 4px;
|
1974 |
+
background: #40acad;
|
1975 |
+
padding: 10px 15px 10px 15px;
|
1976 |
+
color:#fff !important;
|
1977 |
+
font-size: 14px;
|
1978 |
+
position: relative;
|
1979 |
+
top:-1px;
|
1980 |
+
}
|
1981 |
+
.wpallimport-plugin .wpallimport-change-unique-key{
|
1982 |
+
background-position: 10px 12px;
|
1983 |
+
padding: 10px 15px 10px 15px;
|
1984 |
+
}
|
1985 |
+
.wpallimport-plugin .autodetect_cf{
|
1986 |
display: inline-block;
|
1987 |
+
margin-bottom: 5px;
|
1988 |
+
}
|
1989 |
+
.wpallimport-plugin .preview_taxonomies{
|
1990 |
+
float: none;
|
1991 |
+
/*padding: 5px 20px 5px 45px;*/
|
1992 |
+
margin-left: 10px;
|
1993 |
+
}
|
1994 |
+
.wpallimport-plugin .set_xpath{
|
1995 |
+
left: 0;
|
1996 |
+
padding-left: 15px;
|
1997 |
+
position: absolute;
|
1998 |
+
top: 0;
|
1999 |
+
}
|
2000 |
+
.wpallimport-plugin #woocommerce-product-data{
|
2001 |
+
margin-bottom: 20px;
|
2002 |
+
}
|
2003 |
+
.wpallimport-plugin input[name^="attribute_name"],
|
2004 |
+
.wpallimport-plugin input[name^="variable_attribute_name"]{
|
2005 |
+
width: 95% !important;
|
2006 |
+
}
|
2007 |
+
.wpallimport-plugin .fix_checkbox{
|
2008 |
position: relative;
|
2009 |
+
/*margin: 0px !important;*/
|
2010 |
}
|
2011 |
+
.wpallimport-plugin .newline{
|
2012 |
+
line-height: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013 |
}
|
2014 |
+
.wpallimport-plugin #add_encoding{
|
2015 |
+
display: none;
|
2016 |
+
}
|
2017 |
+
.wpallimport-plugin #new_encoding{
|
2018 |
+
border: 1px solid #BBBBBB;
|
2019 |
+
-moz-border-radius: 3px;
|
2020 |
+
-khtml-border-radius: 3px;
|
2021 |
+
-webkit-border-radius: 3px;
|
2022 |
+
border-radius: 3px;
|
2023 |
+
}
|
2024 |
+
.wpallimport-plugin .load_options{
|
2025 |
+
height: 0;
|
2026 |
+
line-height: 0;
|
2027 |
+
margin: 0;
|
2028 |
+
padding: 0;
|
2029 |
+
position: relative;
|
2030 |
+
right: 10px;
|
2031 |
+
text-align: right;
|
2032 |
+
top: -35px;
|
2033 |
+
width: 100%;
|
2034 |
+
}
|
2035 |
+
.wpallimport-plugin .custom-params tr td{
|
2036 |
+
/*width: 50%;*/
|
2037 |
+
}
|
2038 |
+
.wpallimport-plugin .custom-params tr td.action{
|
2039 |
+
width: 100% !important;
|
2040 |
+
position: relative;
|
2041 |
+
display: block;
|
2042 |
+
}
|
2043 |
+
.wpallimport-plugin .form-field textarea{
|
2044 |
+
width:80%;
|
2045 |
+
}
|
2046 |
+
.wpallimport-plugin .drag-element .assign_post{
|
2047 |
+
float: left;
|
2048 |
+
margin-top: 2px;
|
2049 |
+
}
|
2050 |
+
.wpallimport-plugin .post_taxonomy{
|
2051 |
+
/*margin-bottom: 15px;*/
|
2052 |
+
overflow: hidden;
|
2053 |
+
/*padding-bottom: 15px;*/
|
2054 |
+
}
|
2055 |
+
.wpallimport-plugin .post_taxonomy .delim{
|
2056 |
+
padding-left: 25px;
|
2057 |
+
}
|
2058 |
+
.wpallimport-plugin .post_taxonomy .delim .add-new-ico{
|
2059 |
+
float: left;
|
2060 |
+
margin-right: 10%;
|
2061 |
+
margin-top: 5px;
|
2062 |
+
}
|
2063 |
+
.wpallimport-plugin .post_taxonomy ol.ui-sortable{
|
2064 |
+
padding-right: 0px;
|
2065 |
+
}
|
2066 |
+
.wpallimport-plugin .post_taxonomy ol.ui-sortable .drag-element{
|
2067 |
+
background-position: 0 10px;
|
2068 |
+
}
|
2069 |
+
.wpallimport-plugin .post_taxonomy ol.ui-sortable .remove-ico{
|
2070 |
+
top: 8px;
|
2071 |
+
}
|
2072 |
+
|
2073 |
+
.wpallimport-plugin .separated_by{
|
2074 |
+
float: right;
|
2075 |
+
font-size: 12px;
|
2076 |
+
color: #999999;
|
2077 |
+
margin-right: 20px;
|
2078 |
+
}
|
2079 |
+
.wpallimport-plugin .delim > label{
|
2080 |
+
color: #999999;
|
2081 |
+
font-size: 11px;
|
2082 |
+
}
|
2083 |
+
.wpallimport-plugin .template-sidebar .tag{
|
2084 |
+
/*max-height: 550px;*/
|
2085 |
+
}
|
2086 |
+
.wpallimport-plugin .wp-pointer-content .action.remove a{
|
2087 |
+
top: 8px;
|
2088 |
+
}
|
2089 |
+
.wpallimport-plugin .wpallimport-drag-icon{
|
2090 |
+
position: relative;
|
2091 |
+
top: 5px;
|
2092 |
+
}
|
2093 |
+
.wpallimport-plugin .wpallimport-featured-images textarea{
|
2094 |
+
width: 70%;
|
2095 |
+
height: 70px;
|
2096 |
+
margin: 5px 0;
|
2097 |
+
padding-top: 5px;
|
2098 |
+
}
|
2099 |
+
.wpallimport-plugin .wpallimport-placeholder{
|
2100 |
+
color: #888 !important;
|
2101 |
+
}
|
2102 |
+
.wpallimport-plugin .ui-widget-overlay{
|
2103 |
+
background: #777 !important;
|
2104 |
+
z-index: 99999;
|
2105 |
+
}
|
2106 |
+
.wpallimport-plugin .auto_detect_sf{
|
2107 |
+
width: 80px;
|
2108 |
+
left: 0;
|
2109 |
+
}
|
2110 |
+
.wpallimport-plugin .ui-menu-item a{
|
2111 |
+
text-decoration: none;
|
2112 |
+
color: #777;
|
2113 |
+
}
|
2114 |
+
.wpallimport-plugin .ui-menu-item a.ui-state-focus,
|
2115 |
+
.wpallimport-plugin .ui-menu-item a.ui-state-active{
|
2116 |
+
margin: 0;
|
2117 |
+
}
|
2118 |
+
.wpallimport-plugin .ui-menu-item{
|
2119 |
+
border-bottom: 1px solid #777;
|
2120 |
+
}
|
2121 |
+
.wpallimport-plugin .ui-menu-item:last-child{
|
2122 |
+
border-bottom: none;
|
2123 |
+
}
|
2124 |
+
.wpallimport-plugin .cf_welcome,
|
2125 |
+
.wpallimport-plugin .cf_detect_result{
|
2126 |
+
position: relative;
|
2127 |
+
text-align: center;
|
2128 |
+
padding-bottom: 15px;
|
2129 |
+
padding-top: 10px;
|
2130 |
+
border-bottom: 1px solid #ddd;
|
2131 |
+
border-top: 1px solid #ddd;
|
2132 |
+
}
|
2133 |
+
.wpallimport-plugin .wpallimport-dismiss-cf-welcome{
|
2134 |
+
display: block;
|
2135 |
+
width: 100px;
|
2136 |
+
/*height: 16px;
|
2137 |
+
position: absolute;
|
2138 |
+
right: 10px;
|
2139 |
+
top: 30%;*/
|
2140 |
+
/*background: url('../img/ico-remove.png') no-repeat;*/
|
2141 |
+
margin: 0 auto;
|
2142 |
+
}
|
2143 |
+
.wpallimport-plugin .wpallimport-cf-options{
|
2144 |
+
display: block;
|
2145 |
+
padding: 10px 12px;
|
2146 |
+
}
|
2147 |
+
.wpallimport-plugin .wpallimport-cf-menu{
|
2148 |
+
display: none;
|
2149 |
+
border: none;
|
2150 |
+
-webkit-border-radius: 0px;
|
2151 |
+
-moz-border-radius: 0px;
|
2152 |
+
-o-border-radius: 0px;
|
2153 |
+
border-radius: 0px;
|
2154 |
+
border: 0px;
|
2155 |
+
padding: 0;
|
2156 |
+
/*padding-left: 12px;*/
|
2157 |
+
margin-bottom: 0;
|
2158 |
+
margin-top: 0;
|
2159 |
+
}
|
2160 |
+
.wpallimport-plugin .wpallimport-cf-menu li{
|
2161 |
+
border-bottom: none;
|
2162 |
+
padding: 5px 0;
|
2163 |
+
padding-left: 16px;
|
2164 |
+
margin-bottom: 0;
|
2165 |
+
cursor: pointer;
|
2166 |
+
width: auto;
|
2167 |
+
}
|
2168 |
+
.wpallimport-plugin .wpallimport-cf-menu li:hover{
|
2169 |
+
background: #fafafa;
|
2170 |
+
}
|
2171 |
+
.wpallimport-plugin .wpallimport-cf-menu li.active{
|
2172 |
+
list-style: disc inside none;
|
2173 |
+
padding-left: 5px;
|
2174 |
+
}
|
2175 |
+
.wpallimport-plugin .wpallimport-cf-menu li a{
|
2176 |
+
padding: 0;
|
2177 |
+
font-family: "Open Sans",sans-serif;
|
2178 |
+
font-size: 12px;
|
2179 |
+
display: inline;
|
2180 |
+
color: #777;
|
2181 |
+
}
|
2182 |
+
.wpallimport-plugin .ui-autocomplete li a:hover{
|
2183 |
+
border: none;
|
2184 |
+
-webkit-border-radius: 0px;
|
2185 |
+
-moz-border-radius: 0px;
|
2186 |
+
-o-border-radius: 0px;
|
2187 |
+
border-radius: 0px;
|
2188 |
+
border: 0px;
|
2189 |
+
}
|
2190 |
+
.wpallimport-plugin .wpallimport-not-empty{
|
2191 |
+
display: block;
|
2192 |
+
padding: 5px;
|
2193 |
+
}
|
2194 |
+
/*--------------------------------------------------------------------------
|
2195 |
+
*
|
2196 |
+
* Step 4 - Import Options
|
2197 |
+
*
|
2198 |
+
*-------------------------------------------------------------------------*/
|
2199 |
+
|
2200 |
+
.wpallimport-plugin .options .tag{
|
2201 |
+
margin-top: 0px;
|
2202 |
+
}
|
2203 |
+
.wpallimport-plugin .show_hints{
|
2204 |
+
color: #fff;
|
2205 |
+
padding: 10px;
|
2206 |
+
-moz-border-radius-topleft: 5px;
|
2207 |
+
-webkit-border-top-left-radius: 5px;
|
2208 |
+
border-top-left-radius: 5px;
|
2209 |
+
-moz-border-radius-bottomleft: 5px;
|
2210 |
+
-webkit-border-bottom-left-radius: 5px;
|
2211 |
+
border-bottom-left-radius: 5px;
|
2212 |
+
position: absolute;
|
2213 |
+
top: 18px;
|
2214 |
+
right: -1px;
|
2215 |
+
background: url('../img/ui_4.0/right_btn.png') no-repeat 95% 8px #40acad;
|
2216 |
+
padding-right: 30px;
|
2217 |
+
cursor: pointer;
|
2218 |
+
border: none;
|
2219 |
+
}
|
2220 |
+
.wpallimport-plugin .show_hints:hover{
|
2221 |
+
color: #dfdfdf;
|
2222 |
+
}
|
2223 |
+
|
2224 |
+
.wpallimport-plugin .wp-pointer-arrow{
|
2225 |
+
display: none;
|
2226 |
+
}
|
2227 |
+
.wpallimport-plugin .wp-pointer-content,
|
2228 |
+
.wpallimport-plugin .wpallimport-pointer-content{
|
2229 |
+
border: 1px solid #ecebe7;
|
2230 |
+
border-radius: 4px;
|
2231 |
+
-moz-border-radius: 4px;
|
2232 |
+
-khtml-border-radius: 4px;
|
2233 |
+
-webkit-border-radius: 4px;
|
2234 |
+
margin: 20px 10px 20px 20px;
|
2235 |
+
padding: 0;
|
2236 |
+
}
|
2237 |
+
.wpallimport-plugin .wp-pointer-content fieldset{
|
2238 |
+
margin-top: 15px;
|
2239 |
+
}
|
2240 |
+
.wpallimport-plugin .wp-pointer-content .wp-pointer-buttons,
|
2241 |
+
.wpallimport-plugin .wpallimport-pointer-content .wp-pointer-buttons{
|
2242 |
+
padding: 15px;
|
2243 |
+
background: #f7f8f8;
|
2244 |
+
border-top: 1px solid #ebebeb;
|
2245 |
+
}
|
2246 |
+
.wpallimport-plugin .wp-pointer-content .wp-pointer-buttons a.close:before,
|
2247 |
+
.wpallimport-plugin .wpallimport-pointer-content .wp-pointer-buttons a.close:before{
|
2248 |
+
content:none;
|
2249 |
+
}
|
2250 |
+
.wpallimport-plugin .wp-pointer-content .wp-pointer-buttons a.close,
|
2251 |
+
.wpallimport-plugin .wpallimport-pointer-content .wp-pointer-buttons a.close{
|
2252 |
+
background: url('../img/ui_4.0/remove.png') no-repeat 10px 10px #e4e6e6;
|
2253 |
+
padding: 10px 15px 10px 30px;
|
2254 |
+
color: #777;
|
2255 |
+
border-radius: 4px;
|
2256 |
+
-moz-border-radius: 4px;
|
2257 |
+
-khtml-border-radius: 4px;
|
2258 |
+
-webkit-border-radius: 4px;
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
.wpallimport-plugin .options .wpallimport-submit-buttons{
|
2262 |
+
position: relative;
|
2263 |
+
text-align: center;
|
2264 |
+
top: 10px;
|
2265 |
+
}
|
2266 |
+
.wpallimport-plugin form.options{
|
2267 |
+
position: relative;
|
2268 |
+
margin-top: 10px !important;
|
2269 |
+
overflow: hidden;
|
2270 |
+
}
|
2271 |
+
.wpallimport-plugin form.edit{
|
2272 |
+
overflow: hidden;
|
2273 |
+
}
|
2274 |
+
.wpallimport-plugin .switcher-target-is_keep_former_posts{
|
2275 |
+
padding-left: 25px;
|
2276 |
+
}
|
2277 |
+
.wpallimport-plugin .wpallimport-change-custom-type{
|
2278 |
+
margin-left: 6px;
|
2279 |
+
}
|
2280 |
+
|
2281 |
+
/*--------------------------------------------------------------------------
|
2282 |
+
*
|
2283 |
+
* Step 5 - Confirm Import Settings
|
2284 |
+
*
|
2285 |
+
*-------------------------------------------------------------------------*/
|
2286 |
+
|
2287 |
+
/*.wpallimport-plugin .wpallimport-step-5 .wpallimport-section .wpallimport-content-section{
|
2288 |
+
border: none;
|
2289 |
+
-webkit-border-radius: 0px;
|
2290 |
+
-moz-border-radius: 0px;
|
2291 |
+
-o-border-radius: 0px;
|
2292 |
+
border-radius: 0px;
|
2293 |
+
border: 0px;
|
2294 |
+
background: none;
|
2295 |
+
margin: 0;
|
2296 |
+
padding: 0 10%;
|
2297 |
+
}*/
|
2298 |
+
.wpallimport-plugin .wpallimport-step-5 .wpallimport-section .wpallimport-collapsed-content{
|
2299 |
+
border-top: 1px solid #ebebeb;
|
2300 |
+
margin-top: 10px;
|
2301 |
+
padding-top: 10px;
|
2302 |
+
}
|
2303 |
+
.wpallimport-plugin .wpallimport-step-5 .wpallimport-section .wpallimport-collapsed-content p{
|
2304 |
+
color: #777;
|
2305 |
+
background: url('../img/ui_4.0/logo_small.png') no-repeat;
|
2306 |
+
padding-left: 35px;
|
2307 |
+
min-height: 26px;
|
2308 |
+
line-height: 28px;
|
2309 |
+
}
|
2310 |
+
|
2311 |
+
.wpallimport-plugin form.confirm{
|
2312 |
+
margin-bottom: 20px;
|
2313 |
+
margin-top: 20px;
|
2314 |
+
text-align: center;
|
2315 |
+
}
|
2316 |
+
.wpallimport-plugin form.confirm input[type="submit"]{
|
2317 |
+
background: #46ba69;
|
2318 |
+
padding: 20px 30px 20px 30px;
|
2319 |
+
color: #fff;
|
2320 |
+
border: none;
|
2321 |
+
font-weight: bold;
|
2322 |
+
cursor: pointer;
|
2323 |
+
}
|
2324 |
+
.wpallimport-plugin form.confirm a{
|
2325 |
+
text-decoration: none;
|
2326 |
+
color: #777;
|
2327 |
+
}
|
2328 |
+
.wpallimport-plugin table.confirm ul {
|
2329 |
+
list-style: disc inside none;
|
2330 |
+
}
|
2331 |
+
.wpallimport-plugin table.confirm ul li ul{
|
2332 |
+
margin-left: 20px;
|
2333 |
+
margin-top: 5px;
|
2334 |
+
list-style: circle inside none;
|
2335 |
+
}
|
2336 |
+
/*.wpallimport-plugin #download_log_separator,
|
2337 |
+
.wpallimport-plugin #download_log{
|
2338 |
+
display: none;
|
2339 |
+
}*/
|
2340 |
+
|
2341 |
+
.wpallimport-plugin .wpallimport-ready-to-go{
|
2342 |
+
text-align: left;
|
2343 |
+
float: left;
|
2344 |
+
background: url('../img/ui_4.0/elements.png') no-repeat !important;
|
2345 |
+
padding-left: 80px;
|
2346 |
+
margin-top: 15px;
|
2347 |
+
/*margin-bottom: 0;
|
2348 |
+
margin-left: 40px;
|
2349 |
+
margin-top: 35px;
|
2350 |
+
margin-bottom: 20px;*/
|
2351 |
+
}
|
2352 |
+
.wpallimport-plugin .wpallimport-ready-to-go h3{
|
2353 |
+
color: #425f9a;
|
2354 |
+
margin-bottom: 0;
|
2355 |
+
margin-top: 3px;
|
2356 |
+
font-size: 22px;
|
2357 |
+
line-height: 28px;
|
2358 |
+
}
|
2359 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
2360 |
+
color: #777;
|
2361 |
+
margin-top: 5px;
|
2362 |
+
font-size:20px;
|
2363 |
+
}
|
2364 |
+
.wpallimport-plugin .wpallimport-is-continue{
|
2365 |
+
text-align: left;
|
2366 |
+
float: left;
|
2367 |
+
margin: 12px 40px 12px 0px;
|
2368 |
+
}
|
2369 |
+
/*--------------------------------------------------------------------------
|
2370 |
+
*
|
2371 |
+
* Step 6 - Processing
|
2372 |
+
*
|
2373 |
+
*-------------------------------------------------------------------------*/
|
2374 |
+
|
2375 |
+
.wpallimport-plugin .pmxi_error_msg{
|
2376 |
+
color: #FF0000;
|
2377 |
+
display: block;
|
2378 |
+
font-size: 12px;
|
2379 |
+
line-height: 18px;
|
2380 |
+
padding: 2px;
|
2381 |
+
}
|
2382 |
+
.wpallimport-plugin .wpallimport-upload-process{
|
2383 |
+
border: none;
|
2384 |
+
padding: 1px;
|
2385 |
+
}
|
2386 |
+
.wpallimport-plugin #processbar{
|
2387 |
+
text-align: center;
|
2388 |
+
visibility: hidden;
|
2389 |
+
height: 30px;
|
2390 |
+
margin-top: 18px;
|
2391 |
+
margin-bottom: 20px;
|
2392 |
+
background: #fff;
|
2393 |
+
color: #222222;
|
2394 |
+
position: relative;
|
2395 |
+
}
|
2396 |
+
.wpallimport-plugin #processbar div{
|
2397 |
+
background: #76d771;
|
2398 |
+
height: 30px;
|
2399 |
+
width: 0%;
|
2400 |
+
position: absolute;
|
2401 |
+
top:0;
|
2402 |
+
}
|
2403 |
+
.wpallimport-plugin #import_progress{
|
2404 |
+
color: #000000;
|
2405 |
+
font-size: 21px;
|
2406 |
+
/*font-weight: bold;*/
|
2407 |
+
display: block;
|
2408 |
+
width: 100%;
|
2409 |
+
text-align: center;
|
2410 |
+
opacity: 1;
|
2411 |
+
position: relative;
|
2412 |
+
padding-top: 10px;
|
2413 |
+
}
|
2414 |
+
.wpallimport-plugin #import_progress #center_progress{
|
2415 |
+
color:#46ba69;
|
2416 |
+
font-size: 60px;
|
2417 |
+
}
|
2418 |
+
.wpallimport-plugin #right_progress{
|
2419 |
+
position: absolute;
|
2420 |
+
right: 0;
|
2421 |
+
color:#777;
|
2422 |
+
}
|
2423 |
+
.wpallimport-plugin #right_progress span{
|
2424 |
+
color:#000;
|
2425 |
+
}
|
2426 |
+
.wpallimport-plugin #left_progress{
|
2427 |
+
position: absolute;
|
2428 |
+
left: 0;
|
2429 |
+
color: #777;
|
2430 |
+
}
|
2431 |
+
.wpallimport-plugin #left_progress #then{
|
2432 |
+
color:#000;
|
2433 |
+
}
|
2434 |
+
.wpallimport-plugin #existing_meta_keys{
|
2435 |
+
margin-bottom: 10px;
|
2436 |
+
padding: 2px;
|
2437 |
+
width: 580px;
|
2438 |
+
}
|
2439 |
+
.wpallimport-plugin #import_finished{
|
2440 |
+
display: none;
|
2441 |
+
text-align: center;
|
2442 |
+
padding-top: 30px;
|
2443 |
+
}
|
2444 |
+
.wpallimport-plugin #import_finished .wpallimport-log-details{
|
2445 |
+
display: none;
|
2446 |
+
}
|
2447 |
+
.wpallimport-plugin #import_finished #download_log{
|
2448 |
+
background: url('../img/ui_4.0/view_log.png') no-repeat 2px 0px;
|
2449 |
+
padding-left: 25px;
|
2450 |
+
}
|
2451 |
+
.wpallimport-plugin #import_finished #import_history{
|
2452 |
+
background: url('../img/ui_4.0/import_history.png') no-repeat 2px 0px;
|
2453 |
+
padding-left: 25px;
|
2454 |
+
}
|
2455 |
+
.wpallimport-plugin #import_finished #manage_imports{
|
2456 |
+
background: url('../img/ui_4.0/manage_imports.png') no-repeat 2px 0px;
|
2457 |
+
padding-left: 25px;
|
2458 |
+
}
|
2459 |
+
.wpallimport-plugin #import_finished .import_finished_icon{
|
2460 |
+
/*background: url('../img/ui_4.0/import_finished.png') no-repeat center center;*/
|
2461 |
+
width: 100%;
|
2462 |
+
height: 255px;
|
2463 |
+
margin: 40px 0;
|
2464 |
+
}
|
2465 |
+
.wpallimport-plugin #import_finished h1{
|
2466 |
+
font-size: 48px;
|
2467 |
+
color: #46ba69;
|
2468 |
+
font-weight: normal;
|
2469 |
+
}
|
2470 |
+
.wpallimport-plugin #import_finished h3{
|
2471 |
+
font-size: 21px;
|
2472 |
+
color: #777;
|
2473 |
+
font-weight: normal;
|
2474 |
+
line-height: 30px;
|
2475 |
+
}
|
2476 |
+
.wpallimport-plugin #import_finished h3 span{
|
2477 |
+
color: #000;
|
2478 |
+
}
|
2479 |
+
.wpallimport-plugin #import_finished hr{
|
2480 |
+
margin: 20px 15%;
|
2481 |
+
}
|
2482 |
+
.wpallimport-plugin #import_finished a{
|
2483 |
+
color: #40acad;
|
2484 |
+
text-decoration: none;
|
2485 |
+
margin: 5px 10px;
|
2486 |
+
display: inline-block;
|
2487 |
+
height: 25px;
|
2488 |
+
}
|
2489 |
+
.wpallimport-plugin #process{ display:none; }
|
2490 |
+
.wpallimport-plugin .ui-widget-header{
|
2491 |
+
-moz-border-radius: 4px;
|
2492 |
+
-khtml-border-radius: 4px;
|
2493 |
+
-webkit-border-radius: 4px;
|
2494 |
+
border-radius: 4px;
|
2495 |
+
}
|
2496 |
+
.wpallimport-plugin .ui-progressbar-value {
|
2497 |
+
background: #76d771 !important;
|
2498 |
+
border: none !important;
|
2499 |
+
-moz-border-radius: 8px;
|
2500 |
+
-khtml-border-radius: 8px;
|
2501 |
+
-webkit-border-radius: 8px;
|
2502 |
+
border-radius: 8px;
|
2503 |
+
}
|
2504 |
+
.wpallimport-plugin .wpallimport-modal-message{
|
2505 |
+
background: none repeat scroll 0 0 yellow;
|
2506 |
+
color: red;
|
2507 |
+
padding: 4px;
|
2508 |
+
margin-top: 10px;
|
2509 |
+
display: none;
|
2510 |
+
}
|
2511 |
+
.wpallimport-plugin #logwrapper{
|
2512 |
+
border: 1px solid #aaa;
|
2513 |
+
margin: 10px auto;
|
2514 |
+
}
|
2515 |
+
.wpallimport-plugin #loglist{
|
2516 |
+
border: 1px solid #AAAAAA;
|
2517 |
+
height: 380px;
|
2518 |
+
overflow: auto;
|
2519 |
+
}
|
2520 |
+
.wpallimport-plugin #loglist > p{
|
2521 |
+
margin: 0;
|
2522 |
+
padding: 3px 5px;
|
2523 |
+
}
|
2524 |
+
.wpallimport-plugin #loglist > p.odd{
|
2525 |
+
background: #dfdfdf;
|
2526 |
+
}
|
2527 |
+
/*--------------------------------------------------------------------------
|
2528 |
+
*
|
2529 |
+
* Reimport
|
2530 |
+
*
|
2531 |
+
*-------------------------------------------------------------------------*/
|
2532 |
+
|
2533 |
+
.wpallimport-plugin .info_ico{
|
2534 |
+
background: url('../img/ui_4.0/info.png') 0 50% no-repeat;
|
2535 |
+
padding: 10px 10px 10px 40px;
|
2536 |
+
color: #777;
|
2537 |
+
}
|
2538 |
+
.wpallimport-plugin .drag_an_element_ico{
|
2539 |
+
background: url('../img/ui_4.0/drag.png') 0 50% no-repeat;
|
2540 |
+
padding: 10px 10px 10px 40px;
|
2541 |
+
color: #777;
|
2542 |
+
}
|
2543 |
+
|
2544 |
+
/*--------------------------------------------------------------------------
|
2545 |
+
*
|
2546 |
+
* XML & CSV
|
2547 |
+
*
|
2548 |
+
*-------------------------------------------------------------------------*/
|
2549 |
+
|
2550 |
+
/*@+ XML representation */
|
2551 |
+
.wpallimport-plugin .tag {
|
2552 |
+
position: fixed;
|
2553 |
+
max-width: 450px;
|
2554 |
+
top: 127px;
|
2555 |
+
padding-bottom: 20px;
|
2556 |
+
margin-right: 15px;
|
2557 |
+
width: 22%;
|
2558 |
+
}
|
2559 |
+
.wpallimport-plugin #wp-content-editor-tools{
|
2560 |
+
background: #fff !important;
|
2561 |
+
}
|
2562 |
+
.wpallimport-plugin .tag .title {
|
2563 |
+
font-weight: bold;
|
2564 |
+
padding: 6px 8px;
|
2565 |
+
color: #464646;
|
2566 |
+
background: #fff;
|
2567 |
+
font-size: 12px;
|
2568 |
+
text-align: center;
|
2569 |
+
border: 1px solid #ddd;
|
2570 |
+
border-bottom: 1px solid #ddd;
|
2571 |
+
-moz-border-radius-topleft: 4px;
|
2572 |
+
-webkit-border-top-left-radius: 4px;
|
2573 |
+
border-top-left-radius: 4px;
|
2574 |
+
-moz-border-radius-topright: 4px;
|
2575 |
+
-webkit-border-top-right-radius: 4px;
|
2576 |
+
border-top-right-radius: 4px;
|
2577 |
+
}
|
2578 |
+
.wpallimport-plugin .tag .wpallimport-xml {
|
2579 |
+
/*max-height: 525px;*/
|
2580 |
+
max-width: 450px;
|
2581 |
+
overflow: auto;
|
2582 |
+
border: 1px solid #ddd;
|
2583 |
+
border-top:none;
|
2584 |
+
-moz-border-radius-bottomright: 4px;
|
2585 |
+
-webkit-border-bottom-right-radius: 4px;
|
2586 |
+
border-bottom-right-radius: 4px;
|
2587 |
+
-moz-border-radius-bottomleft: 4px;
|
2588 |
+
-webkit-border-bottom-left-radius: 4px;
|
2589 |
+
border-bottom-left-radius: 4px;
|
2590 |
+
background: #fafafa;
|
2591 |
+
}
|
2592 |
+
.wpallimport-plugin .tag .navigation {
|
2593 |
+
/*float: right;*/
|
2594 |
+
/*margin: 2px -12px 0 0;*/
|
2595 |
+
margin-bottom: 3px;
|
2596 |
+
margin-top: 3px;
|
2597 |
+
}
|
2598 |
+
.wpallimport-plugin .tag .navigation a,
|
2599 |
+
.wpallimport-plugin .tag .navigation span,
|
2600 |
+
#post-preview .navigation a,
|
2601 |
+
#post-preview .navigation span {
|
2602 |
+
font-weight: bold;
|
2603 |
+
padding: 0 12px;
|
2604 |
+
text-decoration: none;
|
2605 |
+
height: 25px;
|
2606 |
+
}
|
2607 |
+
.wpallimport-plugin .tag .navigation span.out_of{
|
2608 |
+
color:#777;
|
2609 |
+
margin-left: 0;
|
2610 |
+
}
|
2611 |
+
.wpallimport-plugin .tag .navigation .previous_element,
|
2612 |
+
#post-preview .navigation .previous_element{
|
2613 |
+
float: left;
|
2614 |
+
background: url('../img/ui_4.0/left_btn.png') 5% 0 no-repeat;
|
2615 |
+
margin-top: 4px;
|
2616 |
+
}
|
2617 |
+
.wpallimport-plugin .tag .navigation .next_element,
|
2618 |
+
#post-preview .navigation .next_element{
|
2619 |
+
float: right;
|
2620 |
+
background: url('../img/ui_4.0/right_btn.png') 95% 0 no-repeat;
|
2621 |
+
margin-top: 4px;
|
2622 |
+
}
|
2623 |
+
|
2624 |
+
@media screen and (max-height: 900px) {
|
2625 |
+
.wpallimport-plugin .tag {
|
2626 |
+
padding-bottom: 0px;
|
2627 |
+
}
|
2628 |
+
.wpallimport-plugin .tag .wpallimport-xml {
|
2629 |
+
/*max-height: 400px;*/
|
2630 |
+
}
|
2631 |
+
}
|
2632 |
+
|
2633 |
+
.wpallimport-plugin .wpallimport-xml {
|
2634 |
+
padding-left: 15px;
|
2635 |
+
}
|
2636 |
+
.wpallimport-plugin .wpallimport-xml .wpallimport-hasmenu{
|
2637 |
+
-webkit-user-select: none;
|
2638 |
+
-khtml-user-select: none;
|
2639 |
+
-moz-user-select: none;
|
2640 |
+
-ms-user-select: none;
|
2641 |
+
user-select: none;
|
2642 |
+
}
|
2643 |
+
.wpallimport-plugin .wpallimport-xml .xml-element-xpaths{
|
2644 |
+
/*display: none;*/
|
2645 |
+
}
|
2646 |
+
.wpallimport-plugin .xml-element {
|
2647 |
+
border: 1px solid transparent;
|
2648 |
+
margin: 1px 1px 1px 0;
|
2649 |
+
}
|
2650 |
+
.wpallimport-plugin .xml-element .xml-element-xpaths{
|
2651 |
+
/*display: none;*/
|
2652 |
+
}
|
2653 |
+
.wpallimport-plugin .xml-element.selected > .xml-tag.opening .xml-tag-name {
|
2654 |
+
background-color: #B5E61D;
|
2655 |
+
}
|
2656 |
+
.wpallimport-plugin .xml-content {
|
2657 |
+
padding-left: 14px;
|
2658 |
+
max-width: 500px;
|
2659 |
+
overflow: hidden;
|
2660 |
+
}
|
2661 |
+
.wpallimport-plugin .xml-content.collapsed {
|
2662 |
+
display: none;
|
2663 |
+
}
|
2664 |
+
.wpallimport-plugin .xml-content.textonly.short {
|
2665 |
+
padding-left: 0px;
|
2666 |
+
display: inline;
|
2667 |
+
}
|
2668 |
+
.wpallimport-plugin .xml-tag {
|
2669 |
+
display: inline;
|
2670 |
+
}
|
2671 |
+
.wpallimport-plugin .xml-tag-name,
|
2672 |
+
.wpallimport-plugin .csv-tag-name {
|
2673 |
+
color: #40acad;
|
2674 |
+
font-weight: bold;
|
2675 |
+
}
|
2676 |
+
.wpallimport-plugin .xml-tag.opening .xml-tag-name {
|
2677 |
+
cursor: pointer;
|
2678 |
+
}
|
2679 |
+
.wpallimport-plugin .wpallimport-xml .xml-tag.opening .xml-tag-name{
|
2680 |
+
cursor: default;
|
2681 |
+
}
|
2682 |
+
.wpallimport-plugin .xml-attr-name {
|
2683 |
+
font-weight: bold;
|
2684 |
+
cursor: pointer;
|
2685 |
+
}
|
2686 |
+
.wpallimport-plugin .xml-attr-value {
|
2687 |
+
color: blue;
|
2688 |
+
}
|
2689 |
+
.wpallimport-plugin .xml-expander {
|
2690 |
+
display: inline-block;
|
2691 |
+
width: 12px;
|
2692 |
+
margin-left: -12px;
|
2693 |
+
-moz-user-select: none;
|
2694 |
+
-khtml-user-select: none;
|
2695 |
+
-webkit-user-select: none;
|
2696 |
+
user-select: none;
|
2697 |
+
cursor: pointer;
|
2698 |
+
font-family: monospace;
|
2699 |
+
line-height: 100%;
|
2700 |
+
text-align: left;
|
2701 |
+
color: red;
|
2702 |
+
}
|
2703 |
+
.wpallimport-plugin .xml-more {
|
2704 |
+
color: red;
|
2705 |
+
font-size: 80%;
|
2706 |
+
}
|
2707 |
+
.wpallimport-plugin .xml.resetable .xml-element.lvl-mod4-3 > .xml-content {
|
2708 |
+
margin-left: -59px;
|
2709 |
+
margin-right: -8px;
|
2710 |
+
background-color: #fff;
|
2711 |
+
border: 1px dashed #906;
|
2712 |
+
border-left: 1px solid #906;
|
2713 |
+
border-right: none;
|
2714 |
+
}
|
2715 |
+
.wpallimport-plugin .xml.resetable .xml-element.lvl-mod4-3 > .xml-content.short {
|
2716 |
+
margin-left: 0;
|
2717 |
+
margin-right: 0;
|
2718 |
+
border: none;
|
2719 |
+
background-color: inherit;
|
2720 |
+
}
|
2721 |
+
.wpallimport-plugin .wpallimport-xml .xml-element.lvl-0 .xml-tag .xml-tag-name{
|
2722 |
+
color: #46ba69;
|
2723 |
+
}
|
2724 |
+
.wpallimport-plugin .wpallimport-xml .xml-element.lvl-1 .xml-tag .xml-tag-name{
|
2725 |
+
color: #40acad;
|
2726 |
+
}
|
2727 |
+
/*.wpallimport-plugin .csv_element .is_numeric{
|
2728 |
+
text-align: right;
|
2729 |
+
}*/
|
2730 |
+
.wpallimport-plugin .csv-content{
|
2731 |
+
overflow: hidden;
|
2732 |
+
margin-bottom: 15px;
|
2733 |
+
margin-top: 15px;
|
2734 |
+
padding-right: 15px;
|
2735 |
+
}
|
2736 |
+
.wpallimport-plugin .csv_element .csv-tag,
|
2737 |
+
.wpallimport-plugin .csv_element .xml-content{
|
2738 |
+
width: 46%;
|
2739 |
+
/*border: 1px solid #ccc;*/
|
2740 |
+
padding: 3px !important;
|
2741 |
+
display: block;
|
2742 |
+
float: left;
|
2743 |
+
}
|
2744 |
+
.wpallimport-plugin .wpallimport-choose-elements .csv_element .csv-tag{
|
2745 |
+
width: 25%;
|
2746 |
+
}
|
2747 |
+
.wpallimport-plugin .wpallimport-choose-elements .csv_element .xml-content{
|
2748 |
+
width: 70%;
|
2749 |
+
}
|
2750 |
+
.wpallimport-plugin .csv_element .csv-tag{
|
2751 |
+
border-right: 1px solid #CCCCCC;
|
2752 |
+
margin-right: -1px;
|
2753 |
+
}
|
2754 |
+
.wpallimport-plugin .csv_element .xml-content{
|
2755 |
+
border-left: 1px solid #ccc;
|
2756 |
+
width: 48%;
|
2757 |
+
}
|
2758 |
+
.wpallimport-plugin .csv_element{
|
2759 |
+
border: 1px solid #ccc;
|
2760 |
+
overflow: hidden;
|
2761 |
+
width: 100%;
|
2762 |
+
background: #fff;
|
2763 |
+
}
|
2764 |
+
.wpallimport-plugin .csv_element.lvl-0{
|
2765 |
+
border: none;
|
2766 |
+
}
|
2767 |
+
/* xml table representation */
|
2768 |
+
.wpallimport-plugin tr.xml-element.selected .xml-tag.opening .xml-tag-name {
|
2769 |
+
background-color: #B5E61D;
|
2770 |
+
}
|
2771 |
+
.wpallimport-plugin table.wpallimport-xml td {
|
2772 |
+
padding-left: 20px;
|
2773 |
+
}
|
2774 |
+
.wpallimport-plugin table.wpallimport-xml td:first-child {
|
2775 |
+
width: 1px;
|
2776 |
+
padding-left: 0px;
|
2777 |
+
}
|
2778 |
+
|
2779 |
+
.wpallimport-plugin table.wpallimport-xml,
|
2780 |
+
.wpallimport-plugin table.wpallimport-xml table {
|
2781 |
+
width: 100%;
|
2782 |
+
border-collapse:collapse;
|
2783 |
+
border-spacing:0;
|
2784 |
+
}
|
2785 |
+
/*@*/
|
2786 |
+
|
2787 |
+
/*--------------------------------------------------------------------------
|
2788 |
+
*
|
2789 |
+
* Manage Imports
|
2790 |
+
*
|
2791 |
+
*-------------------------------------------------------------------------*/
|
2792 |
+
|
2793 |
+
/*@+ table list */
|
2794 |
+
.wpallimport-plugin table.widefat th {
|
2795 |
+
white-space: nowrap;
|
2796 |
+
}
|
2797 |
+
.wpallimport-plugin table.widefat th.ASC a {
|
2798 |
+
background-image: url("../img/screen-options-right-up.gif");
|
2799 |
+
background-repeat: no-repeat;
|
2800 |
+
background-position: right center;
|
2801 |
+
padding-right: 19px;
|
2802 |
+
}
|
2803 |
+
.wpallimport-plugin table.widefat th.DESC a {
|
2804 |
+
background-image: url("../img/screen-options-right.gif");
|
2805 |
+
background-repeat: no-repeat;
|
2806 |
+
background-position: right center;
|
2807 |
+
padding-right: 19px;
|
2808 |
+
}
|
2809 |
+
|
2810 |
+
.wpallimport-plugin table.widefat.pmxi-admin-imports th.column-id {
|
2811 |
+
width: 35px;
|
2812 |
+
}
|
2813 |
+
.wpallimport-plugin table.widefat.pmxi-admin-imports th.column-scheduled {
|
2814 |
+
width: 85px;
|
2815 |
+
}
|
2816 |
+
.wpallimport-plugin table.widefat.pmxi-admin-imports th.column-registered_on {
|
2817 |
+
width: 130px;
|
2818 |
+
}
|
2819 |
+
.wpallimport-plugin table.widefat.pmxi-admin-imports th.column-post_count {
|
2820 |
+
width: 105px;
|
2821 |
+
}
|
2822 |
+
.wpallimport-plugin .wpallimport-disabled{
|
2823 |
+
color: #888 !important;
|
2824 |
+
}
|
2825 |
+
/*@*/
|
2826 |
+
/*.wpallimport-plugin .pmxi-admin-imports a.delete{
|
2827 |
+
color: #FF0000;
|
2828 |
+
font-size: 18px;
|
2829 |
+
font-weight: bold;
|
2830 |
+
padding-top: 35px;
|
2831 |
+
vertical-align: middle;
|
2832 |
+
}*/
|
2833 |
+
|
2834 |
+
/*--------------------------------------------------------------------------
|
2835 |
+
*
|
2836 |
+
* Setting Page
|
2837 |
+
*
|
2838 |
+
*-------------------------------------------------------------------------*/
|
2839 |
+
|
2840 |
+
/*@+ Setting Form */
|
2841 |
+
.wpallimport-plugin form.settings {
|
2842 |
+
/*padding: 1px 12px;*/
|
2843 |
+
}
|
2844 |
+
/*@*/
|
2845 |
+
.wpallimport-plugin form.settings p{
|
2846 |
+
font-size: 14px !important;
|
2847 |
+
}
|
2848 |
+
.wpallimport-plugin form.settings .wpallimport-header{
|
2849 |
+
overflow: hidden;
|
2850 |
+
height: 60px;
|
2851 |
+
padding-top: 10px;
|
2852 |
+
}
|
2853 |
+
|
2854 |
+
.wpallimport-plugin .wpallimport-setting-wrapper{
|
2855 |
+
clear: both;
|
2856 |
+
overflow: hidden;
|
2857 |
+
margin: 15px 0;
|
2858 |
+
}
|
2859 |
+
.wpallimport-plugin .wpallimport-setting-label{
|
2860 |
+
width: 250px;
|
2861 |
+
float: left;
|
2862 |
+
padding-top: 10px;
|
2863 |
+
font-weight: bold;
|
2864 |
+
}
|
2865 |
+
.wpallimport-plugin .wpallimport-setting{
|
2866 |
+
float: left;
|
2867 |
+
width: 600px;
|
2868 |
+
}
|
2869 |
+
.wpallimport-plugin .wpallimport-setting-note{
|
2870 |
+
color: #777;
|
2871 |
+
margin-top: 2px;
|
2872 |
+
}
|
2873 |
+
|
2874 |
+
/*--------------------------------------------------------------------------
|
2875 |
+
*
|
2876 |
+
* Media Queries
|
2877 |
+
*
|
2878 |
+
*-------------------------------------------------------------------------*/
|
2879 |
+
|
2880 |
+
@media screen and (min-width: 1630px) and (max-width: 1730px) {
|
2881 |
+
|
2882 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
2883 |
+
width: 320px;
|
2884 |
+
}
|
2885 |
+
}
|
2886 |
+
|
2887 |
+
@media screen and (min-width: 1530px) and (max-width: 1629px) {
|
2888 |
+
|
2889 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
2890 |
+
width: 295px;
|
2891 |
+
}
|
2892 |
+
}
|
2893 |
+
|
2894 |
+
@media screen and (min-width: 1416px) and (max-width: 1529px) {
|
2895 |
+
|
2896 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
2897 |
+
width: 270px;
|
2898 |
+
}
|
2899 |
+
|
2900 |
+
.wpallimport-plugin .pmxi-admin-imports tr td em{
|
2901 |
+
display: block;
|
2902 |
+
max-width: 585px;
|
2903 |
+
}
|
2904 |
+
}
|
2905 |
+
|
2906 |
+
@media screen and (min-width: 1350px) and (max-width: 1415px) {
|
2907 |
+
.wpallimport-plugin .wpallimport-wrapper{
|
2908 |
+
width: 1120px;
|
2909 |
+
}
|
2910 |
+
.wpallimport-plugin a.wpallimport-import-from{
|
2911 |
+
width: 340px;
|
2912 |
+
}
|
2913 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
2914 |
+
width: 220px;
|
2915 |
+
font-size: 15px;
|
2916 |
+
}
|
2917 |
+
.wpallimport-plugin .wpallimport-custom-fields textarea{
|
2918 |
+
width: 60% !important;
|
2919 |
+
}
|
2920 |
+
.wpallimport-plugin .pmxi-admin-imports tr td em{
|
2921 |
+
display: block;
|
2922 |
+
max-width: 525px;
|
2923 |
+
}
|
2924 |
+
.wpallimport-plugin .wpallimport-extra-text-left{
|
2925 |
+
width: 36%;
|
2926 |
+
}
|
2927 |
+
.wpallimport-plugin .wpallimport-extra-text-right{
|
2928 |
+
width: 37%;
|
2929 |
+
}
|
2930 |
+
.wpallimport-plugin .wpallimport-is-continue{
|
2931 |
+
margin: 12px 10px 12px 0;
|
2932 |
+
}
|
2933 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="new"]{
|
2934 |
+
margin-left: -14%;
|
2935 |
+
}
|
2936 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="matching"]{
|
2937 |
+
margin-left: -13%;
|
2938 |
+
}
|
2939 |
+
}
|
2940 |
+
|
2941 |
+
@media screen and (min-width: 1250px) and (max-width: 1349px) {
|
2942 |
+
.wpallimport-plugin .wpallimport-wrapper{
|
2943 |
+
width: 1020px;
|
2944 |
+
}
|
2945 |
+
.wpallimport-plugin a.wpallimport-import-from{
|
2946 |
+
width: 300px;
|
2947 |
+
}
|
2948 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
2949 |
+
font-size: 18px;
|
2950 |
+
}
|
2951 |
+
.wpallimport-plugin .change_file .wpallimport-import-types h3{
|
2952 |
+
font-size: 22px;
|
2953 |
+
}
|
2954 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
2955 |
+
width: 220px;
|
2956 |
+
font-size: 15px;
|
2957 |
+
}
|
2958 |
+
.wpallimport-plugin .wpallimport-custom-fields textarea{
|
2959 |
+
width: 55% !important;
|
2960 |
+
}
|
2961 |
+
.wpallimport-plugin .pmxi-admin-imports tr td em{
|
2962 |
+
display: block;
|
2963 |
+
max-width: 425px;
|
2964 |
+
}
|
2965 |
+
.wpallimport-plugin .wpallimport-extra-text-left{
|
2966 |
+
width: 35%;
|
2967 |
+
}
|
2968 |
+
.wpallimport-plugin .wpallimport-extra-text-right{
|
2969 |
+
width: 35%;
|
2970 |
+
}
|
2971 |
+
.wpallimport-plugin .wpallimport-is-continue{
|
2972 |
+
margin: 12px 10px 12px 0;
|
2973 |
+
}
|
2974 |
+
.wpallimport-plugin .wpallimport-ready-to-go h3{
|
2975 |
+
font-size: 18px;
|
2976 |
+
}
|
2977 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="new"]{
|
2978 |
+
margin-left: -17%;
|
2979 |
+
}
|
2980 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="matching"]{
|
2981 |
+
margin-left: -16%;
|
2982 |
+
}
|
2983 |
+
}
|
2984 |
+
|
2985 |
+
@media screen and (min-width: 1150px) and (max-width: 1249px) {
|
2986 |
+
.wpallimport-plugin .wpallimport-wrapper{
|
2987 |
+
width: 920px;
|
2988 |
+
}
|
2989 |
+
.wpallimport-plugin a.wpallimport-import-from{
|
2990 |
+
width: 260px;
|
2991 |
+
}
|
2992 |
+
.wpallimport-plugin .wpallimport-upload-type-container{
|
2993 |
+
padding: 0 40px;
|
2994 |
+
}
|
2995 |
+
.wpallimport-plugin .ajax-console .founded_records h4{
|
2996 |
+
font-size: 18px;
|
2997 |
+
}
|
2998 |
+
.wpallimport-plugin #pmxi_add_rule{
|
2999 |
+
padding: 13px 25px 10px 50px;
|
3000 |
+
}
|
3001 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
3002 |
+
font-size: 15px;
|
3003 |
+
}
|
3004 |
+
.wpallimport-plugin #process_notice,
|
3005 |
+
.wpallimport-plugin #import_finished h3{
|
3006 |
+
font-size: 16px;
|
3007 |
+
}
|
3008 |
+
.wpallimport-plugin .change_file .wpallimport-import-types{
|
3009 |
+
margin-top: 15px;
|
3010 |
+
}
|
3011 |
+
.wpallimport-plugin .change_file .wpallimport-import-types h3{
|
3012 |
+
font-size: 18px;
|
3013 |
+
}
|
3014 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
3015 |
+
width: 190px;
|
3016 |
+
font-size: 12px;
|
3017 |
+
}
|
3018 |
+
.wpallimport-plugin .wpallimport-custom-fields textarea{
|
3019 |
+
width: 50% !important;
|
3020 |
+
}
|
3021 |
+
.wpallimport-plugin .pmxi-admin-imports tr td em{
|
3022 |
+
display: block;
|
3023 |
+
max-width: 325px;
|
3024 |
+
}
|
3025 |
+
.wpallimport-plugin .wpallimport-extra-text-left{
|
3026 |
+
width: 33%;
|
3027 |
+
}
|
3028 |
+
.wpallimport-plugin .wpallimport-extra-text-right{
|
3029 |
+
width: 34%;
|
3030 |
+
}
|
3031 |
+
.wpallimport-plugin .wpallimport-new-records,
|
3032 |
+
.wpallimport-plugin .wpallimport-existing-records{
|
3033 |
+
font-size: 16px;
|
3034 |
+
}
|
3035 |
+
.wpallimport-plugin .wpallimport-is-continue{
|
3036 |
+
margin: 12px 10px 12px 0;
|
3037 |
+
}
|
3038 |
+
.wpallimport-plugin .wpallimport-ready-to-go h3{
|
3039 |
+
font-size: 14px;
|
3040 |
+
}
|
3041 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
3042 |
+
font-size: 14px;
|
3043 |
+
}
|
3044 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="new"]{
|
3045 |
+
margin-left: -17%;
|
3046 |
+
}
|
3047 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="matching"]{
|
3048 |
+
margin-left: -16%;
|
3049 |
+
}
|
3050 |
+
}
|
3051 |
+
@media screen and (min-width: 1050px) and (max-width: 1149px) {
|
3052 |
+
.wpallimport-plugin .wpallimport-wrapper{
|
3053 |
+
width: 800px;
|
3054 |
+
}
|
3055 |
+
.wpallimport-plugin a.wpallimport-import-from{
|
3056 |
+
width: 230px;
|
3057 |
+
font-size: 15px;
|
3058 |
+
}
|
3059 |
+
.wpallimport-plugin .wpallimport-upload-type-container{
|
3060 |
+
padding: 0 40px;
|
3061 |
+
}
|
3062 |
+
.wpallimport-plugin .ajax-console .founded_records h4{
|
3063 |
+
font-size: 14px;
|
3064 |
+
}
|
3065 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
3066 |
+
font-size: 12px;
|
3067 |
+
}
|
3068 |
+
.wpallimport-plugin form.confirm input[type="submit"]{
|
3069 |
+
padding: 20px 10px 20px 10px;
|
3070 |
+
}
|
3071 |
+
.wpallimport-plugin #process_notice,
|
3072 |
+
.wpallimport-plugin #import_finished h3{
|
3073 |
+
font-size: 14px;
|
3074 |
+
}
|
3075 |
+
.wpallimport-plugin #import_progress{
|
3076 |
+
font-size: 16px;
|
3077 |
+
}
|
3078 |
+
.wpallimport-plugin .change_file .wpallimport-import-types{
|
3079 |
+
margin-top: 15px;
|
3080 |
+
}
|
3081 |
+
.wpallimport-plugin .change_file .wpallimport-import-types h3{
|
3082 |
+
font-size: 18px;
|
3083 |
+
}
|
3084 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
3085 |
+
width: 150px;
|
3086 |
+
font-size: 0px;
|
3087 |
+
}
|
3088 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from .wpallimport-icon{
|
3089 |
+
left: 0 !important;
|
3090 |
+
}
|
3091 |
+
.wpallimport-plugin .wpallimport-custom-fields textarea{
|
3092 |
+
width: 45% !important;
|
3093 |
+
}
|
3094 |
+
.wpallimport-plugin .pmxi-admin-imports tr td em{
|
3095 |
+
display: block;
|
3096 |
+
max-width: 235px;
|
3097 |
+
}
|
3098 |
+
.wpallimport-plugin .wpallimport-extra-text-left{
|
3099 |
+
width: 30%;
|
3100 |
+
}
|
3101 |
+
.wpallimport-plugin .wpallimport-extra-text-right{
|
3102 |
+
width: 31%;
|
3103 |
+
}
|
3104 |
+
.wpallimport-plugin .wpallimport-new-records,
|
3105 |
+
.wpallimport-plugin .wpallimport-existing-records{
|
3106 |
+
font-size: 12px;
|
3107 |
+
}
|
3108 |
+
.wpallimport-plugin .wpallimport-is-continue{
|
3109 |
+
margin: 12px 10px 12px 0;
|
3110 |
+
}
|
3111 |
+
.wpallimport-plugin .wpallimport-ready-to-go h3{
|
3112 |
+
font-size: 11px;
|
3113 |
+
line-height: 20px;
|
3114 |
+
margin-top: 10px;
|
3115 |
+
}
|
3116 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
3117 |
+
font-size: 11px;
|
3118 |
+
}
|
3119 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="new"]{
|
3120 |
+
margin-left: -17%;
|
3121 |
+
}
|
3122 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="matching"]{
|
3123 |
+
margin-left: -16%;
|
3124 |
+
}
|
3125 |
+
}
|
3126 |
+
@media screen and (max-width: 1049px) {
|
3127 |
+
.wpallimport-plugin .wpallimport-wrapper{
|
3128 |
+
width: 760px;
|
3129 |
+
}
|
3130 |
+
.wpallimport-plugin a.wpallimport-import-from{
|
3131 |
+
width: 220px;
|
3132 |
+
font-size: 15px;
|
3133 |
+
}
|
3134 |
+
.wpallimport-plugin .wpallimport-upload-type-container{
|
3135 |
+
padding: 0 40px;
|
3136 |
+
}
|
3137 |
+
.wpallimport-plugin .wpallimport-import-to{
|
3138 |
+
width: 330px;
|
3139 |
+
}
|
3140 |
+
.wpallimport-plugin .ajax-console .founded_records h4{
|
3141 |
+
font-size: 13px;
|
3142 |
+
}
|
3143 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
3144 |
+
font-size: 12px;
|
3145 |
+
}
|
3146 |
+
.wpallimport-plugin form.confirm input[type="submit"]{
|
3147 |
+
padding: 20px 10px 20px 10px;
|
3148 |
+
}
|
3149 |
+
.wpallimport-plugin #process_notice,
|
3150 |
+
.wpallimport-plugin #import_finished h3{
|
3151 |
+
font-size: 13px;
|
3152 |
+
}
|
3153 |
+
.wpallimport-plugin #import_progress{
|
3154 |
+
font-size: 16px;
|
3155 |
+
}
|
3156 |
+
|
3157 |
+
.wpallimport-plugin .change_file .wpallimport-import-types{
|
3158 |
+
margin-top: 15px;
|
3159 |
+
}
|
3160 |
+
.wpallimport-plugin .change_file .wpallimport-import-types h3{
|
3161 |
+
font-size: 14px;
|
3162 |
+
}
|
3163 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from{
|
3164 |
+
width: 130px;
|
3165 |
+
font-size: 0px;
|
3166 |
+
}
|
3167 |
+
.wpallimport-plugin .change_file a.wpallimport-import-from .wpallimport-icon{
|
3168 |
+
left: 0 !important;
|
3169 |
+
}
|
3170 |
+
.wpallimport-plugin .change_file #select-files{
|
3171 |
+
font-size: 14px;
|
3172 |
+
}
|
3173 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-to-new-items span.wpallimport-import-to-title:before{
|
3174 |
+
left: 25%;
|
3175 |
+
}
|
3176 |
+
.wpallimport-plugin .wpallimport-import-to.wpallimport-to-existing-items span.wpallimport-import-to-title:before{
|
3177 |
+
left: 20%;
|
3178 |
+
}
|
3179 |
+
.wpallimport-plugin .wpallimport-custom-fields textarea{
|
3180 |
+
width: 45% !important;
|
3181 |
+
}
|
3182 |
+
.wpallimport-plugin .pmxi-admin-imports tr td em{
|
3183 |
+
display: block;
|
3184 |
+
max-width: 225px;
|
3185 |
+
}
|
3186 |
+
.wpallimport-plugin .wpallimport-extra-text-left{
|
3187 |
+
width: 29%;
|
3188 |
+
}
|
3189 |
+
.wpallimport-plugin .wpallimport-extra-text-right{
|
3190 |
+
width: 30%;
|
3191 |
+
}
|
3192 |
+
.wpallimport-plugin .wpallimport-new-records,
|
3193 |
+
.wpallimport-plugin .wpallimport-existing-records{
|
3194 |
+
font-size: 11px;
|
3195 |
+
}
|
3196 |
+
.wpallimport-plugin .wpallimport-ready-to-go{
|
3197 |
+
padding-left: 70px;
|
3198 |
+
}
|
3199 |
+
.wpallimport-plugin .wpallimport-is-continue{
|
3200 |
+
margin: 12px 10px 12px 0;
|
3201 |
+
}
|
3202 |
+
.wpallimport-plugin .wpallimport-ready-to-go h3{
|
3203 |
+
font-size: 11px;
|
3204 |
+
line-height: 20px;
|
3205 |
+
margin-top: 10px;
|
3206 |
+
}
|
3207 |
+
.wpallimport-plugin .wpallimport-ready-to-go h4{
|
3208 |
+
font-size: 11px;
|
3209 |
+
}
|
3210 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="new"]{
|
3211 |
+
margin-left: -17%;
|
3212 |
+
}
|
3213 |
+
.wpallimport-plugin .wpallimport-choose-import-direction[rel="matching"]{
|
3214 |
+
margin-left: -16%;
|
3215 |
+
}
|
3216 |
}
|
static/css/custom-editor-style.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
body#tinymce.wp-editor {
|
2 |
+
max-width: 100% !important;
|
3 |
+
min-height: 165px;
|
4 |
+
}
|
static/img/help.png
CHANGED
Binary file
|
static/img/loading-step-2.gif
ADDED
Binary file
|
static/img/loading.png
DELETED
Binary file
|
static/img/preloader.gif
ADDED
Binary file
|
static/img/soflyy-logo.png
ADDED
Binary file
|
static/img/success.png
ADDED
Binary file
|
static/img/ui_4.0/add.png
ADDED
Binary file
|
static/img/ui_4.0/back.png
ADDED
Binary file
|
static/img/ui_4.0/bottom_arrow.png
ADDED
Binary file
|
static/img/ui_4.0/change.png
ADDED
Binary file
|
static/img/ui_4.0/cloud.png
ADDED
Binary file
|
static/img/ui_4.0/cloud_url.png
ADDED
Binary file
|
static/img/ui_4.0/collapser.png
ADDED
Binary file
|
static/img/ui_4.0/completed.png
ADDED
Binary file
|
static/img/ui_4.0/continue.png
ADDED
Binary file
|
static/img/ui_4.0/drag.png
ADDED
Binary file
|
static/img/ui_4.0/element_arrow.png
ADDED
Binary file
|
static/img/ui_4.0/elements.png
ADDED
Binary file
|
static/img/ui_4.0/elements_notify.png
ADDED
Binary file
|
static/img/ui_4.0/file_sprite.png
ADDED
Binary file
|
static/img/ui_4.0/future_step.png
ADDED
Binary file
|
static/img/ui_4.0/icon_cpt.png
ADDED
Binary file
|
static/img/ui_4.0/import_history.png
ADDED
Binary file
|
static/img/ui_4.0/info.png
ADDED
Binary file
|
static/img/ui_4.0/left_btn.png
ADDED
Binary file
|
static/img/ui_4.0/list.png
ADDED
Binary file
|
static/img/ui_4.0/logo.png
ADDED
Binary file
|
static/img/ui_4.0/logo_small.png
ADDED
Binary file
|
static/img/ui_4.0/manage_imports.png
ADDED
Binary file
|
static/img/ui_4.0/remove.png
ADDED
Binary file
|
static/img/ui_4.0/right_btn.png
ADDED
Binary file
|
static/img/ui_4.0/rule.png
ADDED
Binary file
|
static/img/ui_4.0/save_btn.png
ADDED
Binary file
|
static/img/ui_4.0/select_files.png
ADDED
Binary file
|
static/img/ui_4.0/step.png
ADDED
Binary file
|
static/img/ui_4.0/step_1_bar.png
ADDED
Binary file
|
static/img/ui_4.0/step_2_bar.png
ADDED
Binary file
|
static/img/ui_4.0/step_3_bar.png
ADDED
Binary file
|
static/img/ui_4.0/step_4_bar.png
ADDED
Binary file
|
static/img/ui_4.0/step_5_bar.png
ADDED
Binary file
|
static/img/ui_4.0/step_6_bar.png
ADDED
Binary file
|
static/img/ui_4.0/support.png
ADDED
Binary file
|
static/img/ui_4.0/tip.png
ADDED
Binary file
|
static/img/ui_4.0/trash.png
ADDED
Binary file
|
static/img/ui_4.0/upload_sprite.png
ADDED
Binary file
|
static/img/ui_4.0/url.png
ADDED
Binary file
|
static/img/ui_4.0/url_sprite.png
ADDED
Binary file
|
static/img/ui_4.0/use_existing_file.png
ADDED
Binary file
|
static/img/ui_4.0/use_existing_green.png
ADDED
Binary file
|
static/img/ui_4.0/view_log.png
ADDED
Binary file
|
static/img/ui_4.0/zip.png
ADDED
Binary file
|
static/img/xmlicon.png
CHANGED
Binary file
|
static/js/admin.js
CHANGED
@@ -2,15 +2,15 @@
|
|
2 |
* plugin admin area javascript
|
3 |
*/
|
4 |
(function($){$(function () {
|
5 |
-
if ( ! $('body.
|
6 |
-
|
7 |
-
// fix layout position
|
8 |
setTimeout(function () {
|
9 |
-
$('table.layout').length && $('table.layout td.left h2:first-child').css('margin-top', $('.wrap').offset().top - $('table.layout').offset().top);
|
10 |
}, 10);
|
11 |
|
12 |
// help icons
|
13 |
-
$('a.help').tipsy({
|
14 |
gravity: function() {
|
15 |
var ver = 'n';
|
16 |
if ($(document).scrollTop() < $(this).offset().top - $('.tipsy').height() - 2) {
|
@@ -44,9 +44,25 @@
|
|
44 |
|
45 |
var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
46 |
if (is_show) {
|
47 |
-
$targets.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
} else {
|
49 |
-
$targets.
|
50 |
}
|
51 |
}).change();
|
52 |
|
@@ -100,174 +116,230 @@
|
|
100 |
$(this).parent().find('.datepicker.range-from').datepicker("option", "maxDate", date);
|
101 |
}
|
102 |
}).change();
|
103 |
-
$('.ui-datepicker').hide(); // fix: make sure datepicker doesn't break wordpress layout upon initialization
|
104 |
|
105 |
// no-enter-submit forms
|
106 |
$('form.no-enter-submit').find('input,select,textarea').not('*[type="submit"]').keydown(function (e) {
|
107 |
if (13 == e.keyCode) e.preventDefault();
|
108 |
});
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
}
|
117 |
-
|
118 |
-
|
119 |
-
// choose file form: option selection dynamic
|
120 |
-
// options form: highlight options of selected post type
|
121 |
-
$('form.choose-file input[name="type"]').click(function() {
|
122 |
-
if ($(this).val() == 'upload' || $(this).val() == 'file' || $(this).val() == 'reimport' || $(this).val() == 'url') $('#large_import').slideDown(); else { $('#large_import').slideUp(); $('#large_import_toggle').removeAttr('checked'); $('#large_import_xpath').slideUp();}
|
123 |
-
var $container = $(this).parents('.file-type-container');
|
124 |
-
$('.file-type-container').not($container).removeClass('selected').find('.file-type-options').hide();
|
125 |
-
$container.addClass('selected').find('.file-type-options').show();
|
126 |
-
}).filter(':checked').click();
|
127 |
-
|
128 |
-
// template form: auto submit when `load template` list value is picked
|
129 |
-
$('form.template, form.options').find('select[name="load_template"]').change(function () {
|
130 |
-
$(this).parents('form').submit();
|
131 |
-
});
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
}
|
147 |
});
|
148 |
-
|
149 |
-
$preview.find('input[name="tagno"]').die();
|
150 |
-
$preview.find('.navigation a').die('click');
|
151 |
-
$modal.addClass('loading').empty().dialog('open').dialog('option', 'position', 'center');
|
152 |
-
if (tinyMCE != undefined) tinyMCE.triggerSave(false, false);
|
153 |
-
$.post('admin.php?page=pmxi-admin-import&action=preview', $form.serialize(), function (response) {
|
154 |
-
$modal.removeClass('loading').html(response.html).dialog('option', 'position', 'center');
|
155 |
-
var $tag = $('.tag');
|
156 |
-
var tagno = parseInt($tag.find('input[name="tagno"]').val());
|
157 |
-
$preview.find('.navigation a').live('click', function () {
|
158 |
-
tagno += '#prev' == $(this).attr('href') ? -1 : 1;
|
159 |
-
$tag.addClass('loading').css('opacity', 0.7);
|
160 |
-
$.post('admin.php?page=pmxi-admin-import&action=tag', {tagno: tagno}, function (data) {
|
161 |
-
var $indicator = $('<span />').insertBefore($tag);
|
162 |
-
$tag.replaceWith(data.html);
|
163 |
-
$indicator.next().tag().prevObject.remove();
|
164 |
-
if ($('#variations_xpath').length){
|
165 |
-
$('#variations_xpath').data('checkedValue', '').change();
|
166 |
-
}
|
167 |
-
if ($('.layout').length){
|
168 |
-
var offset = $('.layout').offset();
|
169 |
-
if ($(document).scrollTop() > offset.top)
|
170 |
-
$('.tag').css({'top':(($(document).scrollTop() - offset.top) ? $(document).scrollTop() - offset.top : 0) + 'px'});
|
171 |
-
else
|
172 |
-
$('.tag').css({'top':''});
|
173 |
-
}
|
174 |
-
$preview.find('input[name="tagno"]').die();
|
175 |
-
$preview.find('.navigation a').die('click');
|
176 |
-
$form.find('.preview').click();
|
177 |
-
}, 'json');
|
178 |
-
return false;
|
179 |
-
});
|
180 |
-
$preview.find('input[name="tagno"]').live('change', function () {
|
181 |
-
tagno = (parseInt($(this).val()) > parseInt($preview.find('.pmxi_count').html())) ? $preview.find('.pmxi_count').html() : ( (parseInt($(this).val())) ? $(this).val() : 1 );
|
182 |
-
$tag.addClass('loading').css('opacity', 0.7);
|
183 |
-
$.post('admin.php?page=pmxi-admin-import&action=tag', {tagno: tagno}, function (data) {
|
184 |
-
var $indicator = $('<span />').insertBefore($tag);
|
185 |
-
$tag.replaceWith(data.html);
|
186 |
-
$indicator.next().tag().prevObject.remove();
|
187 |
-
if ($('#variations_xpath').length){
|
188 |
-
$('#variations_xpath').data('checkedValue', '').change();
|
189 |
-
}
|
190 |
-
if ($('.layout').length){
|
191 |
-
var offset = $('.layout').offset();
|
192 |
-
if ($(document).scrollTop() > offset.top)
|
193 |
-
$('.tag').css({'top':(($(document).scrollTop() - offset.top) ? $(document).scrollTop() - offset.top : 0) + 'px'});
|
194 |
-
else
|
195 |
-
$('.tag').css({'top':''});
|
196 |
-
}
|
197 |
-
$preview.find('input[name="tagno"]').die();
|
198 |
-
$preview.find('.navigation a').die('click');
|
199 |
-
$form.find('.preview').click();
|
200 |
-
}, 'json');
|
201 |
-
return false;
|
202 |
-
});
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
223 |
});
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
});
|
229 |
-
|
230 |
-
|
231 |
-
// options form: highlight options of selected post type
|
232 |
-
$('form.options input[name="type"]').click(function() {
|
233 |
-
var $container = $(this).parents('.post-type-container');
|
234 |
-
$('.post-type-container').not($container).removeClass('selected').find('.post-type-options').hide();
|
235 |
-
$container.addClass('selected').find('.post-type-options').show();
|
236 |
-
}).filter(':checked').click();
|
237 |
-
// options form: add / remove custom params
|
238 |
-
$('.form-table a.action[href="#add"]').live('click', function () {
|
239 |
-
var $template = $(this).parents('table').first().find('tr.template');
|
240 |
-
$template.clone(true).insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
241 |
-
return false;
|
242 |
-
});
|
243 |
|
244 |
-
// options form: auto submit when `load options` checkbox is checked
|
245 |
-
$('input[name="load_options"]').click(function () {
|
246 |
-
if ($(this).is(':checked')) $(this).parents('form').submit();
|
247 |
});
|
248 |
-
|
249 |
-
$('
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
});
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
});
|
|
|
256 |
|
257 |
-
|
258 |
-
|
259 |
-
'
|
260 |
-
};
|
261 |
|
262 |
-
function
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
// [xml representation dynamic]
|
273 |
$.fn.xml = function (opt) {
|
@@ -367,22 +439,14 @@
|
|
367 |
}, 500);
|
368 |
}
|
369 |
});
|
370 |
-
|
371 |
-
|
372 |
-
if (dblclickbuf.selected)
|
373 |
-
{
|
374 |
-
tinyMCE.activeEditor.selection.setContent(dblclickbuf.value);
|
375 |
-
$('.xml-element[title*="'+dblclickbuf.value.replace('{','').replace('}','')+'"]').removeClass('selected');
|
376 |
-
dblclickbuf.value = '';
|
377 |
-
dblclickbuf.selected = false;
|
378 |
-
}
|
379 |
-
});*/
|
380 |
-
|
381 |
-
this.find('.xml-tag.opening > .xml-tag-name, .xml-attr-name').each(function () {
|
382 |
var $this = $(this);
|
383 |
var xpath = '.';
|
384 |
if ($this.is('.xml-attr-name'))
|
385 |
xpath = '{' + ($this.parents('.xml-element:first').attr('title').replace(/^\/[^\/]+\/?/, '') || '.') + '/@' + $this.html().trim() + '}';
|
|
|
|
|
386 |
else
|
387 |
xpath = '{' + ($this.parent().parent().attr('title').replace(/^\/[^\/]+\/?/, '') || '.') + '}';
|
388 |
|
@@ -394,12 +458,590 @@
|
|
394 |
return this;
|
395 |
};
|
396 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
var go_to_template = false;
|
398 |
|
399 |
// selection logic
|
400 |
-
$('form.choose-elements').each(function () {
|
401 |
var $form = $(this);
|
402 |
-
$form.find('.xml').xml();
|
403 |
var $input = $form.find('input[name="xpath"]');
|
404 |
var $next_element = $form.find('#next_element');
|
405 |
var $prev_element = $form.find('#prev_element');
|
@@ -410,11 +1052,8 @@
|
|
410 |
var $csv_delimiter = $form.find('input[name=delimiter]');
|
411 |
var $apply_delimiter = $form.find('input[name=apply_delimiter]');
|
412 |
|
413 |
-
var $xml = $('.xml');
|
414 |
-
|
415 |
-
if ($form.hasClass('loading')) return; // do nothing if selecting operation is currently under way
|
416 |
-
$input.val($(this).parents('.xml-element').first().attr('title').replace(/\[\d+\]$/, '')).change();
|
417 |
-
});
|
418 |
var xpathChanged = function () {
|
419 |
if ($input.val() == $input.data('checkedValue')) return;
|
420 |
|
@@ -423,22 +1062,32 @@
|
|
423 |
// request server to return elements which correspond to xpath entered
|
424 |
$input.attr('readonly', true).unbind('change', xpathChanged).data('checkedValue', $input.val());
|
425 |
$xml.css({'visibility':'hidden'});
|
426 |
-
$
|
|
|
|
|
427 |
go_to_template = false;
|
428 |
$submit.hide();
|
429 |
-
var evaluate = function(){
|
430 |
-
$.post('admin.php?page=pmxi-admin-import&action=evaluate', {xpath: $input.val(), show_element: $goto_element.val(), root_element:$root_element.val(), delimiter:$csv_delimiter.val()}, function (response) {
|
431 |
if (response.result){
|
|
|
432 |
$('.ajax-console').html(response.html);
|
433 |
$input.attr('readonly', false).change(function(){$goto_element.val(1); xpathChanged();});
|
434 |
-
$form.removeClass('loading');
|
|
|
435 |
$xml.parents('fieldset:first').removeClass('preload');
|
|
|
436 |
go_to_template = true;
|
437 |
$('#pmxi_xml_element').find('option').each(function(){
|
438 |
if ($(this).val() != "") $(this).remove();
|
439 |
});
|
440 |
$('#pmxi_xml_element').append(response.render_element);
|
441 |
-
$
|
|
|
|
|
|
|
|
|
|
|
442 |
}
|
443 |
}, "json").fail(function() {
|
444 |
|
@@ -477,10 +1126,13 @@
|
|
477 |
reset_filters();
|
478 |
$root_element.val($(this).attr('root')); $goto_element.val(1); xpathChanged();
|
479 |
});
|
480 |
-
$('.
|
481 |
$input.val('/' + $(this).attr('rel'));
|
482 |
-
if ($input.val() == $input.data('checkedValue')) return;
|
|
|
|
|
483 |
reset_filters();
|
|
|
484 |
$root_element.val($(this).attr('rel')); $goto_element.val(1); xpathChanged();
|
485 |
});
|
486 |
$input.change(function(){$goto_element.val(1); xpathChanged();}).change();
|
@@ -497,7 +1149,7 @@
|
|
497 |
|
498 |
/* Advanced Filtering */
|
499 |
|
500 |
-
$('.filtering_rules').
|
501 |
handle: 'div',
|
502 |
items: 'li',
|
503 |
toleranceElement: '> div',
|
@@ -523,11 +1175,11 @@
|
|
523 |
html += '<input type="hidden" value="'+ $el.val() +'" class="pmxi_xml_element"/>';
|
524 |
html += '<input type="hidden" value="'+ $rule.val() +'" class="pmxi_rule"/>';
|
525 |
html += '<input type="hidden" value="'+ $val.val() +'" class="pmxi_value"/>';
|
526 |
-
html += '<span>' + $el.val() + ' <
|
527 |
html += '<span class="condition"> <label for="rule_and_'+relunumber+'">AND</label><input id="rule_and_'+relunumber+'" type="radio" value="and" name="rule_'+relunumber+'" checked="checked" class="rule_condition"/><label for="rule_or_'+relunumber+'">OR</label><input id="rule_or_'+relunumber+'" type="radio" value="or" name="rule_'+relunumber+'" class="rule_condition"/> </span>';
|
528 |
html += '</div><a href="javascript:void(0);" class="icon-item remove-ico"></a></li>';
|
529 |
|
530 |
-
$('#apply_filters').show();
|
531 |
$('#filtering_rules').find('p').hide();
|
532 |
|
533 |
$('.filtering_rules').append(html);
|
@@ -561,7 +1213,9 @@
|
|
561 |
|
562 |
var xpath_builder = function(rules_box, lvl){
|
563 |
|
564 |
-
var rules = rules_box.children('li');
|
|
|
|
|
565 |
|
566 |
if (lvl && rules.length > 1) filter += ' (';
|
567 |
|
@@ -581,7 +1235,10 @@
|
|
581 |
attr_name = node.split('@')[1];
|
582 |
}
|
583 |
|
584 |
-
|
|
|
|
|
|
|
585 |
|
586 |
if (is_attr) filter += '[@' + attr_name;
|
587 |
|
@@ -589,6 +1246,9 @@
|
|
589 |
case 'equals':
|
590 |
filter += ' = "%s"';
|
591 |
break;
|
|
|
|
|
|
|
592 |
case 'greater':
|
593 |
filter += ' > %s';
|
594 |
break;
|
@@ -637,9 +1297,7 @@
|
|
637 |
var xpath = $('input[name=xpath]').val();
|
638 |
|
639 |
filter = '[';
|
640 |
-
|
641 |
xpath_builder($('.filtering_rules'), 0);
|
642 |
-
|
643 |
filter += ']';
|
644 |
|
645 |
$input.val( $input.val().split('[')[0] + filter);
|
@@ -649,34 +1307,53 @@
|
|
649 |
});
|
650 |
});
|
651 |
|
652 |
-
$('form.choose-elements').find('input[type="submit"]').click(function(e){
|
653 |
e.preventDefault();
|
654 |
if (go_to_template) $(this).parents('form:first').submit();
|
655 |
});
|
656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
// tag preview
|
658 |
$.fn.tag = function () {
|
659 |
this.each(function () {
|
|
|
|
|
|
|
660 |
var $tag = $(this);
|
661 |
$tag.xml('dragable');
|
662 |
var tagno = parseInt($tag.find('input[name="tagno"]').val());
|
|
|
|
|
663 |
$tag.find('.navigation a').live('click', function () {
|
664 |
tagno += '#prev' == $(this).attr('href') ? -1 : 1;
|
665 |
$tag.addClass('loading').css('opacity', 0.7);
|
666 |
-
$.post(
|
667 |
var $indicator = $('<span />').insertBefore($tag);
|
668 |
$tag.replaceWith(data.html);
|
|
|
669 |
$indicator.next().tag().prevObject.remove();
|
670 |
if ($('#variations_xpath').length){
|
671 |
$('#variations_xpath').data('checkedValue', '').change();
|
672 |
-
}
|
673 |
-
|
674 |
-
var offset = $('.layout').offset();
|
675 |
-
if ($(document).scrollTop() > offset.top)
|
676 |
-
$('.tag').css({'top':(($(document).scrollTop() - offset.top) ? $(document).scrollTop() - offset.top : 0) + 'px'});
|
677 |
-
else
|
678 |
-
$('.tag').css({'top':''});
|
679 |
-
}
|
680 |
}, 'json');
|
681 |
return false;
|
682 |
});
|
@@ -684,67 +1361,93 @@
|
|
684 |
tagno = (parseInt($(this).val()) > parseInt($tag.find('.pmxi_count').html())) ? $tag.find('.pmxi_count').html() : ( (parseInt($(this).val())) ? $(this).val() : 1 );
|
685 |
$(this).val(tagno);
|
686 |
$tag.addClass('loading').css('opacity', 0.7);
|
687 |
-
$.post(
|
688 |
var $indicator = $('<span />').insertBefore($tag);
|
689 |
$tag.replaceWith(data.html);
|
|
|
690 |
$indicator.next().tag().prevObject.remove();
|
691 |
if ($('#variations_xpath').length){
|
692 |
$('#variations_xpath').data('checkedValue', '').change();
|
693 |
-
}
|
694 |
-
if ($('.layout').length){
|
695 |
-
var offset = $('.layout').offset();
|
696 |
-
if ($(document).scrollTop() > offset.top)
|
697 |
-
$('.tag').css({'top':(($(document).scrollTop() - offset.top) ? $(document).scrollTop() - offset.top : 0) + 'px'});
|
698 |
-
else
|
699 |
-
$('.tag').css({'top':''});
|
700 |
-
}
|
701 |
}, 'json');
|
702 |
return false;
|
703 |
});
|
704 |
-
});
|
705 |
return this;
|
706 |
};
|
707 |
$('.tag').tag();
|
708 |
// [/xml representation dynamic]
|
709 |
|
710 |
-
$('
|
711 |
-
$(this).autocomplete({
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
});
|
717 |
});
|
718 |
|
719 |
/* Categories hierarchy */
|
720 |
|
721 |
-
$('ol.sortable').
|
722 |
handle: 'div',
|
723 |
items: 'li.dragging',
|
724 |
toleranceElement: '> div',
|
725 |
update: function () {
|
726 |
-
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).
|
727 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
728 |
}
|
729 |
});
|
730 |
|
731 |
$('.drag-element').find('input').live('blur', function(){
|
732 |
-
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').
|
733 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
734 |
});
|
735 |
|
736 |
$('.drag-element').find('input').live('change', function(){
|
737 |
-
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').
|
738 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
739 |
});
|
740 |
|
741 |
$('.drag-element').find('input').live('hover', function(){},function(){
|
742 |
-
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').
|
743 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
744 |
});
|
745 |
|
746 |
$('.taxonomy_auto_nested').live('click', function(){
|
747 |
-
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('td:first').find('.ui-sortable:first').
|
748 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
749 |
});
|
750 |
|
@@ -756,14 +1459,15 @@
|
|
756 |
parent_td.find('ol.sortable:first').find('li').each(function(i, e){
|
757 |
$(this).attr({'id':'item_'+ (i+1)});
|
758 |
});
|
759 |
-
parent_td.find('.hierarhy-output').val(window.JSON.stringify(parent_td.find('.ui-sortable:first').
|
760 |
if (parent_td.find('input:first').val() == '') parent_td.find('.hierarhy-output').val('');
|
761 |
});
|
762 |
|
763 |
$('.add-new-ico').live('click', function(){
|
764 |
var count = $(this).parents('tr:first').find('ol.sortable').find('li.dragging').length + 1;
|
765 |
|
766 |
-
var $template = $(this).
|
|
|
767 |
$clone = $template.clone(true);
|
768 |
$clone.addClass('dragging').attr({'id': $clone.attr('id') + '_' + count}).find('input[type=checkbox][name^=categories_mapping]').each(function(){
|
769 |
$(this).attr({'id': $(this).attr('id') + '_' + count});
|
@@ -774,7 +1478,7 @@
|
|
774 |
|
775 |
var sortable = $(this).parents('.ui-sortable:first');
|
776 |
if (sortable.length){
|
777 |
-
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify(sortable.
|
778 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
779 |
}
|
780 |
$('.widefat').bind('focus', insertxpath );
|
@@ -785,62 +1489,96 @@
|
|
785 |
if ( ! $(this).children('li').not('.template').length ) $(this).next('.add-new-ico').click();
|
786 |
});
|
787 |
|
788 |
-
$('form.
|
789 |
|
790 |
e.preventDefault();
|
791 |
|
792 |
$('.hierarhy-output').each(function(){
|
793 |
var sortable = $(this).parents('td:first').find('.ui-sortable:first');
|
794 |
if (sortable.length){
|
795 |
-
$(this).val(window.JSON.stringify(sortable.
|
796 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).val('');
|
797 |
}
|
798 |
});
|
799 |
if ($(this).attr('name') == 'btn_save_only') $('.save_only').val('1');
|
800 |
|
801 |
-
$('input[name^=in_variations], input[name^=is_visible], input[name^=is_taxonomy], input[name^=create_taxonomy_in_not_exists], input[name^=variable_create_taxonomy_in_not_exists], input[name^=variable_in_variations], input[name^=variable_is_visible], input[name^=variable_is_taxonomy]
|
802 |
if ( ! $(this).is(':checked') && ! $(this).parents('.form-field:first').hasClass('template')){
|
803 |
$(this).val('0').attr('checked','checked');
|
804 |
}
|
805 |
});
|
806 |
|
807 |
-
$('.custom_type[rel=serialized]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
var values = new Array();
|
809 |
$(this).find('.form-field').each(function(){
|
810 |
-
if ($(this).find('.
|
811 |
{
|
812 |
-
var skey = $(this).find('.
|
813 |
-
if (''
|
814 |
-
values.push($(this).find('.serialized_value').val());
|
815 |
-
}
|
816 |
-
else
|
817 |
-
{
|
818 |
var obj = {};
|
819 |
-
obj[skey] = $(this).find('.
|
820 |
values.push(obj);
|
821 |
-
}
|
822 |
-
//values[skey] = $(this).find('.serialized_value').val();
|
823 |
|
824 |
}
|
825 |
});
|
826 |
-
$(this).find('input[name^=
|
827 |
});
|
828 |
|
|
|
|
|
829 |
$(this).parents('form:first').submit();
|
830 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
831 |
});
|
832 |
|
833 |
$('.add-new-custom').click(function(){
|
834 |
var $template = $(this).parents('table').first().children('tbody').children('tr.template');
|
835 |
$number = $(this).parents('table').first().children('tbody').children('tr').length - 2;
|
836 |
$clone = $template.clone(true);
|
837 |
-
|
838 |
-
|
839 |
-
});
|
840 |
-
$clone.find('
|
841 |
-
|
842 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
843 |
$clone.insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
|
|
844 |
return false;
|
845 |
});
|
846 |
|
@@ -849,36 +1587,38 @@
|
|
849 |
$template.clone(true).insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
850 |
});
|
851 |
|
852 |
-
|
853 |
-
|
854 |
-
$(this).parents('.form-field:first').find('.custom_type').hide();
|
855 |
-
if ($(this).is(':checked')){
|
856 |
-
$(this).parents('.form-field:first').find('div[rel=serialized]').show();
|
857 |
-
}
|
858 |
-
else{
|
859 |
-
$(this).parents('.form-field:first').find('div[rel=default]').show();
|
860 |
-
}
|
861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
862 |
});
|
863 |
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
|
|
|
|
|
|
882 |
});
|
883 |
});
|
884 |
|
@@ -906,83 +1646,12 @@
|
|
906 |
|
907 |
/* END plupload scripts */
|
908 |
|
909 |
-
if ($('#large_import_toggle').is(':checked')) $('#large_import_xpath').slideToggle();
|
910 |
-
|
911 |
-
$('#large_import_toggle').click(function(){
|
912 |
-
$('#large_import_xpath').slideToggle();
|
913 |
-
});
|
914 |
-
|
915 |
-
// Step 4 - custom meta keys helper
|
916 |
-
$('.existing_meta_keys').change(function(){
|
917 |
-
|
918 |
-
var parent_fieldset = $(this).parents('fieldset').first();
|
919 |
-
var key = $(this).find('option:selected').val();
|
920 |
-
|
921 |
-
if ("" != $(this).val()) {
|
922 |
-
|
923 |
-
parent_fieldset.find('input[name^=custom_name]:visible').each(function(){
|
924 |
-
if ("" == $(this).val()) $(this).parents('tr').first().remove();
|
925 |
-
});
|
926 |
-
parent_fieldset.find('a.add-new-custom').click();
|
927 |
-
parent_fieldset.find('input[name^=custom_name]:visible').last().val($(this).val());
|
928 |
-
|
929 |
-
$(this).prop('selectedIndex',0);
|
930 |
-
|
931 |
-
parent_fieldset.addClass('loading');
|
932 |
-
|
933 |
-
$.post('admin.php?page=pmxi-admin-settings&action=meta_values', {key: key}, function (data) {
|
934 |
-
|
935 |
-
parent_fieldset.find('input[name^=custom_name]:visible:last').after(data.html);
|
936 |
-
|
937 |
-
parent_fieldset.removeClass('loading');
|
938 |
-
|
939 |
-
}, 'json');
|
940 |
-
}
|
941 |
-
|
942 |
-
});
|
943 |
-
|
944 |
-
$('input[name^=custom_name]').live('change', function(){
|
945 |
-
|
946 |
-
var $ths = $(this);
|
947 |
-
$ths.parents('fieldset:first').addClass('loading');
|
948 |
-
$.post('admin.php?page=pmxi-admin-settings&action=meta_values', {key: $ths.val()}, function (data) {
|
949 |
-
$ths.parents('td:first').find('.ex_values').remove();
|
950 |
-
$ths.after(data.html);
|
951 |
-
$ths.parents('fieldset:first').removeClass('loading');
|
952 |
-
}, 'json');
|
953 |
-
|
954 |
-
});
|
955 |
-
|
956 |
-
$('.existing_meta_values').live('change', function(){
|
957 |
-
var parent_fieldset = $(this).parents('.form-field:first');
|
958 |
-
if ($(this).val() != ""){
|
959 |
-
parent_fieldset.find('textarea').val($(this).val());
|
960 |
-
$(this).prop('selectedIndex', 0);
|
961 |
-
}
|
962 |
-
});
|
963 |
-
|
964 |
-
if ($('#upload_process').length){
|
965 |
-
$('#upload_process').progressbar({ value: (($('#progressbar').html() != '') ? 100 : 0) });
|
966 |
-
if ($('#progressbar').html() != '')
|
967 |
-
$('.submit-buttons').show();
|
968 |
-
}
|
969 |
-
|
970 |
$('#view_log').live('click', function(){
|
971 |
$('#import_finished').css({'visibility':'hidden'});
|
972 |
$('#logwrapper').slideToggle(100, function(){
|
973 |
$('#import_finished').css({'visibility':'visible'});
|
974 |
});
|
975 |
-
});
|
976 |
-
|
977 |
-
$(document).scroll(function() {
|
978 |
-
if ($('.layout').length){
|
979 |
-
var offset = $('.layout').offset();
|
980 |
-
if ($(document).scrollTop() > offset.top)
|
981 |
-
$('.tag').css({'top':(($(document).scrollTop() - offset.top) ? $(document).scrollTop() - offset.top : 0) + 'px'});
|
982 |
-
else
|
983 |
-
$('.tag').css({'top':''});
|
984 |
-
}
|
985 |
-
});
|
986 |
|
987 |
// Select Encoding
|
988 |
$('#import_encoding').live('change', function(){
|
@@ -996,7 +1665,7 @@
|
|
996 |
$('#add_encoding').hide();
|
997 |
$('#select_encoding').show();
|
998 |
$('#new_encoding').val('');
|
999 |
-
$('#import_encoding').prop('selectedIndex',0);
|
1000 |
});
|
1001 |
|
1002 |
$('#add_new_encoding').live('click', function(){
|
@@ -1014,12 +1683,20 @@
|
|
1014 |
});
|
1015 |
|
1016 |
$('.pmxi_choosen').each(function(){
|
1017 |
-
$(this).find(".choosen_input").select2({
|
|
|
|
|
|
|
1018 |
});
|
1019 |
|
1020 |
-
|
|
|
|
|
|
|
|
|
|
|
1021 |
$(this).pointer({
|
1022 |
-
content: $('#
|
1023 |
position: {
|
1024 |
edge: 'right',
|
1025 |
align: 'center'
|
@@ -1030,12 +1707,106 @@
|
|
1030 |
pointer: 'pksn1',
|
1031 |
action: 'dismiss-wp-pointer'
|
1032 |
});
|
|
|
1033 |
}
|
1034 |
}).pointer('open');
|
1035 |
});
|
1036 |
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1041 |
});})(jQuery);
|
2 |
* plugin admin area javascript
|
3 |
*/
|
4 |
(function($){$(function () {
|
5 |
+
if ( ! $('body.wpallimport-plugin').length) return; // do not execute any code if we are not on plugin page
|
6 |
+
|
7 |
+
// fix wpallimport-layout position
|
8 |
setTimeout(function () {
|
9 |
+
$('table.wpallimport-layout').length && $('table.wpallimport-layout td.left h2:first-child').css('margin-top', $('.wrap').offset().top - $('table.wpallimport-layout').offset().top);
|
10 |
}, 10);
|
11 |
|
12 |
// help icons
|
13 |
+
$('a.wpallimport-help').tipsy({
|
14 |
gravity: function() {
|
15 |
var ver = 'n';
|
16 |
if ($(document).scrollTop() < $(this).offset().top - $('.tipsy').height() - 2) {
|
44 |
|
45 |
var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
46 |
if (is_show) {
|
47 |
+
$targets.slideDown();
|
48 |
+
} else {
|
49 |
+
$targets.slideUp().find('.clear-on-switch').add($targets.filter('.clear-on-switch')).val('');
|
50 |
+
}
|
51 |
+
}).change();
|
52 |
+
|
53 |
+
// swither show/hide logic
|
54 |
+
$('input.switcher-horizontal').live('change', function (e) {
|
55 |
+
|
56 |
+
if ($(this).is(':radio:checked')) {
|
57 |
+
$(this).parents('form').find('input.switcher-horizontal:radio[name="' + $(this).attr('name') + '"]').not(this).change();
|
58 |
+
}
|
59 |
+
var $targets = $('.switcher-target-' + $(this).attr('id'));
|
60 |
+
|
61 |
+
var is_show = $(this).is(':checked'); if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
62 |
+
if (is_show) {
|
63 |
+
$targets.animate({width:'toggle'}, 350);
|
64 |
} else {
|
65 |
+
$targets.animate({width:'toggle'}, 1000).find('.clear-on-switch').add($targets.filter('.clear-on-switch')).val('');
|
66 |
}
|
67 |
}).change();
|
68 |
|
116 |
$(this).parent().find('.datepicker.range-from').datepicker("option", "maxDate", date);
|
117 |
}
|
118 |
}).change();
|
119 |
+
$('.ui-datepicker').hide(); // fix: make sure datepicker doesn't break wordpress wpallimport-layout upon initialization
|
120 |
|
121 |
// no-enter-submit forms
|
122 |
$('form.no-enter-submit').find('input,select,textarea').not('*[type="submit"]').keydown(function (e) {
|
123 |
if (13 == e.keyCode) e.preventDefault();
|
124 |
});
|
125 |
|
126 |
+
$('a.collapser').each(function(){
|
127 |
+
if ($(this).html() == "+"){
|
128 |
+
$(this).parents('div:first').find('.collapser_content:first').hide();
|
129 |
+
}
|
130 |
+
else{
|
131 |
+
$(this).parents('div:first').find('.collapser_content:first').fadeIn();
|
132 |
+
}
|
133 |
+
$(this).next('h3').css({'cursor':'pointer'});
|
134 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
$('a.collapser').click(function(){
|
137 |
+
if ($(this).html() == "+") {
|
138 |
+
$(this).html("-");
|
139 |
+
$(this).parents('div:first').find('.collapser_content:first').fadeIn();
|
140 |
+
} else {
|
141 |
+
$(this).html("+");
|
142 |
+
$(this).parents('div:first').find('.collapser_content:first').hide();
|
143 |
+
}
|
144 |
+
});
|
145 |
+
|
146 |
+
$('a.collapser').each(function(){
|
147 |
+
$(this).parents('.fieldset:first').find('h3:first').click(function(){
|
148 |
+
$(this).prev('a.collapser').click();
|
|
|
149 |
});
|
150 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
$('.change_file').each(function(){
|
153 |
+
|
154 |
+
var $wrap = $('.wrap');
|
155 |
+
|
156 |
+
var formHeight = $wrap.height();
|
157 |
+
|
158 |
+
var fixWrapHeight = false;
|
159 |
+
|
160 |
+
$('#custom_type_selector').ddslick({
|
161 |
+
width: 590,
|
162 |
+
onSlideDownOptions: function(o){
|
163 |
+
formHeight = $wrap.height();
|
164 |
+
$wrap.css({'height': formHeight + $('#custom_type_selector').find('.dd-options').height() + 'px'});
|
165 |
+
},
|
166 |
+
onSlideUpOptions: function(o){
|
167 |
+
$wrap.css({'height': formHeight + 'px'});
|
168 |
+
},
|
169 |
+
onSelected: function(selectedData){
|
170 |
+
if (fixWrapHeight)
|
171 |
+
$wrap.css({'height': formHeight + 'px'});
|
172 |
+
else
|
173 |
+
fixWrapHeight = true;
|
174 |
+
$('input[name=custom_type]').val(selectedData.selectedData.value);
|
175 |
+
$('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
|
176 |
+
}
|
177 |
});
|
178 |
+
|
179 |
+
$('.wpallimport-import-from').click(function(){
|
180 |
+
$('.wpallimport-import-from').removeClass('selected').addClass('bind');
|
181 |
+
$(this).addClass('selected').removeClass('bind');
|
182 |
+
$('.change_file').find('.wpallimport-upload-type-container').hide();
|
183 |
+
$('.change_file').find('.wpallimport-file-upload-result').attr('rel', $(this).attr('rel'));
|
184 |
+
$('.change_file').find('.wpallimport-upload-type-container[rel=' + $(this).attr('rel') + ']').show();
|
185 |
+
$('.change_file').find('#wpallimport-url-upload-status').html('');
|
186 |
+
//$('.change_file').find('input[name=new_type]').val( $(this).attr('rel').replace('_type', '') );
|
187 |
+
if ($(this).attr('rel') == 'upload_type'){
|
188 |
+
$('input[type=file]').click();
|
189 |
+
}
|
190 |
});
|
191 |
+
$('.wpallimport-import-from.selected').click();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
|
|
|
|
|
|
|
193 |
});
|
194 |
+
|
195 |
+
$('input[name=url]').change(function(){
|
196 |
+
|
197 |
+
}).keyup(function (e) {
|
198 |
+
if ($(this).val() != ''){
|
199 |
+
$('.wpallimport-url-icon').addClass('focus');
|
200 |
+
$(this).addClass('focus');
|
201 |
+
}
|
202 |
+
else{
|
203 |
+
$('.wpallimport-url-icon').removeClass('focus');
|
204 |
+
$(this).removeClass('focus');
|
205 |
+
}
|
206 |
+
}).focus(function(){
|
207 |
+
if ($(this).val() == 'Enter a web address to download the file from...')
|
208 |
+
$(this).val('');
|
209 |
+
}).blur(function(){
|
210 |
+
if($(this).val() == '')
|
211 |
+
$(this).val('Enter a web address to download the file from...');
|
212 |
});
|
213 |
+
|
214 |
+
// enter-submit form on step 1
|
215 |
+
$('.wpallimport-step-1').each(function(){
|
216 |
+
|
217 |
+
var $wrap = $('.wrap');
|
218 |
+
|
219 |
+
var formHeight = $wrap.height();
|
220 |
+
|
221 |
+
$('.wpallimport-import-from').click(function(){
|
222 |
+
|
223 |
+
var showImportType = false;
|
224 |
+
|
225 |
+
switch ($(this).attr('rel')){
|
226 |
+
case 'upload_type':
|
227 |
+
if ($('input[name=filepath]').val() != '')
|
228 |
+
showImportType = true;
|
229 |
+
break;
|
230 |
+
case 'url_type':
|
231 |
+
if ($('input[name=url]').val() != '')
|
232 |
+
showImportType = false;
|
233 |
+
break;
|
234 |
+
case 'file_type':
|
235 |
+
if ($('input[name=file]').val() != '')
|
236 |
+
showImportType = false;
|
237 |
+
break;
|
238 |
+
}
|
239 |
+
|
240 |
+
$('.wpallimport-import-from').removeClass('selected').addClass('bind');
|
241 |
+
$('.wpallimport-import-types').find('h2').slideUp();
|
242 |
+
$(this).addClass('selected').removeClass('bind');
|
243 |
+
$('.wpallimport-choose-file').find('.wpallimport-upload-type-container').hide();
|
244 |
+
$('.wpallimport-choose-file').find('.wpallimport-file-upload-result').attr('rel', $(this).attr('rel'));
|
245 |
+
$('.wpallimport-choose-file').find('.wpallimport-upload-type-container[rel=' + $(this).attr('rel') + ']').show();
|
246 |
+
$('.wpallimport-choose-file').find('#wpallimport-url-upload-status').html('');
|
247 |
+
$('.wpallimport-choose-file').find('input[name=type]').val( $(this).attr('rel').replace('_type', '') );
|
248 |
+
if ($(this).attr('rel') == 'upload_type'){
|
249 |
+
$('input[type=file]').click();
|
250 |
+
}
|
251 |
+
if ( ! showImportType){
|
252 |
+
$('.wpallimport-choose-file').find('.wpallimport-upload-resource-step-two').slideUp();
|
253 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').hide();
|
254 |
+
}
|
255 |
+
else{
|
256 |
+
$('.wpallimport-choose-file').find('.wpallimport-upload-resource-step-two').slideDown();
|
257 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').show();
|
258 |
+
}
|
259 |
+
});
|
260 |
+
$('.wpallimport-import-from.selected').click();
|
261 |
+
|
262 |
+
$('.wpallimport-download-from-url').click(function(){
|
263 |
+
|
264 |
+
$(this).parents('.wpallimport-upload-type-container').find('.wpallimport-free-edition-notice').slideDown();
|
265 |
+
|
266 |
+
});
|
267 |
+
|
268 |
+
var fixWrapHeight = false;
|
269 |
+
|
270 |
+
$('#custom_type_selector').ddslick({
|
271 |
+
width: 300,
|
272 |
+
onSlideDownOptions: function(o){
|
273 |
+
formHeight = $wrap.height();
|
274 |
+
$wrap.css({'height': formHeight + $('#custom_type_selector').find('.dd-options').height() + 'px'});
|
275 |
+
},
|
276 |
+
onSlideUpOptions: function(o){
|
277 |
+
$wrap.css({'height': formHeight + 'px'});
|
278 |
+
},
|
279 |
+
onSelected: function(selectedData){
|
280 |
+
if (fixWrapHeight)
|
281 |
+
$wrap.css({'height': formHeight + 'px'});
|
282 |
+
else
|
283 |
+
fixWrapHeight = true;
|
284 |
+
|
285 |
+
$('input[name=custom_type]').val(selectedData.selectedData.value);
|
286 |
+
|
287 |
+
if ($('.wpallimport-upload-resource-step-two:visible').length){
|
288 |
+
$('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
|
289 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').show();
|
290 |
+
}
|
291 |
+
else{
|
292 |
+
$('#custom_type_selector').find('.dd-selected').css({'color':'#555'});
|
293 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').hide();
|
294 |
+
}
|
295 |
+
}
|
296 |
+
});
|
297 |
+
|
298 |
+
$('.wpallimport-import-to').click(function(){
|
299 |
+
if ($(this).attr('rel') == 'new'){
|
300 |
+
$('.wpallimport-new-records').show();
|
301 |
+
$('.wpallimport-existing-records').hide();
|
302 |
+
}
|
303 |
+
else{
|
304 |
+
$('.wpallimport-new-records').hide();
|
305 |
+
$('.wpallimport-existing-records').show();
|
306 |
+
}
|
307 |
+
$('.wpallimport-import-to').removeClass('wpallimport-import-to-checked');
|
308 |
+
$(this).addClass('wpallimport-import-to-checked');
|
309 |
+
$('input[name=wizard_type]').val($(this).attr('rel'));
|
310 |
+
$('.wpallimport-choose-import-direction').attr({'rel' : $(this).attr('rel')});
|
311 |
+
$('.dd-container').fadeIn();
|
312 |
+
});
|
313 |
+
|
314 |
+
$('#custom_type_selector').hide();
|
315 |
+
|
316 |
+
$('.wpallimport-import-to.wpallimport-import-to-checked').click();
|
317 |
+
|
318 |
});
|
319 |
+
//[/End Step 1]
|
320 |
|
321 |
+
// template form: auto submit when `load template` list value is picked
|
322 |
+
$('form.wpallimport-template').find('select[name="load_template"]').live('change', function () {
|
323 |
+
$(this).parents('form').submit();
|
324 |
+
});
|
325 |
|
326 |
+
var serialize_ctx_mapping = function(){
|
327 |
+
$('.custom_type[rel=tax_mapping]').each(function(){
|
328 |
+
var values = new Array();
|
329 |
+
$(this).find('.form-field').each(function(){
|
330 |
+
if ($(this).find('.mapping_to').val() != "")
|
331 |
+
{
|
332 |
+
var skey = $(this).find('.mapping_from').val();
|
333 |
+
if ('' != skey){
|
334 |
+
var obj = {};
|
335 |
+
obj[skey] = $(this).find('.mapping_to').val();
|
336 |
+
values.push(obj);
|
337 |
+
}
|
338 |
+
}
|
339 |
+
});
|
340 |
+
$(this).find('input[name^=tax_mapping]').val(window.JSON.stringify(values));
|
341 |
+
});
|
342 |
+
};
|
343 |
|
344 |
// [xml representation dynamic]
|
345 |
$.fn.xml = function (opt) {
|
439 |
}, 500);
|
440 |
}
|
441 |
});
|
442 |
+
|
443 |
+
this.find('.xml-tag.opening > .xml-tag-name, .xml-attr-name, .csv-tag.opening > .csv-tag-name, .ui-menu-item').each(function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
var $this = $(this);
|
445 |
var xpath = '.';
|
446 |
if ($this.is('.xml-attr-name'))
|
447 |
xpath = '{' + ($this.parents('.xml-element:first').attr('title').replace(/^\/[^\/]+\/?/, '') || '.') + '/@' + $this.html().trim() + '}';
|
448 |
+
else if($this.is('.ui-menu-item'))
|
449 |
+
xpath = '{' + ($this.attr('title').replace(/^\/[^\/]+\/?/, '') || '.') + '}';
|
450 |
else
|
451 |
xpath = '{' + ($this.parent().parent().attr('title').replace(/^\/[^\/]+\/?/, '') || '.') + '}';
|
452 |
|
458 |
return this;
|
459 |
};
|
460 |
|
461 |
+
// template form: preview button
|
462 |
+
$('form.wpallimport-template').each(function () {
|
463 |
+
var $form = $(this);
|
464 |
+
|
465 |
+
var $detected_cf = new Array();
|
466 |
+
|
467 |
+
$form.find('.preview, .preview_images, .preview_taxonomies, .preview_prices').click(function () {
|
468 |
+
var $preview_type = $(this).attr('rel');
|
469 |
+
|
470 |
+
if ($preview_type == 'preview_taxonomies') serialize_ctx_mapping();
|
471 |
+
|
472 |
+
var $URL = 'admin.php?page=pmxi-admin-import&action=' + $preview_type + ((typeof import_id != "undefined") ? '&id=' + import_id : '');
|
473 |
+
var $tagURL = 'admin.php?page=pmxi-admin-import&action=tag' + ((typeof import_id != "undefined") ? '&id=' + import_id : '');
|
474 |
+
|
475 |
+
$('.wpallimport-overlay').show();
|
476 |
+
|
477 |
+
var $ths = $(this);
|
478 |
+
|
479 |
+
$(this).pointer({
|
480 |
+
content: '<div class="wpallimport-preview-preload wpallimport-pointer-' + $preview_type + '"></div>',
|
481 |
+
position: {
|
482 |
+
edge: 'right',
|
483 |
+
align: 'center'
|
484 |
+
},
|
485 |
+
pointerWidth: ($preview_type == 'preview_images') ? 800 : 715,
|
486 |
+
close: function() {
|
487 |
+
$.post( ajaxurl, {
|
488 |
+
pointer: 'pksn1',
|
489 |
+
action: 'dismiss-wp-pointer'
|
490 |
+
});
|
491 |
+
$('.wpallimport-overlay').hide();
|
492 |
+
}
|
493 |
+
}).pointer('open');
|
494 |
+
|
495 |
+
var $pointer = $('.wpallimport-pointer-' + $preview_type).parents('.wp-pointer').first();
|
496 |
+
|
497 |
+
var $leftOffset = ($(window).width() - (($preview_type == 'preview_images') ? 800 : 715))/2;
|
498 |
+
|
499 |
+
$pointer.css({'position':'fixed', 'top' : '15%', 'left' : $leftOffset + 'px'});
|
500 |
+
|
501 |
+
if (tinyMCE != undefined) tinyMCE.triggerSave(false, false);
|
502 |
+
|
503 |
+
$.post($URL, $form.serialize(), function (response) {
|
504 |
+
|
505 |
+
$ths.pointer({'content' : response.html});
|
506 |
+
|
507 |
+
$pointer.css({'position':'fixed', 'top' : '15%', 'left' : $leftOffset + 'px'});
|
508 |
+
|
509 |
+
var $preview = $('.wpallimport-' + $preview_type);
|
510 |
+
|
511 |
+
$preview.parent('.wp-pointer-content').removeClass('wp-pointer-content').addClass('wpallimport-pointer-content');
|
512 |
+
|
513 |
+
var $tag = $('.tag');
|
514 |
+
var tagno = parseInt($tag.find('input[name="tagno"]').val());
|
515 |
+
$preview.find('.navigation a').unbind('click').die('click').live('click', function () {
|
516 |
+
tagno += '#prev' == $(this).attr('href') ? -1 : 1;
|
517 |
+
$tag.addClass('loading').css('opacity', 0.7);
|
518 |
+
$preview.addClass('loading').css('opacity', 0.7);
|
519 |
+
$.post($tagURL, {tagno: tagno, import_action: import_action}, function (data) {
|
520 |
+
var $indicator = $('<span />').insertBefore($tag);
|
521 |
+
$tag.replaceWith(data.html);
|
522 |
+
fix_tag_position();
|
523 |
+
$indicator.next().tag().prevObject.remove();
|
524 |
+
if ($('#variations_xpath').length){
|
525 |
+
$('#variations_xpath').data('checkedValue', '').change();
|
526 |
+
}
|
527 |
+
$preview.find('input[name="tagno"]').die();
|
528 |
+
$preview.find('.navigation a').die('click');
|
529 |
+
$form.find('.' + $preview_type).click();
|
530 |
+
|
531 |
+
}, 'json');
|
532 |
+
return false;
|
533 |
+
});
|
534 |
+
$preview.find('input[name="tagno"]').unbind('click').die('click').live('change', function () {
|
535 |
+
tagno = (parseInt($(this).val()) > parseInt($preview.find('.pmxi_count').html())) ? $preview.find('.pmxi_count').html() : ( (parseInt($(this).val())) ? $(this).val() : 1 );
|
536 |
+
$tag.addClass('loading').css('opacity', 0.7);
|
537 |
+
$.post($tagURL, {tagno: tagno}, function (data) {
|
538 |
+
var $indicator = $('<span />').insertBefore($tag);
|
539 |
+
$tag.replaceWith(data.html);
|
540 |
+
fix_tag_position();
|
541 |
+
$indicator.next().tag().prevObject.remove();
|
542 |
+
if ($('#variations_xpath').length){
|
543 |
+
$('#variations_xpath').data('checkedValue', '').change();
|
544 |
+
}
|
545 |
+
$preview.find('input[name="tagno"]').die();
|
546 |
+
$preview.find('.navigation a').die('click');
|
547 |
+
$form.find('.' + $preview_type).click();
|
548 |
+
}, 'json');
|
549 |
+
return false;
|
550 |
+
});
|
551 |
+
|
552 |
+
}, 'json');
|
553 |
+
return false;
|
554 |
+
});
|
555 |
+
|
556 |
+
$form.find('.set_encoding').live('click', function(e){
|
557 |
+
e.preventDefault();
|
558 |
+
$form.find('a[rel="preview"].preview').click();
|
559 |
+
});
|
560 |
+
if ($('input[name=download_images]:checked').val() == 'no'){
|
561 |
+
$('#advanced_options_files').find('p:first').show();
|
562 |
+
$('#advanced_options_files').find('input').attr({'disabled':'disabled'});
|
563 |
+
}
|
564 |
+
$('input[name=download_images]').change(function(){
|
565 |
+
if ($('input[name=download_images]:checked').val() == 'no'){
|
566 |
+
$('#advanced_options_files').find('p:first').show();
|
567 |
+
$('#advanced_options_files').find('input').attr({'disabled':'disabled'});
|
568 |
+
}
|
569 |
+
else{
|
570 |
+
$('#advanced_options_files').find('p:first').hide();
|
571 |
+
$('#advanced_options_files').find('input').removeAttr('disabled');
|
572 |
+
}
|
573 |
+
});
|
574 |
+
|
575 |
+
// Auto-detect custom fields
|
576 |
+
$form.find('.auto_detect_cf').click(function(){
|
577 |
+
|
578 |
+
var parent = $(this).parents('.wpallimport-collapsed-content:first');
|
579 |
+
var request = {
|
580 |
+
action:'auto_detect_cf',
|
581 |
+
fields: $('#existing_meta_keys').val().split(','),
|
582 |
+
post_type: $('input[name=custom_type]').val()
|
583 |
+
};
|
584 |
+
$(this).attr({'disabled':'disabled'});
|
585 |
+
|
586 |
+
var $indicator = $('<span class="img_preloader" style="top:0;"/>').insertBefore($(this)).show();
|
587 |
+
|
588 |
+
var ths = $(this);
|
589 |
+
|
590 |
+
$.ajax({
|
591 |
+
type: 'POST',
|
592 |
+
url: ajaxurl,
|
593 |
+
data: request,
|
594 |
+
success: function(response) {
|
595 |
+
|
596 |
+
parent.find('input[name^=custom_name]:visible').each(function(){
|
597 |
+
if ("" == $(this).val()) $(this).parents('tr').first().remove();
|
598 |
+
});
|
599 |
+
|
600 |
+
$detected_cf = response.result;
|
601 |
+
|
602 |
+
var $added_fields_count = 0;
|
603 |
+
if (response.result.length){
|
604 |
+
for (var i = 0; i < response.result.length; i++){
|
605 |
+
var allow_add = true;
|
606 |
+
parent.find('input[name^=custom_name]:visible').each(function(){
|
607 |
+
if (response.result[i].key == "" || response.result[i].key == $(this).val()) {
|
608 |
+
allow_add = false;
|
609 |
+
return false;
|
610 |
+
}
|
611 |
+
});
|
612 |
+
// if this field doesn't present in custom fields section then put it there
|
613 |
+
if ( allow_add ){
|
614 |
+
parent.find('a.add-new-custom').click();
|
615 |
+
var fieldParent = parent.find('.form-field:visible').last();
|
616 |
+
fieldParent.find('input[name^=custom_name]:visible').last().val(response.result[i].key);
|
617 |
+
fieldParent.find('textarea[name^=custom_value]:visible').last().val(response.result[i].val);
|
618 |
+
if (response.result[i].is_serialized) fieldParent.find('.set_serialize').last().parent().click();
|
619 |
+
$added_fields_count++;
|
620 |
+
}
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
$indicator.remove();
|
625 |
+
|
626 |
+
$('.cf_detected').html(response.msg);
|
627 |
+
$('.cf_welcome').hide();
|
628 |
+
$('.cf_detect_result').fadeIn();
|
629 |
+
|
630 |
+
ths.removeAttr('disabled');
|
631 |
+
},
|
632 |
+
error: function(request) {
|
633 |
+
$indicator.remove();
|
634 |
+
ths.removeAttr('disabled');
|
635 |
+
},
|
636 |
+
dataType: "json"
|
637 |
+
});
|
638 |
+
});
|
639 |
+
|
640 |
+
// Clear all detected custom fields
|
641 |
+
$form.find('.clear_detected_cf').click(function(){
|
642 |
+
if ($detected_cf.length){
|
643 |
+
var parent = $(this).parents('.wpallimport-collapsed-content:first');
|
644 |
+
for (var i = 0; i < $detected_cf.length; i++){
|
645 |
+
parent.find('input[name^=custom_name]:visible').each(function(){
|
646 |
+
if ($detected_cf[i].key == $(this).val()) $(this).parents('tr').first().remove();
|
647 |
+
});
|
648 |
+
}
|
649 |
+
}
|
650 |
+
if ( ! parent.find('input[name^=custom_name]:visible').length){
|
651 |
+
parent.find('a.add-new-custom').click();
|
652 |
+
}
|
653 |
+
$('.cf_detected').html('');
|
654 |
+
$('.cf_detect_result').hide();
|
655 |
+
$('.cf_welcome').fadeIn();
|
656 |
+
$detected_cf = new Array();
|
657 |
+
});
|
658 |
+
|
659 |
+
// toggle custom field as serialized/default
|
660 |
+
$form.find('.wpallimport-cf-menu li').live('click', function(){
|
661 |
+
var $triggerEvent = $(this).find('a');
|
662 |
+
if ($triggerEvent.hasClass('set_serialize')){
|
663 |
+
var parent = $triggerEvent.parents('.form-field:first');
|
664 |
+
var parent_custom_format = parent.find('input[name^=custom_format]:first');
|
665 |
+
var parent_custom_value = parent.find('textarea[name^=custom_value]:first');
|
666 |
+
if (parseInt(parent_custom_format.val())){
|
667 |
+
parent_custom_format.val(0);
|
668 |
+
parent.find('.specify_cf:first').hide();
|
669 |
+
parent_custom_value.fadeIn();
|
670 |
+
$triggerEvent.parent().removeClass('active');
|
671 |
+
}
|
672 |
+
else{
|
673 |
+
parent_custom_format.val(1);
|
674 |
+
parent_custom_value.hide();
|
675 |
+
parent.find('.specify_cf:first').fadeIn();
|
676 |
+
$triggerEvent.parent().addClass('active');
|
677 |
+
}
|
678 |
+
}
|
679 |
+
});
|
680 |
+
|
681 |
+
// [Serialized custom fields]
|
682 |
+
|
683 |
+
// Save serialized custom field format
|
684 |
+
$('.save_sf').live('click', function(){
|
685 |
+
var $source = $(this).parents('table:first');
|
686 |
+
var $destination = $('div#' + $source.attr('rel'));
|
687 |
+
$destination.find('table:first').html('');
|
688 |
+
$source.find('input').each(function(i, e){
|
689 |
+
$(this).attr("value", $(this).val());
|
690 |
+
});
|
691 |
+
$destination.find('table:first').html($source.html());
|
692 |
+
$destination.parents('td:first').find('.pmxi_cf_pointer').pointer('destroy');
|
693 |
+
$('.wpallimport-overlay').hide();
|
694 |
+
});
|
695 |
+
|
696 |
+
// Auto-detect serialized custom fields
|
697 |
+
$('.auto_detect_sf').live('click', function(){
|
698 |
+
var $source = $(this).parents('table:first');
|
699 |
+
var $destination = $('div#' + $source.attr('rel'));
|
700 |
+
var $parentDestination = $destination.parents('tr:first');
|
701 |
+
var $cf_name = $parentDestination.find('input[name^=custom_name]:first').val();
|
702 |
+
|
703 |
+
if ($cf_name != ''){
|
704 |
+
var request = {
|
705 |
+
action:'auto_detect_sf',
|
706 |
+
post_type: $('input[name=custom_type]').val(),
|
707 |
+
name: $cf_name
|
708 |
+
};
|
709 |
+
$(this).attr({'disabled':'disabled'});
|
710 |
+
|
711 |
+
var $indicator = $('<span class="img_preloader" style="position: absolute; top:0;"/>').insertBefore($(this)).show();
|
712 |
+
var ths = $(this);
|
713 |
+
|
714 |
+
$.ajax({
|
715 |
+
type: 'POST',
|
716 |
+
url: ajaxurl,
|
717 |
+
data: request,
|
718 |
+
success: function(response) {
|
719 |
+
|
720 |
+
if (response.result.length){
|
721 |
+
|
722 |
+
$destination.find('tr.form-field').each(function(){
|
723 |
+
if ( ! $(this).hasClass('template') ) $(this).remove();
|
724 |
+
});
|
725 |
+
|
726 |
+
for (var i = 0; i < response.result.length; i++){
|
727 |
+
|
728 |
+
$destination.find('a.add-new-key').click();
|
729 |
+
$destination.find('tr.form-field').not('.template').last().css({"opacity": 1}).find('input.serialized_key').attr("value", response.result[i].key);
|
730 |
+
$destination.find('tr.form-field').not('.template').last().css({"opacity": 1}).find('input.serialized_value').attr("value", response.result[i].val);
|
731 |
+
|
732 |
+
}
|
733 |
+
|
734 |
+
$destination.parents('td:first').find('.pmxi_cf_pointer').pointer('destroy');
|
735 |
+
$destination.parents('td:first').find('.pmxi_cf_pointer').click();
|
736 |
+
}
|
737 |
+
else{
|
738 |
+
|
739 |
+
var $notice = $('<p style="color:red; position: absolute; top: -10px; padding:0; margin:0;">No fields detected.</p>').insertBefore(ths).show();
|
740 |
+
setTimeout(function() {
|
741 |
+
|
742 |
+
$notice.slideUp().remove();
|
743 |
+
|
744 |
+
}, 2500);
|
745 |
+
}
|
746 |
+
|
747 |
+
$indicator.remove();
|
748 |
+
ths.removeAttr('disabled');
|
749 |
+
},
|
750 |
+
error: function(request) {
|
751 |
+
$indicator.remove();
|
752 |
+
ths.removeAttr('disabled');
|
753 |
+
},
|
754 |
+
dataType: "json"
|
755 |
+
});
|
756 |
+
}
|
757 |
+
});
|
758 |
+
|
759 |
+
// [/ Serialized custom fields]
|
760 |
+
|
761 |
+
// Save mapping rules for custom field
|
762 |
+
$('.save_mr').live('click', function(){
|
763 |
+
var $source = $(this).parents('table:first');
|
764 |
+
var $destination = $('div#' + $source.attr('rel'));
|
765 |
+
var $is_active = false;
|
766 |
+
$destination.find('table:first').html('');
|
767 |
+
$source.find('input').each(function(i, e){
|
768 |
+
$(this).attr("value", $(this).val());
|
769 |
+
if ($(this).val() != "")
|
770 |
+
$is_active = true;
|
771 |
+
});
|
772 |
+
var $box = $destination.parents('td.action:first');
|
773 |
+
if ( $is_active ){
|
774 |
+
$box.find('.set_mapping').parent().addClass('active');
|
775 |
+
}
|
776 |
+
else{
|
777 |
+
$box.find('.set_mapping').parent().removeClass('active');
|
778 |
+
}
|
779 |
+
$destination.find('table:first').html($source.html());
|
780 |
+
$destination.parents('td:first').find('.pmxi_cf_mapping').pointer('destroy');
|
781 |
+
$('.wpallimport-overlay').hide();
|
782 |
+
});
|
783 |
+
|
784 |
+
// Taxonnomies
|
785 |
+
$form.find('#show_hidden_ctx').click(function(){
|
786 |
+
$(this).parents('table:first').find('tr.private_ctx').toggle();
|
787 |
+
});
|
788 |
+
|
789 |
+
// Test & Preview images
|
790 |
+
$('.test_images').live('click', function(){
|
791 |
+
|
792 |
+
var ths = $(this);
|
793 |
+
|
794 |
+
$(this).attr({'disabled':'disabled'});
|
795 |
+
|
796 |
+
$('.img_preloader').show();
|
797 |
+
$('.img_success').html('').hide();
|
798 |
+
$('.img_failed').remove();
|
799 |
+
|
800 |
+
var imgs = new Array();
|
801 |
+
|
802 |
+
$('.images_list').find('li').each(function(){
|
803 |
+
imgs.push($(this).attr('rel'));
|
804 |
+
});
|
805 |
+
|
806 |
+
var request = {
|
807 |
+
action:'test_images',
|
808 |
+
download: ths.attr('rel'),
|
809 |
+
imgs:imgs
|
810 |
+
};
|
811 |
+
|
812 |
+
$.ajax({
|
813 |
+
type: 'POST',
|
814 |
+
url: ajaxurl,
|
815 |
+
data: request,
|
816 |
+
success: function(response) {
|
817 |
+
$('.img_preloader').hide();
|
818 |
+
if ( parseInt(response.success_images))
|
819 |
+
$('.img_success').html(response.success_msg).show();
|
820 |
+
|
821 |
+
if (response.failed_msgs.length){
|
822 |
+
for (var i = 0; i < response.failed_msgs.length; i++){
|
823 |
+
$('.test_progress').append('<div class="img_failed">' + response.failed_msgs[i] + '</div>');
|
824 |
+
}
|
825 |
+
$('.img_failed').show();
|
826 |
+
}
|
827 |
+
ths.removeAttr('disabled');
|
828 |
+
},
|
829 |
+
error: function(request) {
|
830 |
+
$('.img_failed').html(request.textStatus).show();
|
831 |
+
ths.removeAttr('disabled');
|
832 |
+
},
|
833 |
+
dataType: "json"
|
834 |
+
});
|
835 |
+
|
836 |
+
});
|
837 |
+
|
838 |
+
/* Merge Main XML file with sub file by provided fields */
|
839 |
+
$form.find('.parse').live('click', function(){
|
840 |
+
|
841 |
+
var submit = true;
|
842 |
+
|
843 |
+
if ("" == $form.find('input[name=nested_url]').val()){
|
844 |
+
$form.find('input[name=nested_url]').css({'background':'red'});
|
845 |
+
submit = false;
|
846 |
+
}
|
847 |
+
|
848 |
+
if (submit){
|
849 |
+
|
850 |
+
var ths = $(this);
|
851 |
+
var $fileURL = $form.find('input[name=nested_url]').val();
|
852 |
+
|
853 |
+
$(this).attr({'disabled':'disabled'});
|
854 |
+
|
855 |
+
var request = {
|
856 |
+
action:'nested_merge',
|
857 |
+
filePath: $fileURL,
|
858 |
+
};
|
859 |
+
|
860 |
+
var $indicator = $('<span class="img_preloader" style="top:10px;"/>').insertBefore($(this)).show();
|
861 |
+
|
862 |
+
$form.find('.nested_msgs').html('');
|
863 |
+
|
864 |
+
$.ajax({
|
865 |
+
type: 'POST',
|
866 |
+
url: ajaxurl + ((typeof import_id != "undefined") ? '?id=' + import_id : ''),
|
867 |
+
data: request,
|
868 |
+
success: function(response) {
|
869 |
+
$indicator.remove();
|
870 |
+
|
871 |
+
if (response.success)
|
872 |
+
{
|
873 |
+
//$form.find('.nested_cancel').click();
|
874 |
+
|
875 |
+
$form.find('.nested_files ul').append('<li rel="' + $form.find('.nested_files ul').find('li').length + '">' + $fileURL + ' <a href="javascript:void(0);" class="unmerge">remove</a></li>');
|
876 |
+
$form.find('input[name=nested_files]').val(window.JSON.stringify(response.nested_files));
|
877 |
+
|
878 |
+
var $tag = $('.tag');
|
879 |
+
var $tagno = parseInt($tag.find('input[name="tagno"]').val());
|
880 |
+
var $tagURL = 'admin.php?page=pmxi-admin-import&action=tag' + ((typeof import_id != "undefined") ? '&id=' + import_id : '');
|
881 |
+
|
882 |
+
$tag.addClass('loading').css('opacity', 0.7);
|
883 |
+
$.post($tagURL, {tagno: $tagno, import_action: import_action}, function (data) {
|
884 |
+
var $indicator = $('<span />').insertBefore($tag);
|
885 |
+
$tag.replaceWith(data.html);
|
886 |
+
fix_tag_position();
|
887 |
+
$indicator.next().tag().prevObject.remove();
|
888 |
+
if ($('#variations_xpath').length){
|
889 |
+
$('#variations_xpath').data('checkedValue', '').change();
|
890 |
+
}
|
891 |
+
}, 'json');
|
892 |
+
return false;
|
893 |
+
|
894 |
+
}
|
895 |
+
else
|
896 |
+
{
|
897 |
+
$form.find('.nested_msgs').html(response.msg);
|
898 |
+
}
|
899 |
+
ths.removeAttr('disabled');
|
900 |
+
},
|
901 |
+
error: function(request) {
|
902 |
+
$indicator.remove();
|
903 |
+
ths.removeAttr('disabled');
|
904 |
+
},
|
905 |
+
dataType: "json"
|
906 |
+
});
|
907 |
+
}
|
908 |
+
});
|
909 |
+
|
910 |
+
/* Unmerge nested XMl/CSV files */
|
911 |
+
$form.find('.unmerge').live('click', function(){
|
912 |
+
|
913 |
+
var ths = $(this);
|
914 |
+
|
915 |
+
$(this).attr({'disabled':'disabled'});
|
916 |
+
|
917 |
+
var $indicator = $('<span class="img_preloader" style="top:5px;"/>').insertBefore($(this)).show();
|
918 |
+
|
919 |
+
var request = {
|
920 |
+
action:'unmerge_file',
|
921 |
+
source: ths.parents('li:first').attr('rel'),
|
922 |
+
};
|
923 |
+
|
924 |
+
$form.find('.nested_msgs').html('');
|
925 |
+
|
926 |
+
$.ajax({
|
927 |
+
type: 'POST',
|
928 |
+
url: ajaxurl + ((typeof import_id != "undefined") ? '?id=' + import_id : ''),
|
929 |
+
data: request,
|
930 |
+
success: function(response) {
|
931 |
+
$indicator.remove();
|
932 |
+
if (response.success){
|
933 |
+
|
934 |
+
ths.parents('li:first').remove();
|
935 |
+
$form.find('input[name=nested_files]').val(window.JSON.stringify(response.nested_files));
|
936 |
+
|
937 |
+
var $tag = $('.tag');
|
938 |
+
var $tagno = parseInt($tag.find('input[name="tagno"]').val());
|
939 |
+
var $tagURL = 'admin.php?page=pmxi-admin-import&action=tag' + ((typeof import_id != "undefined") ? '&id=' + import_id : '');
|
940 |
+
|
941 |
+
$tag.addClass('loading').css('opacity', 0.7);
|
942 |
+
$.post($tagURL, {tagno: $tagno, import_action: import_action}, function (data) {
|
943 |
+
var $indicator = $('<span />').insertBefore($tag);
|
944 |
+
$tag.replaceWith(data.html);
|
945 |
+
fix_tag_position();
|
946 |
+
$indicator.next().tag().prevObject.remove();
|
947 |
+
if ($('#variations_xpath').length){
|
948 |
+
$('#variations_xpath').data('checkedValue', '').change();
|
949 |
+
}
|
950 |
+
}, 'json');
|
951 |
+
return false;
|
952 |
+
}
|
953 |
+
else{
|
954 |
+
$form.find('.msgs').html(response.errors);
|
955 |
+
$form.find('.pmxi_counter').remove();
|
956 |
+
}
|
957 |
+
ths.removeAttr('disabled');
|
958 |
+
},
|
959 |
+
error: function(request) {
|
960 |
+
$indicator.remove();
|
961 |
+
ths.removeAttr('disabled');
|
962 |
+
},
|
963 |
+
dataType: "json"
|
964 |
+
});
|
965 |
+
});
|
966 |
+
|
967 |
+
$form.find('input[name=nested_url]').focus(function(){
|
968 |
+
$(this).css({'background':'#fff'});
|
969 |
+
});
|
970 |
+
|
971 |
+
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
|
972 |
+
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
|
973 |
+
var is_chrome = navigator.userAgent.indexOf('Chrome') > -1;
|
974 |
+
|
975 |
+
if ((is_safari && !is_chrome) || is_firefox){
|
976 |
+
$form.find('textarea[name=download_featured_image]').attr("placeholder", "http://example.com/images/image-1.jpg");
|
977 |
+
$form.find('textarea[name=featured_image]').attr("placeholder", "image-1.jpg")
|
978 |
+
}
|
979 |
+
else{
|
980 |
+
$form.find('textarea[name=download_featured_image]').attr("placeholder", "http://example.com/images/image-1.jpg\nhttp://example.com/images/image-2.jpg\n...");
|
981 |
+
$form.find('textarea[name=featured_image]').attr("placeholder", "image-1.jpg\nimage-2.jpg\n...")
|
982 |
+
}
|
983 |
+
|
984 |
+
$form.find('.wpallimport-dismiss-cf-welcome').click(function(){
|
985 |
+
$('.cf_welcome, .cf_detect_result').slideUp();
|
986 |
+
});
|
987 |
+
|
988 |
+
});
|
989 |
+
|
990 |
+
// options form: highlight options of selected post type
|
991 |
+
$('form.wpallimport-template input[name="type"]').click(function() {
|
992 |
+
var $container = $(this).parents('.post-type-container');
|
993 |
+
$('.post-type-container').not($container).removeClass('selected').find('.post-type-options').hide();
|
994 |
+
$container.addClass('selected').find('.post-type-options').show();
|
995 |
+
}).filter(':checked').click();
|
996 |
+
// options form: add / remove custom params
|
997 |
+
$('.form-table a.action[href="#add"]').live('click', function () {
|
998 |
+
var $template = $(this).parents('table').first().find('tr.template');
|
999 |
+
$template.clone(true).insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
1000 |
+
return false;
|
1001 |
+
});
|
1002 |
+
|
1003 |
+
// options form: auto submit when `load options` checkbox is checked
|
1004 |
+
$('input[name="load_options"]').click(function () {
|
1005 |
+
if ($(this).is(':checked')) $(this).parents('form').submit();
|
1006 |
+
});
|
1007 |
+
// options form: auto submit when `reset options` checkbox is checked
|
1008 |
+
$('form.wpallimport-template').find('input[name="reset_options"]').click(function () {
|
1009 |
+
if ($(this).is(':checked')) $(this).parents('form').submit();
|
1010 |
+
});
|
1011 |
+
$('.form-table .action.remove a, .cf-form-table .action.remove a, .tax-form-table .action.remove a').live('click', function () {
|
1012 |
+
var $box = $(this).parents('tbody').first();
|
1013 |
+
$(this).parents('tr').first().remove();
|
1014 |
+
if ( ! $box.find('tr.form-field:visible').length ){
|
1015 |
+
$box.find('.add-new-entry').click();
|
1016 |
+
}
|
1017 |
+
return false;
|
1018 |
+
});
|
1019 |
+
|
1020 |
+
var dblclickbuf = {
|
1021 |
+
'selected':false,
|
1022 |
+
'value':''
|
1023 |
+
};
|
1024 |
+
|
1025 |
+
function insertxpath(){
|
1026 |
+
if ($(this).hasClass('wpallimport-placeholder')){
|
1027 |
+
$(this).val('');
|
1028 |
+
$(this).removeClass('wpallimport-placeholder');
|
1029 |
+
}
|
1030 |
+
if (dblclickbuf.selected)
|
1031 |
+
{
|
1032 |
+
$(this).val($(this).val() + dblclickbuf.value);
|
1033 |
+
$('.xml-element[title*="/'+dblclickbuf.value.replace('{','').replace('}','')+'"]').removeClass('selected');
|
1034 |
+
dblclickbuf.value = '';
|
1035 |
+
dblclickbuf.selected = false;
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
|
1039 |
var go_to_template = false;
|
1040 |
|
1041 |
// selection logic
|
1042 |
+
$('form.wpallimport-choose-elements').each(function () {
|
1043 |
var $form = $(this);
|
1044 |
+
$form.find('.wpallimport-xml').xml();
|
1045 |
var $input = $form.find('input[name="xpath"]');
|
1046 |
var $next_element = $form.find('#next_element');
|
1047 |
var $prev_element = $form.find('#prev_element');
|
1052 |
var $csv_delimiter = $form.find('input[name=delimiter]');
|
1053 |
var $apply_delimiter = $form.find('input[name=apply_delimiter]');
|
1054 |
|
1055 |
+
var $xml = $('.wpallimport-xml');
|
1056 |
+
|
|
|
|
|
|
|
1057 |
var xpathChanged = function () {
|
1058 |
if ($input.val() == $input.data('checkedValue')) return;
|
1059 |
|
1062 |
// request server to return elements which correspond to xpath entered
|
1063 |
$input.attr('readonly', true).unbind('change', xpathChanged).data('checkedValue', $input.val());
|
1064 |
$xml.css({'visibility':'hidden'});
|
1065 |
+
$('.wpallimport-set-csv-delimiter').hide();
|
1066 |
+
|
1067 |
+
$xml.parents('fieldset:first').addClass('preload');
|
1068 |
go_to_template = false;
|
1069 |
$submit.hide();
|
1070 |
+
var evaluate = function(){
|
1071 |
+
$.post('admin.php?page=pmxi-admin-import&action=evaluate', {xpath: $input.val(), show_element: $goto_element.val(), root_element:$root_element.val(), is_csv: $apply_delimiter.length, delimiter:$csv_delimiter.val()}, function (response) {
|
1072 |
if (response.result){
|
1073 |
+
$('.wpallimport-elements-preloader').hide();
|
1074 |
$('.ajax-console').html(response.html);
|
1075 |
$input.attr('readonly', false).change(function(){$goto_element.val(1); xpathChanged();});
|
1076 |
+
$form.removeClass('loading');
|
1077 |
+
|
1078 |
$xml.parents('fieldset:first').removeClass('preload');
|
1079 |
+
$('.wpallimport-set-csv-delimiter').show();
|
1080 |
go_to_template = true;
|
1081 |
$('#pmxi_xml_element').find('option').each(function(){
|
1082 |
if ($(this).val() != "") $(this).remove();
|
1083 |
});
|
1084 |
$('#pmxi_xml_element').append(response.render_element);
|
1085 |
+
$('.wpallimport-root-element').html(response.root_element);
|
1086 |
+
$('.wpallimport-elements-count-info').html(response.count);
|
1087 |
+
if (response.count)
|
1088 |
+
$submit.show();
|
1089 |
+
else
|
1090 |
+
$submit.hide();
|
1091 |
}
|
1092 |
}, "json").fail(function() {
|
1093 |
|
1126 |
reset_filters();
|
1127 |
$root_element.val($(this).attr('root')); $goto_element.val(1); xpathChanged();
|
1128 |
});
|
1129 |
+
$('.wpallimport-change-root-element').click(function(){
|
1130 |
$input.val('/' + $(this).attr('rel'));
|
1131 |
+
if ($input.val() == $input.data('checkedValue')) return;
|
1132 |
+
$('.wpallimport-change-root-element').removeClass('selected');
|
1133 |
+
$(this).addClass('selected');
|
1134 |
reset_filters();
|
1135 |
+
$('.root_element').html($(this).attr('rel'));
|
1136 |
$root_element.val($(this).attr('rel')); $goto_element.val(1); xpathChanged();
|
1137 |
});
|
1138 |
$input.change(function(){$goto_element.val(1); xpathChanged();}).change();
|
1149 |
|
1150 |
/* Advanced Filtering */
|
1151 |
|
1152 |
+
$('.filtering_rules').pmxi_nestedSortable({
|
1153 |
handle: 'div',
|
1154 |
items: 'li',
|
1155 |
toleranceElement: '> div',
|
1175 |
html += '<input type="hidden" value="'+ $el.val() +'" class="pmxi_xml_element"/>';
|
1176 |
html += '<input type="hidden" value="'+ $rule.val() +'" class="pmxi_rule"/>';
|
1177 |
html += '<input type="hidden" value="'+ $val.val() +'" class="pmxi_value"/>';
|
1178 |
+
html += '<span class="rule_element">' + $el.val() + '</span> <span class="rule_as_is">' + $rule.find('option:selected').html() + '</span> <span class="rule_condition_value">"' + $val.val() +'"</span>';
|
1179 |
html += '<span class="condition"> <label for="rule_and_'+relunumber+'">AND</label><input id="rule_and_'+relunumber+'" type="radio" value="and" name="rule_'+relunumber+'" checked="checked" class="rule_condition"/><label for="rule_or_'+relunumber+'">OR</label><input id="rule_or_'+relunumber+'" type="radio" value="or" name="rule_'+relunumber+'" class="rule_condition"/> </span>';
|
1180 |
html += '</div><a href="javascript:void(0);" class="icon-item remove-ico"></a></li>';
|
1181 |
|
1182 |
+
$('#wpallimport-filters, #apply_filters').show();
|
1183 |
$('#filtering_rules').find('p').hide();
|
1184 |
|
1185 |
$('.filtering_rules').append(html);
|
1213 |
|
1214 |
var xpath_builder = function(rules_box, lvl){
|
1215 |
|
1216 |
+
var rules = rules_box.children('li');
|
1217 |
+
|
1218 |
+
var root_element = $('#root_element').val();
|
1219 |
|
1220 |
if (lvl && rules.length > 1) filter += ' (';
|
1221 |
|
1235 |
attr_name = node.split('@')[1];
|
1236 |
}
|
1237 |
|
1238 |
+
if (is_attr)
|
1239 |
+
filter += (node_name == root_element) ? '' : node_name.replace(/->/g, '/');
|
1240 |
+
else
|
1241 |
+
filter += node.replace(/->/g, '/');
|
1242 |
|
1243 |
if (is_attr) filter += '[@' + attr_name;
|
1244 |
|
1246 |
case 'equals':
|
1247 |
filter += ' = "%s"';
|
1248 |
break;
|
1249 |
+
case 'not_equals':
|
1250 |
+
filter += ' != "%s"';
|
1251 |
+
break;
|
1252 |
case 'greater':
|
1253 |
filter += ' > %s';
|
1254 |
break;
|
1297 |
var xpath = $('input[name=xpath]').val();
|
1298 |
|
1299 |
filter = '[';
|
|
|
1300 |
xpath_builder($('.filtering_rules'), 0);
|
|
|
1301 |
filter += ']';
|
1302 |
|
1303 |
$input.val( $input.val().split('[')[0] + filter);
|
1307 |
});
|
1308 |
});
|
1309 |
|
1310 |
+
$('form.wpallimport-choose-elements').find('input[type="submit"]').click(function(e){
|
1311 |
e.preventDefault();
|
1312 |
if (go_to_template) $(this).parents('form:first').submit();
|
1313 |
});
|
1314 |
|
1315 |
+
var init_context_menu = function(){
|
1316 |
+
if ( $(".tag").length ){
|
1317 |
+
|
1318 |
+
$('.xml-element').each(function(){
|
1319 |
+
var $ths = $(this);
|
1320 |
+
if ($(this).children('.xml-element-xpaths').find('li').length){
|
1321 |
+
$(this).children('.xml-content').css({'cursor':'context-menu'}).attr({'title' : 'Right click to view alternate XPaths'});
|
1322 |
+
$(this).contextmenu({
|
1323 |
+
delegate: ".xml-content",
|
1324 |
+
menu: "#" + $(this).children('.xml-element-xpaths').find('ul').attr('id'),
|
1325 |
+
select: function(event, ui) {
|
1326 |
+
//alert("select " + ui.cmd + " on " + ui.target.text());
|
1327 |
+
}
|
1328 |
+
});
|
1329 |
+
}
|
1330 |
+
});
|
1331 |
+
}
|
1332 |
+
}
|
1333 |
+
|
1334 |
// tag preview
|
1335 |
$.fn.tag = function () {
|
1336 |
this.each(function () {
|
1337 |
+
|
1338 |
+
init_context_menu();
|
1339 |
+
|
1340 |
var $tag = $(this);
|
1341 |
$tag.xml('dragable');
|
1342 |
var tagno = parseInt($tag.find('input[name="tagno"]').val());
|
1343 |
+
var $tagURL = 'admin.php?page=pmxi-admin-import&action=tag' + ((typeof import_id != "undefined") ? '&id=' + import_id : '');
|
1344 |
+
|
1345 |
$tag.find('.navigation a').live('click', function () {
|
1346 |
tagno += '#prev' == $(this).attr('href') ? -1 : 1;
|
1347 |
$tag.addClass('loading').css('opacity', 0.7);
|
1348 |
+
$.post($tagURL, {tagno: tagno, import_action: import_action}, function (data) {
|
1349 |
var $indicator = $('<span />').insertBefore($tag);
|
1350 |
$tag.replaceWith(data.html);
|
1351 |
+
fix_tag_position();
|
1352 |
$indicator.next().tag().prevObject.remove();
|
1353 |
if ($('#variations_xpath').length){
|
1354 |
$('#variations_xpath').data('checkedValue', '').change();
|
1355 |
+
}
|
1356 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
1357 |
}, 'json');
|
1358 |
return false;
|
1359 |
});
|
1361 |
tagno = (parseInt($(this).val()) > parseInt($tag.find('.pmxi_count').html())) ? $tag.find('.pmxi_count').html() : ( (parseInt($(this).val())) ? $(this).val() : 1 );
|
1362 |
$(this).val(tagno);
|
1363 |
$tag.addClass('loading').css('opacity', 0.7);
|
1364 |
+
$.post($tagURL, {tagno: tagno, import_action: import_action}, function (data) {
|
1365 |
var $indicator = $('<span />').insertBefore($tag);
|
1366 |
$tag.replaceWith(data.html);
|
1367 |
+
fix_tag_position();
|
1368 |
$indicator.next().tag().prevObject.remove();
|
1369 |
if ($('#variations_xpath').length){
|
1370 |
$('#variations_xpath').data('checkedValue', '').change();
|
1371 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1372 |
}, 'json');
|
1373 |
return false;
|
1374 |
});
|
1375 |
+
});
|
1376 |
return this;
|
1377 |
};
|
1378 |
$('.tag').tag();
|
1379 |
// [/xml representation dynamic]
|
1380 |
|
1381 |
+
$('.wpallimport-custom-fields').each(function(){
|
1382 |
+
$(this).find('.autocomplete').each(function(){
|
1383 |
+
if ( ! $(this).parents('tr:first').hasClass('template')){
|
1384 |
+
$(this).autocomplete({
|
1385 |
+
source: eval('__META_KEYS'),
|
1386 |
+
minLength: 0
|
1387 |
+
}).click(function () {
|
1388 |
+
$(this).autocomplete('search', '');
|
1389 |
+
$(this).attr('rel', '');
|
1390 |
+
});
|
1391 |
+
}
|
1392 |
+
});
|
1393 |
+
|
1394 |
+
$(this).find('textarea[name^=custom_value]').live('click', function(){
|
1395 |
+
var $ths = $(this);
|
1396 |
+
var $parent = $ths.parents('tr:first');
|
1397 |
+
var $custom_name = $parent.find('input[name^=custom_name]');
|
1398 |
+
var $key = $custom_name.val();
|
1399 |
+
|
1400 |
+
if ($key != "" && $custom_name.attr('rel') != "done"){
|
1401 |
+
$ths.addClass('loading');
|
1402 |
+
$.post('admin.php?page=pmxi-admin-settings&action=meta_values', {key: $key}, function (data) {
|
1403 |
+
if (data.meta_values.length){
|
1404 |
+
$ths.autocomplete({
|
1405 |
+
source: eval(data.meta_values),
|
1406 |
+
minLength: 0
|
1407 |
+
}).click(function () {
|
1408 |
+
$(this).autocomplete('search', '');
|
1409 |
+
}).click();
|
1410 |
+
}
|
1411 |
+
$custom_name.attr('rel','done');
|
1412 |
+
$ths.removeClass('loading');
|
1413 |
+
}, 'json');
|
1414 |
+
}
|
1415 |
+
});
|
1416 |
+
|
1417 |
+
$('.wpallimport-cf-options').live('click', function(){
|
1418 |
+
$(this).next('.wpallimport-cf-menu').slideToggle();
|
1419 |
});
|
1420 |
});
|
1421 |
|
1422 |
/* Categories hierarchy */
|
1423 |
|
1424 |
+
$('ol.sortable').pmxi_nestedSortable({
|
1425 |
handle: 'div',
|
1426 |
items: 'li.dragging',
|
1427 |
toleranceElement: '> div',
|
1428 |
update: function () {
|
1429 |
+
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1430 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
1431 |
}
|
1432 |
});
|
1433 |
|
1434 |
$('.drag-element').find('input').live('blur', function(){
|
1435 |
+
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1436 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
1437 |
});
|
1438 |
|
1439 |
$('.drag-element').find('input').live('change', function(){
|
1440 |
+
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1441 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
1442 |
});
|
1443 |
|
1444 |
$('.drag-element').find('input').live('hover', function(){},function(){
|
1445 |
+
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1446 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
1447 |
});
|
1448 |
|
1449 |
$('.taxonomy_auto_nested').live('click', function(){
|
1450 |
+
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify($(this).parents('td:first').find('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1451 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
1452 |
});
|
1453 |
|
1459 |
parent_td.find('ol.sortable:first').find('li').each(function(i, e){
|
1460 |
$(this).attr({'id':'item_'+ (i+1)});
|
1461 |
});
|
1462 |
+
parent_td.find('.hierarhy-output').val(window.JSON.stringify(parent_td.find('.ui-sortable:first').pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1463 |
if (parent_td.find('input:first').val() == '') parent_td.find('.hierarhy-output').val('');
|
1464 |
});
|
1465 |
|
1466 |
$('.add-new-ico').live('click', function(){
|
1467 |
var count = $(this).parents('tr:first').find('ol.sortable').find('li.dragging').length + 1;
|
1468 |
|
1469 |
+
var $template = $(this).parents('td:first').find('ol').children('li.template');
|
1470 |
+
|
1471 |
$clone = $template.clone(true);
|
1472 |
$clone.addClass('dragging').attr({'id': $clone.attr('id') + '_' + count}).find('input[type=checkbox][name^=categories_mapping]').each(function(){
|
1473 |
$(this).attr({'id': $(this).attr('id') + '_' + count});
|
1478 |
|
1479 |
var sortable = $(this).parents('.ui-sortable:first');
|
1480 |
if (sortable.length){
|
1481 |
+
$(this).parents('td:first').find('.hierarhy-output').val(window.JSON.stringify(sortable.pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1482 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).parents('td:first').find('.hierarhy-output').val('');
|
1483 |
}
|
1484 |
$('.widefat').bind('focus', insertxpath );
|
1489 |
if ( ! $(this).children('li').not('.template').length ) $(this).next('.add-new-ico').click();
|
1490 |
});
|
1491 |
|
1492 |
+
$('form.wpallimport-template').find('input[type=submit]').click(function(e){
|
1493 |
|
1494 |
e.preventDefault();
|
1495 |
|
1496 |
$('.hierarhy-output').each(function(){
|
1497 |
var sortable = $(this).parents('td:first').find('.ui-sortable:first');
|
1498 |
if (sortable.length){
|
1499 |
+
$(this).val(window.JSON.stringify(sortable.pmxi_nestedSortable('toArray', {startDepthCount: 0})));
|
1500 |
if ($(this).parents('td:first').find('input:first').val() == '') $(this).val('');
|
1501 |
}
|
1502 |
});
|
1503 |
if ($(this).attr('name') == 'btn_save_only') $('.save_only').val('1');
|
1504 |
|
1505 |
+
$('input[name^=in_variations], input[name^=is_visible], input[name^=is_taxonomy], input[name^=create_taxonomy_in_not_exists], input[name^=variable_create_taxonomy_in_not_exists], input[name^=variable_in_variations], input[name^=variable_is_visible], input[name^=variable_is_taxonomy]').each(function(){
|
1506 |
if ( ! $(this).is(':checked') && ! $(this).parents('.form-field:first').hasClass('template')){
|
1507 |
$(this).val('0').attr('checked','checked');
|
1508 |
}
|
1509 |
});
|
1510 |
|
1511 |
+
$('.custom_type[rel=serialized]').each(function(){
|
1512 |
+
var values = new Array();
|
1513 |
+
$(this).find('.form-field').each(function(){
|
1514 |
+
var skey = $(this).find('.serialized_key').val();
|
1515 |
+
if ('' == skey){
|
1516 |
+
values.push($(this).find('.serialized_value').val());
|
1517 |
+
}
|
1518 |
+
else
|
1519 |
+
{
|
1520 |
+
var obj = {};
|
1521 |
+
obj[skey] = $(this).find('.serialized_value').val();
|
1522 |
+
values.push(obj);
|
1523 |
+
}
|
1524 |
+
});
|
1525 |
+
$(this).find('input[name^=serialized_values]').val(window.JSON.stringify(values));
|
1526 |
+
});
|
1527 |
+
|
1528 |
+
$('.custom_type[rel=mapping]').each(function(){
|
1529 |
var values = new Array();
|
1530 |
$(this).find('.form-field').each(function(){
|
1531 |
+
if ($(this).find('.mapping_to').val() != "")
|
1532 |
{
|
1533 |
+
var skey = $(this).find('.mapping_from').val();
|
1534 |
+
if ('' != skey){
|
|
|
|
|
|
|
|
|
1535 |
var obj = {};
|
1536 |
+
obj[skey] = $(this).find('.mapping_to').val();
|
1537 |
values.push(obj);
|
1538 |
+
}
|
|
|
1539 |
|
1540 |
}
|
1541 |
});
|
1542 |
+
$(this).find('input[name^=custom_mapping_rules]').val(window.JSON.stringify(values));
|
1543 |
});
|
1544 |
|
1545 |
+
serialize_ctx_mapping();
|
1546 |
+
|
1547 |
$(this).parents('form:first').submit();
|
1548 |
|
1549 |
+
});
|
1550 |
+
|
1551 |
+
$('.wpallimport-step-4').each(function(){
|
1552 |
+
|
1553 |
+
$(this).find('input[name^=custom_duplicate_name]').autocomplete({
|
1554 |
+
source: eval('__META_KEYS'),
|
1555 |
+
minLength: 0
|
1556 |
+
}).click(function () {
|
1557 |
+
$(this).autocomplete('search', '');
|
1558 |
+
$(this).attr('rel', '');
|
1559 |
+
});
|
1560 |
+
|
1561 |
});
|
1562 |
|
1563 |
$('.add-new-custom').click(function(){
|
1564 |
var $template = $(this).parents('table').first().children('tbody').children('tr.template');
|
1565 |
$number = $(this).parents('table').first().children('tbody').children('tr').length - 2;
|
1566 |
$clone = $template.clone(true);
|
1567 |
+
|
1568 |
+
$clone.find('div[rel^=serialized]').attr({'id':'serialized_' + $number}).find('table:first').attr({'rel':'serialized_' + $number});
|
1569 |
+
$clone.find('div[rel^=mapping]').attr({'id':'cf_mapping_' + $number}).find('table:first').attr({'rel':'cf_mapping_' + $number});
|
1570 |
+
$clone.find('a.specify_cf').attr({'rel':'serialized_' + $number})
|
1571 |
+
$clone.find('a.pmxi_cf_mapping').attr({'rel':'cf_mapping_' + $number})
|
1572 |
+
$clone.find('.wpallimport-cf-menu').attr({'id':'wpallimport-cf-menu-' + $number}).menu();
|
1573 |
+
$clone.find('input[name^=custom_name]').autocomplete({
|
1574 |
+
source: eval('__META_KEYS'),
|
1575 |
+
minLength: 0
|
1576 |
+
}).click(function () {
|
1577 |
+
$(this).autocomplete('search', '');
|
1578 |
+
$(this).attr('rel', '');
|
1579 |
+
});
|
1580 |
$clone.insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
1581 |
+
|
1582 |
return false;
|
1583 |
});
|
1584 |
|
1587 |
$template.clone(true).insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
1588 |
});
|
1589 |
|
1590 |
+
/* END Categories hierarchy */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1591 |
|
1592 |
+
$('form.options').each(function(){
|
1593 |
+
var $form = $(this);
|
1594 |
+
var $uniqueKey = $form.find('input[name=unique_key]');
|
1595 |
+
var $tmpUniqueKey = $form.find('input[name=tmp_unique_key]');
|
1596 |
+
$form.find('.wpallimport-auto-detect-unique-key').click(function(){
|
1597 |
+
$uniqueKey.val($tmpUniqueKey.val());
|
1598 |
+
});
|
1599 |
});
|
1600 |
|
1601 |
+
$('form.edit').each(function(){
|
1602 |
+
var $form = $(this);
|
1603 |
+
$form.find('.wpallimport-change-unique-key').click(function(){
|
1604 |
+
var $ths = $(this);
|
1605 |
+
$( "#dialog-confirm" ).dialog({
|
1606 |
+
resizable: false,
|
1607 |
+
height: 290,
|
1608 |
+
width: 550,
|
1609 |
+
modal: true,
|
1610 |
+
draggable: false,
|
1611 |
+
buttons: {
|
1612 |
+
"Continue": function() {
|
1613 |
+
$( this ).dialog( "close" );
|
1614 |
+
$ths.hide();
|
1615 |
+
$('input[name=unique_key]').removeAttr('disabled').focus();
|
1616 |
+
},
|
1617 |
+
Cancel: function() {
|
1618 |
+
$( this ).dialog( "close" );
|
1619 |
+
}
|
1620 |
+
}
|
1621 |
+
});
|
1622 |
});
|
1623 |
});
|
1624 |
|
1646 |
|
1647 |
/* END plupload scripts */
|
1648 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1649 |
$('#view_log').live('click', function(){
|
1650 |
$('#import_finished').css({'visibility':'hidden'});
|
1651 |
$('#logwrapper').slideToggle(100, function(){
|
1652 |
$('#import_finished').css({'visibility':'visible'});
|
1653 |
});
|
1654 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1655 |
|
1656 |
// Select Encoding
|
1657 |
$('#import_encoding').live('change', function(){
|
1665 |
$('#add_encoding').hide();
|
1666 |
$('#select_encoding').show();
|
1667 |
$('#new_encoding').val('');
|
1668 |
+
$('#import_encoding').prop('selectedIndex', 0);
|
1669 |
});
|
1670 |
|
1671 |
$('#add_new_encoding').live('click', function(){
|
1683 |
});
|
1684 |
|
1685 |
$('.pmxi_choosen').each(function(){
|
1686 |
+
$(this).find(".choosen_input").select2({
|
1687 |
+
tags: $(this).find('.choosen_values').html().split(','),
|
1688 |
+
width: '80%',
|
1689 |
+
});
|
1690 |
});
|
1691 |
|
1692 |
+
if (typeof wpPointerL10n != "undefined") wpPointerL10n.dismiss = 'Close';
|
1693 |
+
|
1694 |
+
$('.show_hints').live('click', function(){
|
1695 |
+
var $ths = $(this);
|
1696 |
+
$('.wpallimport-overlay').show();
|
1697 |
+
|
1698 |
$(this).pointer({
|
1699 |
+
content: $('#' + $ths.attr('rel')).html(),
|
1700 |
position: {
|
1701 |
edge: 'right',
|
1702 |
align: 'center'
|
1707 |
pointer: 'pksn1',
|
1708 |
action: 'dismiss-wp-pointer'
|
1709 |
});
|
1710 |
+
$('.wpallimport-overlay').hide();
|
1711 |
}
|
1712 |
}).pointer('open');
|
1713 |
});
|
1714 |
|
1715 |
+
// Serialized Custom Field Dialog
|
1716 |
+
$('.pmxi_cf_pointer').live('click', function(){
|
1717 |
+
var $ths = $(this);
|
1718 |
+
//$('.wpallimport-overlay').show();
|
1719 |
+
|
1720 |
+
if ($ths.parents('.form-field:first').find('input[name^=custom_name]').val() == "") {
|
1721 |
+
$('#' + $ths.attr('rel')).find('.auto_detect_sf').hide();
|
1722 |
+
}
|
1723 |
+
else{
|
1724 |
+
$('#' + $ths.attr('rel')).find('.auto_detect_sf').show();
|
1725 |
+
}
|
1726 |
+
|
1727 |
+
$(this).pointer({
|
1728 |
+
content: $('#' + $ths.attr('rel')).html(),
|
1729 |
+
position: {
|
1730 |
+
edge: 'top',
|
1731 |
+
align: 'center'
|
1732 |
+
},
|
1733 |
+
pointerWidth: 450,
|
1734 |
+
close: function() {
|
1735 |
+
$.post( ajaxurl, {
|
1736 |
+
pointer: 'pksn1',
|
1737 |
+
action: 'dismiss-wp-pointer'
|
1738 |
+
});
|
1739 |
+
//$('.wpallimport-overlay').hide();
|
1740 |
+
}
|
1741 |
+
}).pointer('open');
|
1742 |
+
});
|
1743 |
+
|
1744 |
+
// Custom Fields Mapping Dialog
|
1745 |
+
$('.wpallimport-cf-menu li').live('click', function(){
|
1746 |
+
var $triggerEvent = $(this).find('a');
|
1747 |
+
if ($triggerEvent.hasClass('pmxi_cf_mapping')){
|
1748 |
+
|
1749 |
+
//$('.wpallimport-overlay').show();
|
1750 |
+
var $ths = $triggerEvent;
|
1751 |
+
$triggerEvent.pointer({
|
1752 |
+
content: $('#' + $ths.attr('rel')).html(),
|
1753 |
+
position: {
|
1754 |
+
edge: 'right',
|
1755 |
+
align: 'center'
|
1756 |
+
},
|
1757 |
+
pointerWidth: 450,
|
1758 |
+
close: function() {
|
1759 |
+
$.post( ajaxurl, {
|
1760 |
+
pointer: 'pksn1',
|
1761 |
+
action: 'dismiss-wp-pointer'
|
1762 |
+
});
|
1763 |
+
//$('.wpallimport-overlay').hide();
|
1764 |
+
}
|
1765 |
+
}).pointer('open');
|
1766 |
+
}
|
1767 |
+
});
|
1768 |
+
|
1769 |
+
$('.wpallimport-overlay').click(function(){
|
1770 |
+
$('.wp-pointer').hide();
|
1771 |
+
$(this).hide();
|
1772 |
+
});
|
1773 |
+
|
1774 |
+
$('.wpallimport-collapsed').each(function(){
|
1775 |
+
|
1776 |
+
if ( ! $(this).hasClass('closed')) $(this).find('.wpallimport-collapsed-content:first').slideDown();
|
1777 |
+
|
1778 |
+
});
|
1779 |
+
|
1780 |
+
$('.wpallimport-collapsed').find('.wpallimport-collapsed-header').click(function(){
|
1781 |
+
var $parent = $(this).parents('.wpallimport-collapsed:first');
|
1782 |
+
if ($parent.hasClass('closed')){
|
1783 |
+
$parent.removeClass('closed');
|
1784 |
+
$parent.find('.wpallimport-collapsed-content:first').slideDown();
|
1785 |
+
}
|
1786 |
+
else{
|
1787 |
+
$parent.addClass('closed');
|
1788 |
+
$parent.find('.wpallimport-collapsed-content:first').slideUp();
|
1789 |
+
}
|
1790 |
+
});
|
1791 |
+
|
1792 |
+
var fix_tag_position = function(){
|
1793 |
+
if ($('.wpallimport-layout').length && $('.tag').length){
|
1794 |
+
var offset = $('.wpallimport-layout').offset();
|
1795 |
+
if ($(document).scrollTop() > offset.top){
|
1796 |
+
$('.tag').css({'top':'50px'});
|
1797 |
+
$('.wpallimport-xml').css({'max-height': ($(window).height() - 147) + 'px' });
|
1798 |
+
}
|
1799 |
+
else{
|
1800 |
+
$('.tag').css({'top':'127px'});
|
1801 |
+
$('.wpallimport-xml').css({'max-height': ($(window).height() - 220) + 'px' });
|
1802 |
+
}
|
1803 |
+
}
|
1804 |
+
}
|
1805 |
+
|
1806 |
+
fix_tag_position();
|
1807 |
+
|
1808 |
+
$(document).scroll(function() {
|
1809 |
+
fix_tag_position();
|
1810 |
+
});
|
1811 |
+
|
1812 |
});})(jQuery);
|
static/js/jquery/browserplus-min.js
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/jquery/css/redmond/jquery-ui.css
CHANGED
@@ -594,7 +594,7 @@ button.ui-button::-moz-focus-inner {
|
|
594 |
float: right;
|
595 |
}
|
596 |
.ui-progressbar {
|
597 |
-
height:
|
598 |
text-align: left;
|
599 |
overflow: hidden;
|
600 |
}
|
@@ -808,8 +808,8 @@ body .ui-tooltip {
|
|
808 |
color: #222222;
|
809 |
}
|
810 |
.ui-widget-header {
|
811 |
-
border: 1px solid #
|
812 |
-
background: #
|
813 |
color: #ffffff;
|
814 |
font-weight: bold;
|
815 |
}
|
@@ -822,8 +822,8 @@ body .ui-tooltip {
|
|
822 |
.ui-state-default,
|
823 |
.ui-widget-content .ui-state-default,
|
824 |
.ui-widget-header .ui-state-default {
|
825 |
-
border: 1px solid #
|
826 |
-
background: #
|
827 |
font-weight: bold;
|
828 |
color: #2e6e9e;
|
829 |
}
|
@@ -839,8 +839,8 @@ body .ui-tooltip {
|
|
839 |
.ui-state-focus,
|
840 |
.ui-widget-content .ui-state-focus,
|
841 |
.ui-widget-header .ui-state-focus {
|
842 |
-
border: 1px solid #
|
843 |
-
background: #
|
844 |
font-weight: bold;
|
845 |
color: #1d5987;
|
846 |
}
|
@@ -854,8 +854,8 @@ body .ui-tooltip {
|
|
854 |
.ui-state-active,
|
855 |
.ui-widget-content .ui-state-active,
|
856 |
.ui-widget-header .ui-state-active {
|
857 |
-
border: 1px solid #
|
858 |
-
background: #
|
859 |
font-weight: bold;
|
860 |
color: #e17009;
|
861 |
}
|
@@ -871,8 +871,8 @@ body .ui-tooltip {
|
|
871 |
.ui-state-highlight,
|
872 |
.ui-widget-content .ui-state-highlight,
|
873 |
.ui-widget-header .ui-state-highlight {
|
874 |
-
border: 1px solid #
|
875 |
-
background: #
|
876 |
color: #363636;
|
877 |
}
|
878 |
.ui-state-highlight a,
|
@@ -883,8 +883,8 @@ body .ui-tooltip {
|
|
883 |
.ui-state-error,
|
884 |
.ui-widget-content .ui-state-error,
|
885 |
.ui-widget-header .ui-state-error {
|
886 |
-
border: 1px solid #
|
887 |
-
background: #
|
888 |
color: #cd0a0a;
|
889 |
}
|
890 |
.ui-state-error a,
|
594 |
float: right;
|
595 |
}
|
596 |
.ui-progressbar {
|
597 |
+
height: 1em;
|
598 |
text-align: left;
|
599 |
overflow: hidden;
|
600 |
}
|
808 |
color: #222222;
|
809 |
}
|
810 |
.ui-widget-header {
|
811 |
+
border: 1px solid #40acad;
|
812 |
+
background: #40acad;/* url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x;*/
|
813 |
color: #ffffff;
|
814 |
font-weight: bold;
|
815 |
}
|
822 |
.ui-state-default,
|
823 |
.ui-widget-content .ui-state-default,
|
824 |
.ui-widget-header .ui-state-default {
|
825 |
+
border: 1px solid #40acad;
|
826 |
+
background: #fff;/* url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x;/
|
827 |
font-weight: bold;
|
828 |
color: #2e6e9e;
|
829 |
}
|
839 |
.ui-state-focus,
|
840 |
.ui-widget-content .ui-state-focus,
|
841 |
.ui-widget-header .ui-state-focus {
|
842 |
+
border: 1px solid #40acad;
|
843 |
+
background: #40acad;/* url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x;*/
|
844 |
font-weight: bold;
|
845 |
color: #1d5987;
|
846 |
}
|
854 |
.ui-state-active,
|
855 |
.ui-widget-content .ui-state-active,
|
856 |
.ui-widget-header .ui-state-active {
|
857 |
+
border: 1px solid #40acad;
|
858 |
+
background: #40acad;/* url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x;*/
|
859 |
font-weight: bold;
|
860 |
color: #e17009;
|
861 |
}
|
871 |
.ui-state-highlight,
|
872 |
.ui-widget-content .ui-state-highlight,
|
873 |
.ui-widget-header .ui-state-highlight {
|
874 |
+
border: 1px solid #40acad;
|
875 |
+
background: #40acad;/* url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x;*/
|
876 |
color: #363636;
|
877 |
}
|
878 |
.ui-state-highlight a,
|
883 |
.ui-state-error,
|
884 |
.ui-widget-content .ui-state-error,
|
885 |
.ui-widget-header .ui-state-error {
|
886 |
+
border: 1px solid #40acad;
|
887 |
+
background: #40acad;/* url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;*/
|
888 |
color: #cd0a0a;
|
889 |
}
|
890 |
.ui-state-error a,
|
static/js/jquery/css/select2/select2.css
CHANGED
@@ -10,6 +10,7 @@ Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
|
|
10 |
*display: inline;
|
11 |
vertical-align: middle;
|
12 |
width:100%;
|
|
|
13 |
}
|
14 |
|
15 |
.select2-container,
|
@@ -137,7 +138,7 @@ Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
|
|
137 |
|
138 |
background: #fff;
|
139 |
color: #000;
|
140 |
-
border: 1px solid #aaa
|
141 |
border-top: 0;
|
142 |
|
143 |
border-radius: 0 0 4px 4px;
|
@@ -167,12 +168,12 @@ Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
|
|
167 |
}
|
168 |
|
169 |
.select2-drop-active {
|
170 |
-
border: 1px solid #5897fb
|
171 |
border-top: none;
|
172 |
}
|
173 |
|
174 |
.select2-drop.select2-drop-above.select2-drop-active {
|
175 |
-
border-top: 1px solid #5897fb
|
176 |
}
|
177 |
|
178 |
.select2-container .select2-choice .select2-arrow {
|
@@ -302,8 +303,8 @@ Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
|
|
302 |
/* results */
|
303 |
.select2-results {
|
304 |
max-height: 200px;
|
305 |
-
padding: 0
|
306 |
-
margin:
|
307 |
position: relative;
|
308 |
overflow-x: hidden;
|
309 |
overflow-y: auto;
|
@@ -327,6 +328,7 @@ Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
|
|
327 |
list-style: none;
|
328 |
display: list-item;
|
329 |
background-image: none;
|
|
|
330 |
}
|
331 |
|
332 |
.select2-results li.select2-result-with-children > .select2-result-label {
|
@@ -334,11 +336,11 @@ Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013
|
|
334 |
}
|
335 |
|
336 |
.select2-results .select2-result-label {
|
337 |
-
padding: 3px 7px 4px
|
338 |
margin: 0;
|
339 |
cursor: pointer;
|
340 |
|
341 |
-
min-height: 1em
|
342 |
|
343 |
-webkit-touch-callout: none;
|
344 |
-webkit-user-select: none;
|
@@ -427,7 +429,7 @@ disabled look for disabled choices in the results dropdown
|
|
427 |
.select2-container-multi .select2-choices {
|
428 |
height: auto !important;
|
429 |
height: 1%;
|
430 |
-
margin: 3px 0px;
|
431 |
padding: 5px;
|
432 |
position: relative;
|
433 |
|
@@ -440,6 +442,11 @@ disabled look for disabled choices in the results dropdown
|
|
440 |
background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
|
441 |
background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
|
442 |
background-image: linear-gradient(top, #eee 1%, #fff 15%);
|
|
|
|
|
|
|
|
|
|
|
443 |
}
|
444 |
|
445 |
.select2-locked {
|
@@ -480,6 +487,7 @@ disabled look for disabled choices in the results dropdown
|
|
480 |
box-shadow: none;
|
481 |
background: transparent !important;
|
482 |
border:none !important;
|
|
|
483 |
}
|
484 |
|
485 |
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
@@ -502,9 +510,6 @@ disabled look for disabled choices in the results dropdown
|
|
502 |
|
503 |
border-radius: 3px;
|
504 |
|
505 |
-
-webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
506 |
-
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
507 |
-
|
508 |
background-clip: padding-box;
|
509 |
|
510 |
-webkit-touch-callout: none;
|
@@ -514,11 +519,7 @@ disabled look for disabled choices in the results dropdown
|
|
514 |
user-select: none;
|
515 |
|
516 |
background-color: #e4e4e4;
|
517 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
|
518 |
-
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
|
519 |
-
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
520 |
-
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
521 |
-
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
522 |
}
|
523 |
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
|
524 |
cursor: default;
|
@@ -538,6 +539,10 @@ disabled look for disabled choices in the results dropdown
|
|
538 |
font-size: 1px;
|
539 |
outline: none;
|
540 |
background: url('select2.png') right top no-repeat;
|
|
|
|
|
|
|
|
|
541 |
}
|
542 |
|
543 |
.select2-container-multi .select2-search-choice-close {
|
@@ -547,9 +552,9 @@ disabled look for disabled choices in the results dropdown
|
|
547 |
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
|
548 |
background-position: right -11px;
|
549 |
}
|
550 |
-
|
551 |
background-position: right -11px;
|
552 |
-
}
|
553 |
|
554 |
/* disabled styles */
|
555 |
.select2-container-multi.select2-container-disabled .select2-choices {
|
10 |
*display: inline;
|
11 |
vertical-align: middle;
|
12 |
width:100%;
|
13 |
+
max-width: 900px;
|
14 |
}
|
15 |
|
16 |
.select2-container,
|
138 |
|
139 |
background: #fff;
|
140 |
color: #000;
|
141 |
+
/*border: 1px solid #aaa;*/
|
142 |
border-top: 0;
|
143 |
|
144 |
border-radius: 0 0 4px 4px;
|
168 |
}
|
169 |
|
170 |
.select2-drop-active {
|
171 |
+
/*border: 1px solid #5897fb;*/
|
172 |
border-top: none;
|
173 |
}
|
174 |
|
175 |
.select2-drop.select2-drop-above.select2-drop-active {
|
176 |
+
/*border-top: 1px solid #5897fb;*/
|
177 |
}
|
178 |
|
179 |
.select2-container .select2-choice .select2-arrow {
|
303 |
/* results */
|
304 |
.select2-results {
|
305 |
max-height: 200px;
|
306 |
+
padding: 0;
|
307 |
+
margin: 0;
|
308 |
position: relative;
|
309 |
overflow-x: hidden;
|
310 |
overflow-y: auto;
|
328 |
list-style: none;
|
329 |
display: list-item;
|
330 |
background-image: none;
|
331 |
+
margin-bottom: 0px;
|
332 |
}
|
333 |
|
334 |
.select2-results li.select2-result-with-children > .select2-result-label {
|
336 |
}
|
337 |
|
338 |
.select2-results .select2-result-label {
|
339 |
+
/*padding: 3px 7px 4px;*/
|
340 |
margin: 0;
|
341 |
cursor: pointer;
|
342 |
|
343 |
+
/*min-height: 1em;*/
|
344 |
|
345 |
-webkit-touch-callout: none;
|
346 |
-webkit-user-select: none;
|
429 |
.select2-container-multi .select2-choices {
|
430 |
height: auto !important;
|
431 |
height: 1%;
|
432 |
+
margin: 3px 0px 0px 0px;
|
433 |
padding: 5px;
|
434 |
position: relative;
|
435 |
|
442 |
background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
|
443 |
background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
|
444 |
background-image: linear-gradient(top, #eee 1%, #fff 15%);
|
445 |
+
|
446 |
+
border-radius: 4px;
|
447 |
+
-moz-border-radius: 4px;
|
448 |
+
-khtml-border-radius: 4px;
|
449 |
+
-webkit-border-radius: 4px;
|
450 |
}
|
451 |
|
452 |
.select2-locked {
|
487 |
box-shadow: none;
|
488 |
background: transparent !important;
|
489 |
border:none !important;
|
490 |
+
height: auto !important;
|
491 |
}
|
492 |
|
493 |
.select2-container-multi .select2-choices .select2-search-field input.select2-active {
|
510 |
|
511 |
border-radius: 3px;
|
512 |
|
|
|
|
|
|
|
513 |
background-clip: padding-box;
|
514 |
|
515 |
-webkit-touch-callout: none;
|
519 |
user-select: none;
|
520 |
|
521 |
background-color: #e4e4e4;
|
522 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
|
|
|
|
|
|
|
|
|
523 |
}
|
524 |
.select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
|
525 |
cursor: default;
|
539 |
font-size: 1px;
|
540 |
outline: none;
|
541 |
background: url('select2.png') right top no-repeat;
|
542 |
+
-moz-transition: none;
|
543 |
+
-webkit-transition: none;
|
544 |
+
-o-transition: color 0 ease-in;
|
545 |
+
transition: none;
|
546 |
}
|
547 |
|
548 |
.select2-container-multi .select2-search-choice-close {
|
552 |
.select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
|
553 |
background-position: right -11px;
|
554 |
}
|
555 |
+
/*.select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
|
556 |
background-position: right -11px;
|
557 |
+
}*/
|
558 |
|
559 |
/* disabled styles */
|
560 |
.select2-container-multi.select2-container-disabled .select2-choices {
|
static/js/jquery/jquery.ddslick.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function (a) { function g(a, b) { var c = a.data("ddslick"); var d = a.find(".dd-selected"), e = d.siblings(".dd-selected-value"), f = a.find(".dd-options"), g = d.siblings(".dd-pointer"), h = a.find(".dd-option").eq(b), k = h.closest("li"), l = c.settings, m = c.settings.data[b]; a.find(".dd-option").removeClass("dd-option-selected"); h.addClass("dd-option-selected"); c.selectedIndex = b; c.selectedItem = k; c.selectedData = m; if (l.showSelectedHTML) { d.html((m.text ? '<label class="dd-selected-text ' + (m.imageSrc ? m.imageSrc : "") + '">' + m.text + "</label>" : "") + (m.description ? '<small class="dd-selected-description dd-desc' + (l.truncateDescription ? " dd-selected-description-truncated" : "") + '" >' + m.description + "</small>" : "")) } else d.html(m.text); e.val(m.value); c.original.val(m.value); a.data("ddslick", c); i(a); j(a); if (typeof l.onSelected == "function") { l.onSelected.call(this, c) } } function h(b) { var c = b.find(".dd-select"), d = c.siblings(".dd-options"), e = c.find(".dd-pointer"), f = d.is(":visible"); a(".dd-click-off-close").not(d).slideUp(50); a(".dd-pointer").removeClass("dd-pointer-up"); if (f) { d.slideUp("fast", function(){ var l = b.data("ddslick"); l.settings.onSlideUpOptions.call(this); }); e.removeClass("dd-pointer-up") } else { d.slideDown("fast", function(){ var l = b.data("ddslick"); l.settings.onSlideDownOptions.call(this); }); e.addClass("dd-pointer-up") } k(b) } function i(a) { a.find(".dd-options").slideUp(50); a.find(".dd-pointer").removeClass("dd-pointer-up").removeClass("dd-pointer-up") } function j(a) { var b = a.find(".dd-select").css("height"); var c = a.find(".dd-selected-description"); var d = a.find(".dd-selected-image"); if (c.length <= 0 && d.length > 0) { a.find(".dd-selected-text").css("lineHeight", b) } } function k(b) { b.find(".dd-option").each(function () { var c = a(this); var d = c.css("height"); var e = c.find(".dd-option-description"); var f = b.find(".dd-option-image"); if (e.length <= 0 && f.length > 0) { c.find(".dd-option-text").css("lineHeight", d) } }) } a.fn.ddslick = function (c) { if (b[c]) { return b[c].apply(this, Array.prototype.slice.call(arguments, 1)) } else if (typeof c === "object" || !c) { return b.init.apply(this, arguments) } else { a.error("Method " + c + " does not exists.") } }; var b = {}, c = { data: [], keepJSONItemsOnTop: false, width: 260, height: null, background: "#eee", selectText: "", defaultSelectedIndex: null, truncateDescription: true, imagePosition: "left", showSelectedHTML: true, clickOffToClose: true, onSelected: function () { }, onSlideDownOptions: function() { }, onSlideUpOptions: function() { } }, d = '<div class="dd-select"><input class="dd-selected-value" type="hidden" /><a class="dd-selected"></a><span class="dd-pointer dd-pointer-down"></span></div>', e = '<ul class="dd-options"></ul>', f = '<style id="css-ddslick" type="text/css">' + ".dd-select{ border-radius:4px; -moz-border-radius: 4px; -khtml-border-radius: 4px; -webkit-border-radius: 4px; border:solid 1px #ccc; position:relative; cursor:pointer;}" + ".dd-desc { color:#aaa; display:block; overflow: hidden; font-weight:normal; line-height: 1.4em; }" + ".dd-selected{ overflow:hidden; display:block; padding:10px; font-weight:bold;}" + ".dd-pointer{ width:0; height:0; position:absolute; right:10px; top:50%; margin-top:-3px;}" + ".dd-pointer-down{ border:solid 5px transparent; border-top:solid 5px #000; }" + ".dd-pointer-up{border:solid 5px transparent !important; border-bottom:solid 5px #000 !important; margin-top:-8px;}" + ".dd-options{ border:solid 1px #ccc; border-top:none; list-style:none; box-shadow:0px 1px 5px #ddd; display:none; position:absolute; z-index:2000; margin:0; padding:0;background:#fff; overflow:auto;}" + ".dd-option{ padding:10px; display:block; border-bottom:solid 1px #ddd; overflow:hidden; text-decoration:none; color:#333; cursor:pointer;-webkit-transition: all 0.25s ease-in-out; -moz-transition: all 0.25s ease-in-out;-o-transition: all 0.25s ease-in-out;-ms-transition: all 0.25s ease-in-out; }" + ".dd-options > li:last-child > .dd-option{ border-bottom:none;}" + ".dd-option:hover{ background:#f3f3f3; color:#000;}" + ".dd-selected-description-truncated { text-overflow: ellipsis; white-space:nowrap; }" + ".dd-option-selected { background:#f6f6f6; }" + ".dd-option-image, .dd-selected-image { vertical-align:middle; float:left; margin-right:5px; max-width:64px;}" + ".dd-image-right { float:right; margin-right:15px; margin-left:5px;}" + ".dd-container{ position:relative;} .dd-selected-text { font-weight:bold}</style>"; if (a("#css-ddslick").length <= 0) { a(f).appendTo("head") } b.init = function (b) { var b = a.extend({}, c, b); return this.each(function () { var c = a(this), f = c.data("ddslick"); if (!f) { var i = [], j = b.data; c.find("option").each(function () { var b = a(this), c = b.data(); i.push({ text: a.trim(b.text()), value: b.val(), selected: b.is(":selected"), description: c.description, imageSrc: c.imagesrc }) }); if (b.keepJSONItemsOnTop) a.merge(b.data, i); else b.data = a.merge(i, b.data); var k = c, l = a('<div id="' + c.attr("id") + '"></div>'); c.replaceWith(l); c = l; c.addClass("dd-container").append(d).append(e); var i = c.find(".dd-select"), m = c.find(".dd-options"); m.css({ width: b.width }); i.css({ width: b.width, background: b.background }); c.css({ width: b.width }); if (b.height != null) m.css({ height: b.height, overflow: "auto" }); a.each(b.data, function (a, c) { if (c.selected) b.defaultSelectedIndex = a; m.append("<li>" + '<a class="dd-option">' + (c.value ? ' <input class="dd-option-value" type="hidden" value="' + c.value + '" />' : "") + (c.text ? ' <label class="dd-option-text ' + (c.imageSrc ? c.imageSrc : "") + '">' + c.text + "</label>" : "") + (c.description ? ' <small class="dd-option-description dd-desc">' + c.description + "</small>" : "") + "</a>" + "</li>") }); var n = { settings: b, original: k, selectedIndex: -1, selectedItem: null, selectedData: null }; c.data("ddslick", n); if (b.selectText.length > 0 && b.defaultSelectedIndex == null) { c.find(".dd-selected").html(b.selectText) } else { var o = b.defaultSelectedIndex != null && b.defaultSelectedIndex >= 0 && b.defaultSelectedIndex < b.data.length ? b.defaultSelectedIndex : 0; g(c, o) } c.find(".dd-select").on("click.ddslick", function () { h(c) }); c.find(".dd-option").on("click.ddslick", function () { g(c, a(this).closest("li").index()) }); if (b.clickOffToClose) { m.addClass("dd-click-off-close"); c.on("click.ddslick", function (a) { a.stopPropagation() }); a("body").on("click", function () { a(".dd-click-off-close").slideUp(50).siblings(".dd-select").find(".dd-pointer").removeClass("dd-pointer-up") }) } } }) }; b.select = function (b) { return this.each(function () { if (b.index) g(a(this), b.index) }) }; b.open = function () { return this.each(function () { var b = a(this), c = b.data("ddslick"); if (c) h(b) }) }; b.close = function () { return this.each(function () { var b = a(this), c = b.data("ddslick"); if (c) i(b) }) }; b.destroy = function () { return this.each(function () { var b = a(this), c = b.data("ddslick"); if (c) { var d = c.original; b.removeData("ddslick").unbind(".ddslick").replaceWith(d) } }) } })(jQuery)
|
static/js/jquery/jquery.mjs.nestedSortable.js
CHANGED
@@ -13,12 +13,12 @@
|
|
13 |
|
14 |
(function($) {
|
15 |
|
16 |
-
$.widget("mjs.
|
17 |
|
18 |
options: {
|
19 |
tabSize: 20,
|
20 |
-
disableNesting: 'mjs-
|
21 |
-
errorClass: 'mjs-
|
22 |
listType: 'ol',
|
23 |
maxLevels: 0,
|
24 |
protectRoot: false,
|
@@ -28,18 +28,18 @@
|
|
28 |
},
|
29 |
|
30 |
_create: function() {
|
31 |
-
this.element.data('sortable', this.element.data('
|
32 |
|
33 |
if (!this.element.is(this.options.listType))
|
34 |
-
throw new Error('
|
35 |
|
36 |
return $.ui.sortable.prototype._create.apply(this, arguments);
|
37 |
},
|
38 |
|
39 |
destroy: function() {
|
40 |
this.element
|
41 |
-
.removeData("
|
42 |
-
.unbind(".
|
43 |
return $.ui.sortable.prototype.destroy.apply(this, arguments);
|
44 |
},
|
45 |
|
@@ -345,7 +345,7 @@
|
|
345 |
}
|
346 |
|
347 |
if (id) {
|
348 |
-
ret.push({"item_id": id[2], "
|
349 |
}
|
350 |
|
351 |
left = right + 1;
|
@@ -395,7 +395,7 @@
|
|
395 |
_isAllowed: function(parentItem, level, levels) {
|
396 |
var o = this.options,
|
397 |
isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false,
|
398 |
-
maxLevels = this.placeholder.closest('.ui-sortable').
|
399 |
|
400 |
// Is the root protected?
|
401 |
// Are we trying to nest under a no-nest?
|
@@ -422,5 +422,5 @@
|
|
422 |
|
423 |
}));
|
424 |
|
425 |
-
$.mjs.
|
426 |
})(jQuery);
|
13 |
|
14 |
(function($) {
|
15 |
|
16 |
+
$.widget("mjs.pmxi_nestedSortable", $.extend({}, $.ui.sortable.prototype, {
|
17 |
|
18 |
options: {
|
19 |
tabSize: 20,
|
20 |
+
disableNesting: 'mjs-pmxi_nestedSortable-no-nesting',
|
21 |
+
errorClass: 'mjs-pmxi_nestedSortable-error',
|
22 |
listType: 'ol',
|
23 |
maxLevels: 0,
|
24 |
protectRoot: false,
|
28 |
},
|
29 |
|
30 |
_create: function() {
|
31 |
+
this.element.data('sortable', this.element.data('pmxi_nestedSortable'));
|
32 |
|
33 |
if (!this.element.is(this.options.listType))
|
34 |
+
throw new Error('pmxi_nestedSortable: Please check the listType option is set to your actual list type');
|
35 |
|
36 |
return $.ui.sortable.prototype._create.apply(this, arguments);
|
37 |
},
|
38 |
|
39 |
destroy: function() {
|
40 |
this.element
|
41 |
+
.removeData("pmxi_nestedSortable")
|
42 |
+
.unbind(".pmxi_nestedSortable");
|
43 |
return $.ui.sortable.prototype.destroy.apply(this, arguments);
|
44 |
},
|
45 |
|
345 |
}
|
346 |
|
347 |
if (id) {
|
348 |
+
ret.push({"item_id": id[2], "left": left, "right": right, "parent_id": pid, "xpath":$(item).find('input.xpath_field').val()});
|
349 |
}
|
350 |
|
351 |
left = right + 1;
|
395 |
_isAllowed: function(parentItem, level, levels) {
|
396 |
var o = this.options,
|
397 |
isRoot = $(this.domPosition.parent).hasClass('ui-sortable') ? true : false,
|
398 |
+
maxLevels = this.placeholder.closest('.ui-sortable').pmxi_nestedSortable('option', 'maxLevels'); // this takes into account the maxLevels set to the recipient list
|
399 |
|
400 |
// Is the root protected?
|
401 |
// Are we trying to nest under a no-nest?
|
422 |
|
423 |
}));
|
424 |
|
425 |
+
$.mjs.pmxi_nestedSortable.prototype.options = $.extend({}, $.ui.sortable.prototype.options, $.mjs.pmxi_nestedSortable.prototype.options);
|
426 |
})(jQuery);
|
static/js/jquery/jquery.ui-contextmenu.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
/*! jQuery UI context menu plugin - v1.5.0 - 2014-07-06 | https://github.com/mar10/jquery-ui-contextmenu | Copyright (c) 2014 Martin Wendt; Licensed MIT */
|
2 |
+
!function(a,b,c,d){"use strict";var e,f,g="onselectstart"in c.createElement("div");a.widget("moogle.contextmenu",{version:"1.4.0-1",options:{autoTrigger:!0,delegate:null,hide:{effect:"fadeOut",duration:"fast"},ignoreParentSelect:!0,menu:null,position:null,preventContextMenuForPopup:!1,preventSelect:!1,show:{effect:"slideDown",duration:"fast"},taphold:!1,beforeOpen:a.noop,blur:a.noop,close:a.noop,create:a.noop,createMenu:a.noop,focus:a.noop,open:a.noop,select:a.noop},_create:function(){var b,d,e,f=this.options;if(this.$headStyle=null,this.$menu=null,this.menuIsTemp=!1,this.currentTarget=null,f.preventSelect){e=(a(this.element).is(c)?a("body"):this.element).uniqueId().attr("id"),b="#"+e+" "+f.delegate+" { -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }",this.$headStyle=a("<style class='moogle-contextmenu-style' />").prop("type","text/css").appendTo("head");try{this.$headStyle.html(b)}catch(h){this.$headStyle[0].styleSheet.cssText=b}g&&this.element.delegate(f.delegate,"selectstart"+this.eventNamespace,function(a){a.preventDefault()})}this._createUiMenu(f.menu),d="contextmenu"+this.eventNamespace,f.taphold&&(d+=" taphold"+this.eventNamespace),this.element.delegate(f.delegate,d,a.proxy(this._openMenu,this))},_destroy:function(){this.element.undelegate(this.eventNamespace),this._createUiMenu(null),this.$headStyle&&(this.$headStyle.remove(),this.$headStyle=null)},_createUiMenu:function(b){var c;this.isOpen()&&(c=this.currentTarget,this._closeMenu(!0),this.currentTarget=c),this.menuIsTemp?this.$menu.remove():this.$menu&&this.$menu.menu("destroy").hide(),this.$menu=null,this.menuIsTemp=!1,b&&(a.isArray(b)?(this.$menu=a.moogle.contextmenu.createMenuMarkup(b),this.menuIsTemp=!0):this.$menu="string"==typeof b?a(b):b,this.$menu.hide().menu({blur:a.proxy(this.options.blur,this),create:a.proxy(this.options.createMenu,this),focus:a.proxy(this.options.focus,this),select:a.proxy(function(b,c){var d,e=a.moogle.contextmenu.isMenu(c.item),f=c.item.data("actionHandler");c.cmd=c.item.attr("data-command"),c.target=a(this.currentTarget),e&&this.options.ignoreParentSelect||(d=this._trigger.call(this,"select",b,c),f&&(d=f.call(this,b,c)),d!==!1&&this._closeMenu.call(this),b.preventDefault())},this)}))},_openMenu:function(b){var e=this.options,f=e.position,g=this,h=!!b.isTrigger,i={menu:this.$menu,target:a(b.target),extraData:b.extraData,originalEvent:b};if(e.autoTrigger||h){if(this.currentTarget=b.target,b.preventDefault(),this._trigger("beforeOpen",b,i)===!1)return this.currentTarget=null,!1;i.menu=this.$menu,a(c).bind("keydown"+this.eventNamespace,function(b){b.which===a.ui.keyCode.ESCAPE&&g._closeMenu()}).bind("mousedown"+this.eventNamespace+" touchstart"+this.eventNamespace,function(b){a(b.target).closest(".ui-menu-item").length||g._closeMenu()}),a.isFunction(f)&&(f=f(b,i)),f=a.extend({my:"left top",at:"left bottom",of:b.pageX===d?b.target:b,collision:"fit"},f),this.$menu.show().css({position:"absolute",left:0,top:0}).position(f).hide(),e.preventContextMenuForPopup&&this.$menu.bind("contextmenu"+this.eventNamespace,function(a){a.preventDefault()}),this._show(this.$menu,this.options.show,function(){g._trigger.call(g,"open",b,i)})}},_closeMenu:function(b){var d=this,e=b?!1:this.options.hide;a(c).unbind("mousedown"+this.eventNamespace).unbind("touchstart"+this.eventNamespace).unbind("keydown"+this.eventNamespace),this.$menu.unbind("contextmenu"+this.eventNamespace),d.currentTarget=null,this._hide(this.$menu,e,function(){d._trigger("close")})},_setOption:function(b,c){switch(b){case"menu":this.replaceMenu(c)}a.Widget.prototype._setOption.apply(this,arguments)},_getMenuEntry:function(a){return this.$menu.find("li[data-command="+a+"]")},close:function(){this.isOpen()&&this._closeMenu()},enableEntry:function(a,b){this._getMenuEntry(a).toggleClass("ui-state-disabled",b===!1)},getMenu:function(){return this.$menu},isOpen:function(){return!!this.$menu&&!!this.currentTarget},open:function(a,b){b=b||{};var c=jQuery.Event("contextmenu",{target:a.get(0),extraData:b});return this.element.trigger(c)},replaceMenu:function(a){this._createUiMenu(a)},setEntry:function(b,c){var d=this._getMenuEntry(b);"string"==typeof c?a.moogle.contextmenu.updateTitle(d,c):(d.empty(),c.cmd=c.cmd||b,a.moogle.contextmenu.createEntryMarkup(c,d))},showEntry:function(a,b){this._getMenuEntry(a).toggle(b!==!1)}}),a.extend(a.moogle.contextmenu,{createMenuMarkup:function(b,c){var d,e,f,g;for(null==c&&(c=a("<ul class='ui-helper-hidden' />").appendTo("body")),d=0;d<b.length;d++)e=b[d],g=a("<li/>").appendTo(c),a.moogle.contextmenu.createEntryMarkup(e,g),a.isArray(e.children)&&(f=a("<ul/>").appendTo(g),a.moogle.contextmenu.createMenuMarkup(e.children,f));return c},replaceFirstTextNodeChild:function(a,b){a.contents().filter(function(){return 3===this.nodeType}).first().replaceWith(b)}}),e=a.ui.menu.version.match(/^(\d)\.(\d+)/),f={major:parseInt(e[1],10),minor:parseInt(e[2],10)},f.major<2&&f.minor<11?a.extend(a.moogle.contextmenu,{createEntryMarkup:function(b,c){var d=null;/[^\-\u2014\u2013\s]/.test(b.title)?(c.attr("data-command",b.cmd),d=a("<a/>",{html:""+b.title,href:"#"}).appendTo(c),a.isFunction(b.action)&&c.data("actionHandler",b.action),b.uiIcon&&d.append(a("<span class='ui-icon' />").addClass(b.uiIcon)),b.disabled&&c.addClass("ui-state-disabled"),a.isPlainObject(b.data)&&d.data(b.data)):c.text(b.title)},isMenu:function(a){return a.has(">a[aria-haspopup='true']").length>0},updateTitle:function(b,c){a.moogle.contextmenu.replaceFirstTextNodeChild(a("a",b),c)}}):a.extend(a.moogle.contextmenu,{createEntryMarkup:function(b,c){/[^\-\u2014\u2013\s]/.test(b.title)?(c.attr("data-command",b.cmd).html(""+b.title),a.isFunction(b.action)&&c.data("actionHandler",b.action),b.uiIcon&&c.append(a("<span class='ui-icon' />").addClass(b.uiIcon)),b.disabled&&c.addClass("ui-state-disabled"),a.isPlainObject(b.data)&&c.data(b.data)):c.text(b.title)},isMenu:function(a){return a.is("[aria-haspopup='true']")},updateTitle:function(b,c){a.moogle.contextmenu.replaceFirstTextNodeChild(b,c)}})}(jQuery,window,document);
|
static/js/jquery/select2.min.js
CHANGED
@@ -18,5 +18,5 @@ or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CO
|
|
18 |
either express or implied. See the Apache License and the GPL License for the specific language governing
|
19 |
permissions and limitations under the Apache License and the GPL License.
|
20 |
*/
|
21 |
-
!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(a){var b,c,d,e;if(!a||a.length<1)return a;for(b="",c=0,d=a.length;d>c;c++)e=a.charAt(c),b+=m[e]||e;return b}function o(a,b){for(var c=0,d=b.length;d>c;c+=1)if(q(a,b[c]))return c;return-1}function p(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function q(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function r(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function s(a){return a.outerWidth(!1)-a.width()}function t(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function u(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function v(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function w(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function x(a,b){var c=v(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){o(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=n(a.toUpperCase()).indexOf(n(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g)}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;throw new Error(c+" must be a function or a falsy value")}function K(b){return a.isFunction(b)?b():b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(q(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=N(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=w(function(){return c.element.closest("body")}),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),u(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",f,this.bind(this.highlightUnderEvent)),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),t(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown",function(a){a.stopPropagation()}),a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||p(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.nextSearchTerm=b},destroy:function(){var a=this.opts.element,c=a.data("select2");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),c!==b&&(c.container.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:q(a.attr("locked"),"locked")||q(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,g,h=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,f){var g,i=this.opts.id;g=function(d,e,j){var k,l,m,n,o,p,q,r,s,t;for(d=c.sortResults(d,e,f),k=0,l=d.length;l>k;k+=1)m=d[k],o=m.disabled===!0,n=!o&&i(m)!==b,p=m.children&&m.children.length>0,q=a("<li></li>"),q.addClass("select2-results-dept-"+j),q.addClass("select2-result"),q.addClass(n?"select2-result-selectable":"select2-result-unselectable"),o&&q.addClass("select2-disabled"),p&&q.addClass("select2-result-with-children"),q.addClass(h.opts.formatResultCssClass(m)),r=a(document.createElement("div")),r.addClass("select2-result-label"),t=c.formatResult(m,r,f,h.opts.escapeMarkup),t!==b&&r.html(t),q.append(r),p&&(s=a("<ul></ul>"),s.addClass("select2-result-sub"),g(m.children,s,j+1),q.append(s)),q.data("select2-data",m),e.append(q)},g(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,i,c={results:[],more:!1},e=a.term;i=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(h.optionToData(b)):b.is("optgroup")&&(d=h.optionToData(b),b.children().each2(function(a,b){i(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){i(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id},c.formatResultCssClass=function(a){return a.css}):"query"in c||("ajax"in c?(g=c.element.data("ajax-url"),g&&g.length>0&&(c.ajax.url=g),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(r(b.val(),c.separator)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return q(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");return c},monitorSource:function(){var c,d,a=this.opts.element;a.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),c=this.bind(function(){var c=a.prop("disabled");c===b&&(c=!1),this.enable(!c);var d=a.prop("readonly");d===b&&(d=!1),this.readonly(d),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass)),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass))}),a.on("propertychange.select2",c),this.mutationCallback===b&&(this.mutationCallback=function(a){a.forEach(c)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(this.mutationCallback),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){return a===b&&(a=!1),this._readonly===a?!1:(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface(),!0)},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,u,v,w,x,b=this.dropdown,c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),g=a(window),h=g.width(),i=g.height(),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,o=l>=m+f,p=c.top-f>=this.body().scrollTop(),q=b.outerWidth(!1),r=j>=n+q,s=b.hasClass("select2-drop-above");s?(u=!0,!p&&o&&(v=!0,u=!1)):(u=!1,!o&&p&&(v=!0,u=!0)),v&&(b.hide(),c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,q=b.outerWidth(!1),r=j>=n+q,b.show()),this.opts.dropdownAutoWidth?(x=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),q=b.outerWidth(!1)+(x.scrollHeight===x.clientHeight?0:k.width),q>e?e=q:q=e,r=j>=n+q):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body().css("position")&&(t=this.body().offset(),m-=t.top,n-=t.left),r||(n=c.left+e-q),w={left:n,width:e},u?(w.bottom=i-c.top,w.top="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(w.top=m,w.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),w=a.extend(w,K(this.opts.dropdownCss)),b.css(w)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var f,b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),f=a("#select2-drop-mask"),0==f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body()),f.on("mousedown touchstart click",function(b){var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close({focus:!0}),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),f=e.offset().top+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!0),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=e.offset().top-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled, .select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?o(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.ensureHighlightVisible(),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).text(e.opts.formatLoadMore(d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown()}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!q(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+f.formatSelectionTooBig(o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+f.formatInputTooShort(d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;
|
22 |
-
if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+f.formatInputTooLong(d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+f.formatSearching()+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return q(h.id(this),h.id(i))}).length&&g.results.unshift(i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+f.formatNoMatches(d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var a=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&a||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.text()&&""===a.val())return a}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow'><b></b></span>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>"," </div>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e)),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(a){this.opened()&&(this.parent.close.apply(this,arguments),a=a||{focus:!0},this.focusser.removeAttr("disabled"),a.focus&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var b,d=this.container,e=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=d.find(".select2-choice"),this.focusser=d.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return A(a),void 0;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case c.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return A(a),void 0;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),t(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection.focus())})),b.on("mousedown",this.bind(function(b){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(b)})),e.on("mousedown",this.bind(function(){this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder())})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()?(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val():!1},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=q(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return q(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||this.focusser.focus(),q(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),f=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=r(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return q(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(q(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var d,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=d=this.container.find(b);var e=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){e.search[0].focus(),e.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=d.find(".select2-search-choice-focus"),e=b.prev(".select2-search-choice:not(.select2-locked)"),f=b.next(".select2-search-choice:not(.select2-locked)"),g=z(this.search);if(b.length&&(a.which==c.LEFT||a.which==c.RIGHT||a.which==c.BACKSPACE||a.which==c.DELETE||a.which==c.ENTER)){var h=b;return a.which==c.LEFT&&e.length?h=e:a.which==c.RIGHT?h=f.length?f:null:a.which===c.BACKSPACE?(this.unselect(b.first()),this.search.width(10),h=e.length?e:f):a.which==c.DELETE?(this.unselect(b.first()),this.search.width(10),h=f.length?f:null):a.which==c.ENTER&&(h=null),this.selectChoice(h),A(a),h&&h.length||this.open(),void 0}if((a.which===c.BACKSPACE&&1==this.keydowns||a.which==c.LEFT)&&0==g.offset&&!g.length)return this.selectChoice(d.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case c.ESC:return this.cancel(a),A(a),void 0}if(a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.BACKSPACE&&a.which!==c.ESC){if(a.which===c.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&A(a),a.which===c.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){o(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("<div>"+j+"</div>"),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),A(b))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){for(;(e=o(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();var f=a.Event("select2-removing");f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented()||(b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}))}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));o(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+g.opts.formatNoMatches(g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-s(this.search)},resizeSearch:function(){var a,b,c,d,e,f=s(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),r(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){o(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)q(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,g,h,i,j,c=Array.prototype.slice.call(arguments,0),k=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],l=["opened","isFocused","container","dropdown"],m=["val","data"],n={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?j=d.element.prop("multiple"):(j=d.multiple||!1,"tags"in d&&(d.multiple=j=!0)),g=j?new f:new e,g.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(o(c[0],k)<0)throw"Unknown method: "+c[0];if(i=b,g=a(this).data("select2"),g===b)return;if(h=c[0],"container"===h?i=g.container:"dropdown"===h?i=g.dropdown:(n[h]&&(h=n[h]),i=g[h].apply(g,c.slice(1))),o(c[0],l)>=0||o(c[0],m)&&1==c.length)return!1}}),i===b?this:i},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(){return b},formatSelectionCssClass:function(){return b},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return n(""+b).toUpperCase().indexOf(n(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b}},a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:v,markMatch:E,escapeMarkup:F,stripDiacritics:n},"class":{"abstract":d,single:e,multi:f}}}}(jQuery);
|
18 |
either express or implied. See the Apache License and the GPL License for the specific language governing
|
19 |
permissions and limitations under the Apache License and the GPL License.
|
20 |
*/
|
21 |
+
!function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(a){var b,c,d,e;if(!a||a.length<1)return a;for(b="",c=0,d=a.length;d>c;c++)e=a.charAt(c),b+=m[e]||e;return b}function o(a,b){for(var c=0,d=b.length;d>c;c+=1)if(q(a,b[c]))return c;return-1}function p(){var b=a(l);b.appendTo("body");var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function q(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function r(b,c){var d,e,f;if(null===b||b.length<1)return[];for(d=b.split(c),e=0,f=d.length;f>e;e+=1)d[e]=a.trim(d[e]);return d}function s(a){return a.outerWidth(!1)-a.width()}function t(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function u(c){c.on("mousemove",function(c){var d=i;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function v(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function w(a){var c,b=!1;return function(){return b===!1&&(c=a(),b=!0),c}}function x(a,b){var c=v(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){o(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus(),a.is(":visible")&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!h){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);h=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),h.attr("class","select2-sizer"),a("body").append(h)}return h.text(b.val()),h.width()}function D(b,c,d){var e,g,f=[];e=b.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=c.attr("class"),e&&(e=""+e,a(e.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=n(a.toUpperCase()).indexOf(n(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match " + ((d(a.substring(e,e+f))) ? 'wpallimport-not-empty' : 'wpallimport-empty') + "'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push("<span class='" + ((d(a.substring(e+f,a.length))) ? 'wpallimport-not-empty' : 'wpallimport-empty') + "'>"),c.push(d(a.substring(e+f,a.length))),c.push('</span>'),void 0)}function F(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page);i.callback(b)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]};a(d?c():c).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g)}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;throw new Error(c+" must be a function or a falsy value")}function K(b){return a.isFunction(b)?b():b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(q(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,h,j,k,i={x:0,y:0},c={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case c.LEFT:case c.RIGHT:case c.UP:case c.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case c.SHIFT:case c.CTRL:case c.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z"};j=a(document),g=function(){var a=1;return function(){return a++}}(),j.on("mousemove",function(a){i.x=a.pageX,i.y=a.pageY}),d=N(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,f=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+g()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=w(function(){return c.element.closest("body")}),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss)),this.container.addClass(K(c.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(f),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),u(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",f,this.bind(this.highlightUnderEvent)),x(80,this.results),this.dropdown.on("scroll-debounced",f,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),t(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",f,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown",function(a){a.stopPropagation()}),a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),k=k||p(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.nextSearchTerm=b},destroy:function(){var a=this.opts.element,c=a.data("select2");this.close(),this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),c!==b&&(c.container.remove(),c.dropdown.remove(),a.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show())},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:q(a.attr("locked"),"locked")||q(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,f,g,h=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,f){var g,i=this.opts.id;g=function(d,e,j){var k,l,m,n,o,p,q,r,s,t;for(d=c.sortResults(d,e,f),k=0,l=d.length;l>k;k+=1)m=d[k],o=m.disabled===!0,n=!o&&i(m)!==b,p=m.children&&m.children.length>0,q=a("<li></li>"),q.addClass("select2-results-dept-"+j),q.addClass("select2-result"),q.addClass(n?"select2-result-selectable":"select2-result-unselectable"),o&&q.addClass("select2-disabled"),p&&q.addClass("select2-result-with-children"),q.addClass(h.opts.formatResultCssClass(m)),r=a(document.createElement("div")),r.addClass("select2-result-label"),t=c.formatResult(m,r,f,h.opts.escapeMarkup),t!==b&&r.html(t),q.append(r),p&&(s=a("<ul></ul>"),s.addClass("select2-result-sub"),g(m.children,s,j+1),q.append(s)),q.data("select2-data",m),e.append(q)},g(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(f=c.id,c.id=function(a){return a[f]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,i,c={results:[],more:!1},e=a.term;i=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(h.optionToData(b)):b.is("optgroup")&&(d=h.optionToData(b),b.children().each2(function(a,b){i(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){i(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id},c.formatResultCssClass=function(a){return a.css}):"query"in c||("ajax"in c?(g=c.element.data("ajax-url"),g&&g.length>0&&(c.ajax.url=g),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(r(b.val(),c.separator)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return q(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");return c},monitorSource:function(){var c,d,a=this.opts.element;a.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),c=this.bind(function(){var c=a.prop("disabled");c===b&&(c=!1),this.enable(!c);var d=a.prop("readonly");d===b&&(d=!1),this.readonly(d),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass)),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass))}),a.on("propertychange.select2",c),this.mutationCallback===b&&(this.mutationCallback=function(a){a.forEach(c)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(this.mutationCallback),this.propertyObserver.observe(a.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){return a===b&&(a=!1),this._readonly===a?!1:(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface(),!0)},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,u,v,w,x,b=this.dropdown,c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),g=a(window),h=g.width(),i=g.height(),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,o=l>=m+f,p=c.top-f>=this.body().scrollTop(),q=b.outerWidth(!1),r=j>=n+q,s=b.hasClass("select2-drop-above");s?(u=!0,!p&&o&&(v=!0,u=!1)):(u=!1,!o&&p&&(v=!0,u=!0)),v&&(b.hide(),c=this.container.offset(),d=this.container.outerHeight(!1),e=this.container.outerWidth(!1),f=b.outerHeight(!1),j=g.scrollLeft()+h,l=g.scrollTop()+i,m=c.top+d,n=c.left,q=b.outerWidth(!1),r=j>=n+q,b.show()),this.opts.dropdownAutoWidth?(x=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),q=b.outerWidth(!1)+(x.scrollHeight===x.clientHeight?0:k.width),q>e?e=q:q=e,r=j>=n+q):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body().css("position")&&(t=this.body().offset(),m-=t.top,n-=t.left),r||(n=c.left+e-q),w={left:n,width:e},u?(w.bottom=i-c.top,w.top="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(w.top=m,w.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),w=a.extend(w,K(this.opts.dropdownCss)),b.css(w)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){var f,b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),f=a("#select2-drop-mask"),0==f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body()),f.on("mousedown touchstart click",function(b){var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close({focus:!0}),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerId,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),f=e.offset().top+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!0),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=e.offset().top-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled, .select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?o(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.ensureHighlightVisible(),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).text(e.opts.formatLoadMore(d+1)),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown()}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!q(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+f.formatSelectionTooBig(o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+f.formatInputTooShort(d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;
|
22 |
+
if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+f.formatInputTooLong(d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+f.formatSearching()+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return q(h.id(this),h.id(i))}).length&&g.results.unshift(i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+f.formatNoMatches(d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(f.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var a=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&a||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.text()&&""===a.val())return a}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),e=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow'><b></b></span>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'/>"," </div>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e)),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(a){this.opened()&&(this.parent.close.apply(this,arguments),a=a||{focus:!0},this.focusser.removeAttr("disabled"),a.focus&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var b,d=this.container,e=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=d.find(".select2-choice"),this.focusser=d.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){if(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)return A(a),void 0;switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case c.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.ESC){if(this.opts.openOnEnter===!1&&a.which===c.ENTER)return A(a),void 0;if(a.which==c.DOWN||a.which==c.UP||a.which==c.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==c.DELETE||a.which==c.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),t(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection.focus())})),b.on("mousedown",this.bind(function(b){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(b)})),e.on("mousedown",this.bind(function(){this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder())})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()?(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val():!1},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=q(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return q(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||this.focusser.focus(),q(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),f=N(d,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=r(c.val(),b.separator),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return q(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(q(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments)},initContainer:function(){var d,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=d=this.container.find(b);var e=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(){e.search[0].focus(),e.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+g()),a("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=d.find(".select2-search-choice-focus"),e=b.prev(".select2-search-choice:not(.select2-locked)"),f=b.next(".select2-search-choice:not(.select2-locked)"),g=z(this.search);if(b.length&&(a.which==c.LEFT||a.which==c.RIGHT||a.which==c.BACKSPACE||a.which==c.DELETE||a.which==c.ENTER)){var h=b;return a.which==c.LEFT&&e.length?h=e:a.which==c.RIGHT?h=f.length?f:null:a.which===c.BACKSPACE?(this.unselect(b.first()),this.search.width(10),h=e.length?e:f):a.which==c.DELETE?(this.unselect(b.first()),this.search.width(10),h=f.length?f:null):a.which==c.ENTER&&(h=null),this.selectChoice(h),A(a),h&&h.length||this.open(),void 0}if((a.which===c.BACKSPACE&&1==this.keydowns||a.which==c.LEFT)&&0==g.offset&&!g.length)return this.selectChoice(d.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case c.UP:case c.DOWN:return this.moveHighlight(a.which===c.UP?-1:1),A(a),void 0;case c.ENTER:return this.selectHighlighted(),A(a),void 0;case c.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case c.ESC:return this.cancel(a),A(a),void 0}if(a.which!==c.TAB&&!c.isControl(a)&&!c.isFunctionKey(a)&&a.which!==c.BACKSPACE&&a.which!==c.ESC){if(a.which===c.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===c.PAGE_UP||a.which===c.PAGE_DOWN)&&A(a),a.which===c.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),this.updateResults(!0),this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){o(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,b){this.triggerSelect(a)&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),b&&b.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith("<div>"+j+"</div>"),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),A(b))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),j&&g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){for(;(e=o(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();var f=a.Event("select2-removing");f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented()||(b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}))}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));o(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+g.opts.formatNoMatches(g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-s(this.search)},resizeSearch:function(){var a,b,c,d,e,f=s(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),r(a,this.opts.separator))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){o(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)q(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,g,h,i,j,c=Array.prototype.slice.call(arguments,0),k=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],l=["opened","isFocused","container","dropdown"],m=["val","data"],n={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?j=d.element.prop("multiple"):(j=d.multiple||!1,"tags"in d&&(d.multiple=j=!0)),g=j?new f:new e,g.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(o(c[0],k)<0)throw"Unknown method: "+c[0];if(i=b,g=a(this).data("select2"),g===b)return;if(h=c[0],"container"===h?i=g.container:"dropdown"===h?i=g.dropdown:(n[h]&&(h=n[h]),i=g[h].apply(g,c.slice(1))),o(c[0],l)>=0||o(c[0],m)&&1==c.length)return!1}}),i===b?this:i},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(a.text,c.term,e,d),e.join("")},formatSelection:function(a,c,d){return a?d(a.text):b},sortResults:function(a){return a},formatResultCssClass:function(){return b},formatSelectionCssClass:function(){return b},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a.id},matcher:function(a,b){return n(""+b).toUpperCase().indexOf(n(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b}},a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:v,markMatch:E,escapeMarkup:F,stripDiacritics:n},"class":{"abstract":d,single:e,multi:f}}}}(jQuery);
|
static/js/plupload/wplupload.js
CHANGED
@@ -15,37 +15,29 @@ $.fn.wplupload = function($options) {
|
|
15 |
var $this = $(this);
|
16 |
|
17 |
$up = new plupload.Uploader($options);
|
18 |
-
|
19 |
-
|
20 |
-
/*$up.bind('Init', function(up) {
|
21 |
-
var dropElm = $('#' + up.settings.drop_element);
|
22 |
-
if (dropElm.length && up.features.dragdrop) {
|
23 |
-
dropElm.bind('dragenter', function() {
|
24 |
-
$(this).css('border', '3px dashed #cccccc');
|
25 |
-
});
|
26 |
-
dropElm.bind('dragout drop', function() {
|
27 |
-
$(this).css('border', 'none');
|
28 |
-
});
|
29 |
-
}
|
30 |
-
});*/
|
31 |
-
|
32 |
$up.bind('FilesAdded', function(up, files) {
|
33 |
$.each(files, function(i, file) {
|
34 |
// Create a progress bar containing the filename
|
35 |
-
$('#
|
36 |
-
$('#
|
37 |
})
|
38 |
});
|
39 |
|
40 |
$up.init();
|
41 |
|
42 |
$up.bind('Error', function(up, err) {
|
43 |
-
|
|
|
44 |
});
|
45 |
|
46 |
$up.bind('FilesAdded', function(up, files) {
|
47 |
// Disable submit and enable cancel
|
48 |
|
|
|
|
|
|
|
|
|
49 |
$('#cancel-upload').removeAttr('disabled');
|
50 |
|
51 |
$up.start();
|
@@ -57,7 +49,7 @@ $.fn.wplupload = function($options) {
|
|
57 |
|
58 |
$up.bind('UploadProgress', function(up, file) {
|
59 |
// Lengthen the progress bar
|
60 |
-
$('#progressbar').html('Uploading
|
61 |
$('#upload_process').progressbar({value:file.percent});
|
62 |
|
63 |
});
|
@@ -68,22 +60,47 @@ $.fn.wplupload = function($options) {
|
|
68 |
|
69 |
r = _parseJSON(r.response);
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
-
|
|
|
|
|
|
|
|
|
74 |
|
75 |
-
|
76 |
|
77 |
-
|
|
|
|
|
78 |
|
79 |
-
|
80 |
-
$('#progressbar').html(r.error.message);
|
81 |
}
|
82 |
|
83 |
});
|
84 |
|
85 |
$up.bind('UploadComplete', function(up) {
|
86 |
$('#cancel-upload').attr('disabled', 'disabled');
|
|
|
87 |
});
|
88 |
|
89 |
$('#cancel-upload').click(function() {
|
15 |
var $this = $(this);
|
16 |
|
17 |
$up = new plupload.Uploader($options);
|
18 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
$up.bind('FilesAdded', function(up, files) {
|
20 |
$.each(files, function(i, file) {
|
21 |
// Create a progress bar containing the filename
|
22 |
+
$('#progress').css({'visibility':'visible', 'display':'block'});
|
23 |
+
$('#select-files').hide();
|
24 |
})
|
25 |
});
|
26 |
|
27 |
$up.init();
|
28 |
|
29 |
$up.bind('Error', function(up, err) {
|
30 |
+
//$('#upload_process').html(err.message);
|
31 |
+
$('.wpallimport-header').next('.clear').after(err.message);
|
32 |
});
|
33 |
|
34 |
$up.bind('FilesAdded', function(up, files) {
|
35 |
// Disable submit and enable cancel
|
36 |
|
37 |
+
$('.error.inline').remove();
|
38 |
+
|
39 |
+
$('.wpallimport-choose-file').find('.wpallimport-upload-resource-step-two').slideUp();
|
40 |
+
|
41 |
$('#cancel-upload').removeAttr('disabled');
|
42 |
|
43 |
$up.start();
|
49 |
|
50 |
$up.bind('UploadProgress', function(up, file) {
|
51 |
// Lengthen the progress bar
|
52 |
+
$('#progressbar').html('<span>Uploading</span> ' + file.name + ' ' + file.percent + '%');
|
53 |
$('#upload_process').progressbar({value:file.percent});
|
54 |
|
55 |
});
|
60 |
|
61 |
r = _parseJSON(r.response);
|
62 |
|
63 |
+
if (r.error !== null){
|
64 |
+
|
65 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').hide();
|
66 |
+
/*$('.wpallimport-choose-file').find('.wpallimport-uploaded-file-name').html('');
|
67 |
+
$('.wpallimport-choose-file').find('.wpallimport-uploaded-file-size').html(''); */
|
68 |
+
$('.wpallimport-import-from.selected').click();
|
69 |
+
$('#wpallimport-url-upload-status').html('');
|
70 |
+
|
71 |
+
$('#progress').hide();
|
72 |
+
$('#progressbar').html('<span></span>');
|
73 |
+
$('#select-files').fadeIn();
|
74 |
+
|
75 |
+
$('.wpallimport-header').next('.clear').after(r.error.message);
|
76 |
+
|
77 |
+
}
|
78 |
+
else{
|
79 |
+
|
80 |
+
$('#filepath').val(r.name);
|
81 |
+
|
82 |
+
$('#progressbar').html('<span>Upload Complete</span> - ' + file.name + ' (' + ( (file.size / (1024*1024) >= 1) ? (file.size / (1024*1024)).toFixed(2) + 'mb' : (file.size / (1024)).toFixed(2) + 'kb') + ')');
|
83 |
|
84 |
+
setTimeout(function() {
|
85 |
+
|
86 |
+
$('.wpallimport-choose-file').find('.wpallimport-upload-resource-step-two').slideDown(400, function(){
|
87 |
+
$('.wpallimport-choose-file').find('.wpallimport-submit-buttons').show();
|
88 |
+
});
|
89 |
|
90 |
+
if (r.OK) {
|
91 |
|
92 |
+
} else if (r.error != undefined && '' != r.error.message) {
|
93 |
+
$('#progressbar').html(r.error.message);
|
94 |
+
}
|
95 |
|
96 |
+
}, 1000);
|
|
|
97 |
}
|
98 |
|
99 |
});
|
100 |
|
101 |
$up.bind('UploadComplete', function(up) {
|
102 |
$('#cancel-upload').attr('disabled', 'disabled');
|
103 |
+
$('#advanced_upload').show();
|
104 |
});
|
105 |
|
106 |
$('#cancel-upload').click(function() {
|
static/js/pmxi.js
CHANGED
@@ -6,11 +6,10 @@
|
|
6 |
$('#dismiss').click(function(){
|
7 |
|
8 |
$(this).parents('div.updated:first').slideUp();
|
9 |
-
$.post('admin.php?page=pmxi-admin-settings&action=dismiss', {dismiss: true}, function (data) {
|
10 |
-
|
11 |
-
}, 'json');
|
12 |
});
|
13 |
-
|
14 |
$('#dismiss_manage_top').click(function(){
|
15 |
|
16 |
$(this).parents('div.updated:first').slideUp();
|
@@ -29,5 +28,4 @@
|
|
29 |
|
30 |
});
|
31 |
|
32 |
-
|
33 |
});})(jQuery);
|
6 |
$('#dismiss').click(function(){
|
7 |
|
8 |
$(this).parents('div.updated:first').slideUp();
|
9 |
+
$.post('admin.php?page=pmxi-admin-settings&action=dismiss', {dismiss: true}, function (data) {}, 'html');
|
10 |
+
|
|
|
11 |
});
|
12 |
+
|
13 |
$('#dismiss_manage_top').click(function(){
|
14 |
|
15 |
$(this).parents('div.updated:first').slideUp();
|
28 |
|
29 |
});
|
30 |
|
|
|
31 |
});})(jQuery);
|
views/admin/help/index.php
CHANGED
@@ -3,19 +3,16 @@
|
|
3 |
<table class="layout">
|
4 |
<tr>
|
5 |
<td class="left">
|
6 |
-
<p style=
|
7 |
-
<b>E-mail</b> - <a href=
|
8 |
-
<b
|
9 |
</p>
|
10 |
|
11 |
-
<p style=
|
12 |
|
13 |
-
<p style=
|
14 |
-
|
15 |
-
<p style='font-size: 1.3em;'><b>Please note we generally do not provide technical support via the WordPress.org community forums.</b></p>
|
16 |
-
|
17 |
-
<p style='font-size: 1.3em;'><a href='http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=support&utm_campaign=free+plugin' target='_blank'>For premium support, please upgrade to the professional edition of WP All Import.</a></p>
|
18 |
|
|
|
19 |
|
20 |
</td>
|
21 |
<td class="right"> </td>
|
3 |
<table class="layout">
|
4 |
<tr>
|
5 |
<td class="left">
|
6 |
+
<p style="font-size: 1.3em;">
|
7 |
+
<b>E-mail</b> - <a href="mailto:support@wpallimport.com">support@wpallimport.com</a><br>
|
8 |
+
<b><?php _e('Support Form', 'pmxi_plugin'); ?> </b> - <a target="_blank" href="http://www.wpallimport.com/support">http://www.wpallimport.com/support</a>
|
9 |
</p>
|
10 |
|
11 |
+
<p style="font-size: 1.3em;"><?php _e('Thanks for installing the free version of WP All Import.', 'pmxi_plugin'); ?></p>
|
12 |
|
13 |
+
<p style="font-size: 1.3em;"><?php _e('We do not provide technical support in the WordPress.org community forums. But we are usually more than happy to help out free version users via e-mail - just e-mail us at the address above or submit a ticket through the support form.', 'pmxi_plugin'); ?></p>
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
<p style="font-size: 1.3em;"><a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=support" target="_blank"><?php _e('For premium support, please upgrade to the professional edition of WP All Import.', 'pmxi_plugin'); ?></a></p>
|
16 |
|
17 |
</td>
|
18 |
<td class="right"> </td>
|
views/admin/history/index.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>
|
2 |
+
<?php if ($import->path): ?>
|
3 |
+
<?php if ( in_array($import->type, array('upload'))): ?>
|
4 |
+
<?php
|
5 |
+
$path = $import->path;
|
6 |
+
$path_parts = pathinfo($import->path);
|
7 |
+
if ( ! empty($path_parts['dirname'])){
|
8 |
+
$path_all_parts = explode('/', $path_parts['dirname']);
|
9 |
+
$dirname = array_pop($path_all_parts);
|
10 |
+
if ( pmxi_isValidMd5($dirname)){
|
11 |
+
$path = str_replace($dirname . '/', '', str_replace('temp/','',$import->path));
|
12 |
+
}
|
13 |
+
}
|
14 |
+
?>
|
15 |
+
<em><?php printf(__('%s - Import History', 'pmxi_plugin'), str_replace("\\", '/', preg_replace('%^(\w+://[^:]+:)[^@]+@%', '$1*****@', $path))); ?></em>
|
16 |
+
<?php else:?>
|
17 |
+
<em><?php printf(__('%s - Import History', 'pmxi_plugin'), str_replace("\\", '/', preg_replace('%^(\w+://[^:]+:)[^@]+@%', '$1*****@', $import->path))); ?></em>
|
18 |
+
<?php endif; ?>
|
19 |
+
<?php endif ?>
|
20 |
+
</h2>
|
21 |
+
|
22 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
23 |
+
<?php $this->error() ?>
|
24 |
+
<?php endif ?>
|
25 |
+
|
26 |
+
<?php
|
27 |
+
// define the columns to display, the syntax is 'internal name' => 'display name'
|
28 |
+
$columns = array(
|
29 |
+
'id' => __('ID', 'pmxi_plugin'),
|
30 |
+
'date' => __('Date', 'pmxi_plugin'),
|
31 |
+
'time_run' => __('Run Time', 'pmxi_plugin'),
|
32 |
+
'type' => __('Type', 'pmxi_plugin'),
|
33 |
+
'summary' => __('Summary', 'pmxi_plugin'),
|
34 |
+
'download' => '',
|
35 |
+
);
|
36 |
+
?>
|
37 |
+
|
38 |
+
<?php if ( $import->triggered ): ?>
|
39 |
+
<p> <strong><?php _e('Scheduling Status', 'pmxi_plugin'); ?>:</strong> <?php _e('triggered'); ?> <?php if ($import->processing) _e('and processing', 'pmxi_plugin'); ?>...</p>
|
40 |
+
<?php endif; ?>
|
41 |
+
|
42 |
+
<form method="post" id="import-list" action="<?php echo remove_query_arg('pmxi_nt') ?>">
|
43 |
+
<input type="hidden" name="action" value="bulk" />
|
44 |
+
<?php wp_nonce_field('bulk-imports', '_wpnonce_bulk-imports') ?>
|
45 |
+
|
46 |
+
<div class="tablenav">
|
47 |
+
<div class="alignleft actions">
|
48 |
+
<select name="bulk-action">
|
49 |
+
<option value="" selected="selected"><?php _e('Bulk Actions', 'pmxi_plugin') ?></option>
|
50 |
+
<option value="delete"><?php _e('Delete', 'pmxi_plugin') ?></option>
|
51 |
+
</select>
|
52 |
+
<input type="submit" value="<?php esc_attr_e('Apply', 'pmxi_plugin') ?>" name="doaction" id="doaction" class="button-secondary action" />
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<?php if ($page_links): ?>
|
56 |
+
<div class="tablenav-pages">
|
57 |
+
<?php echo $page_links_html = sprintf(
|
58 |
+
'<span class="displaying-num">' . __('Displaying %s–%s of %s', 'pmxi_plugin') . '</span>%s',
|
59 |
+
number_format_i18n(($pagenum - 1) * $perPage + 1),
|
60 |
+
number_format_i18n(min($pagenum * $perPage, $list->total())),
|
61 |
+
number_format_i18n($list->total()),
|
62 |
+
$page_links
|
63 |
+
) ?>
|
64 |
+
</div>
|
65 |
+
<?php endif ?>
|
66 |
+
</div>
|
67 |
+
<div class="clear"></div>
|
68 |
+
|
69 |
+
<table class="widefat pmxi-admin-imports">
|
70 |
+
<thead>
|
71 |
+
<tr>
|
72 |
+
<th class="manage-column column-cb check-column" scope="col" style="padding: 8px 10px;">
|
73 |
+
<input type="checkbox" style="margin-top:1px;"/>
|
74 |
+
</th>
|
75 |
+
<?php
|
76 |
+
$col_html = '';
|
77 |
+
foreach ($columns as $column_id => $column_display_name) {
|
78 |
+
if ( ! in_array($column_id, array('download'))){
|
79 |
+
$column_link = "<a href='";
|
80 |
+
$order2 = 'ASC';
|
81 |
+
if ($order_by == $column_id)
|
82 |
+
$order2 = ($order == 'DESC') ? 'ASC' : 'DESC';
|
83 |
+
|
84 |
+
$column_link .= esc_url(add_query_arg(array('id' => $id, 'order' => $order2, 'order_by' => $column_id), $this->baseUrl));
|
85 |
+
$column_link .= "'>{$column_display_name}</a>";
|
86 |
+
$col_html .= '<th scope="col" class="column-' . $column_id . ' ' . ($order_by == $column_id ? $order : '') . '">' . $column_link . '</th>';
|
87 |
+
}
|
88 |
+
else $col_html .= '<th scope="col" class="column-' . $column_id . '">' . $column_display_name . '</th>';
|
89 |
+
}
|
90 |
+
echo $col_html;
|
91 |
+
?>
|
92 |
+
</tr>
|
93 |
+
</thead>
|
94 |
+
<tfoot>
|
95 |
+
<tr>
|
96 |
+
<th class="manage-column column-cb check-column" scope="col" style="padding: 8px 10px;">
|
97 |
+
<input type="checkbox" />
|
98 |
+
</th>
|
99 |
+
<?php echo $col_html; ?>
|
100 |
+
</tr>
|
101 |
+
</tfoot>
|
102 |
+
<tbody id="the-pmxi-admin-import-list" class="list:pmxi-admin-imports">
|
103 |
+
<?php if ($list->isEmpty()): ?>
|
104 |
+
<tr>
|
105 |
+
<td colspan="<?php echo count($columns) + 1 ?>"><?php _e('No previous history found.', 'pmxi_plugin') ?></td>
|
106 |
+
</tr>
|
107 |
+
<?php else: ?>
|
108 |
+
<?php
|
109 |
+
$class = '';
|
110 |
+
?>
|
111 |
+
<?php foreach ($list as $item): ?>
|
112 |
+
<?php $class = ('alternate' == $class) ? '' : 'alternate'; ?>
|
113 |
+
<tr class="<?php echo $class; ?>" valign="middle">
|
114 |
+
<th scope="row" class="check-column" style="vertical-align: middle; padding: 8px 10px;">
|
115 |
+
<input type="checkbox" id="item_<?php echo $item['id'] ?>" name="items[]" value="<?php echo esc_attr($item['id']) ?>" />
|
116 |
+
</th>
|
117 |
+
<?php foreach ($columns as $column_id => $column_display_name): ?>
|
118 |
+
<?php
|
119 |
+
switch ($column_id):
|
120 |
+
case 'id':
|
121 |
+
?>
|
122 |
+
<th valign="top" scope="row" style="vertical-align: middle;">
|
123 |
+
<?php echo $item['id'] ?>
|
124 |
+
</th>
|
125 |
+
<?php
|
126 |
+
break;
|
127 |
+
case 'date':
|
128 |
+
?>
|
129 |
+
<td style="vertical-align: middle;">
|
130 |
+
<?php if ('0000-00-00 00:00:00' == $item['date']): ?>
|
131 |
+
<em>never</em>
|
132 |
+
<?php else: ?>
|
133 |
+
<?php echo mysql2date(__('Y/m/d g:i a', 'pmxi_plugin'), $item['date']) ?>
|
134 |
+
<?php endif ?>
|
135 |
+
</td>
|
136 |
+
<?php
|
137 |
+
break;
|
138 |
+
case 'time_run':
|
139 |
+
?>
|
140 |
+
<td style="vertical-align: middle;">
|
141 |
+
<?php echo ($item['time_run'] and is_numeric($item['time_run'])) ? gmdate("H:i:s", $item['time_run']) : '-'; ?>
|
142 |
+
</td>
|
143 |
+
<?php
|
144 |
+
break;
|
145 |
+
case 'summary':
|
146 |
+
?>
|
147 |
+
<td style="vertical-align: middle;">
|
148 |
+
<?php echo $item['summary'];?>
|
149 |
+
</td>
|
150 |
+
<?php
|
151 |
+
break;
|
152 |
+
case 'type':
|
153 |
+
?>
|
154 |
+
<td style="vertical-align: middle;">
|
155 |
+
<?php
|
156 |
+
switch ($item['type']) {
|
157 |
+
case 'manual':
|
158 |
+
_e('manual run', 'pmxi_plugin');
|
159 |
+
break;
|
160 |
+
case 'continue':
|
161 |
+
_e('continue run', 'pmxi_plugin');
|
162 |
+
break;
|
163 |
+
case 'processing':
|
164 |
+
_e('cron processing', 'pmxi_plugin');
|
165 |
+
break;
|
166 |
+
case 'trigger':
|
167 |
+
_e('triggered by cron', 'pmxi_plugin');
|
168 |
+
break;
|
169 |
+
default:
|
170 |
+
# code...
|
171 |
+
break;
|
172 |
+
}
|
173 |
+
?>
|
174 |
+
</td>
|
175 |
+
<?php
|
176 |
+
break;
|
177 |
+
case 'download':
|
178 |
+
?>
|
179 |
+
<td style="vertical-align: middle;">
|
180 |
+
<?php
|
181 |
+
if ( ! in_array($item['type'], array('trigger'))){
|
182 |
+
$wp_uploads = wp_upload_dir();
|
183 |
+
$log_file = pmxi_secure_file( $wp_uploads['basedir'] . "/wpallimport/logs", 'logs', $item['id'] ) . '/' . $item['id'] . '.html';
|
184 |
+
|
185 |
+
if (file_exists($log_file)){
|
186 |
+
?>
|
187 |
+
<a href="<?php echo add_query_arg(array('id' => $import->id, 'action' => 'log', 'history_id' => $item['id']), $this->baseUrl); ?>"><?php _e('Download Log', 'pmxi_plugin'); ?></a>
|
188 |
+
<?php
|
189 |
+
}
|
190 |
+
else {
|
191 |
+
_e('Log Unavailable', 'pmxi_plugin');
|
192 |
+
}
|
193 |
+
}
|
194 |
+
else {
|
195 |
+
?>
|
196 |
+
|
197 |
+
<?php
|
198 |
+
};
|
199 |
+
?>
|
200 |
+
</td>
|
201 |
+
<?php
|
202 |
+
break;
|
203 |
+
default:
|
204 |
+
?>
|
205 |
+
<td>
|
206 |
+
<?php echo $item[$column_id]; ?>
|
207 |
+
</td>
|
208 |
+
<?php
|
209 |
+
break;
|
210 |
+
endswitch;
|
211 |
+
?>
|
212 |
+
<?php endforeach; ?>
|
213 |
+
</tr>
|
214 |
+
<?php endforeach; ?>
|
215 |
+
<?php endif ?>
|
216 |
+
</tbody>
|
217 |
+
</table>
|
218 |
+
|
219 |
+
<div class="tablenav">
|
220 |
+
<?php if ($page_links): ?><div class="tablenav-pages"><?php echo $page_links_html ?></div><?php endif ?>
|
221 |
+
|
222 |
+
<div class="alignleft actions">
|
223 |
+
<select name="bulk-action2">
|
224 |
+
<option value="" selected="selected"><?php _e('Bulk Actions', 'pmxi_plugin') ?></option>
|
225 |
+
<?php if ( empty($type) or 'trash' != $type): ?>
|
226 |
+
<option value="delete"><?php _e('Delete', 'pmxi_plugin') ?></option>
|
227 |
+
<?php else: ?>
|
228 |
+
<option value="restore"><?php _e('Restore', 'pmxi_plugin')?></option>
|
229 |
+
<option value="delete"><?php _e('Delete Permanently', 'pmxi_plugin')?></option>
|
230 |
+
<?php endif ?>
|
231 |
+
</select>
|
232 |
+
<input type="submit" value="<?php esc_attr_e('Apply', 'pmxi_plugin') ?>" name="doaction2" id="doaction2" class="button-secondary action" />
|
233 |
+
</div>
|
234 |
+
</div>
|
235 |
+
<div class="clear"></div>
|
236 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'pmxi_plugin'); ?> <span></span></a>
|
237 |
+
</form>
|
views/admin/import/confirm.php
ADDED
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $is_new_import = ($isWizard or $import->imported + $import->skipped == $import->count or $import->imported + $import->skipped == 0 or $import->options['is_import_specified'] or $import->triggered); ?>
|
2 |
+
|
3 |
+
<h2 class="wpallimport-wp-notices"></h2>
|
4 |
+
|
5 |
+
<div class="wpallimport-wrapper wpallimport-step-5">
|
6 |
+
|
7 |
+
<div class="wpallimport-wrapper">
|
8 |
+
<div class="wpallimport-header">
|
9 |
+
<div class="wpallimport-logo"></div>
|
10 |
+
<div class="wpallimport-title">
|
11 |
+
<p><?php _e('WP All Import', 'pmxi_plugin'); ?></p>
|
12 |
+
<h2><?php _e('Import XML / CSV', 'pmxi_plugin'); ?></h2>
|
13 |
+
</div>
|
14 |
+
<div class="wpallimport-links">
|
15 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'pmxi_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'pmxi_plugin'); ?></a>
|
16 |
+
</div>
|
17 |
+
</div>
|
18 |
+
<div class="clear"></div>
|
19 |
+
</div>
|
20 |
+
|
21 |
+
<div class="ajax-console">
|
22 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
23 |
+
<?php $this->error() ?>
|
24 |
+
<?php endif ?>
|
25 |
+
<?php if ($this->warnings->get_error_codes()): ?>
|
26 |
+
<?php $this->warning() ?>
|
27 |
+
<?php endif ?>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
<?php $custom_type = get_post_type_object( PMXI_Plugin::$session->custom_type ); ?>
|
31 |
+
|
32 |
+
<div class="wpallimport-content-section" style="padding: 30px; overflow: hidden;">
|
33 |
+
<div class="wpallimport-ready-to-go">
|
34 |
+
|
35 |
+
<?php if ($is_new_import):?>
|
36 |
+
<h3><?php _e('Your file is all set up!', 'pmxi_plugin'); ?></h3>
|
37 |
+
<?php else: ?>
|
38 |
+
<h3><?php _e('This import did not finish successfuly last time it was run.', 'pmxi_plugin'); ?></h3>
|
39 |
+
<?php endif; ?>
|
40 |
+
|
41 |
+
<?php if ($is_new_import):?>
|
42 |
+
<h4><?php _e('Check the settings below, then click the green button to run the import.', 'pmxi_plugin'); ?></h4>
|
43 |
+
<?php else: ?>
|
44 |
+
<h4><?php _e('You can attempt to continue where it left off.', 'pmxi_plugin'); ?></h4>
|
45 |
+
<?php endif; ?>
|
46 |
+
|
47 |
+
</div>
|
48 |
+
<?php if ($is_new_import):?>
|
49 |
+
<form class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post" style="float:right;">
|
50 |
+
<?php wp_nonce_field('confirm', '_wpnonce_confirm') ?>
|
51 |
+
<input type="hidden" name="is_confirmed" value="1" />
|
52 |
+
<input type="submit" class="rad10" value="<?php _e('Confirm & Run Import', 'pmxi_plugin') ?>" />
|
53 |
+
</form>
|
54 |
+
<?php else: ?>
|
55 |
+
<form class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post" style="float: right;">
|
56 |
+
<?php wp_nonce_field('confirm', '_wpnonce_confirm') ?>
|
57 |
+
<input type="hidden" name="is_confirmed" value="1" />
|
58 |
+
<!--input type="hidden" name="is_continue" value="1" /-->
|
59 |
+
<div class="input wpallimport-is-continue">
|
60 |
+
<div class="input">
|
61 |
+
<input type="radio" name="is_continue" value="yes" checked="checked" id="is_continue_yes"/>
|
62 |
+
<label for="is_continue_yes"><?php _e('Continue from the last run', 'pmxi_plugin'); ?></label>
|
63 |
+
</div>
|
64 |
+
<div class="input">
|
65 |
+
<input type="radio" name="is_continue" value="no" id="is_continue_no"/>
|
66 |
+
<label for="is_continue_no"><?php _e('Run from the beginning', 'pmxi_plugin'); ?></label>
|
67 |
+
</div>
|
68 |
+
</div>
|
69 |
+
<input type="submit" class="rad10" value="<?php _e('Continue Import', 'pmxi_plugin') ?>" style="margin-left: 0px; float: right;"/>
|
70 |
+
<!--div class="input" style="margin-top:20px;">
|
71 |
+
<a href="<?php echo add_query_arg(array('id' => $import->id, 'action' => 'update', 'continue' => 'no'), $this->baseUrl); ?>" id="entire_run"><?php _e('Run entire import from the beginning', 'pmxi_plugin'); ?></a>
|
72 |
+
</div-->
|
73 |
+
</form>
|
74 |
+
<?php endif; ?>
|
75 |
+
</div>
|
76 |
+
|
77 |
+
<div class="clear"></div>
|
78 |
+
|
79 |
+
<table class="wpallimport-layout confirm">
|
80 |
+
<tr>
|
81 |
+
<td class="left">
|
82 |
+
|
83 |
+
<?php if ( $is_new_import ):?>
|
84 |
+
|
85 |
+
<?php $max_execution_time = ini_get('max_execution_time');?>
|
86 |
+
|
87 |
+
<div class="wpallimport-section">
|
88 |
+
<div class="wpallimport-content-section">
|
89 |
+
<div class="wpallimport-collapsed-header" style="padding-left: 30px;">
|
90 |
+
<h3 style="color: #425e99;"><?php _e('Import Summary', 'pmxi_plugin'); ?></h3>
|
91 |
+
</div>
|
92 |
+
<div class="wpallimport-collapsed-content" style="padding: 15px 25px 25px;">
|
93 |
+
|
94 |
+
<!-- Warnings -->
|
95 |
+
<?php if ($max_execution_time != -1): ?>
|
96 |
+
<p><?php printf(__('Your max_execution_time is %s seconds', 'pmxi_plugin'), $max_execution_time); ?></p>
|
97 |
+
<?php endif;?>
|
98 |
+
|
99 |
+
<!-- General -->
|
100 |
+
<?php
|
101 |
+
$path = $source['path'];
|
102 |
+
$import_type = (!empty($source['type'])) ? $source['type'] : $import['type'];
|
103 |
+
if ( in_array($import_type, array('upload'))):
|
104 |
+
$path_parts = pathinfo($source['path']);
|
105 |
+
if ( ! empty($path_parts['dirname'])){
|
106 |
+
$path_all_parts = explode('/', $path_parts['dirname']);
|
107 |
+
$dirname = array_pop($path_all_parts);
|
108 |
+
if ( pmxi_isValidMd5($dirname)){
|
109 |
+
$path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $source['path']));
|
110 |
+
}
|
111 |
+
}
|
112 |
+
endif;
|
113 |
+
?>
|
114 |
+
<p><?php printf(__('WP All Import will import the file <span style="color:#40acad;">%s</span>, which is <span style="color:#000; font-weight:bold;">%s</span>', 'pmxi_plugin'), $path, (isset($locfilePath)) ? human_filesize(filesize($locfilePath)) : __('undefined', 'pmxi_plugin')); ?></p>
|
115 |
+
|
116 |
+
<?php if ( strpos($xpath, '[') !== false){ ?>
|
117 |
+
<p><?php printf(__('WP All Import will process the records matching the XPath expression: <span style="color:#46ba69; font-weight:bold;">%s</span>', 'pmxi_plugin'), $xpath); ?></p>
|
118 |
+
<?php } elseif ($post['delimiter']) { ?>
|
119 |
+
<p><?php printf(__('WP All Import will process <span style="color:#46ba69; font-weight:bold;">%s</span> rows in your file', 'pmxi_plugin'), $count); ?></p>
|
120 |
+
<?php } else { ?>
|
121 |
+
<p><?php printf(__('WP All Import will process all %s <span style="color:#46ba69; font-weight:bold;"><%s></span> records in your file', 'pmxi_plugin'), $count, $source['root_element']); ?></p>
|
122 |
+
<?php } ?>
|
123 |
+
|
124 |
+
<?php if ( $post['is_import_specified']): ?>
|
125 |
+
<p><?php printf(__('WP All Import will process only specified records: %s', 'pmxi_plugin'), $post['import_specified']); ?></p>
|
126 |
+
<?php endif;?>
|
127 |
+
|
128 |
+
<!-- Record Matching -->
|
129 |
+
<?php $custom_type = get_post_type_object( $post['custom_type'] ); ?>
|
130 |
+
|
131 |
+
<?php if ( "new" == $post['wizard_type']): ?>
|
132 |
+
|
133 |
+
<p><?php printf(__('Your unique key is <span style="color:#000; font-weight:bold;">%s</span>', 'pmxi_plugin'), $post['unique_key']); ?></p>
|
134 |
+
|
135 |
+
<?php if ( ! $isWizard ): ?>
|
136 |
+
|
137 |
+
<p><?php printf(__('%ss previously imported by this import (ID: %s) with the same unique key will be updated.', 'pmxi_plugin'), $custom_type->labels->singular_name, $import->id); ?></p>
|
138 |
+
|
139 |
+
<?php if ( $post['is_delete_missing'] and ! $post['is_update_missing_cf'] and ! $post['set_missing_to_draft']): ?>
|
140 |
+
<p><?php printf(__('%ss previously imported by this import (ID: %s) that aren\'t present for this run of the import will be deleted.', 'pmxi_plugin'), $custom_type->labels->singular_name, $import->id); ?></p>
|
141 |
+
<?php endif; ?>
|
142 |
+
|
143 |
+
<?php if ( $post['is_delete_missing'] and $post['set_missing_to_draft']): ?>
|
144 |
+
<p><?php printf(__('%ss previously imported by this import (ID: %s) that aren\'t present for this run of the import will be set to draft.', 'pmxi_plugin'), $custom_type->labels->singular_name, $import->id); ?></p>
|
145 |
+
<?php endif; ?>
|
146 |
+
|
147 |
+
<?php if ( $post['create_new_records']): ?>
|
148 |
+
<p><?php printf(__('Records with unique keys that don\'t match any unique keys from %ss created by previous runs of this import (ID: %s) will be created.', 'pmxi_plugin'), $custom_type->labels->singular_name, $import->id); ?></p>
|
149 |
+
<?php endif; ?>
|
150 |
+
|
151 |
+
<?php endif; ?>
|
152 |
+
|
153 |
+
<?php else: ?>
|
154 |
+
|
155 |
+
<?php
|
156 |
+
$criteria = '';
|
157 |
+
if ( 'title' == $post['duplicate_indicator']) $criteria = 'has the same Title';
|
158 |
+
if ( 'content' == $post['duplicate_indicator']) $criteria = 'has the same Content';
|
159 |
+
if ( 'custom field' == $post['duplicate_indicator']) $criteria = 'has Custom Field named "'. $post['custom_duplicate_name'] .'" with value = ' . $post['custom_duplicate_value'];
|
160 |
+
?>
|
161 |
+
<p><?php printf(__('WP All Import will merge data into existing %ss, matching the following criteria: %s', 'pmxi_plugin'), $custom_type->labels->singular_name, $criteria); ?></p>
|
162 |
+
|
163 |
+
<?php if ( "no" == $post['is_keep_former_posts'] and "yes" == $post['update_all_data']){ ?>
|
164 |
+
<p><?php _e('Existing data will be updated with the data specified in this import.', 'pmxi_plugin'); ?></p>
|
165 |
+
<?php } elseif ("no" == $post['is_keep_former_posts'] and "no" == $post['update_all_data']){?>
|
166 |
+
<div>
|
167 |
+
<p><?php printf(__('Next %s data will be updated, <strong>all other data will be left alone</strong>', 'pmxi_plugin'), $custom_type->labels->singular_name); ?></p>
|
168 |
+
<ul style="padding-left: 35px;">
|
169 |
+
<?php if ( $post['is_update_status']): ?>
|
170 |
+
<li> <?php _e('status', 'pmxi_plugin'); ?></li>
|
171 |
+
<?php endif; ?>
|
172 |
+
<?php if ( $post['is_update_title']): ?>
|
173 |
+
<li> <?php _e('title', 'pmxi_plugin'); ?></li>
|
174 |
+
<?php endif; ?>
|
175 |
+
<?php if ( $post['is_update_slug']): ?>
|
176 |
+
<li> <?php _e('slug', 'pmxi_plugin'); ?></li>
|
177 |
+
<?php endif; ?>
|
178 |
+
<?php if ( $post['is_update_content']): ?>
|
179 |
+
<li> <?php _e('content', 'pmxi_plugin'); ?></li>
|
180 |
+
<?php endif; ?>
|
181 |
+
<?php if ( $post['is_update_excerpt']): ?>
|
182 |
+
<li> <?php _e('excerpt', 'pmxi_plugin'); ?></li>
|
183 |
+
<?php endif; ?>
|
184 |
+
<?php if ( $post['is_update_dates']): ?>
|
185 |
+
<li> <?php _e('dates', 'pmxi_plugin'); ?></li>
|
186 |
+
<?php endif; ?>
|
187 |
+
<?php if ( $post['is_update_menu_order']): ?>
|
188 |
+
<li> <?php _e('menu order', 'pmxi_plugin'); ?></li>
|
189 |
+
<?php endif; ?>
|
190 |
+
<?php if ( $post['is_update_parent']): ?>
|
191 |
+
<li> <?php _e('parent post', 'pmxi_plugin'); ?></li>
|
192 |
+
<?php endif; ?>
|
193 |
+
<?php if ( $post['is_update_attachments']): ?>
|
194 |
+
<li> <?php _e('attachments', 'pmxi_plugin'); ?></li>
|
195 |
+
<?php endif; ?>
|
196 |
+
<?php if ( ! empty($post['is_update_acf'])): ?>
|
197 |
+
<li>
|
198 |
+
<?php
|
199 |
+
switch($post['update_acf_logic']){
|
200 |
+
case 'full_update':
|
201 |
+
_e('all advanced custom fields', 'pmxi_plugin');
|
202 |
+
break;
|
203 |
+
case 'mapped':
|
204 |
+
_e('only ACF presented in import options', 'pmxi_plugin');
|
205 |
+
break;
|
206 |
+
case 'only':
|
207 |
+
printf(__('only these ACF : %s', 'pmxi_plugin'), $post['acf_only_list']);
|
208 |
+
break;
|
209 |
+
case 'all_except':
|
210 |
+
printf(__('all ACF except these: %s', 'pmxi_plugin'), $post['acf_except_list']);
|
211 |
+
break;
|
212 |
+
} ?>
|
213 |
+
</li>
|
214 |
+
<?php endif; ?>
|
215 |
+
<?php if ( ! empty($post['is_update_images'])): ?>
|
216 |
+
<li>
|
217 |
+
<?php
|
218 |
+
switch($post['update_images_logic']){
|
219 |
+
case 'full_update':
|
220 |
+
_e('old images will be updated with new', 'pmxi_plugin');
|
221 |
+
break;
|
222 |
+
case 'add_new':
|
223 |
+
_e('only new images will be added', 'pmxi_plugin');
|
224 |
+
break;
|
225 |
+
} ?>
|
226 |
+
</li>
|
227 |
+
<?php endif; ?>
|
228 |
+
<?php if ( ! empty($post['is_update_custom_fields'])): ?>
|
229 |
+
<li>
|
230 |
+
<?php
|
231 |
+
switch($post['update_custom_fields_logic']){
|
232 |
+
case 'full_update':
|
233 |
+
_e('all custom fields', 'pmxi_plugin');
|
234 |
+
break;
|
235 |
+
case 'only':
|
236 |
+
printf(__('only these custom fields : %s', 'pmxi_plugin'), $post['custom_fields_only_list']);
|
237 |
+
break;
|
238 |
+
case 'all_except':
|
239 |
+
printf(__('all cusom fields except these: %s', 'pmxi_plugin'), $post['custom_fields_except_list']);
|
240 |
+
break;
|
241 |
+
} ?>
|
242 |
+
</li>
|
243 |
+
<?php endif; ?>
|
244 |
+
<?php if ( ! empty($post['is_update_categories'])): ?>
|
245 |
+
<li>
|
246 |
+
<?php
|
247 |
+
switch($post['update_categories_logic']){
|
248 |
+
case 'full_update':
|
249 |
+
_e('remove existing taxonomies, add new taxonomies', 'pmxi_plugin');
|
250 |
+
break;
|
251 |
+
case 'add_new':
|
252 |
+
_e('only add new', 'pmxi_plugin');
|
253 |
+
break;
|
254 |
+
case 'only':
|
255 |
+
printf(__('update only these taxonomies: %s , leave the rest alone', 'pmxi_plugin'), $post['taxonomies_only_list']);
|
256 |
+
break;
|
257 |
+
case 'all_except':
|
258 |
+
printf(__('leave these taxonomies: %s alone, update all others', 'pmxi_plugin'), $post['taxonomies_except_list']);
|
259 |
+
break;
|
260 |
+
} ?>
|
261 |
+
</li>
|
262 |
+
<?php endif; ?>
|
263 |
+
</ul>
|
264 |
+
</div>
|
265 |
+
<?php } ?>
|
266 |
+
<?php if ( $post['create_new_records']): ?>
|
267 |
+
<p><?php printf(__('New %ss will be created from records that don\'t match the above criteria.', 'pmxi_plugin'), $custom_type->labels->singular_name); ?></p>
|
268 |
+
<?php endif; ?>
|
269 |
+
<?php endif; ?>
|
270 |
+
|
271 |
+
<!-- Import Performance -->
|
272 |
+
<?php if ( "default" == $post['import_processing']): ?>
|
273 |
+
<p><?php _e('High-Speed, Small File Processing enabled. Your import will fail if it takes longer than your server\'s max_execution_time.', 'pmxi_plugin'); ?></p>
|
274 |
+
<?php else: ?>
|
275 |
+
<p><?php printf(__('Piece By Piece Processing enabled. %s records will be processed each iteration. If it takes longer than your server\'s max_execution_time to process %s records, your import will fail.', 'pmxi_plugin'), $post['records_per_request'], $post['records_per_request']); ?></p>
|
276 |
+
<?php endif; ?>
|
277 |
+
|
278 |
+
<?php if ($post['chuncking'] and "default" != $post['import_processing']):?>
|
279 |
+
<p><?php printf(__('Your file will be split into %s records chunks before processing.', 'pmxi_plugin'), PMXI_Plugin::getInstance()->getOption('large_feed_limit')); ?></p>
|
280 |
+
<?php endif; ?>
|
281 |
+
|
282 |
+
<?php if ($post['is_fast_mode']):?>
|
283 |
+
<p><?php _e('do_action calls will be disabled in wp_insert_post and wp_insert_attachment during the import.', 'pmxi_plugin'); ?></p>
|
284 |
+
<?php endif; ?>
|
285 |
+
|
286 |
+
</div>
|
287 |
+
</div>
|
288 |
+
</div>
|
289 |
+
|
290 |
+
<?php endif; ?>
|
291 |
+
|
292 |
+
</td>
|
293 |
+
</tr>
|
294 |
+
</table>
|
295 |
+
<?php if ($is_new_import):?>
|
296 |
+
<form class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post">
|
297 |
+
<?php wp_nonce_field('confirm', '_wpnonce_confirm') ?>
|
298 |
+
<input type="hidden" name="is_confirmed" value="1" />
|
299 |
+
<input type="submit" class="rad10" value="<?php _e('Confirm & Run Import', 'pmxi_plugin') ?>" />
|
300 |
+
<p>
|
301 |
+
<?php if ($isWizard): ?>
|
302 |
+
<a href="<?php echo apply_filters('pmxi_options_back_link', add_query_arg('action', 'options', $this->baseUrl), $isWizard); ?>"><?php _e('or go back to Step 4', 'pmxi_plugin') ?></a>
|
303 |
+
<?php else:?>
|
304 |
+
<a href="<?php echo apply_filters('pmxi_options_back_link', remove_query_arg('id', remove_query_arg('action', $this->baseUrl)), $isWizard); ?>"><?php _e('or go back to Manage Imports', 'pmxi_plugin') ?></a>
|
305 |
+
<?php endif; ?>
|
306 |
+
</p>
|
307 |
+
</form>
|
308 |
+
<?php endif; ?>
|
309 |
+
|
310 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'pmxi_plugin'); ?> <span></span></a>
|
311 |
+
|
312 |
+
</div>
|
views/admin/import/element.php
CHANGED
@@ -1,108 +1,210 @@
|
|
1 |
-
<form class="choose-elements no-enter-submit" method="post">
|
2 |
-
<h2><?php _e('Import XML/CSV - Step 2: Select Elements', 'pmxi_plugin') ?></h2>
|
3 |
|
4 |
-
<
|
5 |
|
6 |
-
<
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
<
|
12 |
-
|
13 |
-
<
|
14 |
-
<
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
<?php //$this->render_xml_element($dom->documentElement) ?>
|
40 |
-
</div>
|
41 |
-
</fieldset>
|
42 |
-
</td>
|
43 |
-
<td class="right" style="width:40%;">
|
44 |
-
<fieldset class="widefat">
|
45 |
-
<legend><?php _e('Fitering Options','pmxi_plugin');?></legend>
|
46 |
-
<p><?php _e('Manual XPath:','pmxi_plugin');?></p>
|
47 |
-
<div>
|
48 |
-
<input type="text" name="xpath" value="<?php echo esc_attr($post['xpath']) ?>" style="max-width:none;" />
|
49 |
-
<input type="hidden" id="root_element" name="root_element" value="<?php echo PMXI_Plugin::$session->data['pmxi_import']['source']['root_element']; ?>"/>
|
50 |
<?php
|
51 |
-
if (!empty($elements_cloud)){
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
59 |
}
|
60 |
-
?>
|
61 |
-
|
62 |
-
|
63 |
-
<
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
</div>
|
95 |
-
<
|
96 |
-
<
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
+
<h2 class="wpallimport-wp-notices"></h2>
|
3 |
|
4 |
+
<form class="wpallimport-choose-elements no-enter-submit wpallimport-step-2 wpallimport-wrapper" method="post">
|
5 |
+
<div class="wpallimport-header">
|
6 |
+
<div class="wpallimport-logo"></div>
|
7 |
+
<div class="wpallimport-title">
|
8 |
+
<p><?php _e('WP All Import', 'pmxi_plugin'); ?></p>
|
9 |
+
<h2><?php _e('Import XML / CSV', 'pmxi_plugin'); ?></h2>
|
10 |
+
</div>
|
11 |
+
<div class="wpallimport-links">
|
12 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'pmxi_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'pmxi_plugin'); ?></a>
|
13 |
+
</div>
|
14 |
+
</div>
|
15 |
+
<div class="clear"></div>
|
16 |
+
<?php $custom_type = get_post_type_object( PMXI_Plugin::$session->custom_type ); ?>
|
17 |
+
<div class="wpallimport-content-section wpallimport-console">
|
18 |
+
<div class="ajax-console">
|
19 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
20 |
+
<?php $this->error() ?>
|
21 |
+
<?php endif ?>
|
22 |
+
</div>
|
23 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Continue to Step 3', 'pmxi_plugin'); ?>" style="position:absolute; top:45px; right:10px;"/>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div class="wpallimport-content-section wpallimport-elements-preloader">
|
27 |
+
<div class="preload" style="height: 80px; margin-top: 25px;"></div>
|
28 |
+
</div>
|
29 |
+
|
30 |
+
<div class="wpallimport-content-section" style="padding-bottom:0; max-height: 600px; overflow:scroll; width: 100%;">
|
31 |
+
|
32 |
+
<table class="wpallimport-layout" style="width:100%;">
|
33 |
+
<tr>
|
34 |
+
<?php if ( ! $is_csv): ?>
|
35 |
+
<td class="left" style="width: 25%; min-width: unset; border-right: 1px solid #ddd;">
|
36 |
+
<h3 class="txt_center"><?php _e('What element are you looking for?', 'pmxi_plugin'); ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
<?php
|
38 |
+
if ( ! empty($elements_cloud) and ! $is_csv ){
|
39 |
+
foreach ($elements_cloud as $tag => $count){
|
40 |
+
?>
|
41 |
+
<a href="javascript:void(0);" rel="<?php echo $tag;?>" class="wpallimport-change-root-element <?php if (PMXI_Plugin::$session->source['root_element'] == $tag) echo 'selected';?>">
|
42 |
+
<span class="tag_name"><?php echo strtolower($tag); ?></span>
|
43 |
+
<span class="tag_count"><?php echo $count; ?></span>
|
44 |
+
</a>
|
45 |
+
<?php
|
46 |
+
}
|
47 |
}
|
48 |
+
?>
|
49 |
+
</td>
|
50 |
+
<?php endif; ?>
|
51 |
+
<td class="right" <?php if ( ! $is_csv){?>style="width:75%; padding:0;"<?php } else {?>style="width:100%; padding:0;"<?php }?>>
|
52 |
+
<div class="action_buttons">
|
53 |
+
<table style="width:100%;">
|
54 |
+
<tr>
|
55 |
+
<td>
|
56 |
+
<a href="javascript:void(0);" id="prev_element" class="wpallimport-go-to"> </a>
|
57 |
+
</td>
|
58 |
+
<td class="txt_center">
|
59 |
+
|
60 |
+
<p class="wpallimport-root-element">
|
61 |
+
<?php echo PMXI_Plugin::$session->source['root_element'];?>
|
62 |
+
</p>
|
63 |
+
<input type="text" id="goto_element" value="1"/>
|
64 |
+
<span class="wpallimport-elements-information">
|
65 |
+
<?php printf(__('of <span class="wpallimport-elements-count-info">%s</span>','pmxi_plugin'), PMXI_Plugin::$session->count);?>
|
66 |
+
</span>
|
67 |
+
|
68 |
+
</td>
|
69 |
+
<td>
|
70 |
+
<a href="javascript:void(0);" id="next_element" class="wpallimport-go-to"> </a>
|
71 |
+
</td>
|
72 |
+
</tr>
|
73 |
+
</table>
|
74 |
+
</div>
|
75 |
+
<fieldset class="widefat" style="background:fafafa;">
|
76 |
+
|
77 |
+
<div class="input">
|
78 |
+
|
79 |
+
<?php if ($is_csv !== false): ?>
|
80 |
+
|
81 |
+
<div class="wpallimport-set-csv-delimiter">
|
82 |
+
<label>
|
83 |
+
<?php _e("Set delimiter for CSV fields:", "pmxi_plugin"); ?>
|
84 |
+
</label>
|
85 |
+
<input type="text" name="delimiter" value="<?php echo $is_csv;?>"/>
|
86 |
+
<input type="button" name="apply_delimiter" class="rad4" value="<?php _e('Apply', 'pmxi_plugin'); ?>"/>
|
87 |
+
</div>
|
88 |
+
|
89 |
+
<?php else: ?>
|
90 |
|
91 |
+
<input type="hidden" value="" name="delimiter"/>
|
92 |
+
|
93 |
+
<?php endif; ?>
|
94 |
+
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<div class="wpallimport-xml">
|
98 |
+
<?php //$this->render_xml_element($dom->documentElement) ?>
|
99 |
+
</div>
|
100 |
+
</fieldset>
|
101 |
+
<div class="import_information">
|
102 |
+
<?php if (PMXI_Plugin::$session->wizard_type == 'new') :?>
|
103 |
+
<h3>
|
104 |
+
<?php printf(__('Each <span><<span class="root_element">%s</span>></span> element will be imported into a <span>New %s</span>'), PMXI_Plugin::$session->source['root_element'], $custom_type->labels->singular_name); ?>
|
105 |
+
</h3>
|
106 |
+
<?php else: ?>
|
107 |
+
<h3>
|
108 |
+
<?php printf(__('Data in <span><<span class="root_element">%s</span>></span> elements will be imported to <span>%s</span>'), PMXI_Plugin::$session->source['root_element'], $custom_type->labels->name); ?>
|
109 |
+
</h3>
|
110 |
+
<?php endif; ?>
|
111 |
+
</div>
|
112 |
+
</td>
|
113 |
+
</tr>
|
114 |
+
</table>
|
115 |
+
</div>
|
116 |
+
|
117 |
+
<div class="wpallimport-collapsed closed">
|
118 |
+
<div class="wpallimport-content-section">
|
119 |
+
<div class="wpallimport-collapsed-header">
|
120 |
+
<h3><?php _e('Add Filtering Options', 'pmxi_plugin'); ?></h3>
|
121 |
+
</div>
|
122 |
+
<div class="wpallimport-collapsed-content">
|
123 |
+
<div>
|
124 |
+
<div class="rule_inputs">
|
125 |
+
<table style="width:100%;">
|
126 |
+
<tr>
|
127 |
+
<th><?php _e('Element', 'pmxi_plugin'); ?></th>
|
128 |
+
<th><?php _e('Rule', 'pmxi_plugin'); ?></th>
|
129 |
+
<th><?php _e('Value', 'pmxi_plugin'); ?></th>
|
130 |
+
<th> </th>
|
131 |
+
</tr>
|
132 |
+
<tr>
|
133 |
+
<td style="width:25%;">
|
134 |
+
<select id="pmxi_xml_element">
|
135 |
+
<option value=""><?php _e('Select Element', 'pmxi_plugin'); ?></option>
|
136 |
+
<?php PMXI_Render::render_xml_elements_for_filtring($elements->item(0)); ?>
|
137 |
+
</select>
|
138 |
+
</td>
|
139 |
+
<td style="width:25%;">
|
140 |
+
<select id="pmxi_rule">
|
141 |
+
<option value=""><?php _e('Select Rule', 'pmxi_plugin'); ?></option>
|
142 |
+
<option value="equals"><?php _e('equals', 'pmxi_plugin'); ?></option>
|
143 |
+
<option value="not_equals"><?php _e('not equals', 'pmxi_plugin'); ?></option>
|
144 |
+
<option value="greater"><?php _e('greater than', 'pmxi_plugin');?></option>
|
145 |
+
<option value="equals_or_greater"><?php _e('equals or greater than', 'pmxi_plugin'); ?></option>
|
146 |
+
<option value="less"><?php _e('less than', 'pmxi_plugin'); ?></option>
|
147 |
+
<option value="equals_or_less"><?php _e('equals or less than', 'pmxi_plugin'); ?></option>
|
148 |
+
<option value="contains"><?php _e('contains', 'pmxi_plugin'); ?></option>
|
149 |
+
<option value="not_contains"><?php _e('not contains', 'pmxi_plugin'); ?></option>
|
150 |
+
<option value="is_empty"><?php _e('is empty', 'pmxi_plugin'); ?></option>
|
151 |
+
<option value="is_not_empty"><?php _e('is not empty', 'pmxi_plugin'); ?></option>
|
152 |
+
</select>
|
153 |
+
</td>
|
154 |
+
<td style="width:25%;">
|
155 |
+
<input id="pmxi_value" type="text" placeholder="value" value=""/>
|
156 |
+
</td>
|
157 |
+
<td style="width:15%;">
|
158 |
+
<a id="pmxi_add_rule" href="javascript:void(0);"><?php _e('Add Rule', 'pmxi_plugin');?></a>
|
159 |
+
</td>
|
160 |
+
</tr>
|
161 |
+
</table>
|
162 |
+
</div>
|
163 |
</div>
|
164 |
+
<div class="clear"></div>
|
165 |
+
<table class="xpath_filtering">
|
166 |
+
<tr>
|
167 |
+
<td style="width:5%; font-weight:bold; color: #000;"><?php _e('XPath','pmxi_plugin');?></td>
|
168 |
+
<td style="width:95%;">
|
169 |
+
<input type="text" name="xpath" value="<?php echo esc_attr($post['xpath']) ?>" style="max-width:none;" />
|
170 |
+
<input type="hidden" id="root_element" name="root_element" value="<?php echo PMXI_Plugin::$session->source['root_element']; ?>"/>
|
171 |
+
</td>
|
172 |
+
</tr>
|
173 |
+
</table>
|
174 |
+
</div>
|
175 |
+
</div>
|
176 |
+
<div id="wpallimport-filters" class="wpallimport-collapsed-content" style="padding:0;">
|
177 |
+
<table style="width: 100%; font-weight: bold; padding: 20px;">
|
178 |
+
<tr>
|
179 |
+
<td style="width: 30%; padding-left: 30px;"><?php _e('Element', 'pmxi_plugin'); ?></td>
|
180 |
+
<td style="width:20%;"><?php _e('Rule', 'pmxi_plugin'); ?></td>
|
181 |
+
<td style="width:20%;"><?php _e('Value', 'pmxi_plugin'); ?></td>
|
182 |
+
<td style="width:25%;"><?php _e('Condition', 'pmxi_plugin'); ?></td>
|
183 |
+
</tr>
|
184 |
+
</table>
|
185 |
+
<div class="wpallimport-content-section">
|
186 |
+
<fieldset id="filtering_rules">
|
187 |
+
<p style="margin:20px 0 5px; text-align:center;"><?php _e('No filtering options. Add filtering options to only import records matching some specified criteria.', 'pmxi_plugin');?></p>
|
188 |
+
<ol class="filtering_rules">
|
189 |
+
|
190 |
+
</ol>
|
191 |
+
<div class="clear"></div>
|
192 |
+
<a href="javascript:void(0);" id="apply_filters" style="display:none;"><?php _e('Apply Filters To XPath', 'pmxi_plugin');?></a>
|
193 |
+
</fieldset>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
|
198 |
+
<hr>
|
199 |
+
|
200 |
+
<p class="wpallimport-submit-buttons" style="text-align:center;">
|
201 |
+
<a href="<?php echo $this->baseUrl ?>" class="back rad3"><?php _e('Back to Step 1','pmxi_plugin');?></a>
|
202 |
+
|
203 |
+
<input type="hidden" name="is_submitted" value="1" />
|
204 |
+
<?php wp_nonce_field('choose-elements', '_wpnonce_choose-elements') ?>
|
205 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Continue to Step 3', 'pmxi_plugin'); ?>" />
|
206 |
+
</p>
|
207 |
+
|
208 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'pmxi_plugin'); ?> <span></span></a>
|
209 |
+
|
210 |
+
</form>
|
views/admin/import/element_after.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<form class="choose-elements no-enter-submit" method="post">
|
2 |
-
<h2><?php _e('Import XML/CSV - Step 2: Select Elements', 'pmxi_plugin') ?></h2>
|
3 |
-
|
4 |
-
<h3><?php _e('<b>Double-click on an element below to select it and its siblings.</b>', 'pmxi_plugin') ?></h3>
|
5 |
-
|
6 |
-
<div class="ajax-console">
|
7 |
-
<?php if ($this->errors->get_error_codes()): ?>
|
8 |
-
<?php $this->error() ?>
|
9 |
-
<?php endif ?>
|
10 |
-
</div>
|
11 |
-
<table class="layout">
|
12 |
-
<tr>
|
13 |
-
<td class="left" style="width:60%;">
|
14 |
-
<fieldset class="widefat">
|
15 |
-
<legend><?php _e('Current XML tree', 'pmxi_plugin');?></legend>
|
16 |
-
<div class="action_buttons">
|
17 |
-
<a href="javascript:void(0);" id="prev_element" class="button button-primary button-hero large_button go_to">«</a>
|
18 |
-
<a href="javascript:void(0);" id="next_element" class="button button-primary button-hero large_button go_to" style="margin-right:15px;">»</a>
|
19 |
-
<div style="float:left;">
|
20 |
-
<span style="font-size:20px; padding-top:17px; float:left; margin-right:10px;"><?php _e('Go to:','pmxi_plugin');?> </span><input type="text" id="goto_element" value="1"/>
|
21 |
-
</div>
|
22 |
-
<?php
|
23 |
-
if ($is_csv !== false){
|
24 |
-
?>
|
25 |
-
<ul class="set_csv_delimiter">
|
26 |
-
<li><?php _e("Set delimiter for CSV fields:",'pmxi_plugin');?> </li>
|
27 |
-
<li> <input type="text" value="<?php echo $is_csv;?>" name="delimiter"/> <input type="button" name="apply_delimiter" value="Apply"/></li>
|
28 |
-
</ul>
|
29 |
-
<?php
|
30 |
-
}
|
31 |
-
else{
|
32 |
-
?>
|
33 |
-
<input type="hidden" value="" name="delimiter"/>
|
34 |
-
<?php
|
35 |
-
}
|
36 |
-
?>
|
37 |
-
</div>
|
38 |
-
<div class="xml" style="min-height:400px;">
|
39 |
-
<?php //$this->render_xml_element($dom->documentElement) ?>
|
40 |
-
</div>
|
41 |
-
</fieldset>
|
42 |
-
</td>
|
43 |
-
<td class="right" style="width:40%;">
|
44 |
-
<fieldset class="widefat">
|
45 |
-
<legend><?php _e('Fitering Options','pmxi_plugin');?></legend>
|
46 |
-
<p><?php _e('Manual XPath:','pmxi_plugin');?></p>
|
47 |
-
<div>
|
48 |
-
<input type="text" name="xpath" value="<?php echo esc_attr($post['xpath']) ?>" style="max-width:none;" />
|
49 |
-
<input type="hidden" id="root_element" name="root_element" value="<?php echo PMXI_Plugin::$session->data['pmxi_import']['source']['root_element']; ?>"/>
|
50 |
-
<?php
|
51 |
-
if (!empty($elements_cloud)){
|
52 |
-
?>
|
53 |
-
<br/><label><?php _e('What element are you looking for?','pmxi_plugin');?></label> <br/>
|
54 |
-
<?php
|
55 |
-
$root_elements = array();
|
56 |
-
foreach ($elements_cloud as $tag => $count)
|
57 |
-
$root_elements[] = '<a href="javascript:void(0);" rel="'. $tag .'" class="change_root_element">' . $tag . '</a>';
|
58 |
-
echo implode(', ', $root_elements);
|
59 |
-
}
|
60 |
-
?>
|
61 |
-
<br/><br/>or <a href="javascript:void(0);" rel="<?php echo esc_attr($post['xpath']) ?>" root="<?php echo PMXI_Plugin::$session->data['pmxi_import']['source']['root_element']; ?>" id="get_default_xpath"><?php _e('get default xPath','pmxi_plugin');?></a>
|
62 |
-
</div>
|
63 |
-
<p><?php _e('Filters:','pmxi_plugin');?></p>
|
64 |
-
<div>
|
65 |
-
<select id="pmxi_xml_element">
|
66 |
-
<option value=""><?php _e('Select Element', 'pmxi_plugin'); ?></option>
|
67 |
-
<?php $this->render_xml_elements_for_filtring($elements->item(0)); ?>
|
68 |
-
</select>
|
69 |
-
<select id="pmxi_rule">
|
70 |
-
<option value=""><?php _e('Select Rule', 'pmxi_plugin'); ?></option>
|
71 |
-
<option value="equals"><?php _e('equals', 'pmxi_plugin'); ?></option>
|
72 |
-
<option value="greater"><?php _e('greater than', 'pmxi_plugin');?></option>
|
73 |
-
<option value="less"><?php _e('less than', 'pmxi_plugin'); ?></option>
|
74 |
-
<option value="contains"><?php _e('contains', 'pmxi_plugin'); ?></option>
|
75 |
-
</select>
|
76 |
-
<input id="pmxi_value" type="text" placeholder="value" value=""/>
|
77 |
-
<a id="pmxi_add_rule" href="javascript:void(0);"><?php _e('Add rule', 'pmxi_plugin');?></a>
|
78 |
-
</div>
|
79 |
-
<div class="clear"></div>
|
80 |
-
<br><br>
|
81 |
-
<a href="http://www.w3schools.com/xpath/default.asp" target='_blank'><?php _e('XPath Tutorial','pmxi_plugin');?></a> - <?php _e('For further help','pmxi_plugin');?>, <a href="http://www.wpallimport.com/support" target='_blank'><?php _e('contact us','pmxi_plugin');?></a>.
|
82 |
-
</fieldset>
|
83 |
-
<p class="submit-buttons" style="text-align:right;">
|
84 |
-
<a href="<?php echo $this->baseUrl ?>" class="back"><?php _e('Back','pmxi_plugin');?></a>
|
85 |
-
|
86 |
-
<input type="hidden" name="is_submitted" value="1" />
|
87 |
-
<?php wp_nonce_field('choose-elements', '_wpnonce_choose-elements') ?>
|
88 |
-
<input type="submit" class="button button-primary button-hero large_button" value="<?php _e('Next', 'pmxi_plugin') ?>" />
|
89 |
-
</p>
|
90 |
-
</td>
|
91 |
-
</tr>
|
92 |
-
</table>
|
93 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/evaluate.php
CHANGED
@@ -1,17 +1,26 @@
|
|
1 |
-
<div class="updated">
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
<?php if (PMXI_Plugin::getInstance()->getOption('highlight_limit') and $elements->length > PMXI_Plugin::getInstance()->getOption('highlight_limit')): ?>
|
4 |
<p><?php _e('<strong>Note</strong>: Highlighting is turned off since can be very slow on large sets of elements.', 'pmxi_plugin') ?></p>
|
5 |
<?php endif ?>
|
6 |
</div>
|
7 |
<div id="current_xml">
|
8 |
-
<?php
|
|
|
|
|
|
|
|
|
9 |
</div>
|
10 |
<script type="text/javascript">
|
11 |
(function($){
|
12 |
var paths = <?php echo json_encode($paths) ?>;
|
13 |
-
var $xml = $('.xml');
|
14 |
-
|
15 |
$xml.html($('#current_xml').html()).css({'visibility':'visible'});
|
16 |
for (var i = 0; i < paths.length; i++) {
|
17 |
$xml.find('.xml-element[title="' + paths[i] + '"]').addClass('selected').parents('.xml-element').find('> .xml-content.collapsed').removeClass('collapsed').parent().find('> .xml-expander').html('-');
|
1 |
+
<div class="updated founded_records">
|
2 |
+
<?php if ($is_csv):?>
|
3 |
+
<h3><?php printf(__('<span class="matches_count">%s</span> <strong>%s</strong> will be imported', 'pmxi_plugin'), $node_list_count, _n('row', 'rows', $node_list_count, 'pmxi_plugin')); ?></h3>
|
4 |
+
<?php else:?>
|
5 |
+
<h3><?php printf(__('<span class="matches_count">%s</span> <strong>%s</strong> %s will be imported', 'pmxi_plugin'), $node_list_count, PMXI_Plugin::$session->source['root_element'], _n('element', 'elements', $node_list_count, 'pmxi_plugin')); ?></h3>
|
6 |
+
<?php endif; ?>
|
7 |
+
<h4><?php _e('Click an element to select it, or scroll down to add filtering options.', 'pmxi_plugin'); ?></h4>
|
8 |
<?php if (PMXI_Plugin::getInstance()->getOption('highlight_limit') and $elements->length > PMXI_Plugin::getInstance()->getOption('highlight_limit')): ?>
|
9 |
<p><?php _e('<strong>Note</strong>: Highlighting is turned off since can be very slow on large sets of elements.', 'pmxi_plugin') ?></p>
|
10 |
<?php endif ?>
|
11 |
</div>
|
12 |
<div id="current_xml">
|
13 |
+
<?php if ($is_csv): ?>
|
14 |
+
<?php PMXI_Render::render_csv_element($elements->item(0), false, '//'); ?>
|
15 |
+
<?php else:?>
|
16 |
+
<?php PMXI_Render::render_xml_element($elements->item(0), false, '//'); ?>
|
17 |
+
<?php endif;?>
|
18 |
</div>
|
19 |
<script type="text/javascript">
|
20 |
(function($){
|
21 |
var paths = <?php echo json_encode($paths) ?>;
|
22 |
+
var $xml = $('.wpallimport-xml');
|
23 |
+
$('.wpallimport-console').fadeIn();
|
24 |
$xml.html($('#current_xml').html()).css({'visibility':'visible'});
|
25 |
for (var i = 0; i < paths.length; i++) {
|
26 |
$xml.find('.xml-element[title="' + paths[i] + '"]').addClass('selected').parents('.xml-element').find('> .xml-content.collapsed').removeClass('collapsed').parent().find('> .xml-expander').html('-');
|
views/admin/import/evaluate_variations.php
CHANGED
@@ -8,15 +8,15 @@
|
|
8 |
<div id="current_xml">
|
9 |
<div class="variations_tag">
|
10 |
<input type="hidden" name="variations_tagno" value="<?php echo $tagno + 1 ?>" />
|
11 |
-
<div class="title">
|
12 |
-
<?php printf(__('Variation Record #<strong>%s</strong> out of <strong>%s</strong>', 'pmxi_plugin'), $tagno + 1, $variation_list_count); ?>
|
13 |
<div class="navigation">
|
14 |
-
<?php if ($tagno > 0): ?><a href="#variation_prev">&
|
15 |
-
<?php
|
|
|
16 |
</div>
|
17 |
</div>
|
18 |
<div class="clear"></div>
|
19 |
-
<div class="xml resetable"> <?php if (!empty($variation_list_count))
|
20 |
</div>
|
21 |
</div>
|
22 |
<?php endif; ?>
|
@@ -28,6 +28,6 @@
|
|
28 |
$xml.html($('#current_xml').html()).css({'visibility':'visible'});
|
29 |
for (var i = 0; i < paths.length; i++) {
|
30 |
$xml.find('.xml-element[title="' + paths[i] + '"]').addClass('selected').parents('.xml-element').find('> .xml-content.collapsed').removeClass('collapsed').parent().find('> .xml-expander').html('-');
|
31 |
-
}
|
32 |
})(jQuery);
|
33 |
</script>
|
8 |
<div id="current_xml">
|
9 |
<div class="variations_tag">
|
10 |
<input type="hidden" name="variations_tagno" value="<?php echo $tagno + 1 ?>" />
|
11 |
+
<div class="title">
|
|
|
12 |
<div class="navigation">
|
13 |
+
<?php if ($tagno > 0): ?><a href="#variation_prev" class="previous_element"> </a><?php else: ?><span class="previous_element"> </span><?php endif ?>
|
14 |
+
<?php printf(__('#<strong>%s</strong> out of <strong>%s</strong>', 'pmxi_plugin'), $tagno + 1, $variation_list_count); ?>
|
15 |
+
<?php if ($tagno < $variation_list_count - 1): ?><a href="#variation_next" class="next_element"> </a><?php else: ?><span class="next_element"> </span><?php endif ?>
|
16 |
</div>
|
17 |
</div>
|
18 |
<div class="clear"></div>
|
19 |
+
<div class="xml resetable"> <?php if (!empty($variation_list_count)) PMXI_Render::render_xml_element($variation_elements->item($tagno), true); ?></div>
|
20 |
</div>
|
21 |
</div>
|
22 |
<?php endif; ?>
|
28 |
$xml.html($('#current_xml').html()).css({'visibility':'visible'});
|
29 |
for (var i = 0; i < paths.length; i++) {
|
30 |
$xml.find('.xml-element[title="' + paths[i] + '"]').addClass('selected').parents('.xml-element').find('> .xml-content.collapsed').removeClass('collapsed').parent().find('> .xml-expander').html('-');
|
31 |
+
}
|
32 |
})(jQuery);
|
33 |
</script>
|
views/admin/import/index.php
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
|
3 |
$l10n = array(
|
@@ -28,94 +32,214 @@ $l10n = array(
|
|
28 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
29 |
</script>
|
30 |
|
31 |
-
<table class="layout
|
32 |
<tr>
|
33 |
<td class="left">
|
34 |
-
<
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
if ( ! $reimported_import->isEmpty()):
|
42 |
-
?>
|
43 |
-
<div class="reimported_notify">
|
44 |
-
<p><?php _e( 'You are importing a new file for: <b>' . $reimported_import->name . '</b>' , 'pmxi_plugin' );?></p>
|
45 |
-
<p><span><?php _e( 'Last imported on ' . date("m-d-Y H:i:s", strtotime($reimported_import->registered_on)) , 'pmxi_plugin' ); ?></span></p>
|
46 |
</div>
|
47 |
-
|
48 |
-
|
49 |
-
?>
|
50 |
-
<?php do_action('pmxi_choose_file_header'); ?>
|
51 |
-
<form method="post" class="choose-file enter-submit" enctype="multipart/form-data" autocomplete="off">
|
52 |
-
<input type="hidden" name="is_submitted" value="1" />
|
53 |
-
<?php wp_nonce_field('upload-xml', '_wpnonce_upload-xml') ?>
|
54 |
-
|
55 |
-
<div class="file-type-container">
|
56 |
-
<h3>
|
57 |
-
<input type="radio" id="type_upload" name="type" value="upload" checked="checked" />
|
58 |
-
<label for="type_upload"><?php _e('Upload File From Your Computer', 'pmxi_plugin') ?></label>
|
59 |
-
</h3>
|
60 |
-
<div id="plupload-ui" class="file-type-options">
|
61 |
-
<div>
|
62 |
-
<h3 style="float:left; margin-top:5px;"><label><?php _e( 'Choose file to upload...' ); ?></label></h3>
|
63 |
-
<input type="hidden" name="filepath" value="<?php echo $post['filepath'] ?>" id="filepath"/>
|
64 |
-
<span><input id="select-files" type="button" class="button-primary" value="<?php esc_attr_e('Select File'); ?>" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" /></span>
|
65 |
-
<div id="progress" class="progress" <?php if (!empty($post['filepath'])):?>style="visibility: visible;"<?php endif;?>>
|
66 |
-
<div id="upload_process" class="upload_process"></div>
|
67 |
-
<div id="progressbar" class="progressbar"><?php if (!empty($post['filepath'])) _e( 'Import Complete - '.basename($post['filepath']).' 100%', 'pmxi_plugin'); ?></div>
|
68 |
-
</div>
|
69 |
-
</div>
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
-
<div class="file-type-container">
|
73 |
-
<h3>
|
74 |
-
<input type="radio" id="type_url" name="type" value="url" />
|
75 |
-
<label for="type_url"><?php _e('Download File From URL', 'pmxi_plugin') ?></label>
|
76 |
-
</h3>
|
77 |
-
<div class="file-type-options">
|
78 |
-
<input type="text" class="regular-text" name="url" value="" disabled="disabled"/>
|
79 |
-
<p>To have the option to set up a cron-based recurring import, specify the URL to your file.</p>
|
80 |
-
<a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=step-1&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade to the professional edition of WP All Import to use this feature.</a>
|
81 |
</div>
|
82 |
-
</div>
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
</div>
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
<
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
120 |
</tr>
|
121 |
</table>
|
1 |
+
<!-- Preload Images -->
|
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(
|
32 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
33 |
</script>
|
34 |
|
35 |
+
<table class="wpallimport-layout wpallimport-step-1">
|
36 |
<tr>
|
37 |
<td class="left">
|
38 |
+
<div class="wpallimport-wrapper">
|
39 |
+
<h2 class="wpallimport-wp-notices"></h2>
|
40 |
+
<div class="wpallimport-header">
|
41 |
+
<div class="wpallimport-logo"></div>
|
42 |
+
<div class="wpallimport-title">
|
43 |
+
<p><?php _e('WP All Import', 'pmxi_plugin'); ?></p>
|
44 |
+
<h2><?php _e('Import XML / CSV', 'pmxi_plugin'); ?></h2>
|
|
|
|
|
|
|
|
|
|
|
45 |
</div>
|
46 |
+
<div class="wpallimport-links">
|
47 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'pmxi_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'pmxi_plugin'); ?></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
</div>
|
49 |
+
</div>
|
50 |
+
|
51 |
+
<div class="clear"></div>
|
52 |
+
|
53 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
54 |
+
<?php $this->error() ?>
|
55 |
+
<?php endif ?>
|
56 |
+
|
57 |
+
<?php
|
58 |
+
if ( ! $reimported_import->isEmpty()):
|
59 |
+
?>
|
60 |
+
<div class="wpallimport-reimported-notify">
|
61 |
+
<p><?php _e( 'You are importing a new file for: <b>' . $reimported_import->name . '</b>' , 'pmxi_plugin' );?></p>
|
62 |
+
<p><span><?php _e( 'Last imported on ' . date("m-d-Y H:i:s", strtotime($reimported_import->registered_on)) , 'pmxi_plugin' ); ?></span></p>
|
63 |
+
</div>
|
64 |
+
<?php
|
65 |
+
endif;
|
66 |
+
?>
|
67 |
+
|
68 |
+
<?php //do_action('pmxi_choose_file_header'); ?>
|
69 |
+
|
70 |
+
<form method="post" class="wpallimport-choose-file" enctype="multipart/form-data" autocomplete="off">
|
71 |
+
|
72 |
+
<div class="wpallimport-upload-resource-step-one">
|
73 |
+
|
74 |
+
<input type="hidden" name="is_submitted" value="1" />
|
75 |
+
|
76 |
+
<?php wp_nonce_field('upload-xml', '_wpnonce_upload-xml') ?>
|
77 |
+
|
78 |
+
<div class="clear"></div>
|
79 |
+
|
80 |
+
<div class="wpallimport-import-types">
|
81 |
+
<h2><?php _e('First, specify how you want to import your data', 'pmxi_plugin'); ?></h2>
|
82 |
+
<a class="wpallimport-import-from wpallimport-upload-type <?php echo ('upload' == $post['type'] and ! empty($_POST)) ? 'selected' : '' ?>" rel="upload_type" href="javascript:void(0);">
|
83 |
+
<span class="wpallimport-icon"></span>
|
84 |
+
<span class="wpallimport-icon-label"><?php _e('Upload a file', 'pmxi_plugin'); ?></span>
|
85 |
+
</a>
|
86 |
+
<a class="wpallimport-import-from wpallimport-url-type <?php echo 'url' == $post['type'] ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
|
87 |
+
<span class="wpallimport-icon"></span>
|
88 |
+
<span class="wpallimport-icon-label"><?php _e('Download from URL', 'pmxi_plugin'); ?></span>
|
89 |
+
</a>
|
90 |
+
<a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $post['type'] ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
|
91 |
+
<span class="wpallimport-icon"></span>
|
92 |
+
<span class="wpallimport-icon-label"><?php _e('Use existing file', 'pmxi_plugin'); ?></span>
|
93 |
+
</a>
|
94 |
+
</div>
|
95 |
+
|
96 |
+
<input type="hidden" value="<?php echo $post['type']; ?>" name="type"/>
|
97 |
+
|
98 |
+
<div class="wpallimport-upload-type-container" rel="upload_type">
|
99 |
+
<div id="plupload-ui" class="wpallimport-file-type-options">
|
100 |
+
<div>
|
101 |
+
<input type="hidden" name="filepath" value="<?php echo $post['filepath'] ?>" id="filepath"/>
|
102 |
+
<a id="select-files" href="javascript:void(0);"/><?php _e('Click here to select file from your computer...', 'pmxi_plugin'); ?></a>
|
103 |
+
<div id="progressbar" class="wpallimport-progressbar">
|
104 |
+
|
105 |
+
</div>
|
106 |
+
<div id="progress" class="wpallimport-progress">
|
107 |
+
<div id="upload_process" class="wpallimport-upload-process"></div>
|
108 |
+
</div>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<div class="wpallimport-upload-type-container" rel="url_type">
|
113 |
+
<div class="wpallimport-file-type-options">
|
114 |
+
<span class="wpallimport-url-icon"></span>
|
115 |
+
<input type="text" class="regular-text" name="url" value="<?php echo ( ! empty($post['url'])) ? esc_attr($post['url']) : ''; ?>" placeholder="Enter a web address to download the file from..."/>
|
116 |
+
<a class="wpallimport-download-from-url rad4" href="javascript:void(0);"><?php _e('Download', 'pmxi_plugin'); ?></a>
|
117 |
+
<span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
|
118 |
+
</div>
|
119 |
+
<div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
|
120 |
+
<?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. If anything in your file has changed, WP All Import can update your site with the changed data automatically.', 'pmxi_plugin'); ?>
|
121 |
+
<div class="wpallimport-free-edition-notice" style="display:none;">
|
122 |
+
<a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the professional edition of WP All Import to use this feature.', 'pmxi_plugin');?></a>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
<input type="hidden" name="downloaded" value="<?php echo $post['downloaded']; ?>"/>
|
126 |
+
</div>
|
127 |
+
<div class="wpallimport-upload-type-container" rel="file_type">
|
128 |
+
<?php $upload_dir = wp_upload_dir(); ?>
|
129 |
+
<div class="wpallimport-file-type-options">
|
130 |
+
|
131 |
+
<div id="file_selector" class="dd-container dd-disabled" style="width: 600px;">
|
132 |
+
<div class="dd-select" style="width: 600px; background: none repeat scroll 0% 0% rgb(238, 238, 238);">
|
133 |
+
<input type="hidden" class="dd-selected-value" value="">
|
134 |
+
<a class="dd-selected" style="color: rgb(207, 206, 202);">
|
135 |
+
<label class="dd-selected-text "><?php _e('Select a previously uploaded file', 'pmxi_plugin');?></label>
|
136 |
+
</a>
|
137 |
+
<span class="dd-pointer dd-pointer-down"></span>
|
138 |
+
</div>
|
139 |
+
</div>
|
140 |
+
|
141 |
+
<input type="hidden" name="file" value="<?php echo esc_attr($post['file']); ?>"/>
|
142 |
+
|
143 |
+
<div class="wpallimport-note" style="margin: 0 auto; font-size: 13px;">
|
144 |
+
<?php printf(__('Upload files to <strong>%s</strong> and they will appear in this list', 'pmxi_plugin'), $upload_dir['basedir'] . '/wpallimport/files') ?>
|
145 |
+
<div class="wpallimport-free-edition-notice">
|
146 |
+
<a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=use-existing-file" target="_blank" class="upgrade_link"><?php _e('Upgrade to the professional edition of WP All Import to use this feature.', 'pmxi_plugin');?></a>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
<div id="wpallimport-url-upload-status"></div>
|
152 |
+
|
153 |
+
<div class="wpallimport-upload-resource-step-two">
|
154 |
+
|
155 |
+
<div class="wpallimport-choose-post-type">
|
156 |
+
|
157 |
+
<input type="hidden" name="wizard_type" value="<?php echo $post['wizard_type']; ?>"/>
|
158 |
+
|
159 |
+
<h2 style="margin-top:0;"><?php _e('Import data from this file into...', 'pmxi_plugin'); ?></h2>
|
160 |
+
|
161 |
+
<div class="wpallimport-choose-data-type">
|
162 |
+
<a class="wpallimport-import-to rad4 wpallimport-to-new-items <?php if ($post['wizard_type'] == 'new') echo 'wpallimport-import-to-checked'; ?>" rel="new" href="javascript:void(0);">
|
163 |
+
<span class="wpallimport-import-to-title"><?php _e('New Items', 'pmxi_plugin'); ?></span>
|
164 |
+
<span class="wpallimport-import-to-arrow"></span>
|
165 |
+
</a>
|
166 |
+
<a class="wpallimport-import-to rad4 wpallimport-to-existing-items <?php if ($post['wizard_type'] == 'matching') echo 'wpallimport-import-to-checked'; ?>" rel="matching" href="javascript:void(0);">
|
167 |
+
<span class="wpallimport-import-to-title"><?php _e('Existing Items', 'pmxi_plugin'); ?></span>
|
168 |
+
<span class="wpallimport-import-to-arrow"></span>
|
169 |
+
</a>
|
170 |
+
</div>
|
171 |
+
|
172 |
+
<?php
|
173 |
+
|
174 |
+
$custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
|
175 |
+
foreach ($custom_types as $key => $ct) {
|
176 |
+
if (in_array($key, array('attachment', 'revision', 'nav_menu_item'))) unset($custom_types[$key]);
|
177 |
+
}
|
178 |
+
$custom_types = apply_filters( 'pmxi_custom_types', $custom_types );
|
179 |
+
|
180 |
+
$hidden_post_types = get_post_types(array('_builtin' => false, 'show_ui' => false), 'objects');
|
181 |
+
foreach ($hidden_post_types as $key => $ct) {
|
182 |
+
if (in_array($key, array('attachment', 'revision', 'nav_menu_item'))) unset($hidden_post_types[$key]);
|
183 |
+
}
|
184 |
+
$hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types );
|
185 |
+
|
186 |
+
?>
|
187 |
+
<div class="wpallimport-choose-import-direction">
|
188 |
+
<div class="wpallimport-extra-text-left">
|
189 |
+
<div class="wpallimport-new-records"><?php _e('Create new', 'pmxi_plugin'); ?></div>
|
190 |
+
<div class="wpallimport-existing-records"><?php _e('Import to existing', 'pmxi_plugin'); ?></div>
|
191 |
+
</div>
|
192 |
+
<div class="wpallimport-extra-text-right">
|
193 |
+
<div class="wpallimport-new-records"><?php _e('for each record in my data file.', 'pmxi_plugin'); ?></div>
|
194 |
+
<div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', 'pmxi_plugin'); ?>
|
195 |
+
<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>
|
196 |
+
</div>
|
197 |
+
</div>
|
198 |
+
<select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
|
199 |
+
<?php if ( ! empty($custom_types)): ?>
|
200 |
+
<?php foreach ($custom_types as $key => $cpt) :?>
|
201 |
+
<?php
|
202 |
+
$image_src = 'dashicon-cpt';
|
203 |
+
if ( in_array($key, array('post', 'page', 'product', 'import_users') ) )
|
204 |
+
$image_src = 'dashicon-' . $key;
|
205 |
+
?>
|
206 |
+
<option value="<?php echo $key; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>"><?php echo $cpt->labels->name; ?></option>
|
207 |
+
<?php endforeach; ?>
|
208 |
+
<?php endif; ?>
|
209 |
+
<?php if ( ! empty($hidden_post_types)): ?>
|
210 |
+
<?php foreach ($hidden_post_types as $key => $cpt) :?>
|
211 |
+
<?php
|
212 |
+
$image_src = 'dashicon-cpt';
|
213 |
+
if ( in_array($key, array('post', 'page', 'product') ) )
|
214 |
+
$image_src = 'dashicon-' . $key;
|
215 |
+
?>
|
216 |
+
<option value="<?php echo $key; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>"><?php echo $cpt->labels->name; ?></option>
|
217 |
+
<?php endforeach; ?>
|
218 |
+
<?php endif; ?>
|
219 |
+
</select>
|
220 |
+
</div>
|
221 |
+
<div class="clear wpallimport-extra-text-below">
|
222 |
+
<!--div class="wpallimport-existing-records">
|
223 |
+
<p><?php _e('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.', 'pmxi_plugin'); ?></p>
|
224 |
+
<p><?php _e('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.', 'pmxi_plugin'); ?></p>
|
225 |
+
</div-->
|
226 |
+
</div>
|
227 |
+
</div>
|
228 |
</div>
|
229 |
+
|
230 |
+
</div>
|
231 |
+
|
232 |
+
<p class="wpallimport-submit-buttons">
|
233 |
+
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
234 |
+
<input type="hidden" name="is_submitted" value="1" />
|
235 |
+
<?php wp_nonce_field('choose-file', '_wpnonce_choose-file'); ?>
|
236 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Continue to Step 2', 'pmxi_plugin') ?>" id="advanced_upload"/>
|
237 |
+
</p>
|
238 |
+
|
239 |
+
<table><tr><td class="wpallimport-note"></td></tr></table>
|
240 |
+
</form>
|
241 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'pmxi_plugin'); ?> <span></span></a>
|
242 |
+
</div>
|
243 |
+
</td>
|
244 |
</tr>
|
245 |
</table>
|
views/admin/import/options.php
CHANGED
@@ -1,141 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false), 'objects');
|
4 |
-
foreach ($custom_types as $key => $ct) {
|
5 |
-
if (in_array($key, array('attachment', 'revision', 'nav_menu_item'))) unset($custom_types[$key]);
|
6 |
-
}
|
7 |
$isWizard = $this->isWizard;
|
8 |
-
$baseUrl = $this->baseUrl;
|
9 |
-
|
10 |
?>
|
11 |
|
12 |
<input type="hidden" id="selected_post_type" value="<?php echo (!empty($post['custom_type'])) ? $post['custom_type'] : '';?>">
|
13 |
<input type="hidden" id="selected_type" value="<?php echo (!empty($post['type'])) ? $post['type'] : '';?>">
|
14 |
-
<h2>
|
15 |
-
<?php if ($isWizard): ?>
|
16 |
-
<?php _e('Import XML/CSV - Step 4: Options', 'pmxi_plugin') ?>
|
17 |
-
<?php else: ?>
|
18 |
-
<?php _e('Edit Import Options', 'pmxi_plugin') ?>
|
19 |
-
<?php endif ?>
|
20 |
-
</h2>
|
21 |
-
<h3><?php _e('Click the appropriate tab to choose the type of posts to create.', 'pmxi_plugin');?></h3>
|
22 |
-
|
23 |
-
<?php do_action('pmxi_options_header', $isWizard, $post); ?>
|
24 |
-
|
25 |
-
<div class="ajax-console">
|
26 |
-
<?php if ($this->errors->get_error_codes()): ?>
|
27 |
-
<?php $this->error() ?>
|
28 |
-
<?php endif ?>
|
29 |
-
</div>
|
30 |
|
31 |
-
<
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
if (count($custom_types)): ?>
|
62 |
-
<?php foreach ($custom_types as $key => $ct):?>
|
63 |
-
<?php if ( $key == $get['pmxi-cpt'] ): ?>
|
64 |
-
<div id="<?php echo $key;?>" class="">
|
65 |
-
<form class="options <?php echo ! $isWizard ? 'edit' : '' ?>" method="post">
|
66 |
-
<input type="hidden" name="custom_type" value="<?php echo $key; ?>"/>
|
67 |
-
<input type="hidden" name="type" value="post"/>
|
68 |
-
<div class="post-type-options">
|
69 |
-
<table class="form-table" style="max-width:none;">
|
70 |
-
<?php
|
71 |
-
$post_type = $entry = $key;
|
72 |
-
include( 'options/_main_options_template.php' );
|
73 |
-
|
74 |
-
if ( 'page' == $key ):
|
75 |
-
|
76 |
-
$entry = 'page';
|
77 |
-
?>
|
78 |
-
<tr>
|
79 |
-
<td align="center" width="33%" style="padding-bottom:20px;">
|
80 |
-
<label><?php _e('Page Template', 'pmxi_plugin') ?></label> <br>
|
81 |
-
<select name="page_template" id="page_template">
|
82 |
-
<option value='default'><?php _e('Default', 'pmxi_plugin') ?></option>
|
83 |
-
<?php page_template_dropdown($post['page_template']); ?>
|
84 |
-
</select>
|
85 |
-
</td>
|
86 |
-
<td align="center" width="33%">
|
87 |
-
<label><?php _e('Parent Page', 'pmxi_plugin') ?></label> <br>
|
88 |
-
<?php wp_dropdown_pages(array('post_type' => 'page', 'selected' => $post['parent'], 'name' => 'parent', 'show_option_none' => __('(no parent)', 'pmxi_plugin'), 'sort_column'=> 'menu_order, post_title',)) ?>
|
89 |
-
</td>
|
90 |
-
<td align="center" width="33%">
|
91 |
-
<label><?php _e('Order', 'pmxi_plugin') ?></label> <br>
|
92 |
-
<input type="text" class="" name="order" value="<?php echo esc_attr($post['order']) ?>" />
|
93 |
-
</td>
|
94 |
-
</tr>
|
95 |
-
<?php
|
96 |
-
endif;
|
97 |
-
|
98 |
-
do_action('pmxi_extend_options_main', $entry);
|
99 |
-
include( 'options/_taxonomies_template.php' );
|
100 |
-
do_action('pmxi_extend_options_taxonomies', $entry);
|
101 |
-
|
102 |
-
if ( ! in_array($entry, array('page', 'product')) ){
|
103 |
-
include( 'options/_categories_template.php' );
|
104 |
-
do_action('pmxi_extend_options_categories', $entry);
|
105 |
-
}
|
106 |
-
|
107 |
-
include( 'options/_custom_fields_template.php' );
|
108 |
-
do_action('pmxi_extend_options_custom_fields', $entry);
|
109 |
-
include( 'options/_featured_template.php' );
|
110 |
-
do_action('pmxi_extend_options_featured', $entry);
|
111 |
-
include( 'options/_author_template.php' );
|
112 |
-
do_action('pmxi_extend_options_author', $entry);
|
113 |
-
include( 'options/_reimport_template.php' );
|
114 |
-
include( 'options/_settings_template.php' );
|
115 |
-
?>
|
116 |
-
</table>
|
117 |
-
</div>
|
118 |
-
|
119 |
-
<?php include( 'options/_buttons_template.php' ); ?>
|
120 |
-
|
121 |
-
</form>
|
122 |
-
</div>
|
123 |
-
<?php endif ?>
|
124 |
-
<?php endforeach ?>
|
125 |
<?php endif ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
<?php if ($isWizard or $this->isTemplateEdit): ?>
|
131 |
-
<div class="right options">
|
132 |
<?php $this->tag( false ); ?>
|
133 |
</div>
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
</
|
139 |
|
140 |
<div id="record_matching_pointer" style="display:none;">
|
141 |
|
1 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
$isWizard = $this->isWizard;
|
3 |
+
$baseUrl = $this->baseUrl;
|
|
|
4 |
?>
|
5 |
|
6 |
<input type="hidden" id="selected_post_type" value="<?php echo (!empty($post['custom_type'])) ? $post['custom_type'] : '';?>">
|
7 |
<input type="hidden" id="selected_type" value="<?php echo (!empty($post['type'])) ? $post['type'] : '';?>">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
<div class="wpallimport-step-4">
|
10 |
+
|
11 |
+
<h2 class="wpallimport-wp-notices"></h2>
|
12 |
+
|
13 |
+
<div class="wpallimport-wrapper">
|
14 |
+
<h2 class="wpallimport-wp-notices"></h2>
|
15 |
+
<div class="wpallimport-header">
|
16 |
+
<div class="wpallimport-logo"></div>
|
17 |
+
<div class="wpallimport-title">
|
18 |
+
<p><?php _e('WP All Import', 'pmxi_plugin'); ?></p>
|
19 |
+
<h2><?php _e('Import XML / CSV', 'pmxi_plugin'); ?></h2>
|
20 |
+
</div>
|
21 |
+
<div class="wpallimport-links">
|
22 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'pmxi_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'pmxi_plugin'); ?></a>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
<div class="clear"></div>
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<?php $visible_sections = apply_filters('pmxi_visible_options_sections', array('reimport', 'settings'), $post['custom_type']); ?>
|
29 |
+
|
30 |
+
<table class="wpallimport-layout">
|
31 |
+
<tr>
|
32 |
+
<td class="left">
|
33 |
+
|
34 |
+
<?php do_action('pmxi_options_header', $isWizard, $post); ?>
|
35 |
+
|
36 |
+
<div class="ajax-console">
|
37 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
38 |
+
<?php $this->error() ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
<?php endif ?>
|
40 |
+
<?php if ($this->warnings->get_error_codes()): ?>
|
41 |
+
<?php $this->warning() ?>
|
42 |
+
<?php endif ?>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
<form class="<?php echo ! $isWizard ? 'edit' : 'options' ?>" method="post" enctype="multipart/form-data" autocomplete="off" <?php echo ! $isWizard ? 'style="overflow:visible;"' : '' ?>>
|
46 |
+
|
47 |
+
<?php $post_type = $post['custom_type']; ?>
|
48 |
+
|
49 |
+
<?php if ( ! $this->isWizard): ?>
|
50 |
+
|
51 |
+
<?php include( 'options/_import_file.php' ); ?>
|
52 |
+
|
53 |
+
<?php endif; ?>
|
54 |
+
|
55 |
+
<div class="options">
|
56 |
+
<?php
|
57 |
+
|
58 |
+
if ( in_array('reimport', $visible_sections)) include( 'options/_reimport_template.php' );
|
59 |
+
do_action('pmxi_options_tab', $isWizard, $post);
|
60 |
+
if ( in_array('settings', $visible_sections)) include( 'options/_settings_template.php' );
|
61 |
+
|
62 |
+
include( 'options/_buttons_template.php' );
|
63 |
+
|
64 |
+
?>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
</form>
|
68 |
+
|
69 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'pmxi_plugin'); ?> <span></span></a>
|
70 |
|
71 |
+
</td>
|
72 |
+
<td class="right template-sidebar ">
|
73 |
+
<div style="position:relative;">
|
|
|
|
|
74 |
<?php $this->tag( false ); ?>
|
75 |
</div>
|
76 |
+
</td>
|
77 |
+
</tr>
|
78 |
+
</table>
|
79 |
+
|
80 |
+
</div>
|
81 |
|
82 |
<div id="record_matching_pointer" style="display:none;">
|
83 |
|
views/admin/import/options/_author_template.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<tr>
|
2 |
-
<td colspan="3">
|
3 |
-
<h3 style="float:left;"><?php _e('Download & Import Attachments', 'pmxi_plugin') ?></h3>
|
4 |
-
<span class="separated_by" style="position:relative; top:15px; margin-right:0px;"><?php _e('Separated by','pmxi_plugin');?></span>
|
5 |
-
<div>
|
6 |
-
<input type="text" name="attachments" style="width:93%;" value="<?php echo esc_attr($post['attachments']) ?>" />
|
7 |
-
<input type="text" class="small" name="atch_delim" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center; float:right;"/>
|
8 |
-
</div>
|
9 |
-
</td>
|
10 |
-
</tr>
|
11 |
-
<tr>
|
12 |
-
<td colspan="3">
|
13 |
-
<h3><?php _e('Post Author', 'pmxi_plugin') ?></h3>
|
14 |
-
<div>
|
15 |
-
<input type="text" name="author" value="<?php echo esc_attr($post['author']) ?>"/> <a href="#help" class="help" title="<?php _e('Value that contains user ID, login, slug or email.', 'pmxi_plugin') ?>">?</a>
|
16 |
-
</div>
|
17 |
-
</td>
|
18 |
-
</tr>
|
19 |
-
<tr>
|
20 |
-
<td colspan="3">
|
21 |
-
<?php if ($entry != 'page'):?>
|
22 |
-
<h3><?php (class_exists('PMWI_Plugin') and $entry == 'product') ? _e('WooCommerce Short Description', 'pmxi_plugin') : _e('Post Excerpt', 'pmxi_plugin'); ?></h3>
|
23 |
-
<div>
|
24 |
-
<input type="text" name="post_excerpt" style="width:100%;" value="<?php echo esc_attr($post['post_excerpt']) ?>" />
|
25 |
-
</div>
|
26 |
-
<?php endif; ?>
|
27 |
-
<h3><?php _e('Post Slug', 'pmxi_plugin') ?></h3>
|
28 |
-
<div>
|
29 |
-
<input type="text" name="post_slug" style="width:100%;" value="<?php echo esc_attr($post['post_slug']) ?>" />
|
30 |
-
</div>
|
31 |
-
</td>
|
32 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/options/_buttons_template.php
CHANGED
@@ -1,21 +1,24 @@
|
|
1 |
-
|
|
|
|
|
|
|
2 |
<?php wp_nonce_field('options', '_wpnonce_options') ?>
|
3 |
<input type="hidden" name="is_submitted" value="1" />
|
4 |
<input type="hidden" name="converted_options" value="1"/>
|
5 |
|
6 |
<?php if ($isWizard): ?>
|
7 |
|
8 |
-
<a href="<?php echo apply_filters('pmxi_options_back_link', add_query_arg('action', 'template', $this->baseUrl), $isWizard); ?>" class="back"><?php _e('Back', 'pmxi_plugin') ?></a>
|
9 |
|
10 |
<?php if (isset($source_type) and in_array($source_type, array('url', 'ftp', 'file'))): ?>
|
11 |
-
|
12 |
-
<input type="submit" name="
|
13 |
<?php endif ?>
|
14 |
|
15 |
-
<input type="submit" class="button button-primary button-hero
|
16 |
|
17 |
-
<?php else: ?>
|
18 |
-
<a href="<?php echo apply_filters('pmxi_options_back_link', remove_query_arg('id', remove_query_arg('action', $this->baseUrl)), $isWizard); ?>" class="back"><?php _e('Back', 'pmxi_plugin') ?></a>
|
19 |
-
<input type="submit" class="button button-primary button-hero
|
20 |
<?php endif ?>
|
21 |
</p>
|
1 |
+
<?php if ( ! $isWizard): ?>
|
2 |
+
<!--p class="note" style="float:left; margin-top:30px;"><?php _e('To run the import, click Run Import on the Manage Imports page.'); ?></p-->
|
3 |
+
<?php endif; ?>
|
4 |
+
<p class="wpallimport-submit-buttons">
|
5 |
<?php wp_nonce_field('options', '_wpnonce_options') ?>
|
6 |
<input type="hidden" name="is_submitted" value="1" />
|
7 |
<input type="hidden" name="converted_options" value="1"/>
|
8 |
|
9 |
<?php if ($isWizard): ?>
|
10 |
|
11 |
+
<a href="<?php echo apply_filters('pmxi_options_back_link', add_query_arg('action', 'template', $this->baseUrl), $isWizard); ?>" class="back rad3"><?php _e('Back to Step 3', 'pmxi_plugin') ?></a>
|
12 |
|
13 |
<?php if (isset($source_type) and in_array($source_type, array('url', 'ftp', 'file'))): ?>
|
14 |
+
<!--input type="hidden" class="save_only" value="0" name="save_only"/-->
|
15 |
+
<input type="submit" name="save_only" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Save Only', 'pmxi_plugin') ?>" style="background:#425f9a;"/>
|
16 |
<?php endif ?>
|
17 |
|
18 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Continue', 'pmxi_plugin') ?>" />
|
19 |
|
20 |
+
<?php else: ?>
|
21 |
+
<a href="<?php echo apply_filters('pmxi_options_back_link', remove_query_arg('id', remove_query_arg('action', $this->baseUrl)), $isWizard); ?>" class="back rad3"><?php _e('Back to Manage Imports', 'pmxi_plugin') ?></a>
|
22 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Save Import Configuration', 'pmxi_plugin') ?>" />
|
23 |
<?php endif ?>
|
24 |
</p>
|
views/admin/import/options/_categories_template.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<tr>
|
2 |
-
<td colspan="3">
|
3 |
-
<div class="col2 post_taxonomy">
|
4 |
-
<fieldset style="margin-left:0px;">
|
5 |
-
<legend><?php _e('Categories', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Uncheck a box and the category will still be created, but the post will not be assigned to it.', 'pmxi_plugin') ?>">?</a></legend>
|
6 |
-
<ol class="sortable no-margin">
|
7 |
-
<?php
|
8 |
-
if ( ! empty($post['categories']) ):
|
9 |
-
|
10 |
-
$categories = json_decode($post['categories']);
|
11 |
-
|
12 |
-
if ( ! empty($categories) and is_array($categories)):
|
13 |
-
|
14 |
-
$i = 0;
|
15 |
-
foreach ($categories as $cat) { $i++;
|
16 |
-
if (is_null($cat->parent_id) or empty($cat->parent_id)){
|
17 |
-
?>
|
18 |
-
<li id="item_<?php echo $i; ?>" class="dragging">
|
19 |
-
<div class="drag-element">
|
20 |
-
<input type="checkbox" class="assign_post" <?php if ($cat->assign): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>"/>
|
21 |
-
<input type="text" class="widefat xpath_field" value="<?php echo (is_object($cat)) ? esc_attr($cat->xpath) : esc_attr($cat); ?>"/>
|
22 |
-
|
23 |
-
<?php do_action('pmxi_category_view', $cat, $i, 'category', $entry); ?>
|
24 |
-
|
25 |
-
</div>
|
26 |
-
<?php if ($i > 1):?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif;?>
|
27 |
-
<?php if ( is_object($cat) ) echo reverse_taxonomies_html($categories, $cat->item_id, $i, 'category', $entry); ?>
|
28 |
-
</li>
|
29 |
-
<?php
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
endif;
|
34 |
-
|
35 |
-
endif; ?>
|
36 |
-
|
37 |
-
<li id="item" class="template">
|
38 |
-
<div class="drag-element">
|
39 |
-
<input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>"/>
|
40 |
-
<input type="text" class="widefat xpath_field" value=""/>
|
41 |
-
|
42 |
-
<?php do_action('pmxi_category_view', false, false, 'category', $entry); ?>
|
43 |
-
|
44 |
-
</div>
|
45 |
-
<a href="javascript:void(0);" class="icon-item remove-ico"></a>
|
46 |
-
</li>
|
47 |
-
|
48 |
-
</ol>
|
49 |
-
<a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add more', 'pmxi_plugin');?></a> <br><br>
|
50 |
-
<input type="hidden" class="hierarhy-output" name="categories" value="<?php echo esc_attr($post['categories']) ?>"/>
|
51 |
-
<div class="hidden" id="dialog-confirm-category-removing" title="Delete categories?"><?php _e('Remove only current category or current category with subcategories?', 'pmxi_plugin');?></div>
|
52 |
-
<?php do_action('pmxi_category_options_view', ((!empty($post['categories'])) ? $post['categories'] : false), 'category', $entry, __('Categories', 'pmxi_plugin')); ?>
|
53 |
-
<div class="delim">
|
54 |
-
<label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
|
55 |
-
<input type="text" class="small" name="categories_delim" value="<?php echo ( ! empty($post['categories_delim']) ) ? str_replace("&","&", htmlentities(htmlentities($post['categories_delim']))) : ',' ; ?>" />
|
56 |
-
<label for="categories_auto_nested"><?php _e('Enable Auto Nest', 'pmxi_plugin');?></label>
|
57 |
-
<input type="hidden" name="categories_auto_nested" value="0"/>
|
58 |
-
<input type="checkbox" id="categories_auto_nested" name="categories_auto_nested" <?php if ($post['categories_auto_nested']):?>checked="checked"<?php endif; ?>/>
|
59 |
-
<a href="#help" class="help" style="position:relative; top:-1px; left: -5px;" title="<?php _e('If this box is checked, a category hierarchy will be created. For example, if your <code>{category}</code> value is <code>Mens > Shoes > Diesel</code>, enter <code>></code> as the separator and enable <code>Auto Nest</code> to create <code>Diesel</code> as a child category of <code>Shoes</code> and <code>Shoes</code> as a child category of <code>Mens.</code>', 'pmxi_plugin') ?>">?</a>
|
60 |
-
<?php do_action('pmxi_category_options', ((!empty($post['categories'])) ? $post['categories'] : false), 'category', $entry); ?>
|
61 |
-
</div>
|
62 |
-
|
63 |
-
</fieldset>
|
64 |
-
</div>
|
65 |
-
<div class="col2">
|
66 |
-
<fieldset style="padding:5px; margin-right:0px;">
|
67 |
-
<legend><?php _e('Tags', 'pmxi_plugin') ?> </legend>
|
68 |
-
<input type="text" name="tags" class="widefat" value="<?php echo esc_attr($post['tags']) ?>" /> <br> <br>
|
69 |
-
<div class="delim">
|
70 |
-
<label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
|
71 |
-
<input type="text" class="small" name="tags_delim" value="<?php echo esc_attr($post['tags_delim']) ?>" />
|
72 |
-
</div>
|
73 |
-
</fieldset>
|
74 |
-
</div>
|
75 |
-
</td>
|
76 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/options/_custom_fields_template.php
DELETED
@@ -1,257 +0,0 @@
|
|
1 |
-
<tr>
|
2 |
-
<td colspan="3" style="padding-top:20px;">
|
3 |
-
<fieldset class="optionsset" style="text-align:center;">
|
4 |
-
<legend><?php _e('Custom Fields','pmxi_plugin');?></legend>
|
5 |
-
|
6 |
-
<center>
|
7 |
-
|
8 |
-
<h3>Please upgrade to the professional edition of WP All Import to import data to Custom Fields.</h3>
|
9 |
-
|
10 |
-
<p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=custom-fields&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
|
11 |
-
|
12 |
-
<hr />
|
13 |
-
|
14 |
-
</center>
|
15 |
-
|
16 |
-
<table class="form-table custom-params" style="max-width:none; border:none;">
|
17 |
-
<thead>
|
18 |
-
<tr>
|
19 |
-
<td><?php _e('Name', 'pmxi_plugin') ?></td>
|
20 |
-
<td><?php _e('Value', 'pmxi_plugin') ?></td>
|
21 |
-
</tr>
|
22 |
-
</thead>
|
23 |
-
<tbody>
|
24 |
-
<?php if (!empty($post['custom_name'])):?>
|
25 |
-
<?php foreach ($post['custom_name'] as $i => $name): ?>
|
26 |
-
<tr class="form-field">
|
27 |
-
<td>
|
28 |
-
<input type="text" name="custom_name[]" value="<?php echo esc_attr($name) ?>" class="widefat" disabled="disabled"/>
|
29 |
-
<div class="input to_the_left">
|
30 |
-
<input id="custom_format_<?php echo $i; ?>" type="checkbox" name="custom_format[]" <?php if ( ! empty($post['custom_format'][$i]) ): ?>checked="checked"<?php endif; ?> style="width:12px;" value="1"/>
|
31 |
-
<label for="custom_format_<?php echo $i; ?>"><?php _e('Serialized format', 'pmxi_plugin') ?></label>
|
32 |
-
</div>
|
33 |
-
</td>
|
34 |
-
<td class="action">
|
35 |
-
<div class="custom_type" rel="default" <?php if ( ! empty($post['custom_format'][$i]) ): ?>style="display:none;"<?php endif; ?>>
|
36 |
-
<textarea name="custom_value[]" class="widefat" disabled="disabled"><?php echo esc_html($post['custom_value'][$i]) ?></textarea>
|
37 |
-
</div>
|
38 |
-
<div class="custom_type" rel="serialized" <?php if ( empty($post['custom_format'][$i]) ): ?>style="display:none;"<?php endif; ?>>
|
39 |
-
<table cellpadding="0" cellspacing="5">
|
40 |
-
<thead>
|
41 |
-
<tr>
|
42 |
-
<td><?php _e('Key', 'pmxi_plugin') ?></td>
|
43 |
-
<td><?php _e('Value', 'pmxi_plugin') ?></td>
|
44 |
-
<td> </td>
|
45 |
-
</tr>
|
46 |
-
</thead>
|
47 |
-
<tbody>
|
48 |
-
<?php
|
49 |
-
$serialized_values = (!empty($post['serialized_values'][$i])) ? json_decode($post['serialized_values'][$i], true) : false;
|
50 |
-
|
51 |
-
if (!empty($serialized_values) and is_array($serialized_values)){
|
52 |
-
foreach ($serialized_values as $key => $value) {
|
53 |
-
|
54 |
-
$k = $key;
|
55 |
-
|
56 |
-
if (is_array($value)){
|
57 |
-
$keys = array_keys($value);
|
58 |
-
$k = $keys[0];
|
59 |
-
}
|
60 |
-
|
61 |
-
?>
|
62 |
-
<tr class="form-field">
|
63 |
-
<td>
|
64 |
-
<input type="text" class="serialized_key widefat" value="<?php echo $k; ?>" disabled="disabled">
|
65 |
-
</td>
|
66 |
-
<td>
|
67 |
-
<input type="text" class="serialized_value widefat" value="<?php echo (is_array($value)) ? $value[$k] : $value; ?>" disabled="disabled">
|
68 |
-
</td>
|
69 |
-
<td class="action remove">
|
70 |
-
<a href="#remove" style="right:-10px;"></a>
|
71 |
-
</td>
|
72 |
-
</tr>
|
73 |
-
<?php
|
74 |
-
}
|
75 |
-
}
|
76 |
-
else{
|
77 |
-
?>
|
78 |
-
<tr class="form-field">
|
79 |
-
<td>
|
80 |
-
<input type="text" class="serialized_key widefat" disabled="disabled">
|
81 |
-
</td>
|
82 |
-
<td>
|
83 |
-
<input type="text" class="serialized_value widefat" disabled="disabled">
|
84 |
-
</td>
|
85 |
-
<td class="action remove">
|
86 |
-
<a href="#remove" style="right:-10px;"></a>
|
87 |
-
</td>
|
88 |
-
</tr>
|
89 |
-
<?php
|
90 |
-
}
|
91 |
-
?>
|
92 |
-
<tr class="form-field template">
|
93 |
-
<td>
|
94 |
-
<input type="text" class="serialized_key widefat" disabled="disabled">
|
95 |
-
</td>
|
96 |
-
<td>
|
97 |
-
<input type="text" class="serialized_value widefat" disabled="disabled">
|
98 |
-
</td>
|
99 |
-
<td class="action remove">
|
100 |
-
<a href="#remove" style="right:-10px;"></a>
|
101 |
-
</td>
|
102 |
-
</tr>
|
103 |
-
<tr>
|
104 |
-
<td colspan="3">
|
105 |
-
<a href="javascript:void(0);" title="<?php _e('add', 'pmxi_plugin')?>" class="action add-new-key"><?php _e('Add more', 'pmxi_plugin') ?></a>
|
106 |
-
</td>
|
107 |
-
</tr>
|
108 |
-
</tbody>
|
109 |
-
</table>
|
110 |
-
<input type="hidden" name="serialized_values[]" value="<?php if (!empty($post['serialized_values'][$i])) echo esc_html($post['serialized_values'][$i]); ?>"/>
|
111 |
-
</div>
|
112 |
-
<span class="action remove">
|
113 |
-
<a href="#remove"></a>
|
114 |
-
</span>
|
115 |
-
</td>
|
116 |
-
</tr>
|
117 |
-
<?php endforeach ?>
|
118 |
-
<?php else: ?>
|
119 |
-
<tr class="form-field">
|
120 |
-
<td>
|
121 |
-
<input type="text" name="custom_name[]" value="" class="widefat" disabled="disabled"/>
|
122 |
-
<div class="input to_the_left">
|
123 |
-
<input id="custom_format_0" type="checkbox" name="custom_format[]" style="width:12px;" value="1"/>
|
124 |
-
<label for="custom_format_0"><?php _e('Serialized format', 'pmxi_plugin') ?></label>
|
125 |
-
</div>
|
126 |
-
</td>
|
127 |
-
<td class="action">
|
128 |
-
<div class="custom_type" rel="default">
|
129 |
-
<textarea name="custom_value[]" class="widefat" disabled="disabled"></textarea>
|
130 |
-
</div>
|
131 |
-
<div class="custom_type" rel="serialized" style="display:none;">
|
132 |
-
<table cellpadding="0" cellspacing="5">
|
133 |
-
<thead>
|
134 |
-
<tr>
|
135 |
-
<td><?php _e('Key', 'pmxi_plugin') ?></td>
|
136 |
-
<td><?php _e('Value', 'pmxi_plugin') ?></td>
|
137 |
-
<td> </td>
|
138 |
-
</tr>
|
139 |
-
</thead>
|
140 |
-
<tbody>
|
141 |
-
<tr class="form-field">
|
142 |
-
<td>
|
143 |
-
<input type="text" class="serialized_key widefat" disabled="disabled">
|
144 |
-
</td>
|
145 |
-
<td>
|
146 |
-
<input type="text" class="serialized_value widefat" disabled="disabled">
|
147 |
-
</td>
|
148 |
-
<td class="action remove">
|
149 |
-
<a href="#remove" style="right:-10px;"></a>
|
150 |
-
</td>
|
151 |
-
</tr>
|
152 |
-
<tr class="form-field template">
|
153 |
-
<td>
|
154 |
-
<input type="text" class="serialized_key widefat" disabled="disabled">
|
155 |
-
</td>
|
156 |
-
<td>
|
157 |
-
<input type="text" class="serialized_value widefat" disabled="disabled">
|
158 |
-
</td>
|
159 |
-
<td class="action remove">
|
160 |
-
<a href="#remove" style="right:-10px;"></a>
|
161 |
-
</td>
|
162 |
-
</tr>
|
163 |
-
<tr>
|
164 |
-
<td colspan="3">
|
165 |
-
<a href="javascript:void(0);" title="<?php _e('add', 'pmxi_plugin')?>" class="action add-new-key"><?php _e('Add more', 'pmxi_plugin') ?></a>
|
166 |
-
</td>
|
167 |
-
</tr>
|
168 |
-
</tbody>
|
169 |
-
</table>
|
170 |
-
<input type="hidden" name="serialized_values[]" value=""/>
|
171 |
-
</div>
|
172 |
-
<span class="action remove">
|
173 |
-
<a href="#remove"></a>
|
174 |
-
</span>
|
175 |
-
</td>
|
176 |
-
</tr>
|
177 |
-
<?php endif;?>
|
178 |
-
<tr class="form-field template">
|
179 |
-
<td>
|
180 |
-
<input type="text" name="custom_name[]" value="" class="widefat" disabled="disabled"/>
|
181 |
-
<div class="input to_the_left">
|
182 |
-
<input type="checkbox" id="custom_format" name="custom_format[]" style="width:12px;" value="1"/>
|
183 |
-
<label for="custom_format"><?php _e('Serialized format', 'pmxi_plugin') ?></label>
|
184 |
-
</div>
|
185 |
-
</td>
|
186 |
-
<td class="action">
|
187 |
-
<div class="custom_type" rel="default">
|
188 |
-
<textarea name="custom_value[]" class="widefat" disabled="disabled"></textarea>
|
189 |
-
</div>
|
190 |
-
<div class="custom_type" rel="serialized" style="display:none;">
|
191 |
-
<table cellpadding="0" cellspacing="5">
|
192 |
-
<thead>
|
193 |
-
<tr>
|
194 |
-
<td><?php _e('Key', 'pmxi_plugin') ?></td>
|
195 |
-
<td><?php _e('Value', 'pmxi_plugin') ?></td>
|
196 |
-
<td> </td>
|
197 |
-
</tr>
|
198 |
-
</thead>
|
199 |
-
<tbody>
|
200 |
-
<tr class="form-field">
|
201 |
-
<td>
|
202 |
-
<input type="text" class="serialized_key widefat" disabled="disabled">
|
203 |
-
</td>
|
204 |
-
<td>
|
205 |
-
<input type="text" class="serialized_value widefat" disabled="disabled">
|
206 |
-
</td>
|
207 |
-
<td class="action remove">
|
208 |
-
<a href="#remove" style="right:-10px;"></a>
|
209 |
-
</td>
|
210 |
-
</tr>
|
211 |
-
<tr class="form-field template">
|
212 |
-
<td>
|
213 |
-
<input type="text" class="serialized_key widefat" disabled="disabled">
|
214 |
-
</td>
|
215 |
-
<td>
|
216 |
-
<input type="text" class="serialized_value widefat" disabled="disabled">
|
217 |
-
</td>
|
218 |
-
<td class="action remove">
|
219 |
-
<a href="#remove" style="right:-10px;"></a>
|
220 |
-
</td>
|
221 |
-
</tr>
|
222 |
-
<tr>
|
223 |
-
<td colspan="3">
|
224 |
-
<a href="javascript:void(0);" title="<?php _e('add', 'pmxi_plugin')?>" class="action add-new-key"><?php _e('Add more', 'pmxi_plugin') ?></a>
|
225 |
-
</td>
|
226 |
-
</tr>
|
227 |
-
</tbody>
|
228 |
-
</table>
|
229 |
-
<input type="hidden" name="serialized_values[]" value=""/>
|
230 |
-
</div>
|
231 |
-
<span class="action remove">
|
232 |
-
<a href="#remove"></a>
|
233 |
-
</span>
|
234 |
-
</td>
|
235 |
-
</tr>
|
236 |
-
<tr>
|
237 |
-
<td colspan="2"><a href="javascript:void(0);" title="<?php _e('add', 'pmxi_plugin')?>" class="action add-new-custom"><?php _e('Add more', 'pmxi_plugin') ?></a></td>
|
238 |
-
</tr>
|
239 |
-
</tbody>
|
240 |
-
</table>
|
241 |
-
<select class="existing_meta_keys">
|
242 |
-
<option value=""><?php _e('Existing Custom Fields...','pmxi_plugin');?></option>
|
243 |
-
<?php
|
244 |
-
$hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
|
245 |
-
if (!empty($meta_keys) and $meta_keys->count()):
|
246 |
-
foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
|
247 |
-
?>
|
248 |
-
<option value="<?php echo $meta_key['meta_key'];?>"><?php echo $meta_key['meta_key'];?></option>
|
249 |
-
<?php
|
250 |
-
}
|
251 |
-
endif;
|
252 |
-
?>
|
253 |
-
</select>
|
254 |
-
<br/>
|
255 |
-
</fieldset>
|
256 |
-
</td>
|
257 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/options/_featured_template.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<tr>
|
2 |
-
<td colspan="3" style="padding-top:20px;">
|
3 |
-
<fieldset class="optionsset">
|
4 |
-
<legend><?php _e('Featured Image & Media Gallery', 'pmxi_plugin') ?></legend>
|
5 |
-
|
6 |
-
<?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>
|
7 |
-
|
8 |
-
<center>
|
9 |
-
|
10 |
-
<h3>Please upgrade to the professional edition of WP All Import to download and import images to the post media gallery.</h3>
|
11 |
-
|
12 |
-
<p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=custom-fields&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
|
13 |
-
|
14 |
-
<hr />
|
15 |
-
|
16 |
-
</center>
|
17 |
-
|
18 |
-
<?php endif; ?>
|
19 |
-
|
20 |
-
<div class="input">
|
21 |
-
<p style="margin-bottom:5px;"><?php _e('<b>Image URLs</b> (one per line)', 'pmxi_plugin');?></p>
|
22 |
-
<textarea name="featured_image" class="newline" style="width:100%;margin-bottom:5px;" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>><?php echo esc_attr($post['featured_image']) ?></textarea>
|
23 |
-
<label for="featured_delim_<?php echo $entry;?>"><?php _e('Place one image URL per line, or separate URLs with a ', 'pmxi_plugin');?></label>
|
24 |
-
<input type="text" class="small" id="featured_delim_<?php echo $entry;?>" name="featured_delim" value="<?php echo esc_attr($post['featured_delim']) ?>" style="width:5%; text-align:center;" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/>
|
25 |
-
<span style="float:right;">
|
26 |
-
<input type="hidden" name="create_draft" value="no" />
|
27 |
-
<input type="checkbox" id="create_draft_<?php echo $entry; ?>" name="create_draft" value="yes" <?php echo 'yes' == $post['create_draft'] ? 'checked="checked"' : '' ?> class="fix_checkbox" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/>
|
28 |
-
<label for="create_draft_<?php echo $entry; ?>"><?php _e('If no images are downloaded successfully, create entry as Draft.', 'pmxi_plugin') ?></label>
|
29 |
-
</span>
|
30 |
-
</div>
|
31 |
-
<div class="input" style="margin:3px 0px;">
|
32 |
-
<input type="hidden" name="download_images" value="0" />
|
33 |
-
<input type="checkbox" id="download_images_<?php echo $entry; ?>" name="download_images" value="1" <?php echo $post['download_images'] ? 'checked="checked"' : '' ?> class="fix_checkbox" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/>
|
34 |
-
<label for="download_images_<?php echo $entry;?>"><?php _e('Download images','pmxi_plugin');?> </label>
|
35 |
-
<a href="#help" class="help" title="<?php _e('Enable this option and WP All Import will download images into the Uploads folder. If this option is disabled, then WP All Import will search for files in the <strong>/wp-content/uploads/'.date("Y/m").'</strong> folder, and if no matching image is found, only then will WP All Import attempt to download it', 'pmxi_plugin') ?>">?</a>
|
36 |
-
</div>
|
37 |
-
<div class="input" style="margin:3px 0px;">
|
38 |
-
<input type="hidden" name="auto_rename_images" value="0" />
|
39 |
-
<input type="checkbox" id="auto_rename_images_<?php echo $entry; ?>" name="auto_rename_images" value="1" <?php echo $post['auto_rename_images'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/>
|
40 |
-
<label for="auto_rename_images_<?php echo $entry;?>"><?php _e('Instead of using original image file name, set file name(s) to','pmxi_plugin');?> </label>
|
41 |
-
<input type="text" id="auto_rename_images_suffix_<?php echo $entry;?>" class="switcher-target-auto_rename_images_<?php echo $entry; ?>" name="auto_rename_images_suffix" value="<?php echo esc_attr($post['auto_rename_images_suffix']) ?>" /> <a href="#help" class="help" title="<?php _e('Instead of using original image file name, set file name(s) suffix', 'pmxi_plugin') ?>">?</a>
|
42 |
-
</div>
|
43 |
-
<div class="input">
|
44 |
-
<input type="hidden" name="set_image_meta_data" value="0" />
|
45 |
-
<input type="checkbox" id="set_image_meta_data_<?php echo $entry; ?>" name="set_image_meta_data" value="1" <?php echo $post['set_image_meta_data'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
46 |
-
<label for="set_image_meta_data_<?php echo $entry;?>"><?php _e('Set Image Meta Data (alt text, caption, description, title)','pmxi_plugin');?></label>
|
47 |
-
</div>
|
48 |
-
<div class="switcher-target-set_image_meta_data_<?php echo $entry; ?>" style="padding-left:17px;">
|
49 |
-
<div class="input">
|
50 |
-
<p style="margin-bottom:5px;"><?php _e('Title', 'pmxi_plugin');?> <a href="#help" class="help" title="<?php _e('Image Title', 'pmxi_plugin') ?>">?</a></p>
|
51 |
-
<textarea name="image_meta_title" class="newline" style="width:100%; margin-bottom:5px;" placeholder="<?php _e('Default will be image filename. The first title will be associated with the first image URL, the second title will be associated with second image URL, etc.','pmxi_plugin');?>" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>><?php echo esc_attr($post['image_meta_title']) ?></textarea>
|
52 |
-
<label for="image_meta_title_delim_<?php echo $entry;?>"><?php _e('Separated by', 'pmxi_plugin');?></label>
|
53 |
-
<input type="text" class="small" id="image_meta_title_delim_<?php echo $entry;?>" name="image_meta_title_delim" value="<?php echo esc_attr($post['image_meta_title_delim']) ?>" style="width:5%; text-align:center;" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/> <span>(<?php _e('or newline','pmxi_plugin');?>)</span>
|
54 |
-
</div>
|
55 |
-
<div class="input">
|
56 |
-
<p style="margin-bottom:5px;"><?php _e('Caption', 'pmxi_plugin');?> <a href="#help" class="help" title="<?php _e('Image Capltion', 'pmxi_plugin') ?>">?</a></p>
|
57 |
-
<textarea name="image_meta_caption" class="newline" style="width:100%; margin-bottom:5px;" placeholder="The first caption will be associated with the first image URL, the second caption will be associated with the second image URL, etc." <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>><?php echo esc_attr($post['image_meta_caption']) ?></textarea>
|
58 |
-
<label for="image_meta_caption_delim_<?php echo $entry;?>"><?php _e('Separated by', 'pmxi_plugin');?></label>
|
59 |
-
<input type="text" class="small" id="image_meta_caption_delim_<?php echo $entry;?>" name="image_meta_caption_delim" value="<?php echo esc_attr($post['image_meta_caption_delim']) ?>" style="width:5%; text-align:center;" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/> <span>(<?php _e('or newline','pmxi_plugin');?>)</span>
|
60 |
-
</div>
|
61 |
-
<div class="input">
|
62 |
-
<p style="margin-bottom:5px;"><?php _e('Alt text', 'pmxi_plugin');?> <a href="#help" class="help" title="<?php _e('Image Alt Text', 'pmxi_plugin') ?>">?</a></p>
|
63 |
-
<textarea name="image_meta_alt" class="newline" style="width:100%; margin-bottom:5px;" placeholder="The first alt text will be associated with the first image URL, the second alt text will be associted with the second image URL, etc." <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>><?php echo esc_attr($post['image_meta_alt']) ?></textarea>
|
64 |
-
<label for="image_meta_alt_delim_<?php echo $entry;?>"><?php _e('Separated by', 'pmxi_plugin');?></label>
|
65 |
-
<input type="text" class="small" id="image_meta_alt_delim_<?php echo $entry;?>" name="image_meta_alt_delim" value="<?php echo esc_attr($post['image_meta_alt_delim']) ?>" style="width:5%; text-align:center;" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/> <span>(<?php _e('or newline','pmxi_plugin');?>)</span>
|
66 |
-
</div>
|
67 |
-
<div class="input">
|
68 |
-
<p style="margin-bottom:5px;"><?php _e('Description', 'pmxi_plugin');?> <a href="#help" class="help" title="<?php _e('Image Description', 'pmxi_plugin') ?>">?</a></p>
|
69 |
-
<textarea name="image_meta_description" class="newline" style="width:100%; margin-bottom:5px;" placeholder="The first description will be associated with the first URL, the second descrition will be associated with the second URL, etc." <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>><?php echo esc_attr($post['image_meta_description']) ?></textarea>
|
70 |
-
<label for="image_meta_description_delim_<?php echo $entry;?>"><?php _e('Separated by', 'pmxi_plugin');?></label>
|
71 |
-
<input type="text" class="small" id="image_meta_description_delim_<?php echo $entry;?>" name="image_meta_description_delim" value="<?php echo esc_attr($post['image_meta_description_delim']) ?>" style="width:5%; text-align:center;" <?php if ($post_type != "product" or ! class_exists('PMWI_Plugin')):?>disabled="disabled"<?php endif; ?>/> <span>(<?php _e('or newline','pmxi_plugin');?>)</span>
|
72 |
-
</div>
|
73 |
-
</div>
|
74 |
-
</fieldset>
|
75 |
-
</td>
|
76 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/options/_import_file.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.',
|
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 PMXI_ROOT_URL; ?>';
|
28 |
+
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
29 |
+
</script>
|
30 |
+
|
31 |
+
<div class="change_file">
|
32 |
+
<div class="wpallimport-content-section">
|
33 |
+
<div class="wpallimport-collapsed-header" style="padding-left:30px;">
|
34 |
+
<h3><?php _e('Import File','pmxi_plugin');?></h3>
|
35 |
+
</div>
|
36 |
+
<div class="wpallimport-collapsed-content" style="padding-bottom: 40px;">
|
37 |
+
<hr>
|
38 |
+
<table class="form-table" style="max-width:none;">
|
39 |
+
<tr>
|
40 |
+
<td colspan="3">
|
41 |
+
|
42 |
+
<div class="wpallimport-import-types">
|
43 |
+
<h3><?php _e('Specify the location of the file to use for future runs of this import.', 'pmxi_plugin'); ?></h3>
|
44 |
+
<a class="wpallimport-import-from wpallimport-upload-type <?php echo 'upload' == $import->type ? 'selected' : '' ?>" rel="upload_type" href="javascript:void(0);">
|
45 |
+
<span class="wpallimport-icon"></span>
|
46 |
+
<span class="wpallimport-icon-label"><?php _e('Upload a file', 'pmxi_plugin'); ?></span>
|
47 |
+
</a>
|
48 |
+
<a class="wpallimport-import-from wpallimport-url-type <?php echo 'url' == $import->type ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
|
49 |
+
<span class="wpallimport-icon"></span>
|
50 |
+
<span class="wpallimport-icon-label"><?php _e('Download from URL', 'pmxi_plugin'); ?></span>
|
51 |
+
</a>
|
52 |
+
<a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $import->type ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
|
53 |
+
<span class="wpallimport-icon"></span>
|
54 |
+
<span class="wpallimport-icon-label"><?php _e('Use existing file', 'pmxi_plugin'); ?></span>
|
55 |
+
</a>
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<input type="hidden" value="upload" name="new_type"/>
|
59 |
+
|
60 |
+
<div class="wpallimport-upload-type-container" rel="upload_type">
|
61 |
+
<div id="plupload-ui" class="wpallimport-file-type-options">
|
62 |
+
<div>
|
63 |
+
<input type="hidden" name="filepath" value="<?php if ('upload' == $import->type) echo $import->path; ?>" id="filepath"/>
|
64 |
+
<a id="select-files" href="javascript:void(0);"/><?php _e('Click here to select file from your computer...', 'pmxi_plugin'); ?></a>
|
65 |
+
<div id="progressbar" class="wpallimport-progressbar">
|
66 |
+
<?php if ('upload' == $import->type) _e( '<span>Upload Complete</span> - '.basename($import->path).' 100%', 'pmxi_plugin'); ?>
|
67 |
+
</div>
|
68 |
+
<div id="progress" class="wpallimport-progress" <?php if ('upload' == $import->type):?>style="display: block;"<?php endif;?>>
|
69 |
+
<div id="upload_process" class="wpallimport-upload-process"></div>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
<div class="wpallimport-upload-type-container" rel="url_type">
|
75 |
+
<div class="wpallimport-file-type-options">
|
76 |
+
<span class="wpallimport-url-icon"></span>
|
77 |
+
<input type="text" class="regular-text" name="url" value="<?php echo ('url' == $import->type) ? esc_attr($import->path) : 'Enter a web address to download the file from...'; ?>"/>
|
78 |
+
<div class="wpallimport-free-edition-notice">
|
79 |
+
<a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=download-from-url" target="_blank" class="upgrade_link"><?php _e('Upgrade to the professional edition of WP All Import to use this feature.', 'pmxi_plugin');?></a>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
<input type="hidden" name="downloaded"/>
|
83 |
+
</div>
|
84 |
+
<div class="wpallimport-upload-type-container" rel="file_type">
|
85 |
+
<?php $upload_dir = wp_upload_dir(); ?>
|
86 |
+
<div class="wpallimport-file-type-options">
|
87 |
+
|
88 |
+
<div id="file_selector" class="dd-container" style="width: 600px;">
|
89 |
+
<div class="dd-select" style="width: 600px; background: none repeat scroll 0% 0% rgb(238, 238, 238);">
|
90 |
+
<input type="hidden" class="dd-selected-value" value="">
|
91 |
+
<a class="dd-selected" style="color: rgb(207, 206, 202);">
|
92 |
+
<label class="dd-selected-text "><?php _e('Select a previously uploaded file', 'pmxi_plugin'); ?></label>
|
93 |
+
</a>
|
94 |
+
<span class="dd-pointer dd-pointer-down"></span>
|
95 |
+
</div>
|
96 |
+
</div>
|
97 |
+
|
98 |
+
<input type="hidden" name="file" value="<?php if ('file' == $import->type) echo esc_attr($import->path); ?>"/>
|
99 |
+
|
100 |
+
<div class="wpallimport-note" style="width:60%; margin: 0 auto; ">
|
101 |
+
<?php printf(__('Upload files to <strong>%s</strong> and they will appear in this list', 'pmxi_plugin'), $upload_dir['basedir'] . '/wpallimport/files'); ?>
|
102 |
+
</div>
|
103 |
+
<div class="wpallimport-free-edition-notice">
|
104 |
+
<a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=use-existing-file" target="_blank" class="upgrade_link"><?php _e('Upgrade to the professional edition of WP All Import to use this feature.', 'pmxi_plugin');?></a>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
+
</td>
|
109 |
+
</tr>
|
110 |
+
</table>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
</div>
|
views/admin/import/options/_main_options_template.php
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<tr>
|
2 |
-
<td style="border-bottom:1px solid #ccc;" colspan="3">
|
3 |
-
|
4 |
-
<?php if ($post_type != "post" and $post_type != 'page'):?>
|
5 |
-
|
6 |
-
<?php if ($post_type == "product" and class_exists('PMWI_Plugin')):?>
|
7 |
-
|
8 |
-
<input type="hidden" class="is_disabled" value="0"/>
|
9 |
-
|
10 |
-
<?php else: ?>
|
11 |
-
<center>
|
12 |
-
<h3>Please upgrade to the professional version of WP All Import to import to Custom Post Types.</h3>
|
13 |
-
<input type="hidden" class="is_disabled" value="1"/>
|
14 |
-
<p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=custom-fields&utm_campaign=free+plugin" target="_blank" class="upgrade_link">Upgrade Now</a></p>
|
15 |
-
<hr />
|
16 |
-
</center>
|
17 |
-
<?php endif; ?>
|
18 |
-
|
19 |
-
<?php else: ?>
|
20 |
-
|
21 |
-
<input type="hidden" class="is_disabled" value="0"/>
|
22 |
-
|
23 |
-
<?php endif; ?>
|
24 |
-
|
25 |
-
<input type="hidden" name="encoding" value="<?php echo ($isWizard) ? PMXI_Plugin::$session->data['pmxi_import']['encoding'] : $post['encoding']; ?>"/>
|
26 |
-
<input type="hidden" name="delimiter" value="<?php echo ($isWizard) ? PMXI_Plugin::$session->data['pmxi_import']['is_csv'] : $post['delimiter']; ?>"/>
|
27 |
-
|
28 |
-
<?php $is_support_post_format = ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) ? true : false; ?>
|
29 |
-
|
30 |
-
<div class="<?php echo ($is_support_post_format) ? 'col3' : 'col2';?>" style="margin-bottom:20px;">
|
31 |
-
<h3><?php _e('Post Status', 'pmxi_plugin') ?></h3>
|
32 |
-
<div>
|
33 |
-
<div class="input">
|
34 |
-
<input type="radio" id="status_publish_<?php echo $entry; ?>" name="status" value="publish" <?php echo 'publish' == $post['status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
35 |
-
<label for="status_publish_<?php echo $entry; ?>"><?php _e('Published', 'pmxi_plugin') ?></label>
|
36 |
-
</div>
|
37 |
-
<div class="input">
|
38 |
-
<input type="radio" id="status_draft_<?php echo $entry; ?>" name="status" value="draft" <?php echo 'draft' == $post['status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
39 |
-
<label for="status_draft_<?php echo $entry; ?>"><?php _e('Draft', 'pmxi_plugin') ?></label>
|
40 |
-
</div>
|
41 |
-
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px;">
|
42 |
-
<input type="radio" id="status_xpath_<?php echo $entry; ?>" class="switcher" name="status" value="xpath" <?php echo 'xpath' == $post['status'] ? 'checked="checked"': '' ?>/>
|
43 |
-
<label for="status_xpath_<?php echo $entry; ?>"><?php _e('Set with XPath', 'pmxi_plugin' )?></label> <br>
|
44 |
-
<div class="switcher-target-status_xpath_<?php echo $entry; ?> set_xpath">
|
45 |
-
<div class="input">
|
46 |
-
<input type="text" class="smaller-text" name="status_xpath" style="width:150px; float:left; margin-left:10px;" value="<?php echo esc_attr($post['status_xpath']) ?>"/>
|
47 |
-
<a href="#help" class="help" title="<?php _e('The value of presented XPath should be one of the following: (\'publish\', \'draft\', \'trash\').', 'pmxi_plugin') ?>" style="position:relative; top:2px;">?</a>
|
48 |
-
</div>
|
49 |
-
</div>
|
50 |
-
</div>
|
51 |
-
<div class="clear"></div>
|
52 |
-
<div class="input">
|
53 |
-
<input type="hidden" name="comment_status" value="closed" />
|
54 |
-
<input type="checkbox" id="comment_status_<?php echo $entry; ?>" name="comment_status" value="open" <?php echo 'open' == $post['comment_status'] ? 'checked="checked"' : '' ?> />
|
55 |
-
<label for="comment_status_<?php echo $entry; ?>"><?php _e('Allow Comments', 'pmxi_plugin') ?></label>
|
56 |
-
</div>
|
57 |
-
<div class="input">
|
58 |
-
<input type="hidden" name="ping_status" value="closed" />
|
59 |
-
<input type="checkbox" id="ping_status_<?php echo $entry; ?>" name="ping_status" value="open" <?php echo 'open' == $post['ping_status'] ? 'checked="checked"' : '' ?> />
|
60 |
-
<label for="ping_status_<?php echo $entry; ?>"><?php _e('Allow Trackbacks and Pingbacks', 'pmxi_plugin') ?></label>
|
61 |
-
</div>
|
62 |
-
</div>
|
63 |
-
</div>
|
64 |
-
<?php if ($is_support_post_format):?>
|
65 |
-
<div class="col3">
|
66 |
-
<h3><?php _e('Post Format', 'pmxi_plugin') ?></h3>
|
67 |
-
<div>
|
68 |
-
<?php $post_formats = get_theme_support( 'post-formats' ); ?>
|
69 |
-
|
70 |
-
<div class="input">
|
71 |
-
<input type="radio" id="post_format_<?php echo "standart_" . $entry; ?>" name="post_format" value="0" <?php echo (empty($post['post_format']) or ( empty($post_formats) )) ? 'checked="checked"' : '' ?> />
|
72 |
-
<label for="post_format_<?php echo "standart_" . $entry; ?>"><?php _e( "Standard", 'pmxi_plugin') ?></label>
|
73 |
-
</div>
|
74 |
-
|
75 |
-
<?php
|
76 |
-
if ( ! empty($post_formats[0]) ){
|
77 |
-
foreach ($post_formats[0] as $post_format) {
|
78 |
-
?>
|
79 |
-
<div class="input">
|
80 |
-
<input type="radio" id="post_format_<?php echo $post_format . "_" . $entry; ?>" name="post_format" value="<?php echo $post_format; ?>" <?php echo $post_format == $post['post_format'] ? 'checked="checked"' : '' ?> />
|
81 |
-
<label for="post_format_<?php echo $post_format . "_" . $entry; ?>"><?php _e( ucfirst($post_format), 'pmxi_plugin') ?></label>
|
82 |
-
</div>
|
83 |
-
<?php
|
84 |
-
}
|
85 |
-
}
|
86 |
-
?>
|
87 |
-
</div>
|
88 |
-
</div>
|
89 |
-
<?php endif; ?>
|
90 |
-
<div class="<?php echo ($is_support_post_format) ? 'col3' : 'col2';?>" <?php if ($is_support_post_format):?>style="border-right:none; padding-right:0px;"<?php endif; ?>>
|
91 |
-
<h3><?php _e('Post Dates', 'pmxi_plugin') ?><a href="#help" class="help" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', 'pmxi_plugin') ?>">?</a></h3>
|
92 |
-
<div class="input">
|
93 |
-
<input type="radio" id="date_type_specific_<?php echo $entry; ?>" class="switcher" name="date_type" value="specific" <?php echo 'random' != $post['date_type'] ? 'checked="checked"' : '' ?> />
|
94 |
-
<label for="date_type_specific_<?php echo $entry; ?>">
|
95 |
-
<?php _e('As specified', 'pmxi_plugin') ?>
|
96 |
-
</label>
|
97 |
-
<span class="switcher-target-date_type_specific_<?php echo $entry; ?>" style="vertical-align:middle">
|
98 |
-
<input type="text" class="datepicker" name="date" value="<?php echo esc_attr($post['date']) ?>" style="width:40%;"/>
|
99 |
-
</span>
|
100 |
-
</div>
|
101 |
-
<div class="input">
|
102 |
-
<input type="radio" id="date_type_random_<?php echo $entry; ?>" class="switcher" name="date_type" value="random" <?php echo 'random' == $post['date_type'] ? 'checked="checked"' : '' ?> />
|
103 |
-
<label for="date_type_random_<?php echo $entry; ?>">
|
104 |
-
<?php _e('Random dates', 'pmxi_plugin') ?><a href="#help" class="help" title="<?php _e('Posts will be randomly assigned dates in this range. WordPress ensures posts with dates in the future will not appear until their date has been reached.', 'pmxi_plugin') ?>">?</a>
|
105 |
-
</label> <br>
|
106 |
-
<span class="switcher-target-date_type_random_<?php echo $entry; ?>" style="vertical-align:middle; display:inline-block; margin-top:10px;">
|
107 |
-
<input type="text" class="datepicker" name="date_start" value="<?php echo esc_attr($post['date_start']) ?>" />
|
108 |
-
<?php _e('and', 'pmxi_plugin') ?>
|
109 |
-
<input type="text" class="datepicker" name="date_end" value="<?php echo esc_attr($post['date_end']) ?>" />
|
110 |
-
</span>
|
111 |
-
</div>
|
112 |
-
</div>
|
113 |
-
</td>
|
114 |
-
</tr>
|
115 |
-
<tr>
|
116 |
-
<td colspan="3">
|
117 |
-
<h3 style="text-align:center; color:#999;"><?php _e('Drag elements from the XML tree on the right to any textbox below.','pmxi_plugin');?></h3>
|
118 |
-
</td>
|
119 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/options/_reimport_options.php
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h4><?php _e('When WP All Import finds new or changed data...', 'pmxi_plugin'); ?></h4>
|
2 |
+
<div class="input">
|
3 |
+
<input type="hidden" name="create_new_records" value="0" />
|
4 |
+
<input type="checkbox" id="create_new_records" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
5 |
+
<label for="create_new_records"><?php _e('Create new posts from records newly present in your file', 'pmxi_plugin') ?></label>
|
6 |
+
</div>
|
7 |
+
<div class="switcher-target-auto_matching">
|
8 |
+
<div class="input">
|
9 |
+
<input type="hidden" name="is_delete_missing" value="0" />
|
10 |
+
<input type="checkbox" id="is_delete_missing" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher"/>
|
11 |
+
<label for="is_delete_missing"><?php _e('Delete posts that are no longer present in your file', 'pmxi_plugin') ?></label>
|
12 |
+
<!--a href="#help" class="wpallimport-help" title="<?php _e('Check this option if you want to delete posts from the previous import operation which are not found among newly imported set.', 'pmxi_plugin') ?>">?</a-->
|
13 |
+
</div>
|
14 |
+
<div class="switcher-target-is_delete_missing" style="padding-left:17px;">
|
15 |
+
<div class="input">
|
16 |
+
<input type="hidden" name="is_keep_attachments" value="0" />
|
17 |
+
<input type="checkbox" id="is_keep_attachments" name="is_keep_attachments" value="1" <?php echo $post['is_keep_attachments'] ? 'checked="checked"': '' ?> />
|
18 |
+
<label for="is_keep_attachments"><?php _e('Do not remove attachments', 'pmxi_plugin') ?></label>
|
19 |
+
</div>
|
20 |
+
<div class="input">
|
21 |
+
<input type="hidden" name="is_keep_imgs" value="0" />
|
22 |
+
<input type="checkbox" id="is_keep_imgs" name="is_keep_imgs" value="1" <?php echo $post['is_keep_imgs'] ? 'checked="checked"': '' ?> />
|
23 |
+
<label for="is_keep_imgs"><?php _e('Do not remove images', 'pmxi_plugin') ?></label>
|
24 |
+
</div>
|
25 |
+
<div class="input">
|
26 |
+
<input type="hidden" name="is_update_missing_cf" value="0" />
|
27 |
+
<input type="checkbox" id="is_update_missing_cf" name="is_update_missing_cf" value="1" <?php echo $post['is_update_missing_cf'] ? 'checked="checked"': '' ?> class="switcher"/>
|
28 |
+
<label for="is_update_missing_cf"><?php _e('Instead of deletion, set Custom Field', 'pmxi_plugin') ?></label>
|
29 |
+
<div class="switcher-target-is_update_missing_cf" style="padding-left:17px;">
|
30 |
+
<div class="input">
|
31 |
+
<?php _e('Name', 'pmxi_plugin') ?>
|
32 |
+
<input type="text" name="update_missing_cf_name" value="<?php echo esc_attr($post['update_missing_cf_name']) ?>" />
|
33 |
+
<?php _e('Value', 'pmxi_plugin') ?>
|
34 |
+
<input type="text" name="update_missing_cf_value" value="<?php echo esc_attr($post['update_missing_cf_value']) ?>" />
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
</div>
|
38 |
+
<div class="input">
|
39 |
+
<input type="hidden" name="set_missing_to_draft" value="0" />
|
40 |
+
<input type="checkbox" id="set_missing_to_draft" name="set_missing_to_draft" value="1" <?php echo $post['set_missing_to_draft'] ? 'checked="checked"': '' ?> />
|
41 |
+
<label for="set_missing_to_draft"><?php _e('Instead of deletion, change post status to Draft', 'pmxi_plugin') ?></label>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<div class="input">
|
46 |
+
<input type="hidden" id="is_keep_former_posts" name="is_keep_former_posts" value="yes" />
|
47 |
+
<input type="checkbox" id="is_not_keep_former_posts" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
|
48 |
+
<label for="is_not_keep_former_posts"><?php _e('Update existing posts with changed data in your file', 'pmxi_plugin') ?></label>
|
49 |
+
|
50 |
+
<div class="switcher-target-is_not_keep_former_posts" style="padding-left:17px;">
|
51 |
+
<input type="radio" id="update_all_data" class="switcher" name="update_all_data" value="yes" <?php echo 'no' != $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
52 |
+
<label for="update_all_data"><?php _e('Update all data', 'pmxi_plugin' )?></label><br>
|
53 |
+
|
54 |
+
<input type="radio" id="update_choosen_data" class="switcher" name="update_all_data" value="no" <?php echo 'no' == $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
55 |
+
<label for="update_choosen_data"><?php _e('Choose which data to update', 'pmxi_plugin' )?></label><br>
|
56 |
+
<div class="switcher-target-update_choosen_data" style="padding-left:17px;">
|
57 |
+
<div class="input">
|
58 |
+
<input type="hidden" name="is_update_status" value="0" />
|
59 |
+
<input type="checkbox" id="is_update_status" name="is_update_status" value="1" <?php echo $post['is_update_status'] ? 'checked="checked"': '' ?> />
|
60 |
+
<label for="is_update_status"><?php _e('Post status', 'pmxi_plugin') ?></label>
|
61 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('Hint: uncheck this box to keep trashed posts in the trash.', 'pmxi_plugin') ?>">?</a>
|
62 |
+
</div>
|
63 |
+
<div class="input">
|
64 |
+
<input type="hidden" name="is_update_title" value="0" />
|
65 |
+
<input type="checkbox" id="is_update_title" name="is_update_title" value="1" <?php echo $post['is_update_title'] ? 'checked="checked"': '' ?> />
|
66 |
+
<label for="is_update_title"><?php _e('Title', 'pmxi_plugin') ?></label>
|
67 |
+
</div>
|
68 |
+
<div class="input">
|
69 |
+
<input type="hidden" name="is_update_author" value="0" />
|
70 |
+
<input type="checkbox" id="is_update_author" name="is_update_author" value="1" <?php echo $post['is_update_author'] ? 'checked="checked"': '' ?> />
|
71 |
+
<label for="is_update_author"><?php _e('Author', 'pmxi_plugin') ?></label>
|
72 |
+
</div>
|
73 |
+
<div class="input">
|
74 |
+
<input type="hidden" name="is_update_slug" value="0" />
|
75 |
+
<input type="checkbox" id="is_update_slug" name="is_update_slug" value="1" <?php echo $post['is_update_slug'] ? 'checked="checked"': '' ?> />
|
76 |
+
<label for="is_update_slug"><?php _e('Slug', 'pmxi_plugin') ?></label>
|
77 |
+
</div>
|
78 |
+
<div class="input">
|
79 |
+
<input type="hidden" name="is_update_content" value="0" />
|
80 |
+
<input type="checkbox" id="is_update_content" name="is_update_content" value="1" <?php echo $post['is_update_content'] ? 'checked="checked"': '' ?> />
|
81 |
+
<label for="is_update_content"><?php _e('Content', 'pmxi_plugin') ?></label>
|
82 |
+
</div>
|
83 |
+
<div class="input">
|
84 |
+
<input type="hidden" name="is_update_excerpt" value="0" />
|
85 |
+
<input type="checkbox" id="is_update_excerpt" name="is_update_excerpt" value="1" <?php echo $post['is_update_excerpt'] ? 'checked="checked"': '' ?> />
|
86 |
+
<label for="is_update_excerpt"><?php _e('Excerpt/Short Description', 'pmxi_plugin') ?></label>
|
87 |
+
</div>
|
88 |
+
<div class="input">
|
89 |
+
<input type="hidden" name="is_update_dates" value="0" />
|
90 |
+
<input type="checkbox" id="is_update_dates" name="is_update_dates" value="1" <?php echo $post['is_update_dates'] ? 'checked="checked"': '' ?> />
|
91 |
+
<label for="is_update_dates"><?php _e('Dates', 'pmxi_plugin') ?></label>
|
92 |
+
</div>
|
93 |
+
<div class="input">
|
94 |
+
<input type="hidden" name="is_update_menu_order" value="0" />
|
95 |
+
<input type="checkbox" id="is_update_menu_order" name="is_update_menu_order" value="1" <?php echo $post['is_update_menu_order'] ? 'checked="checked"': '' ?> />
|
96 |
+
<label for="is_update_menu_order"><?php _e('Menu order', 'pmxi_plugin') ?></label>
|
97 |
+
</div>
|
98 |
+
<div class="input">
|
99 |
+
<input type="hidden" name="is_update_parent" value="0" />
|
100 |
+
<input type="checkbox" id="is_update_parent" name="is_update_parent" value="1" <?php echo $post['is_update_parent'] ? 'checked="checked"': '' ?> />
|
101 |
+
<label for="is_update_parent"><?php _e('Parent post', 'pmxi_plugin') ?></label>
|
102 |
+
</div>
|
103 |
+
<div class="input">
|
104 |
+
<input type="hidden" name="is_update_attachments" value="0" />
|
105 |
+
<input type="checkbox" id="is_update_attachments" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
|
106 |
+
<label for="is_update_attachments"><?php _e('Attachments', 'pmxi_plugin') ?></label>
|
107 |
+
</div>
|
108 |
+
|
109 |
+
<?php
|
110 |
+
|
111 |
+
// add-ons re-import options
|
112 |
+
do_action('pmxi_reimport', $post_type, $post);
|
113 |
+
|
114 |
+
?>
|
115 |
+
|
116 |
+
<div class="input">
|
117 |
+
<input type="hidden" name="is_update_images" value="0" />
|
118 |
+
<input type="checkbox" id="is_update_images" name="is_update_images" value="1" <?php echo $post['is_update_images'] ? 'checked="checked"': '' ?> class="switcher" />
|
119 |
+
<label for="is_update_images"><?php _e('Images', 'pmxi_plugin') ?></label>
|
120 |
+
<!--a href="#help" class="wpallimport-help" title="<?php _e('This will keep the featured image if it exists, so you could modify the post image manually, and then do a reimport, and it would not overwrite the manually modified post image.', 'pmxi_plugin') ?>">?</a-->
|
121 |
+
<div class="switcher-target-is_update_images" style="padding-left:17px;">
|
122 |
+
<div class="input" style="margin-bottom:3px;">
|
123 |
+
<input type="radio" id="update_images_logic_full_update" name="update_images_logic" value="full_update" <?php echo ( "full_update" == $post['update_images_logic'] ) ? 'checked="checked"': '' ?> />
|
124 |
+
<label for="update_images_logic_full_update"><?php _e('Update all images', 'pmxi_plugin') ?></label>
|
125 |
+
</div>
|
126 |
+
<div class="input" style="margin-bottom:3px;">
|
127 |
+
<input type="radio" id="update_images_logic_add_new" name="update_images_logic" value="add_new" <?php echo ( "add_new" == $post['update_images_logic'] ) ? 'checked="checked"': '' ?> />
|
128 |
+
<label for="update_images_logic_add_new"><?php _e('Don\'t touch existing images, append new images', 'pmxi_plugin') ?></label>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
<div class="input">
|
133 |
+
<input type="hidden" name="custom_fields_list" value="0" />
|
134 |
+
<input type="hidden" name="is_update_custom_fields" value="0" />
|
135 |
+
<input type="checkbox" id="is_update_custom_fields" name="is_update_custom_fields" value="1" <?php echo $post['is_update_custom_fields'] ? 'checked="checked"': '' ?> class="switcher"/>
|
136 |
+
<label for="is_update_custom_fields"><?php _e('Custom Fields', 'pmxi_plugin') ?></label>
|
137 |
+
<!--a href="#help" class="wpallimport-help" title="<?php _e('If Keep Custom Fields box is checked, it will keep all Custom Fields, and add any new Custom Fields specified in Custom Fields section, as long as they do not overwrite existing fields. If \'Only keep this Custom Fields\' is specified, it will only keep the specified fields.', 'pmxi_plugin') ?>">?</a-->
|
138 |
+
<div class="switcher-target-is_update_custom_fields" style="padding-left:17px;">
|
139 |
+
<div class="input">
|
140 |
+
<input type="radio" id="update_custom_fields_logic_full_update" name="update_custom_fields_logic" value="full_update" <?php echo ( "full_update" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
141 |
+
<label for="update_custom_fields_logic_full_update"><?php _e('Update all Custom Fields', 'pmxi_plugin') ?></label>
|
142 |
+
</div>
|
143 |
+
<div class="input">
|
144 |
+
<input type="radio" id="update_custom_fields_logic_only" name="update_custom_fields_logic" value="only" <?php echo ( "only" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
145 |
+
<label for="update_custom_fields_logic_only"><?php _e('Update only these Custom Fields, leave the rest alone', 'pmxi_plugin') ?></label>
|
146 |
+
<div class="switcher-target-update_custom_fields_logic_only pmxi_choosen" style="padding-left:17px;">
|
147 |
+
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo implode(',', $existing_meta_keys);?></span>
|
148 |
+
<input class="choosen_input" value="<?php if (!empty($post['custom_fields_list']) and "only" == $post['update_custom_fields_logic']) echo implode(',', $post['custom_fields_list']); ?>" type="hidden" name="custom_fields_only_list"/>
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
<div class="input">
|
152 |
+
<input type="radio" id="update_custom_fields_logic_all_except" name="update_custom_fields_logic" value="all_except" <?php echo ( "all_except" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
153 |
+
<label for="update_custom_fields_logic_all_except"><?php _e('Leave these fields alone, update all other Custom Fields', 'pmxi_plugin') ?></label>
|
154 |
+
<div class="switcher-target-update_custom_fields_logic_all_except pmxi_choosen" style="padding-left:17px;">
|
155 |
+
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo implode(',', $existing_meta_keys);?></span>
|
156 |
+
<input class="choosen_input" value="<?php if (!empty($post['custom_fields_list']) and "all_except" == $post['update_custom_fields_logic']) echo implode(',', $post['custom_fields_list']); ?>" type="hidden" name="custom_fields_except_list"/>
|
157 |
+
</div>
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
<div class="input">
|
162 |
+
<input type="hidden" name="taxonomies_list" value="0" />
|
163 |
+
<input type="hidden" name="is_update_categories" value="0" />
|
164 |
+
<input type="checkbox" id="is_update_categories" name="is_update_categories" value="1" class="switcher" <?php echo $post['is_update_categories'] ? 'checked="checked"': '' ?> />
|
165 |
+
<label for="is_update_categories"><?php _e('Taxonomies (incl. Categories and Tags)', 'pmxi_plugin') ?></label>
|
166 |
+
<div class="switcher-target-is_update_categories" style="padding-left:17px;">
|
167 |
+
<?php
|
168 |
+
$existing_taxonomies = array();
|
169 |
+
$hide_taxonomies = (class_exists('PMWI_Plugin')) ? array('product_type') : array();
|
170 |
+
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($hide_taxonomies));
|
171 |
+
if (!empty($post_taxonomies)):
|
172 |
+
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and $post_type == "product" and strpos($ctx->name, "pa_") === 0)) continue;
|
173 |
+
$existing_taxonomies[] = $ctx->name;
|
174 |
+
endforeach;
|
175 |
+
endif;
|
176 |
+
?>
|
177 |
+
<div class="input" style="margin-bottom:3px;">
|
178 |
+
<input type="radio" id="update_categories_logic_all_except" name="update_categories_logic" value="all_except" <?php echo ( "all_except" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
179 |
+
<label for="update_categories_logic_all_except"><?php _e('Leave these taxonomies alone, update all others', 'pmxi_plugin') ?></label>
|
180 |
+
<div class="switcher-target-update_categories_logic_all_except pmxi_choosen" style="padding-left:17px;">
|
181 |
+
<span class="hidden choosen_values"><?php if (!empty($existing_taxonomies)) echo implode(',', $existing_taxonomies);?></span>
|
182 |
+
<input class="choosen_input" value="<?php if (!empty($post['taxonomies_list']) and "all_except" == $post['update_categories_logic']) echo implode(',', $post['taxonomies_list']); ?>" type="hidden" name="taxonomies_except_list"/>
|
183 |
+
</div>
|
184 |
+
</div>
|
185 |
+
<div class="input" style="margin-bottom:3px;">
|
186 |
+
<input type="radio" id="update_categories_logic_only" name="update_categories_logic" value="only" <?php echo ( "only" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
187 |
+
<label for="update_categories_logic_only"><?php _e('Update only these taxonomies, leave the rest alone', 'pmxi_plugin') ?></label>
|
188 |
+
<div class="switcher-target-update_categories_logic_only pmxi_choosen" style="padding-left:17px;">
|
189 |
+
<span class="hidden choosen_values"><?php if (!empty($existing_taxonomies)) echo implode(',', $existing_taxonomies);?></span>
|
190 |
+
<input class="choosen_input" value="<?php if (!empty($post['taxonomies_list']) and "only" == $post['update_categories_logic']) echo implode(',', $post['taxonomies_list']); ?>" type="hidden" name="taxonomies_only_list"/>
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
<div class="input" style="margin-bottom:3px;">
|
194 |
+
<input type="radio" id="update_categories_logic_full_update" name="update_categories_logic" value="full_update" <?php echo ( "full_update" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
195 |
+
<label for="update_categories_logic_full_update"><?php _e('Remove existing taxonomies, add new taxonomies', 'pmxi_plugin') ?></label>
|
196 |
+
</div>
|
197 |
+
<div class="input" style="margin-bottom:3px;">
|
198 |
+
<input type="radio" id="update_categories_logic_add_new" name="update_categories_logic" value="add_new" <?php echo ( "add_new" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
199 |
+
<label for="update_categories_logic_add_new"><?php _e('Only add new', 'pmxi_plugin') ?></label>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
</div>
|
204 |
+
</div>
|
205 |
+
</div>
|
views/admin/import/options/_reimport_template.php
CHANGED
@@ -1,259 +1,97 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
<a href="#help" class="help" title="<?php _e('If posts are being updated and not just created during a brand new import, the problem is that the value of the unique key is not unique for each record.', 'pmxi_plugin') ?>">?</a>
|
15 |
-
</div>
|
16 |
-
</div>
|
17 |
-
<input type="radio" id="manual_matching_<?php echo $entry; ?>" class="switcher" name="duplicate_matching" value="manual" <?php echo 'manual' == $post['duplicate_matching'] ? 'checked="checked"': '' ?>/>
|
18 |
-
<label for="manual_matching_<?php echo $entry; ?>"><?php _e('Manual Record Matching', 'pmxi_plugin' )?></label>
|
19 |
-
<div class="switcher-target-manual_matching_<?php echo $entry; ?>" style="padding-left:17px;">
|
20 |
-
<div class="input">
|
21 |
-
<input type="radio" id="duplicate_indicator_title_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
22 |
-
<label for="duplicate_indicator_title_<?php echo $entry; ?>"><?php _e('match by Title', 'pmxi_plugin' )?></label><br>
|
23 |
-
<input type="radio" id="duplicate_indicator_content_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
24 |
-
<label for="duplicate_indicator_content_<?php echo $entry; ?>"><?php _e('match by Content', 'pmxi_plugin' )?></label><br>
|
25 |
-
<input type="radio" id="duplicate_indicator_custom_field_<?php echo $entry; ?>" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
26 |
-
<label for="duplicate_indicator_custom_field_<?php echo $entry; ?>"><?php _e('match by Custom field', 'pmxi_plugin' )?></label><br>
|
27 |
-
<span class="switcher-target-duplicate_indicator_custom_field_<?php echo $entry; ?>" style="vertical-align:middle; padding-left:17px;">
|
28 |
-
<?php _e('Name', 'pmxi_plugin') ?>
|
29 |
-
<input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
|
30 |
-
<?php _e('Value', 'pmxi_plugin') ?>
|
31 |
-
<input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
|
32 |
-
</span>
|
33 |
-
</div>
|
34 |
-
</div>
|
35 |
-
</div>
|
36 |
-
<hr>
|
37 |
-
<div class="input">
|
38 |
-
<input type="hidden" name="create_new_records" value="0" />
|
39 |
-
<input type="checkbox" id="create_new_records_<?php echo $entry; ?>" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
40 |
-
<label for="create_new_records_<?php echo $entry; ?>"><?php _e('Create new posts from records newly present in your file', 'pmxi_plugin') ?></label>
|
41 |
</div>
|
42 |
-
<div class="
|
43 |
-
<div class="
|
44 |
-
<
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
<label for="is_keep_attachments_<?php echo $entry; ?>"><?php _e('Do not remove attachments', 'pmxi_plugin') ?></label>
|
54 |
-
<a href="#help" class="help" title="<?php _e('Check this option if you want attachments like *.pdf or *.doc files to be kept in media library after parent post or page is removed or replaced during reimport operation.', 'pmxi_plugin') ?>">?</a>
|
55 |
-
</div>
|
56 |
-
<div class="input">
|
57 |
-
<input type="hidden" name="is_keep_imgs" value="0" />
|
58 |
-
<input type="checkbox" id="is_keep_imgs_<?php echo $entry; ?>" name="is_keep_imgs" value="1" <?php echo $post['is_keep_imgs'] ? 'checked="checked"': '' ?> />
|
59 |
-
<label for="is_keep_imgs_<?php echo $entry; ?>"><?php _e('Do not remove images', 'pmxi_plugin') ?></label>
|
60 |
-
<a href="#help" class="help" title="<?php _e('Check this option if you want images like featured image to be kept in media library after parent post or page is removed or replaced during reimport operation.', 'pmxi_plugin') ?>">?</a>
|
61 |
-
</div>
|
62 |
-
<div class="input">
|
63 |
-
<input type="hidden" name="is_update_missing_cf" value="0" />
|
64 |
-
<input type="checkbox" id="is_update_missing_cf_<?php echo $entry; ?>" name="is_update_missing_cf" value="1" <?php echo $post['is_update_missing_cf'] ? 'checked="checked"': '' ?> class="switcher"/>
|
65 |
-
<label for="is_update_missing_cf_<?php echo $entry; ?>"><?php _e('Instead of deletion, set Custom Field', 'pmxi_plugin') ?></label>
|
66 |
-
<a href="#help" class="help" title="<?php _e('Check this option if you want to update posts custom fields from the previous import operation which are not found among newly imported set.', 'pmxi_plugin') ?>">?</a>
|
67 |
-
<div class="switcher-target-is_update_missing_cf_<?php echo $entry; ?>" style="padding-left:17px;">
|
68 |
-
<div class="input">
|
69 |
-
<?php _e('Name', 'pmxi_plugin') ?>
|
70 |
-
<input type="text" name="update_missing_cf_name" value="<?php echo esc_attr($post['update_missing_cf_name']) ?>" />
|
71 |
-
<?php _e('Value', 'pmxi_plugin') ?>
|
72 |
-
<input type="text" name="update_missing_cf_value" value="<?php echo esc_attr($post['update_missing_cf_value']) ?>" />
|
73 |
-
</div>
|
74 |
-
</div>
|
75 |
-
</div>
|
76 |
-
<div class="input">
|
77 |
-
<input type="hidden" name="set_missing_to_draft" value="0" />
|
78 |
-
<input type="checkbox" id="set_missing_to_draft_<?php echo $entry; ?>" name="set_missing_to_draft" value="1" <?php echo $post['set_missing_to_draft'] ? 'checked="checked"': '' ?> />
|
79 |
-
<label for="set_missing_to_draft_<?php echo $entry; ?>"><?php _e('Instead of deletion, change post status to Draft', 'pmxi_plugin') ?></label>
|
80 |
-
</div>
|
81 |
-
</div>
|
82 |
-
</div>
|
83 |
-
<div class="input">
|
84 |
-
<input type="hidden" id="is_keep_former_posts_<?php echo $entry; ?>" name="is_keep_former_posts" value="yes" />
|
85 |
-
<input type="checkbox" id="is_not_keep_former_posts_<?php echo $entry; ?>" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
|
86 |
-
<label for="is_not_keep_former_posts_<?php echo $entry; ?>"><?php _e('Update existing posts with changed data in your file', 'pmxi_plugin') ?></label>
|
87 |
|
88 |
-
|
89 |
-
<input type="radio" id="update_all_data_<?php echo $entry; ?>" class="switcher" name="update_all_data" value="yes" <?php echo 'no' != $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
90 |
-
<label for="update_all_data_<?php echo $entry; ?>"><?php _e('Update all data', 'pmxi_plugin' )?></label><br>
|
91 |
-
|
92 |
-
<input type="radio" id="update_choosen_data_<?php echo $entry; ?>" class="switcher" name="update_all_data" value="no" <?php echo 'no' == $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
93 |
-
<label for="update_choosen_data_<?php echo $entry; ?>"><?php _e('Choose which data to update', 'pmxi_plugin' )?></label><br>
|
94 |
-
<div class="switcher-target-update_choosen_data_<?php echo $entry; ?>" style="padding-left:17px;">
|
95 |
-
<div class="input">
|
96 |
-
<input type="hidden" name="is_update_status" value="0" />
|
97 |
-
<input type="checkbox" id="is_update_status_<?php echo $entry; ?>" name="is_update_status" value="1" <?php echo $post['is_update_status'] ? 'checked="checked"': '' ?> />
|
98 |
-
<label for="is_update_status_<?php echo $entry; ?>"><?php _e('Post status', 'pmxi_plugin') ?></label>
|
99 |
-
<a href="#help" class="help" title="<?php _e('Check this option if you want previously imported posts to change their publish status or being restored from Trash.', 'pmxi_plugin') ?>">?</a>
|
100 |
-
</div>
|
101 |
-
<div class="input">
|
102 |
-
<input type="hidden" name="is_update_title" value="0" />
|
103 |
-
<input type="checkbox" id="is_update_title_<?php echo $entry; ?>" name="is_update_title" value="1" <?php echo $post['is_update_title'] ? 'checked="checked"': '' ?> />
|
104 |
-
<label for="is_update_title_<?php echo $entry; ?>"><?php _e('Title', 'pmxi_plugin') ?></label>
|
105 |
-
</div>
|
106 |
-
<div class="input">
|
107 |
-
<input type="hidden" name="is_update_post_author" value="0" />
|
108 |
-
<input type="checkbox" id="is_update_post_author_<?php echo $entry; ?>" name="is_update_post_author" value="1" <?php echo $post['is_update_post_author'] ? 'checked="checked"': '' ?> />
|
109 |
-
<label for="is_update_post_author_<?php echo $entry; ?>"><?php _e('Author', 'pmxi_plugin') ?></label>
|
110 |
-
</div>
|
111 |
-
<div class="input">
|
112 |
-
<input type="hidden" name="is_update_slug" value="0" />
|
113 |
-
<input type="checkbox" id="is_update_slug_<?php echo $entry; ?>" name="is_update_slug" value="1" <?php echo $post['is_update_slug'] ? 'checked="checked"': '' ?> />
|
114 |
-
<label for="is_update_slug_<?php echo $entry; ?>"><?php _e('Slug', 'pmxi_plugin') ?></label>
|
115 |
-
</div>
|
116 |
-
<div class="input">
|
117 |
-
<input type="hidden" name="is_update_content" value="0" />
|
118 |
-
<input type="checkbox" id="is_update_content_<?php echo $entry; ?>" name="is_update_content" value="1" <?php echo $post['is_update_content'] ? 'checked="checked"': '' ?> />
|
119 |
-
<label for="is_update_content_<?php echo $entry; ?>"><?php _e('Content', 'pmxi_plugin') ?></label>
|
120 |
-
</div>
|
121 |
-
<div class="input">
|
122 |
-
<input type="hidden" name="is_update_excerpt" value="0" />
|
123 |
-
<input type="checkbox" id="is_update_excerpt_<?php echo $entry; ?>" name="is_update_excerpt" value="1" <?php echo $post['is_update_excerpt'] ? 'checked="checked"': '' ?> />
|
124 |
-
<label for="is_update_excerpt_<?php echo $entry; ?>"><?php _e('Excerpt/Short Description', 'pmxi_plugin') ?></label>
|
125 |
-
</div>
|
126 |
-
<div class="input">
|
127 |
-
<input type="hidden" name="is_update_dates" value="0" />
|
128 |
-
<input type="checkbox" id="is_update_dates_<?php echo $entry; ?>" name="is_update_dates" value="1" <?php echo $post['is_update_dates'] ? 'checked="checked"': '' ?> />
|
129 |
-
<label for="is_update_dates_<?php echo $entry; ?>"><?php _e('Dates', 'pmxi_plugin') ?></label>
|
130 |
-
</div>
|
131 |
-
<div class="input">
|
132 |
-
<input type="hidden" name="is_update_menu_order" value="0" />
|
133 |
-
<input type="checkbox" id="is_update_menu_order_<?php echo $entry; ?>" name="is_update_menu_order" value="1" <?php echo $post['is_update_menu_order'] ? 'checked="checked"': '' ?> />
|
134 |
-
<label for="is_update_menu_order_<?php echo $entry; ?>"><?php _e('Menu order', 'pmxi_plugin') ?></label>
|
135 |
-
</div>
|
136 |
-
<div class="input">
|
137 |
-
<input type="hidden" name="is_update_parent" value="0" />
|
138 |
-
<input type="checkbox" id="is_update_parent_<?php echo $entry; ?>" name="is_update_parent" value="1" <?php echo $post['is_update_parent'] ? 'checked="checked"': '' ?> />
|
139 |
-
<label for="is_update_parent_<?php echo $entry; ?>"><?php _e('Parent post', 'pmxi_plugin') ?></label>
|
140 |
-
</div>
|
141 |
-
<div class="input">
|
142 |
-
<input type="hidden" name="is_update_attachments" value="0" />
|
143 |
-
<input type="checkbox" id="is_update_attachments_<?php echo $entry; ?>" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
|
144 |
-
<label for="is_update_attachments_<?php echo $entry; ?>"><?php _e('Attachments', 'pmxi_plugin') ?></label>
|
145 |
-
</div>
|
146 |
-
|
147 |
-
<?php
|
148 |
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
<
|
171 |
-
<
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
<div class="input">
|
191 |
-
<input type="radio" id="update_custom_fields_logic_only_<?php echo $entry; ?>" name="update_custom_fields_logic" value="only" <?php echo ( "only" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
192 |
-
<label for="update_custom_fields_logic_only_<?php echo $entry; ?>"><?php _e('Update only these Custom Fields, leave the rest alone', 'pmxi_plugin') ?></label>
|
193 |
-
<div class="switcher-target-update_custom_fields_logic_only_<?php echo $entry; ?> pmxi_choosen" style="padding-left:17px;">
|
194 |
-
|
195 |
-
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo implode(',', $existing_meta_keys);?></span>
|
196 |
-
<input class="choosen_input" value="<?php if (!empty($post['custom_fields_list']) and "only" == $post['update_custom_fields_logic']) echo implode(',', $post['custom_fields_list']); ?>" type="hidden" name="custom_fields_only_list"/>
|
197 |
-
</div>
|
198 |
-
</div>
|
199 |
-
<div class="input">
|
200 |
-
<input type="radio" id="update_custom_fields_logic_all_except_<?php echo $entry; ?>" name="update_custom_fields_logic" value="all_except" <?php echo ( "all_except" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
201 |
-
<label for="update_custom_fields_logic_all_except_<?php echo $entry; ?>"><?php _e('Leave these fields alone, update all other Custom Fields', 'pmxi_plugin') ?></label>
|
202 |
-
<div class="switcher-target-update_custom_fields_logic_all_except_<?php echo $entry; ?> pmxi_choosen" style="padding-left:17px;">
|
203 |
-
|
204 |
-
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo implode(',', $existing_meta_keys);?></span>
|
205 |
-
<input class="choosen_input" value="<?php if (!empty($post['custom_fields_list']) and "all_except" == $post['update_custom_fields_logic']) echo implode(',', $post['custom_fields_list']); ?>" type="hidden" name="custom_fields_except_list"/>
|
206 |
-
</div>
|
207 |
-
</div>
|
208 |
-
</div>
|
209 |
-
</div>
|
210 |
-
<div class="input">
|
211 |
-
<input type="hidden" name="taxonomies_list" value="0" />
|
212 |
-
<input type="hidden" name="is_update_categories" value="0" />
|
213 |
-
<input type="checkbox" id="is_update_categories_<?php echo $entry; ?>" name="is_update_categories" value="1" class="switcher" <?php echo $post['is_update_categories'] ? 'checked="checked"': '' ?> />
|
214 |
-
<label for="is_update_categories_<?php echo $entry; ?>"><?php _e('Taxonomies (incl. Categories and Tags)', 'pmxi_plugin') ?></label>
|
215 |
-
<div class="switcher-target-is_update_categories_<?php echo $entry; ?>" style="padding-left:17px;">
|
216 |
-
<?php
|
217 |
-
$existing_taxonomies = array();
|
218 |
-
$hide_taxonomies = (class_exists('PMWI_Plugin')) ? array('product_type') : array();
|
219 |
-
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($hide_taxonomies));
|
220 |
-
if (!empty($post_taxonomies)):
|
221 |
-
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and $post_type == "product" and strpos($ctx->name, "pa_") === 0)) continue;
|
222 |
-
$existing_taxonomies[] = $ctx->name;
|
223 |
-
endforeach;
|
224 |
-
endif;
|
225 |
-
?>
|
226 |
-
<div class="input" style="margin-bottom:3px;">
|
227 |
-
<input type="radio" id="update_categories_logic_all_except_<?php echo $entry; ?>" name="update_categories_logic" value="all_except" <?php echo ( "all_except" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
228 |
-
<label for="update_categories_logic_all_except_<?php echo $entry; ?>" style="position:relative; top:1px;"><?php _e('Leave these taxonomies alone, update all others', 'pmxi_plugin') ?></label>
|
229 |
-
<div class="switcher-target-update_categories_logic_all_except_<?php echo $entry; ?> pmxi_choosen" style="padding-left:17px;">
|
230 |
-
|
231 |
-
<span class="hidden choosen_values"><?php if (!empty($existing_taxonomies)) echo implode(',', $existing_taxonomies);?></span>
|
232 |
-
<input class="choosen_input" value="<?php if (!empty($post['taxonomies_list']) and "all_except" == $post['update_categories_logic']) echo implode(',', $post['taxonomies_list']); ?>" type="hidden" name="taxonomies_except_list"/>
|
233 |
-
</div>
|
234 |
-
</div>
|
235 |
-
<div class="input" style="margin-bottom:3px;">
|
236 |
-
<input type="radio" id="update_categories_logic_only_<?php echo $entry; ?>" name="update_categories_logic" value="only" <?php echo ( "only" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
237 |
-
<label for="update_categories_logic_only_<?php echo $entry; ?>" style="position:relative; top:1px;"><?php _e('Update only these taxonomies, leave the rest alone', 'pmxi_plugin') ?></label>
|
238 |
-
<div class="switcher-target-update_categories_logic_only_<?php echo $entry; ?> pmxi_choosen" style="padding-left:17px;">
|
239 |
-
|
240 |
-
<span class="hidden choosen_values"><?php if (!empty($existing_taxonomies)) echo implode(',', $existing_taxonomies);?></span>
|
241 |
-
<input class="choosen_input" value="<?php if (!empty($post['taxonomies_list']) and "only" == $post['update_categories_logic']) echo implode(',', $post['taxonomies_list']); ?>" type="hidden" name="taxonomies_only_list"/>
|
242 |
</div>
|
243 |
-
</div>
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
<div class="input" style="margin-bottom:3px;">
|
249 |
-
<input type="radio" id="update_categories_logic_add_new_<?php echo $entry; ?>" name="update_categories_logic" value="add_new" <?php echo ( "add_new" == $post['update_categories_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
250 |
-
<label for="update_categories_logic_add_new_<?php echo $entry; ?>" style="position:relative; top:1px;"><?php _e('Only add new', 'pmxi_plugin') ?></label>
|
251 |
-
</div>
|
252 |
-
</div>
|
253 |
-
</div>
|
254 |
-
</div>
|
255 |
</div>
|
256 |
-
</div>
|
257 |
-
|
258 |
-
</
|
259 |
-
</
|
1 |
+
<?php $custom_type = get_post_type_object( $post_type ); ?>
|
2 |
+
<div class="wpallimport-collapsed wpallimport-section">
|
3 |
+
<script type="text/javascript">
|
4 |
+
__META_KEYS = <?php echo json_encode($existing_meta_keys) ?>;
|
5 |
+
</script>
|
6 |
+
<div class="wpallimport-content-section">
|
7 |
+
<div class="wpallimport-collapsed-header">
|
8 |
+
<?php if ( "new" == $post['wizard_type']): ?>
|
9 |
+
<?php if ( ! $this->isWizard ):?>
|
10 |
+
<h3><?php _e('Record Matching', 'pmxi_plugin'); ?></h3>
|
11 |
+
<?php else: ?>
|
12 |
+
<h3 style="padding-left:0;"><?php printf(__('WP All Import will create new %s for each unique record in your file.','pmxi_plugin'), $custom_type->labels->name);?></h3>
|
13 |
+
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
</div>
|
15 |
+
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
16 |
+
<div class="wpallimport-collapsed-content-inner">
|
17 |
+
<table class="form-table" style="max-width:none;">
|
18 |
+
<tr>
|
19 |
+
<td>
|
20 |
+
<input type="hidden" name="duplicate_matching" value="auto"/>
|
21 |
+
<?php if ( ! $this->isWizard ):?>
|
22 |
+
<h4><?php printf(__('WP All Import will associate records in your file with %s it has already created from previous runs of this import based on the Unique Identifier.','pmxi_plugin'), $custom_type->labels->name);?></h4>
|
23 |
+
<?php endif; ?>
|
24 |
+
<div class="wpallimport-unique-key-wrapper">
|
25 |
+
<label style="font-weight: bold;"><?php _e("Unique Identifier", "pmxi_plugin"); ?></label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
+
<input type="text" class="smaller-text" name="unique_key" style="width:300px;" value="<?php if ( ! $this->isWizard ) echo esc_attr($post['unique_key']); elseif ($post['tmp_unique_key']) echo esc_attr($post['unique_key']); ?>" <?php echo ( ! $isWizard ) ? 'disabled="disabled"' : '' ?>/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
<?php if ( $this->isWizard ): ?>
|
30 |
+
<input type="hidden" name="tmp_unique_key" value="<?php echo ($post['unique_key']) ? esc_attr($post['unique_key']) : esc_attr($post['tmp_unique_key']); ?>"/>
|
31 |
+
<a href="javascript:void(0);" class="wpallimport-auto-detect-unique-key"><?php _e('Auto-detect', 'pmxi_plugin'); ?></a>
|
32 |
+
<?php else: ?>
|
33 |
+
<a href="javascript:void(0);" class="wpallimport-change-unique-key"><?php _e('Edit', 'pmxi_plugin'); ?></a>
|
34 |
+
<div id="dialog-confirm" title="<?php _e('Warning: Are you sure you want to edit the Unique Identifier?','pmxi_plugin');?>" style="display:none;">
|
35 |
+
<p><?php printf(__('It is recommended you delete all %s associated with this import before editing the unique identifier.', 'pmxi_plugin'), strtolower($custom_type->labels->name)); ?></p>
|
36 |
+
<p><?php printf(__('Editing the unique identifier will dissociate all existing %s linked to this import. Future runs of the import will result in duplicates, as WP All Import will no longer be able to update these %s.', 'pmxi_plugin'), strtolower($custom_type->labels->name), strtolower($custom_type->labels->name)); ?></p>
|
37 |
+
<p><?php _e('You really should just re-create your import, and pick the right unique identifier to start with.', 'pmxi_plugin'); ?></p>
|
38 |
+
</div>
|
39 |
+
<?php endif; ?>
|
40 |
|
41 |
+
<p> </p>
|
42 |
+
<?php if ( $this->isWizard ):?>
|
43 |
+
<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.', 'pmxi_plugin'); ?></p>
|
44 |
+
<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.', 'pmxi_plugin'), $custom_type->labels->name); ?></p>
|
45 |
+
<?php endif; ?>
|
46 |
+
</div>
|
47 |
+
<?php if ( ! $this->isWizard ):?>
|
48 |
+
|
49 |
+
<?php include( '_reimport_options.php' ); ?>
|
50 |
|
51 |
+
<?php endif; ?>
|
52 |
+
</td>
|
53 |
+
</tr>
|
54 |
+
</table>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
<?php else: ?>
|
58 |
+
<?php if ( ! $this->isWizard ):?>
|
59 |
+
<h3><?php _e('Record Matching', 'pmxi_plugin'); ?></h3>
|
60 |
+
<?php else: ?>
|
61 |
+
<h3 style="padding-left:0;"><?php printf(__('WP All Import will merge data into existing %s.','pmxi_plugin'), $custom_type->labels->name);?></h3>
|
62 |
+
<?php endif; ?>
|
63 |
+
</div>
|
64 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
65 |
+
<div class="wpallimport-collapsed-content-inner">
|
66 |
+
<table class="form-table" style="max-width:none;">
|
67 |
+
<tr>
|
68 |
+
<td>
|
69 |
+
<div class="input" style="margin-bottom:15px; position:relative;">
|
70 |
+
<input type="hidden" name="duplicate_matching" value="manual"/>
|
71 |
+
<h4><?php printf(__('Records in your file will be matched with %ss on your site based on...', 'pmxi_plugin' ), $custom_type->labels->singular_name);?></h4>
|
72 |
+
<div style="margin-left: -4px;">
|
73 |
+
<div class="input">
|
74 |
+
<input type="radio" id="duplicate_indicator_title" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
75 |
+
<label for="duplicate_indicator_title"><?php _e('Title', 'pmxi_plugin' )?></label><br>
|
76 |
+
<input type="radio" id="duplicate_indicator_content" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
77 |
+
<label for="duplicate_indicator_content"><?php _e('Content', 'pmxi_plugin' )?></label><br>
|
78 |
+
<input type="radio" id="duplicate_indicator_custom_field" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
79 |
+
<label for="duplicate_indicator_custom_field"><?php _e('Custom field', 'pmxi_plugin' )?></label><br>
|
80 |
+
<span class="switcher-target-duplicate_indicator_custom_field" style="vertical-align:middle; padding-left:17px;">
|
81 |
+
<?php _e('Name', 'pmxi_plugin') ?>
|
82 |
+
<input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
|
83 |
+
<?php _e('Value', 'pmxi_plugin') ?>
|
84 |
+
<input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
|
85 |
+
</span>
|
86 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
</div>
|
88 |
+
</div>
|
89 |
+
<?php include( '_reimport_options.php' ); ?>
|
90 |
+
</td>
|
91 |
+
</tr>
|
92 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
</div>
|
94 |
+
</div>
|
95 |
+
<?php endif; ?>
|
96 |
+
</div>
|
97 |
+
</div>
|
views/admin/import/options/_scheduling_template.php
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
<?php if (in_array($source_type, array('url', 'ftp'))): ?>
|
2 |
-
<tr>
|
3 |
-
<td colspan="3" style="padding-top:20px;">
|
4 |
-
<fieldset class="optionsset">
|
5 |
-
<legend><?php _e('Scheduling','pmxi_plugin');?></legend>
|
6 |
-
<div class="input">
|
7 |
-
<input type="hidden" name="is_scheduled" value="0" />
|
8 |
-
<input type="checkbox" id="is_scheduled_<?php echo $entry; ?>" class="switcher fix_checkbox" name="is_scheduled" value="1" <?php echo $scheduled['is_scheduled'] ? 'checked="checked"': '' ?>/>
|
9 |
-
<label for="is_scheduled_<?php echo $entry; ?>"><?php _e('Schedule import using WordPress Scheduling Logic', 'pmxi_plugin') ?> <a href="#help" class="help" title="<?php _e('Using this is not recommended. Unless you are importing a very small file, use cron jobs instead.', 'pmxi_plugin') ?>">?</a></label>
|
10 |
-
<span class="switcher-target-is_scheduled_<?php echo $entry; ?>" style="vertical-align:middle">
|
11 |
-
<select name="scheduled_period">
|
12 |
-
<?php foreach (array(
|
13 |
-
'*/5 * * * *' => __('every 5 min'),
|
14 |
-
'*/10 * * * *' => __('every 10 min'),
|
15 |
-
'*/30 * * * *' => __('half-hourly'),
|
16 |
-
'0 * * * *' => __('hourly'),
|
17 |
-
'0 */4 * * *' => __('every 4 hours'),
|
18 |
-
'0 */12 * * *' => __('half-daily'),
|
19 |
-
'0 0 * * *' => __('daily'),
|
20 |
-
'0 0 * * 1' => __('weekly'),
|
21 |
-
'0 0 1 * 1' => __('monthly'),
|
22 |
-
) as $key => $title): ?>
|
23 |
-
<option value="<?php echo $key ?>" <?php echo $key == $scheduled['scheduled_period'] ? 'selected="selected"' : '' ?>><?php echo esc_html($title) ?></option>
|
24 |
-
<?php endforeach ?>
|
25 |
-
</select>
|
26 |
-
<a href="#help" class="help" title="<?php _e('<b>Warning</b>: Execution periods are not guaranteed due to internal WordPress scheduling logic. Scheduled tasks are only triggered upon a user request/visit to the site. On sites with low user activity, when time span between requests exceeds scheduled periods, those scheduling periods cannot be kept. In most cases though, such behavior achives the goal since delayed tasks are run right when a request is registered and user sees the content after the task has been executed. ', 'pmxi_plugin') ?>">?</a>
|
27 |
-
</span>
|
28 |
-
|
29 |
-
<br /><br />
|
30 |
-
|
31 |
-
<p>
|
32 |
-
<?php _e('<b>This import can be also be scheduled using cron jobs.</b> Save the import, visit the <i>Manage Imports</i> page, and click the <i>Cron Scheduling</i> link to set up cron scheduling. Using WordPress scheduling logic is not recommended for large files.','pmxi_plugin');?>
|
33 |
-
</p>
|
34 |
-
|
35 |
-
</div>
|
36 |
-
</fieldset>
|
37 |
-
</td>
|
38 |
-
</tr>
|
39 |
-
<?php endif;?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/options/_settings_template.php
CHANGED
@@ -1,79 +1,132 @@
|
|
1 |
-
<
|
2 |
-
<
|
3 |
-
<
|
4 |
-
<
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpallimport-collapsed closed wpallimport-section">
|
2 |
+
<div class="wpallimport-content-section">
|
3 |
+
<div class="wpallimport-collapsed-header">
|
4 |
+
<h3><?php _e('Configure Advanced Settings','pmxi_plugin');?></h3>
|
5 |
+
</div>
|
6 |
+
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
7 |
+
<div class="wpallimport-collapsed-content-inner">
|
8 |
+
<table class="form-table" style="max-width:none;">
|
9 |
+
<tr>
|
10 |
+
<td colspan="3">
|
11 |
+
<h4><?php _e('Import Speed Optimization', 'pmxi_plugin'); ?></h4>
|
12 |
+
<div class="input">
|
13 |
+
<div class="input">
|
14 |
+
<input type="radio" id="import_default_processing" class="switcher" name="import_processing" value="default" <?php echo ('ajax' != $post['import_processing']) ? 'checked="checked"': '' ?> style="margin-left:0;"/>
|
15 |
+
<label for="import_default_processing"><?php _e('High Speed Small File Processing', 'pmxi_plugin' )?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php _e('If the import takes longer than your server\'s timeout settings (max_execution_time, mod_fcgid read data timeout, etc.) it will fail.', 'pmxi_plugin'); ?>">?</a></label>
|
16 |
+
</div>
|
17 |
+
|
18 |
+
<input type="radio" id="import_ajax_processing" class="switcher" name="import_processing" value="ajax" <?php echo 'ajax' == $post['import_processing'] ? 'checked="checked"': '' ?> style="margin-left:0;"/>
|
19 |
+
<label for="import_ajax_processing"><?php _e('Iterative, Piece-by-Piece Processing', 'pmxi_plugin' )?></label>
|
20 |
+
|
21 |
+
<span class="switcher-target-import_ajax_processing pl17" style="display:block; clear: both; width: 100%;">
|
22 |
+
<div class="pl17" style="margin:5px 0px;">
|
23 |
+
<label for="records_per_request"><?php _e('In each iteration, process', 'pmxi_plugin');?></label> <input type="text" name="records_per_request" style="vertical-align:middle; font-size:11px; background:#fff !important; width: 40px; text-align:center;" value="<?php echo esc_attr($post['records_per_request']) ?>" /> <?php _e('records', 'pmxi_plugin'); ?>
|
24 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('WP All Import must be able to process this many records in less than your server\'s timeout settings. If your import fails before completion, to troubleshoot you should lower this number. If you are importing images, especially high resolution images, high numbers here are probably a bad idea, since downloading the images can take lots of time - for example, 20 posts with 5 images each = 100 images. At 500Kb per image that\'s 50Mb that needs to be downloaded. Can your server download that before timing out? If not, the import will fail.', 'pmxi_plugin'); ?>">?</a>
|
25 |
+
</div>
|
26 |
+
<div class="input pl17" style="margin:5px 0px;">
|
27 |
+
<input type="hidden" name="chuncking" value="0" />
|
28 |
+
<input type="checkbox" id="chuncking" name="chuncking" value="1" class="fix_checkbox" <?php echo $post['chuncking'] ? 'checked="checked"': '' ?>/>
|
29 |
+
<label for="chuncking"><?php _e('Split file up into <strong>' . PMXI_Plugin::getInstance()->getOption('large_feed_limit') . '</strong> record chunks.', 'pmxi_plugin');?></label>
|
30 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option will decrease the amount of slowdown experienced at the end of large imports. The slowdown is partially caused by the need for WP All Import to read deeper and deeper into the file on each successive iteration. Splitting the file into pieces means that, for example, instead of having to read 19000 records into a 20000 record file when importing the last 1000 records, WP All Import will just split it into 20 chunks, and then read the last chunk from the beginning.','pmxi_plugin'); ?>">?</a>
|
31 |
+
</div>
|
32 |
+
</span>
|
33 |
+
</div>
|
34 |
+
<div class="input">
|
35 |
+
<input type="hidden" name="is_fast_mode" value="0" />
|
36 |
+
<input type="checkbox" id="is_fast_mode" name="is_fast_mode" value="1" class="fix_checkbox" <?php echo $post['is_fast_mode'] ? 'checked="checked"': '' ?>/>
|
37 |
+
<label for="is_fast_mode"><?php _e('Increase speed by disabling do_action calls in wp_insert_post during import.', 'pmxi_plugin') ?> <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('This option is for advanced users with knowledge of WordPress development. Your theme or plugins may require these calls when posts are created. Verify your created posts work properly if you check this box.', 'pmxi_plugin') ?>">?</a></label>
|
38 |
+
</div>
|
39 |
+
<?php if ( ! $this->isWizard ): ?>
|
40 |
+
|
41 |
+
<h4><?php _e('Post Type', 'pmxi_plugin'); ?></h4>
|
42 |
+
<p><?php _e('Editing this will change the post type of the posts processed by this import. Re-run the import for the changes to take effect.', 'pmxi_plugin');?></p> <br>
|
43 |
+
|
44 |
+
|
45 |
+
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
46 |
+
|
47 |
+
<?php
|
48 |
+
|
49 |
+
$custom_types = get_post_types(array('_builtin' => true), 'objects') + get_post_types(array('_builtin' => false, 'show_ui' => true), 'objects');
|
50 |
+
foreach ($custom_types as $key => $ct) {
|
51 |
+
if (in_array($key, array('attachment', 'revision', 'nav_menu_item'))) unset($custom_types[$key]);
|
52 |
+
}
|
53 |
+
$custom_types = apply_filters( 'pmxi_custom_types', $custom_types );
|
54 |
+
|
55 |
+
$hidden_post_types = get_post_types(array('_builtin' => false, 'show_ui' => false), 'objects');
|
56 |
+
foreach ($hidden_post_types as $key => $ct) {
|
57 |
+
if (in_array($key, array('attachment', 'revision', 'nav_menu_item'))) unset($hidden_post_types[$key]);
|
58 |
+
}
|
59 |
+
$hidden_post_types = apply_filters( 'pmxi_custom_types', $hidden_post_types );
|
60 |
+
|
61 |
+
?>
|
62 |
+
<div class="wpallimport-change-custom-type">
|
63 |
+
<select name="custom_type_selector" id="custom_type_selector" class="wpallimport-post-types">
|
64 |
+
<?php if ( ! empty($custom_types)): ?>
|
65 |
+
<?php foreach ($custom_types as $key => $cpt) :?>
|
66 |
+
<?php
|
67 |
+
$image_src = 'dashicon-cpt';
|
68 |
+
if ( in_array($key, array('post', 'page', 'product') ) )
|
69 |
+
$image_src = 'dashicon-' . $key;
|
70 |
+
?>
|
71 |
+
<option value="<?php echo $key; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>" <?php if ( $key == $post['custom_type'] ) echo 'selected="selected"';?>><?php echo $cpt->labels->name; ?></option>
|
72 |
+
<?php endforeach; ?>
|
73 |
+
<?php endif; ?>
|
74 |
+
<?php if ( ! empty($hidden_post_types)): ?>
|
75 |
+
<?php foreach ($hidden_post_types as $key => $cpt) :?>
|
76 |
+
<?php
|
77 |
+
$image_src = 'dashicon-cpt';
|
78 |
+
if ( in_array($key, array('post', 'page', 'product') ) )
|
79 |
+
$image_src = 'dashicon-' . $key;
|
80 |
+
?>
|
81 |
+
<option value="<?php echo $key; ?>" data-imagesrc="dashicon <?php echo $image_src; ?>" <?php if ( $key == $post['custom_type'] ) echo 'selected="selected"';?>><?php echo $cpt->labels->name; ?></option>
|
82 |
+
<?php endforeach; ?>
|
83 |
+
<?php endif; ?>
|
84 |
+
</select>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<h4><?php _e('XPath', 'pmxi_plugin'); ?></h4>
|
88 |
+
<p><?php _e('Editing this can break your entire import. You will have to re-create it from scratch.', 'pmxi_plugin');?></p> <br>
|
89 |
+
<div class="input">
|
90 |
+
<input type="text" name="xpath" value="<?php echo esc_attr($import->xpath) ?>" style="width: 50%; font-size: 18px; color: #555; height: 50px; padding: 10px;"/>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<?php endif; ?>
|
94 |
+
<h4><?php _e('Other', 'pmxi_plugin'); ?></h4>
|
95 |
+
<div class="input">
|
96 |
+
<input type="hidden" name="is_import_specified" value="0" />
|
97 |
+
<input type="checkbox" id="is_import_specified" class="switcher fix_checkbox" name="is_import_specified" value="1" <?php echo $post['is_import_specified'] ? 'checked="checked"': '' ?>/>
|
98 |
+
<label for="is_import_specified"><?php _e('Import only specified records', 'pmxi_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php _e('Enter records or record ranges separated by commas, e.g. <b>1,5,7-10</b> would import the first, the fifth, and the seventh to tenth.', 'pmxi_plugin') ?>">?</a></label>
|
99 |
+
<div class="switcher-target-is_import_specified" style="vertical-align:middle">
|
100 |
+
<div class="input" style="display:inline;">
|
101 |
+
<input type="text" name="import_specified" value="<?php echo esc_attr($post['import_specified']) ?>" style="width:320px;"/>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
<?php if (isset($source_type) and in_array($source_type, array('ftp', 'file'))): ?>
|
106 |
+
<div class="input">
|
107 |
+
<input type="hidden" name="is_delete_source" value="0" />
|
108 |
+
<input type="checkbox" id="is_delete_source" class="fix_checkbox" name="is_delete_source" value="1" <?php echo $post['is_delete_source'] ? 'checked="checked"': '' ?>/>
|
109 |
+
<label for="is_delete_source"><?php _e('Delete source XML file after importing', 'pmxi_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php _e('This setting takes effect only when script has access rights to perform the action, e.g. file is not deleted when pulled via HTTP or delete permission is not granted to the user that script is executed under.', 'pmxi_plugin') ?>">?</a></label>
|
110 |
+
</div>
|
111 |
+
<?php endif; ?>
|
112 |
+
<?php if (class_exists('PMLC_Plugin')): // option is only valid when `WP Wizard Cloak` pluign is enabled ?>
|
113 |
+
<div class="input">
|
114 |
+
<input type="hidden" name="is_cloak" value="0" />
|
115 |
+
<input type="checkbox" id="is_cloak" class="fix_checkbox" name="is_cloak" value="1" <?php echo $post['is_cloak'] ? 'checked="checked"': '' ?>/>
|
116 |
+
<label for="is_cloak"><?php _e('Auto-Cloak Links', 'pmxi_plugin') ?> <a href="#help" class="wpallimport-help" style="position:relative; top:0;" title="<?php printf(__('Automatically process all links present in body of created post or page with <b>%s</b> plugin', 'pmxi_plugin'), PMLC_Plugin::getInstance()->getName()) ?>">?</a></label>
|
117 |
+
</div>
|
118 |
+
<?php endif; ?>
|
119 |
+
|
120 |
+
<div class="input" style="margin-top: 15px;">
|
121 |
+
<p><?php _e('Friendly Name','pmxi_plugin');?></p> <br>
|
122 |
+
<div class="input">
|
123 |
+
<input type="text" name="friendly_name" style="vertical-align:middle; background:#fff !important; width: 50%;" value="<?php echo esc_attr($post['friendly_name']) ?>" />
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
</td>
|
127 |
+
</tr>
|
128 |
+
</table>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
</div>
|
132 |
+
</div>
|
views/admin/import/options/_taxonomies_template.php
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$exclude_taxonomies = (class_exists('PMWI_Plugin')) ? array('category', 'post_tag', 'post_format', 'product_type') : array('category', 'post_format', 'post_tag');
|
3 |
-
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($exclude_taxonomies));
|
4 |
-
if ( ! empty($post_taxonomies)): ?>
|
5 |
-
<tr>
|
6 |
-
<td colspan="3" style="padding-bottom:20px;">
|
7 |
-
<fieldset class="optionsset">
|
8 |
-
<legend><?php _e('Custom Taxonomies','pmxi_plugin');?></legend>
|
9 |
-
<?php foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or (class_exists('PMWI_Plugin') and strpos($ctx->name, "pa_") === 0 and $post_type == "product")) continue;?>
|
10 |
-
<table style="width:100%;">
|
11 |
-
<tr>
|
12 |
-
<td>
|
13 |
-
<div class="post_taxonomy">
|
14 |
-
<div class="col2" style="width:35%;">
|
15 |
-
<nobr><?php echo $ctx->labels->name ?></nobr>
|
16 |
-
</div>
|
17 |
-
<div class="col2" style="width:65%;">
|
18 |
-
<ol class="sortable no-margin">
|
19 |
-
<?php
|
20 |
-
if (!empty($post['post_taxonomies'][$ctx->name])):
|
21 |
-
|
22 |
-
$taxonomies_hierarchy = json_decode($post['post_taxonomies'][$ctx->name]);
|
23 |
-
|
24 |
-
if (!empty($taxonomies_hierarchy) and is_array($taxonomies_hierarchy)): $i = 0;
|
25 |
-
|
26 |
-
foreach ($taxonomies_hierarchy as $cat) { $i++;
|
27 |
-
if (is_null($cat->parent_id) or empty($cat->parent_id))
|
28 |
-
{
|
29 |
-
?>
|
30 |
-
<li id="item_<?php echo $i; ?>" class="dragging">
|
31 |
-
<div class="drag-element">
|
32 |
-
<input type="checkbox" class="assign_post" <?php if ($cat->assign): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>"/>
|
33 |
-
<input type="text" class="widefat xpath_field" value="<?php echo esc_attr($cat->xpath); ?>"/>
|
34 |
-
|
35 |
-
<?php do_action('pmxi_category_view', $cat, $i, $ctx->name, $entry); ?>
|
36 |
-
|
37 |
-
</div>
|
38 |
-
<?php if ($i>1):?><a href="javascript:void(0);" class="icon-item remove-ico"></a><?php endif;?>
|
39 |
-
<?php echo reverse_taxonomies_html($taxonomies_hierarchy, $cat->item_id, $i, $ctx->name, $entry); ?>
|
40 |
-
</li>
|
41 |
-
<?php
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
endif;
|
46 |
-
|
47 |
-
endif;?>
|
48 |
-
|
49 |
-
<li id="item" class="template">
|
50 |
-
<div class="drag-element">
|
51 |
-
<input type="checkbox" class="assign_post" checked="checked" title="<?php _e('Assign post to the taxonomy.','pmxi_plugin');?>"/>
|
52 |
-
<input type="text" class="widefat xpath_field" value=""/>
|
53 |
-
<?php do_action('pmxi_category_view', false, false, $ctx->name, $entry); ?>
|
54 |
-
</div>
|
55 |
-
<a href="javascript:void(0);" class="icon-item remove-ico"></a>
|
56 |
-
</li>
|
57 |
-
|
58 |
-
</ol>
|
59 |
-
<a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add more','pmxi_plugin');?></a>
|
60 |
-
<input type="hidden" class="hierarhy-output" name="post_taxonomies[<?php echo $ctx->name ?>]" value="<?php echo esc_attr($post['post_taxonomies'][$ctx->name]) ?>"/>
|
61 |
-
<?php do_action('pmxi_category_options_view', ((!empty($post['post_taxonomies'][$ctx->name])) ? $post['post_taxonomies'][$ctx->name] : false), $ctx->name, $entry, $ctx->labels->name); ?>
|
62 |
-
<div class="delim">
|
63 |
-
<label><?php _e('Separated by', 'pmxi_plugin'); ?></label>
|
64 |
-
<input type="text" class="small tax_delim" value="<?php echo (!empty($taxonomies_hierarchy) and $taxonomies_hierarchy[0]->delim) ? str_replace("&","&", htmlentities(htmlentities($taxonomies_hierarchy[0]->delim))) : ',' ?>" />
|
65 |
-
<label for="nested_<?php echo $ctx->name;?>"><?php _e('Enable Auto Nest', 'pmxi_plugin');?></label>
|
66 |
-
<input id="nested_<?php echo $ctx->name;?>" type="checkbox" class="taxonomy_auto_nested" <?php if (!empty($taxonomies_hierarchy) and $taxonomies_hierarchy[0]->auto_nested):?>checked="checked"<?php endif; ?>/>
|
67 |
-
<a href="#help" class="help" style="position:relative; top:-1px; left: -5px;" title="<?php _e('If this box is checked, a category hierarchy will be created. For example, if your <code>{category}</code> value is <code>Mens > Shoes > Diesel</code>, enter <code>></code> as the separator and enable <code>Auto Nest</code> to create <code>Diesel</code> as a child category of <code>Shoes</code> and <code>Shoes</code> as a child category of <code>Mens.</code>', 'pmxi_plugin') ?>">?</a>
|
68 |
-
<?php do_action('pmxi_category_options', ((!empty($post['post_taxonomies'][$ctx->name])) ? $post['post_taxonomies'][$ctx->name] : false), $ctx->name, $entry); ?>
|
69 |
-
</div>
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
-
</td>
|
73 |
-
</tr>
|
74 |
-
</table>
|
75 |
-
<?php endforeach; ?>
|
76 |
-
</fieldset>
|
77 |
-
</td>
|
78 |
-
</tr>
|
79 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/import/preview.php
CHANGED
@@ -1,21 +1,26 @@
|
|
1 |
-
<div id="post-preview">
|
2 |
|
3 |
-
<div class="title">
|
4 |
-
|
5 |
-
|
6 |
-
<?php
|
7 |
-
<?php if ($tagno < PMXI_Plugin::$session->
|
8 |
</div>
|
9 |
</div>
|
10 |
-
|
11 |
-
|
12 |
-
<?php $this->error() ?>
|
13 |
-
<?php endif ?>
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
</div>
|
1 |
+
<div id="post-preview" class="wpallimport-preview">
|
2 |
|
3 |
+
<div class="title">
|
4 |
+
<div class="navigation">
|
5 |
+
<?php if ($tagno > 1): ?><a href="#prev" class="previous_element"> </a><?php else: ?><span class="previous_element"> </span><?php endif ?>
|
6 |
+
<?php printf(__('<strong><input type="text" value="%s" name="tagno" class="tagno"/></strong><span class="out_of"> of <strong class="pmxi_count">%s</strong></span>', 'pmxi_plugin'), $tagno, PMXI_Plugin::$session->count); ?>
|
7 |
+
<?php if ($tagno < PMXI_Plugin::$session->count): ?><a href="#next" class="next_element"> </a><?php else: ?><span class="next_element"> </span><?php endif ?>
|
8 |
</div>
|
9 |
</div>
|
10 |
+
|
11 |
+
<div class="wpallimport-preview-content">
|
|
|
|
|
12 |
|
13 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
14 |
+
<?php $this->error() ?>
|
15 |
+
<?php endif ?>
|
16 |
+
|
17 |
+
<?php if (isset($title)): ?>
|
18 |
+
<h2 class="title"><?php echo $title ?></h2>
|
19 |
+
<?php endif ?>
|
20 |
+
<?php if (isset($content)): ?>
|
21 |
+
<?php echo apply_filters('the_content', $content) ?>
|
22 |
+
<?php endif ?>
|
23 |
+
|
24 |
+
</div>
|
25 |
+
|
26 |
</div>
|
views/admin/import/preview_images.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="post-preview" class="wpallimport-preview_images">
|
2 |
+
|
3 |
+
<div class="title">
|
4 |
+
<div class="navigation">
|
5 |
+
<?php if ($tagno > 1): ?><a href="#prev" class="previous_element"> </a><?php else: ?><span class="previous_element"> </span><?php endif ?>
|
6 |
+
<?php printf(__('<strong><input type="text" value="%s" name="tagno" class="tagno"/></strong><span class="out_of"> of <strong class="pmxi_count">%s</strong></span>', 'pmxi_plugin'), $tagno, PMXI_Plugin::$session->count); ?>
|
7 |
+
<?php if ($tagno < PMXI_Plugin::$session->count): ?><a href="#next" class="next_element"> </a><?php else: ?><span class="next_element"> </span><?php endif ?>
|
8 |
+
</div>
|
9 |
+
</div>
|
10 |
+
|
11 |
+
<div class="wpallimport-preview-content">
|
12 |
+
|
13 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
14 |
+
<?php $this->error() ?>
|
15 |
+
<?php endif ?>
|
16 |
+
|
17 |
+
<h3><?php _e('Test Image Import', 'pmxi_plugin'); ?></h3>
|
18 |
+
|
19 |
+
<?php
|
20 |
+
|
21 |
+
if ( ! empty($featured_images) ){
|
22 |
+
|
23 |
+
?>
|
24 |
+
<p><?php _e('Click to test button to have WP All Import ensure it can import your images.', 'pmxi_plugin'); ?></p>
|
25 |
+
|
26 |
+
<a class="test_images" href="javascript:void(0);" style="margin-left:0;" rel="<?php echo $post['download_images']; ?>"><?php _e('Test', 'pmxi_plugin'); ?></a>
|
27 |
+
|
28 |
+
<?php
|
29 |
+
|
30 |
+
$featured_delim = ( "yes" == $post['download_images'] ) ? $post['download_featured_delim'] : $post['featured_delim'];
|
31 |
+
$imgs = array();
|
32 |
+
|
33 |
+
$line_imgs = explode("\n", $featured_images);
|
34 |
+
if ( ! empty($line_imgs) )
|
35 |
+
foreach ($line_imgs as $line_img)
|
36 |
+
$imgs = array_merge($imgs, ( ! empty($featured_delim) ) ? str_getcsv($line_img, $featured_delim) : array($line_img) );
|
37 |
+
|
38 |
+
if ( "yes" == $post['download_images']):
|
39 |
+
|
40 |
+
?>
|
41 |
+
<div class="test_progress">
|
42 |
+
<div class="img_preloader"><?php _e('Download in progress...'); ?></div>
|
43 |
+
<div class="img_success"></div>
|
44 |
+
<div class="img_failed"></div>
|
45 |
+
</div>
|
46 |
+
<h4><?php _e('WP All Import will attempt to import images from the following URLs:'); ?></h4>
|
47 |
+
<p><?php _e('Please check the URLs to ensure they point to valid images'); ?></p>
|
48 |
+
<ul class="images_list">
|
49 |
+
<?php foreach ($imgs as $img):?>
|
50 |
+
|
51 |
+
<li rel="<?php echo trim($img); ?>"><a href="<?php echo trim($img); ?>" target="_blank"><?php echo trim($img); ?></a></li>
|
52 |
+
|
53 |
+
<?php endforeach; ?>
|
54 |
+
</ul>
|
55 |
+
<h4><?php _e('Here are the above URLs, in <img> tags. '); ?></h4>
|
56 |
+
<?php foreach ($imgs as $img) : ?>
|
57 |
+
|
58 |
+
<img src="<?php echo trim($img);?>" style="width:64px; margin:5px; vertical-align:top;"/>
|
59 |
+
|
60 |
+
<?php endforeach; ?>
|
61 |
+
|
62 |
+
<?php
|
63 |
+
|
64 |
+
else:
|
65 |
+
|
66 |
+
$wp_uploads = wp_upload_dir();
|
67 |
+
|
68 |
+
?>
|
69 |
+
<div class="test_progress">
|
70 |
+
<div class="img_preloader"><?php _e('Retrieving images...'); ?></div>
|
71 |
+
<div class="img_success"></div>
|
72 |
+
<div class="img_failed"></div>
|
73 |
+
</div>
|
74 |
+
<h4><?php _e('WP All Import will import images from the following file paths:', 'pmxi_plugin'); ?></h4>
|
75 |
+
<p><?php _e('Please ensure the images exists at these file paths', 'pmxi_plugin'); ?></p>
|
76 |
+
<ul class="images_list">
|
77 |
+
<?php foreach ($imgs as $img) :?>
|
78 |
+
|
79 |
+
<li rel="<?php echo trim($img);?>"><?php echo trim(preg_replace('%.*/wp-content%', '/wp-content', $wp_uploads['basedir']) . '/wpallimport/files/' . trim($img)); ?></li>
|
80 |
+
|
81 |
+
<?php endforeach; ?>
|
82 |
+
</ul>
|
83 |
+
<h4><?php _e('Here are the above URLs, in <img> tags. '); ?></h4>
|
84 |
+
|
85 |
+
<?php
|
86 |
+
foreach ($imgs as $img) {
|
87 |
+
$img_url = home_url() . preg_replace('%.*/wp-content%', '/wp-content', $wp_uploads['basedir']) . '/wpallimport/files/' . trim($img);
|
88 |
+
?>
|
89 |
+
<img src="<?php echo trim($img_url);?>" style="width:64px; margin:5px; vertical-align:top;"/>
|
90 |
+
<?php
|
91 |
+
}
|
92 |
+
|
93 |
+
endif;
|
94 |
+
|
95 |
+
}
|
96 |
+
else{
|
97 |
+
?>
|
98 |
+
<p><?php _e('Images not found for current record.', 'pmxi_plugin'); ?></p>
|
99 |
+
<?php
|
100 |
+
}
|
101 |
+
?>
|
102 |
+
</div>
|
103 |
+
</div>
|
views/admin/import/preview_prices.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="post-preview" class="wpallimport-preview_prices">
|
2 |
+
|
3 |
+
<div class="title">
|
4 |
+
<div class="navigation">
|
5 |
+
<?php if ($tagno > 1): ?><a href="#prev" class="previous_element"> </a><?php else: ?><span class="previous_element"> </span><?php endif ?>
|
6 |
+
<?php printf(__('<strong><input type="text" value="%s" name="tagno" class="tagno"/></strong><span class="out_of"> of <strong class="pmxi_count">%s</strong></span>', 'pmxi_plugin'), $tagno, PMXI_Plugin::$session->count); ?>
|
7 |
+
<?php if ($tagno < PMXI_Plugin::$session->count): ?><a href="#next" class="next_element"> </a><?php else: ?><span class="next_element"> </span><?php endif ?>
|
8 |
+
</div>
|
9 |
+
</div>
|
10 |
+
|
11 |
+
<div class="wpallimport-preview-content">
|
12 |
+
<?php if ($this->errors->get_error_codes()): ?>
|
13 |
+
<?php $this->error() ?>
|
14 |
+
<?php endif ?>
|
15 |
+
|
16 |
+
<h3><?php _e('Preview Prices', 'pmxi_plugin'); ?></h3>
|
17 |
+
|
18 |
+
<p><?php _e('Regular Price', 'pmxi_plugin'); ?>: <?php echo $product_regular_price; ?></p>
|
19 |
+
<p><?php _e('Sale Price', 'pmxi_plugin'); ?>: <?php echo $product_sale_price; ?></p>
|
20 |
+
|
21 |
+
</div>
|
22 |
+
|
23 |
+
</div>
|
views/admin/import/preview_taxonomies.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
1 |
+
<div id="post-preview" cla
|