Version Description
- critical security fix - stopping non-logged in users from accessing adminInit http://www.wpallimport.com/2015/02/wp-import-4-1-1-mandatory-security-update/
- added new option 'Search for existing attachments to prevent duplicates in media library'
- added new filter 'wp_all_import_is_post_to_update' to skip needed posts
- fixed imports pagination
- fixed preview taxonomies
- fixed upload folder creation when 'upload_dir' filter defined
- fixed db schema for wpmu when new site added
Download this release
Release Info
Developer | soflyy |
Plugin | Import any XML or CSV File to WordPress |
Version | 3.2.4 |
Comparing to | |
See all releases |
Code changes from version 3.2.3 to 3.2.4
- actions/admin_head.php +4 -0
- actions/admin_init.php +1 -1
- actions/wp.php +0 -5
- actions/wp_ajax_auto_detect_cf.php +7 -3
- actions/wp_ajax_auto_detect_sf.php +4 -0
- actions/wp_ajax_import_failed.php +5 -0
- actions/wp_ajax_nested_merge.php +0 -36
- actions/wp_ajax_nested_xpath.php +0 -60
- actions/wp_ajax_parse_nested_file.php +0 -155
- actions/wp_ajax_test_images.php +29 -18
- actions/wp_ajax_unmerge_file.php +0 -29
- actions/wp_loaded.php +0 -169
- actions/wpmu_new_blog.php +26 -0
- classes/arraytoxml.php +62 -0
- classes/chunk.php +15 -3
- classes/config.php +0 -0
- classes/download.php +0 -0
- classes/handler.php +0 -0
- classes/helper.php +0 -0
- classes/input.php +0 -0
- classes/nested.php +0 -88
- classes/render.php +6 -6
- classes/session.php +0 -0
- classes/upload.php +24 -538
- config/options.php +3 -2
- controllers/admin/addons.php +14 -14
- controllers/admin/help.php +0 -0
- controllers/admin/history.php +36 -23
- controllers/admin/home.php +0 -0
- controllers/admin/import.php +562 -551
- controllers/admin/license.php +0 -190
- controllers/admin/manage.php +32 -42
- controllers/admin/settings.php +63 -39
- controllers/controller.php +20 -14
- controllers/controller/admin.php +35 -23
- helpers/backward.php +0 -0
- helpers/functions.php +132 -0
- helpers/get_file_curl.php +14 -6
- helpers/get_taxonomies_by_object_type.php +0 -0
- helpers/import_custom_meta_box.php +0 -28
- helpers/is_exists_term.php +0 -0
- helpers/pmxi_findDuplicates.php +0 -0
- helpers/pmxi_functions.php +0 -662
- helpers/pmxi_insert_attachment.php +0 -0
- helpers/pmxi_insert_post.php +0 -0
- helpers/pmxi_json_to_xml.php +0 -8
- helpers/pmxi_recursion_taxes.php +0 -0
- helpers/reverse_taxonomies_html.php +1 -0
- helpers/str_getcsv.php +0 -0
- helpers/wp_all_import_clear_directory.php +16 -0
- helpers/{pmxi_ctx_mapping.php → wp_all_import_ctx_mapping.php} +3 -3
- helpers/wp_all_import_get_feed_type.php +58 -0
- helpers/wp_all_import_get_gz.php +63 -0
- helpers/wp_all_import_is_json.php +31 -0
- helpers/wp_all_import_json_to_xml.php +8 -0
- helpers/wp_all_import_rand_char.php +11 -0
- helpers/wp_all_import_remove_source.php +22 -0
- helpers/wp_all_import_rmdir.php +13 -0
- helpers/wp_all_import_secure_file.php +23 -0
- helpers/wp_all_import_strip_tags_content.php +22 -0
- helpers/wp_all_import_url_title.php +42 -0
- helpers/wp_delete_attachments.php +0 -0
- helpers/wp_redirect_or_javascript.php +0 -0
- helpers/wpai_util_map.php +28 -0
- libraries/XmlImportConfig.php +0 -0
- libraries/XmlImportCsvParse.php +13 -2
- libraries/XmlImportException.php +0 -0
- libraries/XmlImportParser.php +4 -4
- libraries/XmlImportReaderInterface.php +0 -0
- libraries/XmlImportSQLParse.php +2 -2
- libraries/XmlImportStringReader.php +0 -0
- libraries/XmlImportTemplate.php +0 -0
- libraries/XmlImportTemplateCodeGenerator.php +4 -4
- libraries/XmlImportTemplateParser.php +0 -0
- libraries/XmlImportTemplateScanner.php +32 -22
- libraries/XmlImportToken.php +0 -0
- libraries/ast/XmlImportAstElseif.php +0 -0
- libraries/ast/XmlImportAstExpression.php +0 -0
- libraries/ast/XmlImportAstFloat.php +0 -0
- libraries/ast/XmlImportAstForeach.php +0 -0
- libraries/ast/XmlImportAstFunction.php +0 -0
- libraries/ast/XmlImportAstIf.php +0 -0
- libraries/ast/XmlImportAstInteger.php +0 -0
- libraries/ast/XmlImportAstLiteral.php +0 -0
- libraries/ast/XmlImportAstMath.php +0 -0
- libraries/ast/XmlImportAstPrint.php +0 -0
- libraries/ast/XmlImportAstSequence.php +0 -0
- libraries/ast/XmlImportAstSpintax.php +0 -0
- libraries/ast/XmlImportAstStatement.php +0 -0
- libraries/ast/XmlImportAstString.php +0 -0
- libraries/ast/XmlImportAstText.php +0 -0
- libraries/ast/XmlImportAstWith.php +0 -0
- libraries/ast/XmlImportAstXPath.php +0 -0
- libraries/ast/XmlImportAstXpathClause.php +0 -0
- libraries/cache/.gitkeep +0 -0
- libraries/pclzip.lib.php +1 -1
- models/file/list.php +0 -0
- models/file/record.php +5 -5
- models/history/list.php +0 -0
- models/history/record.php +4 -4
- models/import/list.php +0 -0
- models/import/record.php +605 -358
- models/model.php +0 -0
- models/model/list.php +0 -0
- models/model/record.php +0 -0
- models/post/list.php +0 -0
- models/post/record.php +0 -0
- models/template/list.php +0 -0
- models/template/record.php +0 -0
- plugin.php +353 -119
- readme.txt +10 -1
- static/css/admin.css +13 -5
- static/js/admin.js +31 -147
- static/js/{pmxi.js → wp-all-import.js} +0 -0
- views/admin/addons/index.php +5 -5
- views/admin/help/index.php +5 -5
- views/admin/history/index.php +29 -29
- views/admin/home/index.php +0 -0
- views/admin/import/confirm.php +62 -62
- views/admin/import/element.php +34 -34
- views/admin/import/evaluate.php +4 -4
- views/admin/import/evaluate_variations.php +3 -3
- views/admin/import/index.php +29 -31
- views/admin/import/options.php +6 -6
- views/admin/import/options/_buttons_template.php +5 -5
- views/admin/import/options/_import_file.php +12 -12
- views/admin/import/options/_reimport_options.php +41 -39
- views/admin/import/options/_reimport_template.php +19 -19
- views/admin/import/options/_settings_template.php +18 -18
- views/admin/import/preview_prices.php +4 -4
- views/admin/import/preview_taxonomies.php +28 -24
- views/admin/import/process.php +20 -19
- views/admin/import/tag.php +3 -3
- views/admin/import/template.php +20 -18
- views/admin/import/template/_custom_fields_template.php +53 -53
- views/admin/import/template/_featured_template.php +40 -36
- views/admin/import/template/_nested_template.php +5 -5
- views/admin/import/template/_other_template.php +103 -36
- views/admin/import/template/_taxonomies_template.php +98 -35
- views/admin/license/index.php +0 -41
- views/admin/manage/bulk.php +1 -1
- views/admin/manage/delete.php +2 -2
- views/admin/manage/index.php +46 -45
- views/admin/manage/scheduling.php +22 -19
- views/admin/manage/update.php +3 -3
- views/admin/settings/index.php +36 -29
actions/admin_head.php
CHANGED
@@ -17,9 +17,13 @@ function pmxi_admin_head(){
|
|
17 |
</script>
|
18 |
<?php
|
19 |
}
|
|
|
|
|
|
|
20 |
?>
|
21 |
<script type="text/javascript">
|
22 |
var import_action = '<?php echo $import_action; ?>';
|
|
|
23 |
</script>
|
24 |
<?php
|
25 |
}
|
17 |
</script>
|
18 |
<?php
|
19 |
}
|
20 |
+
|
21 |
+
$wp_all_import_ajax_nonce = wp_create_nonce( "wp_all_import_secure" );
|
22 |
+
|
23 |
?>
|
24 |
<script type="text/javascript">
|
25 |
var import_action = '<?php echo $import_action; ?>';
|
26 |
+
var wp_all_import_security = '<?php echo $wp_all_import_ajax_nonce; ?>';
|
27 |
</script>
|
28 |
<?php
|
29 |
}
|
actions/admin_init.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
function pmxi_admin_init(){
|
4 |
|
5 |
-
wp_enqueue_script('pmxi-script',
|
6 |
|
7 |
@ini_set('mysql.connect_timeout', 300);
|
8 |
@ini_set('default_socket_timeout', 300);
|
2 |
|
3 |
function pmxi_admin_init(){
|
4 |
|
5 |
+
wp_enqueue_script('pmxi-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/wp-all-import.js', array('jquery'), PMXI_VERSION);
|
6 |
|
7 |
@ini_set('mysql.connect_timeout', 300);
|
8 |
@ini_set('default_socket_timeout', 300);
|
actions/wp.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
function pmxi_wp() {
|
4 |
-
|
5 |
-
}
|
|
|
|
|
|
|
|
|
|
actions/wp_ajax_auto_detect_cf.php
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
<?php
|
2 |
function pmxi_wp_ajax_auto_detect_cf(){
|
|
|
|
|
|
|
|
|
3 |
|
4 |
$input = new PMXI_Input();
|
5 |
$fields = $input->post('fields', array());
|
@@ -45,12 +49,12 @@ function pmxi_wp_ajax_auto_detect_cf(){
|
|
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', '
|
49 |
}
|
50 |
elseif (count($result) === 1)
|
51 |
-
$msg = sprintf(__('%s field was automatically detected.', '
|
52 |
else{
|
53 |
-
$msg = sprintf(__('%s fields were automatically detected.', '
|
54 |
}
|
55 |
|
56 |
exit( json_encode(array('result' => $result, 'msg' => $msg)) );
|
1 |
<?php
|
2 |
function pmxi_wp_ajax_auto_detect_cf(){
|
3 |
+
|
4 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
|
5 |
+
exit( json_encode(array('result' => array(), 'msg' => __('Security check', 'wp_all_import_plugin'))) );
|
6 |
+
}
|
7 |
|
8 |
$input = new PMXI_Input();
|
9 |
$fields = $input->post('fields', array());
|
49 |
|
50 |
if (empty($result)){
|
51 |
$custom_type = get_post_type_object( $post_type );
|
52 |
+
$msg = sprintf(__('No Custom Fields are present in your database for %s', 'wp_all_import_plugin'), $custom_type->labels->name);
|
53 |
}
|
54 |
elseif (count($result) === 1)
|
55 |
+
$msg = sprintf(__('%s field was automatically detected.', 'wp_all_import_plugin'), count($result));
|
56 |
else{
|
57 |
+
$msg = sprintf(__('%s fields were automatically detected.', 'wp_all_import_plugin'), count($result));
|
58 |
}
|
59 |
|
60 |
exit( json_encode(array('result' => $result, 'msg' => $msg)) );
|
actions/wp_ajax_auto_detect_sf.php
CHANGED
@@ -1,6 +1,10 @@
|
|
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');
|
1 |
<?php
|
2 |
function pmxi_wp_ajax_auto_detect_sf(){
|
3 |
|
4 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
|
5 |
+
exit( json_encode(array('result' => array(), 'msg' => __('Security check', 'wp_all_import_plugin'))) );
|
6 |
+
}
|
7 |
+
|
8 |
$input = new PMXI_Input();
|
9 |
$fieldName = $input->post('name', '');
|
10 |
$post_type = $input->post('post_type', 'post');
|
actions/wp_ajax_import_failed.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
function pmxi_wp_ajax_import_failed(){
|
|
|
|
|
|
|
|
|
|
|
3 |
extract($_POST);
|
4 |
$import = new PMXI_Import_record();
|
5 |
$import->getbyId($id);
|
1 |
<?php
|
2 |
function pmxi_wp_ajax_import_failed(){
|
3 |
+
|
4 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
|
5 |
+
exit( json_encode(array('result' => false, 'msg' => __('Security check', 'wp_all_import_plugin'))) );
|
6 |
+
}
|
7 |
+
|
8 |
extract($_POST);
|
9 |
$import = new PMXI_Import_record();
|
10 |
$import->getbyId($id);
|
actions/wp_ajax_nested_merge.php
DELETED
@@ -1,36 +0,0 @@
|
|
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
DELETED
@@ -1,60 +0,0 @@
|
|
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
DELETED
@@ -1,155 +0,0 @@
|
|
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
CHANGED
@@ -2,13 +2,22 @@
|
|
2 |
|
3 |
function pmxi_wp_ajax_test_images(){
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
$result = array();
|
8 |
|
9 |
$wp_uploads = wp_upload_dir();
|
10 |
-
$imgs_basedir = $wp_uploads['basedir'] .
|
11 |
-
$targetDir = $wp_uploads['path'];
|
12 |
$success_images = 0;
|
13 |
$success_msg = '';
|
14 |
|
@@ -16,18 +25,18 @@ function pmxi_wp_ajax_test_images(){
|
|
16 |
|
17 |
if ( ! @is_writable($targetDir) )
|
18 |
{
|
19 |
-
$failed_msgs[] = sprintf(__('Uploads folder `%s` is not writable.', '
|
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`.', '
|
31 |
continue;
|
32 |
}
|
33 |
|
@@ -44,31 +53,33 @@ function pmxi_wp_ajax_test_images(){
|
|
44 |
}
|
45 |
}
|
46 |
if ((int)$success_images === 1)
|
47 |
-
$success_msg = sprintf(__('%d image was successfully retrieved from `%s
|
48 |
elseif ((int)$success_images > 1)
|
49 |
-
$success_msg = sprintf(__('%d images were successfully retrieved from `%s
|
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.', '
|
60 |
continue;
|
61 |
}
|
62 |
|
63 |
$image_name = wp_unique_filename($targetDir, 'test');
|
64 |
$image_filepath = $targetDir . '/' . $image_name;
|
65 |
|
66 |
-
$
|
|
|
|
|
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', '
|
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.', '
|
72 |
} else {
|
73 |
$success_images++;
|
74 |
}
|
@@ -78,9 +89,9 @@ function pmxi_wp_ajax_test_images(){
|
|
78 |
$time = time() - $start;
|
79 |
|
80 |
if ((int)$success_images === 1)
|
81 |
-
$success_msg = sprintf(__('%d image was successfully downloaded in %s seconds', '
|
82 |
elseif ((int)$success_images > 1)
|
83 |
-
$success_msg = sprintf(__('%d images were successfully downloaded in %s seconds', '
|
84 |
}
|
85 |
}
|
86 |
|
2 |
|
3 |
function pmxi_wp_ajax_test_images(){
|
4 |
|
5 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
|
6 |
+
exit( json_encode(array('result' => array(), 'failed_msgs' => array(__('Security check', 'wp_all_import_plugin')))));
|
7 |
+
}
|
8 |
+
|
9 |
+
$input = new PMXI_Input();
|
10 |
+
|
11 |
+
$post = $input->post(array(
|
12 |
+
'download' => 'yes',
|
13 |
+
'imgs' => array()
|
14 |
+
));
|
15 |
|
16 |
$result = array();
|
17 |
|
18 |
$wp_uploads = wp_upload_dir();
|
19 |
+
$imgs_basedir = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
20 |
+
$targetDir = $wp_uploads['path'];
|
21 |
$success_images = 0;
|
22 |
$success_msg = '';
|
23 |
|
25 |
|
26 |
if ( ! @is_writable($targetDir) )
|
27 |
{
|
28 |
+
$failed_msgs[] = sprintf(__('Uploads folder `%s` is not writable.', 'wp_all_import_plugin'), $targetDir);
|
29 |
}
|
30 |
else{
|
31 |
|
32 |
+
if ( 'no' == $post['download'] ){
|
33 |
|
34 |
+
if ( ! empty($post['imgs']) ){
|
35 |
|
36 |
+
foreach ($post['imgs'] as $img) {
|
37 |
|
38 |
if ( preg_match('%^(http|https|ftp|ftps)%i', $img)){
|
39 |
+
$failed_msgs[] = sprintf(__('Use image name instead of URL `%s`.', 'wp_all_import_plugin'), $img);
|
40 |
continue;
|
41 |
}
|
42 |
|
53 |
}
|
54 |
}
|
55 |
if ((int)$success_images === 1)
|
56 |
+
$success_msg = sprintf(__('%d image was successfully retrieved from `%s`', 'wp_all_import_plugin'), $success_images, preg_replace('%.*/wp-content%', '/wp-content', $wp_uploads['basedir']) . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY);
|
57 |
elseif ((int)$success_images > 1)
|
58 |
+
$success_msg = sprintf(__('%d images were successfully retrieved from `%s`', 'wp_all_import_plugin'), $success_images, preg_replace('%.*/wp-content%', '/wp-content', $wp_uploads['basedir']) . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY);
|
59 |
}
|
60 |
else {
|
61 |
|
62 |
$start = time();
|
63 |
+
if ( ! empty($post['imgs']) ){
|
64 |
|
65 |
+
foreach ($post['imgs'] as $img) {
|
66 |
|
67 |
if ( ! preg_match('%^(http|https|ftp|ftps)%i', $img)){
|
68 |
+
$failed_msgs[] = sprintf(__('URL `%s` is not valid.', 'wp_all_import_plugin'), $img);
|
69 |
continue;
|
70 |
}
|
71 |
|
72 |
$image_name = wp_unique_filename($targetDir, 'test');
|
73 |
$image_filepath = $targetDir . '/' . $image_name;
|
74 |
|
75 |
+
$url = str_replace(" ", "%20", trim($img));
|
76 |
+
|
77 |
+
$request = get_file_curl($url, $image_filepath);
|
78 |
|
79 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($img))) {
|
80 |
+
$failed_msgs[] = (is_wp_error($request)) ? $request->get_error_message() : sprintf(__('File `%s` cannot be saved locally', 'wp_all_import_plugin'), $img);
|
81 |
} elseif( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
82 |
+
$failed_msgs[] = sprintf(__('File `%s` is not a valid image.', 'wp_all_import_plugin'), $img);
|
83 |
} else {
|
84 |
$success_images++;
|
85 |
}
|
89 |
$time = time() - $start;
|
90 |
|
91 |
if ((int)$success_images === 1)
|
92 |
+
$success_msg = sprintf(__('%d image was successfully downloaded in %s seconds', 'wp_all_import_plugin'), $success_images, number_format($time, 2));
|
93 |
elseif ((int)$success_images > 1)
|
94 |
+
$success_msg = sprintf(__('%d images were successfully downloaded in %s seconds', 'wp_all_import_plugin'), $success_images, number_format($time, 2));
|
95 |
}
|
96 |
}
|
97 |
|
actions/wp_ajax_unmerge_file.php
DELETED
@@ -1,29 +0,0 @@
|
|
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
@@ -5,175 +5,6 @@ function pmxi_wp_loaded() {
|
|
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 |
}
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
}
|
actions/wpmu_new_blog.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function pmxi_wpmu_new_blog($blog_id, $user_id, $domain, $path, $site_id, $meta)
|
4 |
+
{
|
5 |
+
// create/update required database tables
|
6 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
7 |
+
require PMXI_Plugin::ROOT_DIR . '/schema.php';
|
8 |
+
global $wpdb;
|
9 |
+
|
10 |
+
if (function_exists('is_multisite') && is_multisite()) {
|
11 |
+
// check if it is a network activation - if so, run the activation function for each blog id
|
12 |
+
$old_blog = $wpdb->blogid;
|
13 |
+
|
14 |
+
switch_to_blog($blog_id);
|
15 |
+
require PMXI_Plugin::ROOT_DIR . '/schema.php';
|
16 |
+
dbDelta($plugin_queries);
|
17 |
+
|
18 |
+
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
19 |
+
|
20 |
+
$post = new PMXI_Post_Record();
|
21 |
+
$wpdb->query('DELETE FROM ' . $post->getTable() . ' WHERE post_id NOT IN (SELECT ID FROM ' . $wpdb->posts . ')');
|
22 |
+
|
23 |
+
switch_to_blog($old_blog);
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
}
|
classes/arraytoxml.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class PMXI_ArrayToXML
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* The main function for converting to an XML document.
|
7 |
+
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
|
8 |
+
*
|
9 |
+
* @param array $data
|
10 |
+
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
|
11 |
+
* @param SimpleXMLElement $xml - should only be used recursively
|
12 |
+
* @return string XML
|
13 |
+
*/
|
14 |
+
public static function toXml($data, $rootNodeName = 'data', $xml=null, $lvl = 0)
|
15 |
+
{
|
16 |
+
// turn off compatibility mode as simple xml throws a wobbly if you don't.
|
17 |
+
if (ini_get('zend.ze1_compatibility_mode') == 1)
|
18 |
+
{
|
19 |
+
ini_set ('zend.ze1_compatibility_mode', 0);
|
20 |
+
}
|
21 |
+
|
22 |
+
if ($xml == null)
|
23 |
+
{
|
24 |
+
$xml = simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><'.$rootNodeName .'/>');
|
25 |
+
}
|
26 |
+
if ( !empty($data)){
|
27 |
+
// loop through the data passed in.
|
28 |
+
foreach($data as $key => $value)
|
29 |
+
{
|
30 |
+
// no numeric keys in our xml please!
|
31 |
+
if (!$key or is_numeric($key))
|
32 |
+
{
|
33 |
+
// make string key...
|
34 |
+
$key = "item_" . $lvl;
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
// replace anything not alpha numeric
|
39 |
+
$key = preg_replace('/[^a-z0-9_]/i', '', $key);
|
40 |
+
|
41 |
+
// if there is another array found recrusively call this function
|
42 |
+
if (is_array($value) or is_object($value))
|
43 |
+
{
|
44 |
+
$node = $xml->addChild($key);
|
45 |
+
// recrusive call.
|
46 |
+
PMXI_ArrayToXML::toXml($value, $rootNodeName, $node, $lvl + 1);
|
47 |
+
}
|
48 |
+
else
|
49 |
+
{
|
50 |
+
// add single node.
|
51 |
+
$value = htmlspecialchars($value);
|
52 |
+
$xml->addChild($key,$value);
|
53 |
+
}
|
54 |
+
|
55 |
+
}
|
56 |
+
}
|
57 |
+
// pass back as string. or simple xml object if you want!
|
58 |
+
return $xml->asXML();
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
}
|
classes/chunk.php
CHANGED
@@ -73,7 +73,18 @@ class PMXI_Chunk {
|
|
73 |
$this->options['chunkSize'] *= PMXI_Plugin::getInstance()->getOption('chunk_size');
|
74 |
|
75 |
// set the filename
|
76 |
-
$this->file = $file;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
if (empty($this->options['element'])){
|
79 |
//$founded_tags = array();
|
@@ -127,12 +138,13 @@ class PMXI_Chunk {
|
|
127 |
break;
|
128 |
}
|
129 |
}
|
|
|
130 |
if (empty($this->options['element'])){
|
131 |
foreach ($this->cloud as $el => $count) {
|
132 |
$this->options['element'] = $el;
|
133 |
break;
|
134 |
}
|
135 |
-
}
|
136 |
}
|
137 |
}
|
138 |
|
@@ -232,7 +244,7 @@ class PMXI_Chunk {
|
|
232 |
|
233 |
return $feed;
|
234 |
|
235 |
-
|
236 |
|
237 |
}
|
238 |
|
73 |
$this->options['chunkSize'] *= PMXI_Plugin::getInstance()->getOption('chunk_size');
|
74 |
|
75 |
// set the filename
|
76 |
+
$this->file = $file;
|
77 |
+
|
78 |
+
$is_html = false;
|
79 |
+
$f = @fopen($file, "rb");
|
80 |
+
while (!@feof($f)) {
|
81 |
+
$chunk = @fread($f, 1024);
|
82 |
+
if (strpos($chunk, "<!DOCTYPE") === 0) $is_html = true;
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
@fclose($f);
|
86 |
+
|
87 |
+
if ($is_html) return;
|
88 |
|
89 |
if (empty($this->options['element'])){
|
90 |
//$founded_tags = array();
|
138 |
break;
|
139 |
}
|
140 |
}
|
141 |
+
|
142 |
if (empty($this->options['element'])){
|
143 |
foreach ($this->cloud as $el => $count) {
|
144 |
$this->options['element'] = $el;
|
145 |
break;
|
146 |
}
|
147 |
+
}
|
148 |
}
|
149 |
}
|
150 |
|
244 |
|
245 |
return $feed;
|
246 |
|
247 |
+
}
|
248 |
|
249 |
}
|
250 |
|
classes/config.php
CHANGED
File without changes
|
classes/download.php
CHANGED
File without changes
|
classes/handler.php
CHANGED
File without changes
|
classes/helper.php
CHANGED
File without changes
|
classes/input.php
CHANGED
File without changes
|
classes/nested.php
DELETED
@@ -1,88 +0,0 @@
|
|
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
CHANGED
@@ -65,7 +65,7 @@ if ( ! class_exists('PMXI_Render')){
|
|
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', '
|
69 |
}
|
70 |
}
|
71 |
}
|
@@ -85,13 +85,13 @@ if ( ! class_exists('PMXI_Render')){
|
|
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', '
|
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', '
|
95 |
}
|
96 |
$is_short = strlen($text) <= 40;
|
97 |
$newtext = htmlspecialchars($text);
|
@@ -160,7 +160,7 @@ if ( ! class_exists('PMXI_Render')){
|
|
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', '
|
164 |
}
|
165 |
}
|
166 |
}
|
@@ -180,13 +180,13 @@ if ( ! class_exists('PMXI_Render')){
|
|
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', '
|
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', '
|
190 |
}
|
191 |
$is_short = strlen($text) <= 40;
|
192 |
$text = htmlspecialchars($text);
|
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', 'wp_all_import_plugin'), $no, _n('element', 'elements', $no, 'wp_all_import_plugin')) . ' ⇓ ]</div>';
|
69 |
}
|
70 |
}
|
71 |
}
|
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', 'wp_all_import_plugin'), $no, _n('element', 'elements', $no, 'wp_all_import_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', 'wp_all_import_plugin') . ']</span>';
|
95 |
}
|
96 |
$is_short = strlen($text) <= 40;
|
97 |
$newtext = htmlspecialchars($text);
|
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', 'wp_all_import_plugin'), $no, _n('element', 'elements', $no, 'wp_all_import_plugin')) . ' ⇓ ]</div>';
|
164 |
}
|
165 |
}
|
166 |
}
|
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', 'wp_all_import_plugin'), $no, _n('element', 'elements', $no, 'wp_all_import_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', 'wp_all_import_plugin') . ']</span>';
|
190 |
}
|
191 |
$is_short = strlen($text) <= 40;
|
192 |
$text = htmlspecialchars($text);
|
classes/session.php
CHANGED
File without changes
|
classes/upload.php
CHANGED
@@ -20,7 +20,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
20 |
if ( $uploads['error'] )
|
21 |
$this->uploadsPath = false;
|
22 |
else
|
23 |
-
$this->uploadsPath = (
|
24 |
}
|
25 |
|
26 |
public function upload(){
|
@@ -28,18 +28,18 @@ if ( ! class_exists('PMXI_Upload')){
|
|
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.', '
|
32 |
} elseif (!is_file($this->file)) {
|
33 |
-
$this->errors->add('form-validation', __('Uploaded file is empty', '
|
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', '
|
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.', '
|
43 |
}
|
44 |
else {
|
45 |
|
@@ -51,7 +51,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
51 |
}
|
52 |
}
|
53 |
if ( $this->uploadsPath === false ){
|
54 |
-
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', '
|
55 |
}
|
56 |
|
57 |
if(empty($filePath)){
|
@@ -71,7 +71,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
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.', '
|
75 |
}
|
76 |
}
|
77 |
|
@@ -85,12 +85,12 @@ if ( ! class_exists('PMXI_Upload')){
|
|
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.', '
|
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 |
-
//
|
94 |
$filePath = $csv->xml_path;
|
95 |
$this->is_csv = $csv->is_csv;
|
96 |
$this->root_element = 'node';
|
@@ -98,22 +98,22 @@ if ( ! class_exists('PMXI_Upload')){
|
|
98 |
} elseif (preg_match('%\W(json)$%i', trim($filePath))){
|
99 |
|
100 |
$json_str = file_get_contents($filePath);
|
101 |
-
$is_json =
|
102 |
|
103 |
if( is_wp_error($is_json)){
|
104 |
-
$this->errors->add('form-validation', $is_json->get_error_message(), '
|
105 |
}
|
106 |
else{
|
107 |
|
108 |
-
$xml_data =
|
109 |
|
110 |
if ( empty($xml_data) ){
|
111 |
-
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', '
|
112 |
}
|
113 |
else{
|
114 |
-
$jsontmpname = $this->uploadsPath .'/'.
|
115 |
file_put_contents($jsontmpname, $xml_data);
|
116 |
-
|
117 |
$filePath = $jsontmpname;
|
118 |
}
|
119 |
}
|
@@ -125,14 +125,14 @@ if ( ! class_exists('PMXI_Upload')){
|
|
125 |
$localSQLPath = $filePath;
|
126 |
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
127 |
$filePath = $sql->parse();
|
128 |
-
|
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.', '
|
136 |
}
|
137 |
$filePath = $this->file;
|
138 |
$source = array(
|
@@ -150,7 +150,7 @@ if ( ! class_exists('PMXI_Upload')){
|
|
150 |
|
151 |
} elseif(preg_match('%\W(gz)$%i', trim($this->file))){ // If gz file uploaded
|
152 |
|
153 |
-
$fileInfo =
|
154 |
|
155 |
if ( ! is_wp_error($fileInfo) ){
|
156 |
|
@@ -188,20 +188,20 @@ if ( ! class_exists('PMXI_Upload')){
|
|
188 |
);
|
189 |
|
190 |
$json_str = file_get_contents($this->file);
|
191 |
-
$is_json =
|
192 |
|
193 |
if( is_wp_error($is_json)){
|
194 |
-
$this->errors->add('form-validation', $is_json->get_error_message(), '
|
195 |
}
|
196 |
else{
|
197 |
|
198 |
-
$xml_data =
|
199 |
|
200 |
if ( empty($xml_data) ){
|
201 |
-
$this->errors->add('form-validation', __('Can not import this file. JSON to XML convertation failed.', '
|
202 |
}
|
203 |
else{
|
204 |
-
$jsontmpname = $this->uploadsPath .'/'.
|
205 |
//@unlink($this->file);
|
206 |
file_put_contents($jsontmpname, $xml_data);
|
207 |
$filePath = $jsontmpname;
|
@@ -243,520 +243,6 @@ if ( ! class_exists('PMXI_Upload')){
|
|
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 |
}
|
20 |
if ( $uploads['error'] )
|
21 |
$this->uploadsPath = false;
|
22 |
else
|
23 |
+
$this->uploadsPath = ( ! $targetDir ) ? wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY) : $targetDir;
|
24 |
}
|
25 |
|
26 |
public function upload(){
|
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.', 'wp_all_import_plugin'));
|
32 |
} elseif (!is_file($this->file)) {
|
33 |
+
$this->errors->add('form-validation', __('Uploaded file is empty', 'wp_all_import_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', 'wp_all_import_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.', 'wp_all_import_plugin'));
|
43 |
}
|
44 |
else {
|
45 |
|
51 |
}
|
52 |
}
|
53 |
if ( $this->uploadsPath === false ){
|
54 |
+
$this->errors->add('form-validation', __('WP All Import can\'t access your WordPress uploads folder.', 'wp_all_import_plugin'));
|
55 |
}
|
56 |
|
57 |
if(empty($filePath)){
|
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.', 'wp_all_import_plugin'));
|
75 |
}
|
76 |
}
|
77 |
|
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.', 'wp_all_import_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 |
+
//wp_all_import_remove_source($filePath, false);
|
94 |
$filePath = $csv->xml_path;
|
95 |
$this->is_csv = $csv->is_csv;
|
96 |
$this->root_element = 'node';
|
98 |
} elseif (preg_match('%\W(json)$%i', trim($filePath))){
|
99 |
|
100 |
$json_str = file_get_contents($filePath);
|
101 |
+
$is_json = wp_all_import_is_json($json_str);
|
102 |
|
103 |
if( is_wp_error($is_json)){
|
104 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
|
105 |
}
|
106 |
else{
|
107 |
|
108 |
+
$xml_data = wp_all_import_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.', 'wp_all_import_plugin'));
|
112 |
}
|
113 |
else{
|
114 |
+
$jsontmpname = $this->uploadsPath .'/'. wp_all_import_url_title(wp_unique_filename($this->uploadsPath, str_replace("json", "xml", basename($filePath))));
|
115 |
file_put_contents($jsontmpname, $xml_data);
|
116 |
+
wp_all_import_remove_source($filePath, false);
|
117 |
$filePath = $jsontmpname;
|
118 |
}
|
119 |
}
|
125 |
$localSQLPath = $filePath;
|
126 |
$sql = new PMXI_SQLParser( $localSQLPath, $this->uploadsPath );
|
127 |
$filePath = $sql->parse();
|
128 |
+
wp_all_import_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.', 'wp_all_import_plugin'));
|
136 |
}
|
137 |
$filePath = $this->file;
|
138 |
$source = array(
|
150 |
|
151 |
} elseif(preg_match('%\W(gz)$%i', trim($this->file))){ // If gz file uploaded
|
152 |
|
153 |
+
$fileInfo = wp_all_import_get_gz($this->file, 0, $this->uploadsPath);
|
154 |
|
155 |
if ( ! is_wp_error($fileInfo) ){
|
156 |
|
188 |
);
|
189 |
|
190 |
$json_str = file_get_contents($this->file);
|
191 |
+
$is_json = wp_all_import_is_json($json_str);
|
192 |
|
193 |
if( is_wp_error($is_json)){
|
194 |
+
$this->errors->add('form-validation', $is_json->get_error_message(), 'wp_all_import_plugin');
|
195 |
}
|
196 |
else{
|
197 |
|
198 |
+
$xml_data = wp_all_import_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.', 'wp_all_import_plugin'));
|
202 |
}
|
203 |
else{
|
204 |
+
$jsontmpname = $this->uploadsPath .'/'. wp_all_import_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;
|
243 |
'root_element' => $this->root_element,
|
244 |
'is_csv' => $this->is_csv
|
245 |
);
|
246 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
|
|
248 |
}
|
config/options.php
CHANGED
@@ -16,7 +16,7 @@ $config = array(
|
|
16 |
"dismiss_manage_bottom" => 0,
|
17 |
"html_entities" => 0,
|
18 |
"utf8_decode" => 0,
|
19 |
-
"cron_job_key" =>
|
20 |
"chunk_size" => 32,
|
21 |
"pingbacks" => 1,
|
22 |
"legacy_special_character_handling" => 1,
|
@@ -28,5 +28,6 @@ $config = array(
|
|
28 |
"cron_processing_time_limit" => 120,
|
29 |
"secure" => 1,
|
30 |
"log_storage" => 5,
|
31 |
-
"cron_sleep" => ""
|
|
|
32 |
);
|
16 |
"dismiss_manage_bottom" => 0,
|
17 |
"html_entities" => 0,
|
18 |
"utf8_decode" => 0,
|
19 |
+
"cron_job_key" => wp_all_import_url_title(wp_all_import_rand_char(12)),
|
20 |
"chunk_size" => 32,
|
21 |
"pingbacks" => 1,
|
22 |
"legacy_special_character_handling" => 1,
|
28 |
"cron_processing_time_limit" => 120,
|
29 |
"secure" => 1,
|
30 |
"log_storage" => 5,
|
31 |
+
"cron_sleep" => "",
|
32 |
+
"port" => "",
|
33 |
);
|
controllers/admin/addons.php
CHANGED
@@ -18,8 +18,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
18 |
|
19 |
// Woocommerce add-on
|
20 |
self::$premium['PMWI_Plugin'] = array(
|
21 |
-
'title' => __("WooCommerce Addon",'
|
22 |
-
'description' => __("Import Products from any XML or CSV to WooCommerce",'
|
23 |
'thumbnail' => 'http://placehold.it/220x220',
|
24 |
'active' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'paid'),
|
25 |
'free_installed' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'free'),
|
@@ -29,8 +29,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
29 |
|
30 |
// ACF add-on
|
31 |
self::$premium['PMAI_Plugin'] = array(
|
32 |
-
'title' => __("ACF Addon",'
|
33 |
-
'description' => __("Import to advanced custom fields",'
|
34 |
'thumbnail' => 'http://placehold.it/220x220',
|
35 |
'active' => (class_exists('PMAI_Plugin') and defined('PMAI_EDITION') and PMAI_EDITION == 'paid'),
|
36 |
'free_installed' => (class_exists('PMAI_Plugin') and defined('PMAI_EDITION') and PMAI_EDITION == 'free'),
|
@@ -40,8 +40,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
40 |
|
41 |
// WPML add-on
|
42 |
self::$premium['PMLI_Plugin'] = array(
|
43 |
-
'title' => __("WPML Addon",'
|
44 |
-
'description' => __("Import to WPML",'
|
45 |
'thumbnail' => 'http://placehold.it/220x220',
|
46 |
'active' => (class_exists('PMLI_Plugin') and defined('PMLI_EDITION') and PMLI_EDITION == 'paid'),
|
47 |
'free_installed' => (class_exists('PMLI_Plugin') and defined('PMLI_EDITION') and PMLI_EDITION == 'free'),
|
@@ -51,8 +51,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
51 |
|
52 |
// User add-on
|
53 |
self::$premium['PMUI_Plugin'] = array(
|
54 |
-
'title' => __("User Addon",'
|
55 |
-
'description' => __("Import Users",'
|
56 |
'thumbnail' => 'http://placehold.it/220x220',
|
57 |
'active' => (class_exists('PMUI_Plugin') and defined('PMUI_EDITION') and PMUI_EDITION == 'paid'),
|
58 |
'free_installed' => (class_exists('PMUI_Plugin') and defined('PMUI_EDITION') and PMUI_EDITION == 'free'),
|
@@ -62,8 +62,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
62 |
|
63 |
// Affiliate link cloaking add-on
|
64 |
self::$premium['PMLCA_Plugin'] = array(
|
65 |
-
'title' => __("Link cloaking Addon",'
|
66 |
-
'description' => __("Affiliate link cloaking",'
|
67 |
'thumbnail' => 'http://placehold.it/220x220',
|
68 |
'active' => (class_exists('PMLCA_Plugin') and defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid'),
|
69 |
'free_installed' => (class_exists('PMLCA_Plugin') and defined('PMLCA_EDITION') and PMLCA_EDITION == 'free'),
|
@@ -72,8 +72,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
72 |
);
|
73 |
|
74 |
self::$free['PMWI_Plugin'] = array(
|
75 |
-
'title' => __("WooCommerce Addon - free edition",'
|
76 |
-
'description' => __("Import Products from any XML or CSV to WooCommerce",'
|
77 |
'thumbnail' => 'http://placehold.it/220x220',
|
78 |
'active' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'free'),
|
79 |
'paid_installed' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'paid'),
|
@@ -81,8 +81,8 @@ class PMXI_Admin_Addons extends PMXI_Controller_Admin {
|
|
81 |
'url' => 'http://wordpress.org/plugins/woocommerce-xml-csv-product-import'
|
82 |
);
|
83 |
self::$free['PMWITabs_Plugin'] = array(
|
84 |
-
'title' => __("WooCommerce Tabs Addon",'
|
85 |
-
'description' => __("Import data to WooCommerce tabs",'
|
86 |
'thumbnail' => 'http://placehold.it/220x220',
|
87 |
'active' => class_exists('PMWITabs_Plugin'),
|
88 |
'paid_installed' => false,
|
18 |
|
19 |
// Woocommerce add-on
|
20 |
self::$premium['PMWI_Plugin'] = array(
|
21 |
+
'title' => __("WooCommerce Addon",'wp_all_import_plugin'),
|
22 |
+
'description' => __("Import Products from any XML or CSV to WooCommerce",'wp_all_import_plugin'),
|
23 |
'thumbnail' => 'http://placehold.it/220x220',
|
24 |
'active' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'paid'),
|
25 |
'free_installed' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'free'),
|
29 |
|
30 |
// ACF add-on
|
31 |
self::$premium['PMAI_Plugin'] = array(
|
32 |
+
'title' => __("ACF Addon",'wp_all_import_plugin'),
|
33 |
+
'description' => __("Import to advanced custom fields",'wp_all_import_plugin'),
|
34 |
'thumbnail' => 'http://placehold.it/220x220',
|
35 |
'active' => (class_exists('PMAI_Plugin') and defined('PMAI_EDITION') and PMAI_EDITION == 'paid'),
|
36 |
'free_installed' => (class_exists('PMAI_Plugin') and defined('PMAI_EDITION') and PMAI_EDITION == 'free'),
|
40 |
|
41 |
// WPML add-on
|
42 |
self::$premium['PMLI_Plugin'] = array(
|
43 |
+
'title' => __("WPML Addon",'wp_all_import_plugin'),
|
44 |
+
'description' => __("Import to WPML",'wp_all_import_plugin'),
|
45 |
'thumbnail' => 'http://placehold.it/220x220',
|
46 |
'active' => (class_exists('PMLI_Plugin') and defined('PMLI_EDITION') and PMLI_EDITION == 'paid'),
|
47 |
'free_installed' => (class_exists('PMLI_Plugin') and defined('PMLI_EDITION') and PMLI_EDITION == 'free'),
|
51 |
|
52 |
// User add-on
|
53 |
self::$premium['PMUI_Plugin'] = array(
|
54 |
+
'title' => __("User Addon",'wp_all_import_plugin'),
|
55 |
+
'description' => __("Import Users",'wp_all_import_plugin'),
|
56 |
'thumbnail' => 'http://placehold.it/220x220',
|
57 |
'active' => (class_exists('PMUI_Plugin') and defined('PMUI_EDITION') and PMUI_EDITION == 'paid'),
|
58 |
'free_installed' => (class_exists('PMUI_Plugin') and defined('PMUI_EDITION') and PMUI_EDITION == 'free'),
|
62 |
|
63 |
// Affiliate link cloaking add-on
|
64 |
self::$premium['PMLCA_Plugin'] = array(
|
65 |
+
'title' => __("Link cloaking Addon",'wp_all_import_plugin'),
|
66 |
+
'description' => __("Affiliate link cloaking",'wp_all_import_plugin'),
|
67 |
'thumbnail' => 'http://placehold.it/220x220',
|
68 |
'active' => (class_exists('PMLCA_Plugin') and defined('PMLCA_EDITION') and PMLCA_EDITION == 'paid'),
|
69 |
'free_installed' => (class_exists('PMLCA_Plugin') and defined('PMLCA_EDITION') and PMLCA_EDITION == 'free'),
|
72 |
);
|
73 |
|
74 |
self::$free['PMWI_Plugin'] = array(
|
75 |
+
'title' => __("WooCommerce Addon - free edition",'wp_all_import_plugin'),
|
76 |
+
'description' => __("Import Products from any XML or CSV to WooCommerce",'wp_all_import_plugin'),
|
77 |
'thumbnail' => 'http://placehold.it/220x220',
|
78 |
'active' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'free'),
|
79 |
'paid_installed' => (class_exists('PMWI_Plugin') and defined('PMWI_EDITION') and PMWI_EDITION == 'paid'),
|
81 |
'url' => 'http://wordpress.org/plugins/woocommerce-xml-csv-product-import'
|
82 |
);
|
83 |
self::$free['PMWITabs_Plugin'] = array(
|
84 |
+
'title' => __("WooCommerce Tabs Addon",'wp_all_import_plugin'),
|
85 |
+
'description' => __("Import data to WooCommerce tabs",'wp_all_import_plugin'),
|
86 |
'thumbnail' => 'http://placehold.it/220x220',
|
87 |
'active' => class_exists('PMWITabs_Plugin'),
|
88 |
'paid_installed' => false,
|
controllers/admin/help.php
CHANGED
File without changes
|
controllers/admin/history.php
CHANGED
@@ -27,7 +27,7 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
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.', '
|
31 |
}
|
32 |
$this->data += $get;
|
33 |
$by = array('import_id' => $id);
|
@@ -44,8 +44,8 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
44 |
$this->data['page_links'] = paginate_links(array(
|
45 |
'base' => add_query_arg(array('id' => $id, 'pagenum' => '%#%'), $this->baseUrl),
|
46 |
'format' => '',
|
47 |
-
'prev_text' => __('«', '
|
48 |
-
'next_text' => __('»', '
|
49 |
'total' => ceil($list->total() / $perPage),
|
50 |
'current' => $pagenum,
|
51 |
));
|
@@ -59,22 +59,28 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
59 |
*/
|
60 |
public function log(){
|
61 |
|
62 |
-
$
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
76 |
|
77 |
-
|
|
|
78 |
}
|
79 |
}
|
80 |
|
@@ -82,13 +88,20 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
82 |
* Delete an import
|
83 |
*/
|
84 |
public function delete() {
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
-
|
91 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('History deleted', 'pmxi_plugin')), $this->baseUrl)); die();
|
92 |
}
|
93 |
|
94 |
/**
|
@@ -113,7 +126,7 @@ class PMXI_Admin_History extends PMXI_Controller_Admin {
|
|
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', '
|
117 |
|
118 |
}
|
119 |
}
|
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.', 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
31 |
}
|
32 |
$this->data += $get;
|
33 |
$by = array('import_id' => $id);
|
44 |
$this->data['page_links'] = paginate_links(array(
|
45 |
'base' => add_query_arg(array('id' => $id, 'pagenum' => '%#%'), $this->baseUrl),
|
46 |
'format' => '',
|
47 |
+
'prev_text' => __('«', 'wp_all_import_plugin'),
|
48 |
+
'next_text' => __('»', 'wp_all_import_plugin'),
|
49 |
'total' => ceil($list->total() / $perPage),
|
50 |
'current' => $pagenum,
|
51 |
));
|
59 |
*/
|
60 |
public function log(){
|
61 |
|
62 |
+
$nonce = (!empty($_REQUEST['_wpnonce'])) ? $_REQUEST['_wpnonce'] : '';
|
63 |
+
if ( ! wp_verify_nonce( $nonce, '_wpnonce-download_log' ) ) {
|
64 |
+
die( __('Security check', 'wp_all_import_plugin') );
|
65 |
+
} else {
|
66 |
|
67 |
+
$id = $this->input->get('history_id');
|
68 |
+
|
69 |
+
$import_id = $this->input->get('id');
|
70 |
|
71 |
+
$wp_uploads = wp_upload_dir();
|
72 |
+
|
73 |
+
$log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $id ) . DIRECTORY_SEPARATOR . $id . '.html';
|
74 |
+
|
75 |
+
if (file_exists($log_file))
|
76 |
+
{
|
77 |
+
PMXI_download::xml($log_file);
|
78 |
+
}
|
79 |
+
else
|
80 |
+
{
|
81 |
|
82 |
+
wp_redirect(add_query_arg(array('id' => $import_id, 'pmxi_nt' => urlencode(__('Log file does not exists.', 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
83 |
+
}
|
84 |
}
|
85 |
}
|
86 |
|
88 |
* Delete an import
|
89 |
*/
|
90 |
public function delete() {
|
91 |
+
|
92 |
+
if ( ! get_current_user_id() or ! current_user_can('manage_options')) {
|
93 |
+
// This nonce is not valid.
|
94 |
+
die( 'Security check' );
|
95 |
+
} else {
|
96 |
+
$id = $this->input->get('id');
|
97 |
+
$this->data['item'] = $item = new PMXI_History_Record();
|
98 |
+
if ( ! $id or $item->getById($id)->isEmpty()) {
|
99 |
+
wp_redirect($this->baseUrl); die();
|
100 |
+
}
|
101 |
+
$item->delete();
|
102 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('History deleted', 'wp_all_import_plugin')), $this->baseUrl)); die();
|
103 |
}
|
104 |
+
|
|
|
105 |
}
|
106 |
|
107 |
/**
|
126 |
|
127 |
$id = $this->input->get('id');
|
128 |
|
129 |
+
wp_redirect(add_query_arg(array('id' => $id, 'pmxi_nt' => urlencode(sprintf(__('<strong>%d</strong> %s deleted', 'wp_all_import_plugin'), $items->count(), _n('history', 'histories', $items->count(), 'wp_all_import_plugin')))), $this->baseUrl)); die();
|
130 |
|
131 |
}
|
132 |
}
|
controllers/admin/home.php
CHANGED
File without changes
|
controllers/admin/import.php
CHANGED
@@ -72,7 +72,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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.', '
|
76 |
wp_redirect_or_javascript($this->baseUrl); die();
|
77 |
}
|
78 |
}
|
@@ -89,7 +89,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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.', '
|
93 |
wp_redirect_or_javascript(add_query_arg('action', 'element', $this->baseUrl)); die();
|
94 |
}
|
95 |
|
@@ -145,89 +145,43 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
145 |
}
|
146 |
|
147 |
$this->data['post'] = $post = $this->input->post( $default );
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
-
|
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 |
-
|
156 |
-
|
157 |
-
|
158 |
-
$
|
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::$
|
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 |
-
|
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 |
-
|
214 |
-
|
215 |
-
|
216 |
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
|
221 |
-
|
|
|
|
|
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);
|
@@ -239,13 +193,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
239 |
$file = new PMXI_Chunk($path, array('element' => $post['root_element']));
|
240 |
|
241 |
if ( ! empty($file->options['element']) ) {
|
242 |
-
$xpath = "/"
|
243 |
$elements_cloud = $file->cloud;
|
244 |
break;
|
245 |
}
|
246 |
|
247 |
}
|
248 |
-
else $this->errors->add('form-validation', __('Unable to download feed resource.', '
|
249 |
}
|
250 |
|
251 |
if ( ! $this->errors->get_error_codes() ) {
|
@@ -279,7 +233,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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) {
|
@@ -302,17 +256,17 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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.', '
|
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', '
|
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.', '
|
316 |
}
|
317 |
|
318 |
do_action("pmxi_get_file", $filePath);
|
@@ -337,19 +291,19 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
337 |
|
338 |
$wp_uploads = wp_upload_dir();
|
339 |
|
340 |
-
if ($this->input->post('is_submitted')) {
|
341 |
check_admin_referer('choose-elements', '_wpnonce_choose-elements');
|
342 |
if ('' == $post['xpath']) {
|
343 |
-
$this->errors->add('form-validation', __('No elements selected', '
|
344 |
} else {
|
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.', '
|
349 |
} else {
|
350 |
foreach ($node_list as $el) {
|
351 |
if ( ! $el instanceof DOMElement) {
|
352 |
-
$this->errors->add('form-validation', __('XPath must match only elements', '
|
353 |
break;
|
354 |
};
|
355 |
}
|
@@ -368,7 +322,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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.', '
|
372 |
}
|
373 |
} else {
|
374 |
// suggest 1st repeating element as default selection
|
@@ -389,10 +343,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
389 |
* Helper to evaluate xpath and return matching elements as direct paths for javascript side to highlight them
|
390 |
*/
|
391 |
public function evaluate()
|
392 |
-
{
|
|
|
393 |
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
394 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
395 |
-
}
|
396 |
|
397 |
// HTTP headers for no cache etc
|
398 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
@@ -405,8 +360,11 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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 (''
|
409 |
-
$this->errors->add('form-validation', __('
|
|
|
|
|
|
|
410 |
} else {
|
411 |
|
412 |
$source = PMXI_Plugin::$session->get('source');
|
@@ -418,7 +376,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
418 |
|
419 |
PMXI_Plugin::$session->set('is_csv', $post['delimiter']);
|
420 |
|
421 |
-
|
422 |
|
423 |
$csv = new PMXI_CsvParser( array(
|
424 |
'filename' => PMXI_Plugin::$session->get('csv_path'),
|
@@ -495,7 +453,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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.', '
|
499 |
}
|
500 |
}
|
501 |
|
@@ -549,20 +507,20 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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.', '
|
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.', '
|
560 |
} elseif ( ! $elements->length) {
|
561 |
-
$this->errors->add('form-validation', __('No matching variations found for XPath specified', '
|
562 |
} else {
|
563 |
foreach ($elements as $el) {
|
564 |
if ( ! $el instanceof DOMElement) {
|
565 |
-
$this->errors->add('form-validation', __('XPath must match only elements', '
|
566 |
break;
|
567 |
};
|
568 |
}
|
@@ -595,6 +553,8 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
595 |
*/
|
596 |
public function tag( $is_json = true )
|
597 |
{
|
|
|
|
|
598 |
|
599 |
$wp_uploads = wp_upload_dir();
|
600 |
|
@@ -614,10 +574,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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();
|
@@ -703,117 +660,129 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
703 |
*/
|
704 |
public function preview()
|
705 |
{
|
706 |
-
$post = $this->input->post(array(
|
707 |
-
'title' => '',
|
708 |
-
'content' => '',
|
709 |
-
'is_keep_linebreaks' => 0,
|
710 |
-
'is_leave_html' => 0,
|
711 |
-
'fix_characters' => 0,
|
712 |
-
'import_encoding' => 'UTF-8',
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
720 |
|
721 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
722 |
|
723 |
-
|
724 |
-
|
725 |
|
726 |
-
|
727 |
-
|
728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
729 |
|
730 |
-
$
|
731 |
-
'
|
732 |
-
'
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
737 |
}
|
|
|
738 |
|
739 |
-
$
|
740 |
-
|
741 |
-
|
742 |
-
)
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
$
|
754 |
-
|
755 |
-
|
756 |
-
$
|
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 |
-
}
|
775 |
-
}
|
776 |
-
unset($file);
|
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>')))) {
|
795 |
-
$this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post title is empty', 'pmxi_plugin'));
|
796 |
}
|
797 |
-
|
|
|
798 |
}
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
$this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post content is empty', 'pmxi_plugin'));
|
812 |
}
|
813 |
-
|
|
|
814 |
}
|
815 |
-
} catch (XmlImportException $e) {
|
816 |
-
$this->errors->add('form-validation', sprintf(__('Error parsing content: %s', 'pmxi_plugin'), $e->getMessage()));
|
817 |
}
|
818 |
|
819 |
ob_start();
|
@@ -826,95 +795,106 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
826 |
*/
|
827 |
public function preview_images()
|
828 |
{
|
829 |
-
|
830 |
-
'
|
831 |
-
|
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 |
-
|
|
|
|
|
843 |
|
844 |
-
|
845 |
|
846 |
-
|
847 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
848 |
|
849 |
-
|
850 |
-
|
851 |
-
|
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 |
-
$
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
$
|
894 |
-
|
895 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
896 |
}
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
|
|
915 |
}
|
916 |
-
} catch (XmlImportException $e) {
|
917 |
-
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'pmxi_plugin'), $e->getMessage()));
|
918 |
}
|
919 |
|
920 |
ob_start();
|
@@ -927,97 +907,144 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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 |
-
|
|
|
|
|
941 |
|
942 |
-
|
|
|
|
|
943 |
|
944 |
-
|
945 |
|
946 |
-
|
947 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
948 |
|
949 |
-
|
950 |
-
|
951 |
-
|
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 |
-
$
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
$
|
992 |
-
|
993 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
994 |
}
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1014 |
}
|
|
|
|
|
1015 |
}
|
1016 |
-
|
1017 |
-
|
1018 |
}
|
1019 |
-
} catch (XmlImportException $e) {
|
1020 |
-
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'pmxi_plugin'), $e->getMessage()));
|
1021 |
}
|
1022 |
|
1023 |
ob_start();
|
@@ -1030,107 +1057,119 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1048 |
|
1049 |
-
|
1050 |
|
1051 |
-
|
1052 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1053 |
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
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 |
-
$
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
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 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1128 |
|
1129 |
-
|
1130 |
-
|
|
|
|
|
|
|
1131 |
}
|
1132 |
-
} catch (XmlImportException $e) {
|
1133 |
-
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'pmxi_plugin'), $e->getMessage()));
|
1134 |
}
|
1135 |
|
1136 |
ob_start();
|
@@ -1161,7 +1200,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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 |
}
|
@@ -1205,22 +1244,16 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1205 |
$this->_validate_template($post['title'], 'Post title');
|
1206 |
}
|
1207 |
else{
|
1208 |
-
$this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', '
|
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.', '
|
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
|
@@ -1245,19 +1278,14 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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', '
|
1249 |
} else {
|
1250 |
foreach ($post['custom_name'] as $custom_name) {
|
1251 |
-
$this->_validate_template($custom_name, __('Custom Field Name', '
|
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', '
|
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 |
|
@@ -1270,27 +1298,34 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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', '
|
1274 |
} else {
|
1275 |
foreach ($post['attribute_name'] as $attribute_name) {
|
1276 |
-
$this->_validate_template($attribute_name, __('Attribute Field Name', '
|
1277 |
}
|
1278 |
foreach ($post['attribute_value'] as $custom_value) {
|
1279 |
-
$this->_validate_template($custom_value, __('Attribute Field Value', '
|
1280 |
}
|
1281 |
}
|
1282 |
|
1283 |
}
|
1284 |
-
|
1285 |
-
if ('
|
1286 |
-
|
|
|
|
|
|
|
|
|
1287 |
}
|
1288 |
if ('specific' == $post['date_type']) {
|
1289 |
-
'' == $post['date'] or $this->_validate_template($post['date'], __('Date', '
|
1290 |
} else {
|
1291 |
-
'' == $post['date_start'] or $this->_validate_template($post['date_start'], __('Start Date', '
|
1292 |
-
'' == $post['date_end'] or $this->_validate_template($post['date_end'], __('Start Date', '
|
1293 |
-
}
|
|
|
|
|
|
|
1294 |
|
1295 |
$this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, $this->data['import']);
|
1296 |
|
@@ -1309,12 +1344,12 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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', '
|
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 |
}
|
@@ -1364,7 +1399,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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', '
|
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'];
|
@@ -1390,7 +1425,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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', '
|
1394 |
}
|
1395 |
}
|
1396 |
|
@@ -1414,11 +1449,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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 |
-
|
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');
|
@@ -1449,11 +1480,16 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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 |
}
|
@@ -1481,30 +1517,30 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
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', '
|
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', '
|
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', '
|
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', '
|
1500 |
} elseif ('manual' != $post['duplicate_matching']) {
|
1501 |
-
$this->_validate_template($post['unique_key'], __('Post Unique Key', '
|
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.', '
|
1506 |
if ('' == $post['custom_duplicate_value'])
|
1507 |
-
$this->errors->add('form-validation', __('Custom field value must be specified.', '
|
1508 |
}
|
1509 |
|
1510 |
// Categories/taxonomies logic
|
@@ -1535,12 +1571,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1535 |
if ($this->data['import']['path'] != $filePath){
|
1536 |
$uploader = new PMXI_Upload($filePath, $this->errors);
|
1537 |
$upload_result = $uploader->upload();
|
1538 |
-
}
|
1539 |
|
1540 |
break;
|
|
|
1541 |
default:
|
1542 |
|
1543 |
-
$this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', '
|
1544 |
|
1545 |
break;
|
1546 |
}
|
@@ -1584,7 +1621,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1584 |
|
1585 |
if ( (int) $loop === 0 ){
|
1586 |
|
1587 |
-
$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.', '
|
1588 |
|
1589 |
$file = new PMXI_Chunk($upload_result['filePath'], array('element' => ( ! empty($upload_result['root_element'])) ? $upload_result['root_element'] : ''));
|
1590 |
|
@@ -1629,7 +1666,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1629 |
|
1630 |
}
|
1631 |
else{
|
1632 |
-
$this->errors->add('form-validation', __('Root element not found for uploaded feed.', '
|
1633 |
}
|
1634 |
|
1635 |
}
|
@@ -1681,7 +1718,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1681 |
'registered_on' => date('Y-m-d H:i:s'),
|
1682 |
))->save();
|
1683 |
|
1684 |
-
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode($is_update ? __('Import updated', '
|
1685 |
}
|
1686 |
|
1687 |
} else {
|
@@ -1713,33 +1750,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1713 |
'type' => 'upload',
|
1714 |
'path' => $filePath,
|
1715 |
);
|
1716 |
-
break;
|
1717 |
-
case 'url':
|
1718 |
-
$filePath = $this->input->post('url');
|
1719 |
-
$source = array(
|
1720 |
-
'name' => basename(parse_url($filePath, PHP_URL_PATH)),
|
1721 |
-
'type' => 'url',
|
1722 |
-
'path' => $filePath,
|
1723 |
-
);
|
1724 |
-
break;
|
1725 |
-
case 'file':
|
1726 |
-
$wp_uploads = wp_upload_dir();
|
1727 |
-
$filePath = $this->input->post('file');
|
1728 |
-
$source = array(
|
1729 |
-
'name' => basename($filePath),
|
1730 |
-
'type' => 'file',
|
1731 |
-
'path' => $wp_uploads['basedir'] . '/wpallimport/files/' . $filePath,
|
1732 |
-
);
|
1733 |
-
break;
|
1734 |
-
/*case 'ftp':
|
1735 |
-
$ftp = $this->input->post('ftp');
|
1736 |
-
$filePath = preg_replace('%://([^@/]*@)?%', '://' . rawurlencode($ftp['user']) . ':' . rawurlencode($ftp['pass']) . '@', $ftp['url'], 1);
|
1737 |
-
$source = array(
|
1738 |
-
'name' => basename($filePath),
|
1739 |
-
'type' => 'ftp',
|
1740 |
-
'path' => $filePath,
|
1741 |
-
);
|
1742 |
-
break;*/
|
1743 |
}
|
1744 |
|
1745 |
// if new file is successfully uploaded
|
@@ -1751,9 +1762,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1751 |
foreach ($history as $file){
|
1752 |
if ( @file_exists($file['path']) and $file['path'] != $upload_result['filePath'] ){
|
1753 |
if (in_array($this->data['import']->type, array('upload')))
|
1754 |
-
|
1755 |
else
|
1756 |
-
|
1757 |
}
|
1758 |
$history_file = new PMXI_File_Record();
|
1759 |
$history_file->getBy('id', $file['id']);
|
@@ -1769,13 +1780,13 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1769 |
//'contents' => $this->get_xml(),
|
1770 |
'registered_on' => date('Y-m-d H:i:s')
|
1771 |
))->save();
|
1772 |
-
}
|
1773 |
|
1774 |
if ( ! $this->warnings->get_error_codes()) {
|
1775 |
|
1776 |
$this->data['import']->set($source)->save();
|
1777 |
|
1778 |
-
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode(__('Configuration updated', '
|
1779 |
}
|
1780 |
else{
|
1781 |
|
@@ -1852,10 +1863,6 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1852 |
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1853 |
if (empty(PMXI_Plugin::$session->options['content']))
|
1854 |
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1855 |
-
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')))
|
1856 |
-
$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.'));
|
1857 |
-
if (!empty(PMXI_Plugin::$session->options['custom_name']) and !empty(PMXI_Plugin::$session->options['custom_value']))
|
1858 |
-
$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.'));
|
1859 |
}
|
1860 |
|
1861 |
$this->data['post'] =& $DefaultOptions;
|
@@ -1941,7 +1948,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1941 |
foreach ($historyLogs as $i => $file){
|
1942 |
$historyRecord = new PMXI_History_Record();
|
1943 |
$historyRecord->getBy('id', $file['id']);
|
1944 |
-
if ( ! $historyRecord->isEmpty()) $historyRecord->delete(
|
1945 |
if ($i == $logsToRemove)
|
1946 |
break;
|
1947 |
}
|
@@ -1978,9 +1985,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
1978 |
foreach ($history as $file){
|
1979 |
if ( @file_exists($file['path']) and $file['path'] != PMXI_Plugin::$session->filePath ){
|
1980 |
if (in_array($import->type, array('upload')))
|
1981 |
-
|
1982 |
else
|
1983 |
-
|
1984 |
}
|
1985 |
$history_file = new PMXI_File_Record();
|
1986 |
$history_file->getBy('id', $file['id']);
|
@@ -2044,7 +2051,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2044 |
|
2045 |
if ( $chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count ){
|
2046 |
$feed .= "</pmxi_records>";
|
2047 |
-
$chunk_file_path =
|
2048 |
file_put_contents($chunk_file_path, $feed);
|
2049 |
$chunk_files[] = $chunk_file_path;
|
2050 |
$chunk_records_count = 0;
|
@@ -2059,9 +2066,9 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2059 |
PMXI_Plugin::$session->save_data();
|
2060 |
|
2061 |
if ( $log_storage ){
|
2062 |
-
$log_file =
|
2063 |
if ( PMXI_Plugin::$session->action != 'continue' and file_exists($log_file)){
|
2064 |
-
|
2065 |
}
|
2066 |
}
|
2067 |
|
@@ -2087,13 +2094,17 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2087 |
|
2088 |
$ajax_processing = ("ajax" == $import->options['import_processing']) ? true : false;
|
2089 |
|
|
|
|
|
|
|
|
|
2090 |
if ($ajax_processing)
|
2091 |
-
{
|
2092 |
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; flush();');
|
2093 |
}
|
2094 |
else
|
2095 |
{
|
2096 |
-
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; if ( "" != strip_tags(
|
2097 |
}
|
2098 |
|
2099 |
PMXI_Plugin::$session->set('start_time', (empty(PMXI_Plugin::$session->start_time)) ? time() : PMXI_Plugin::$session->start_time);
|
@@ -2105,7 +2116,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2105 |
$iteration_start_time = time();
|
2106 |
|
2107 |
if ( $log_storage )
|
2108 |
-
$log_file =
|
2109 |
|
2110 |
if ( $ajax_processing ) {
|
2111 |
// HTTP headers for no cache etc
|
@@ -2149,10 +2160,10 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2149 |
|
2150 |
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
2151 |
|
2152 |
-
$import_done = ($import->imported + $import->skipped
|
2153 |
|
2154 |
if ( $import_done ) {
|
2155 |
-
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path))
|
2156 |
PMXI_Plugin::$session->set('local_paths', array());
|
2157 |
PMXI_Plugin::$session->save_data();
|
2158 |
break;
|
@@ -2198,7 +2209,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2198 |
|
2199 |
$feed .= $xml; $loop += $elements->length;
|
2200 |
|
2201 |
-
$processed_records = $import->imported + $import->skipped
|
2202 |
|
2203 |
if ( $loop == $records_per_request or $processed_records + $loop == $records_to_import or $processed_records == $records_to_import) {
|
2204 |
|
@@ -2271,7 +2282,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2271 |
do_action( 'pmxi_after_xml_import', $import->id );
|
2272 |
|
2273 |
if ("ajax" != $import->options['import_processing'] and $log_storage ){
|
2274 |
-
$log_file =
|
2275 |
if (PMXI_Plugin::$session->action != 'continue'){
|
2276 |
@file_put_contents($log_file, PMXI_Plugin::$session->log);
|
2277 |
}
|
@@ -2304,7 +2315,7 @@ class PMXI_Admin_Import extends PMXI_Controller_Admin {
|
|
2304 |
PMXI_Plugin::$session->clean_session($import->id); // clear session data (prevent from reimporting the same data on page refresh)
|
2305 |
|
2306 |
// [indicate in header process is complete]
|
2307 |
-
$msg = ( ! empty($import->canceled) ) ? addcslashes(__('Canceled', '
|
2308 |
|
2309 |
if ( $ajax_processing ) ob_start();
|
2310 |
|
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.', 'wp_all_import_plugin'));
|
76 |
wp_redirect_or_javascript($this->baseUrl); die();
|
77 |
}
|
78 |
}
|
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.', 'wp_all_import_plugin'));
|
93 |
wp_redirect_or_javascript(add_query_arg('action', 'element', $this->baseUrl)); die();
|
94 |
}
|
95 |
|
145 |
}
|
146 |
|
147 |
$this->data['post'] = $post = $this->input->post( $default );
|
148 |
+
|
149 |
+
if ( ! class_exists('DOMDocument') or ! class_exists('XMLReader') ) {
|
150 |
+
$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.', 'wp_all_import_plugin'));
|
151 |
+
}
|
152 |
+
|
153 |
+
if ($this->input->post('is_submitted') and ! $this->errors->get_error_codes()) {
|
154 |
|
155 |
+
check_admin_referer('choose-file', '_wpnonce_choose-file');
|
|
|
|
|
|
|
|
|
156 |
|
157 |
+
if ('upload' == $this->input->post('type')) {
|
158 |
+
|
159 |
+
$uploader = new PMXI_Upload($post['filepath'], $this->errors, rtrim(str_replace(basename($post['filepath']), '', $post['filepath']), '/'));
|
160 |
+
$upload_result = $uploader->upload();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
if ($upload_result instanceof WP_Error){
|
162 |
$this->errors = $upload_result;
|
163 |
}
|
164 |
+
else{
|
165 |
$source = $upload_result['source'];
|
166 |
+
$filePath = $upload_result['filePath'];
|
167 |
+
PMXI_Plugin::$is_csv = $upload_result['is_csv'];
|
|
|
168 |
if ( ! empty($upload_result['root_element']))
|
169 |
$post['root_element'] = $upload_result['root_element'];
|
170 |
+
}
|
171 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
+
if ($this->input->post('is_submitted') and '' == $this->input->post('custom_type')) {
|
174 |
+
$this->errors->add('form-validation', __('Select an item type to import the data', 'wp_all_import_plugin'));
|
175 |
+
}
|
176 |
|
177 |
+
if ($post['is_update_previous'] and empty($post['update_previous'])) {
|
178 |
+
$this->errors->add('form-validation', __('Previous import for update must be selected to proceed with a new one', 'wp_all_import_plugin'));
|
179 |
+
}
|
180 |
|
181 |
+
$this->data['detection_feed_extension'] = false;
|
182 |
+
|
183 |
+
$elements_cloud = array();
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
@set_time_limit(0);
|
186 |
|
187 |
$local_paths = !empty($local_paths) ? $local_paths : array($filePath);
|
193 |
$file = new PMXI_Chunk($path, array('element' => $post['root_element']));
|
194 |
|
195 |
if ( ! empty($file->options['element']) ) {
|
196 |
+
$xpath = "/" . $file->options['element'];
|
197 |
$elements_cloud = $file->cloud;
|
198 |
break;
|
199 |
}
|
200 |
|
201 |
}
|
202 |
+
else $this->errors->add('form-validation', __('Unable to download feed resource.', 'wp_all_import_plugin'));
|
203 |
}
|
204 |
|
205 |
if ( ! $this->errors->get_error_codes() ) {
|
233 |
'csv_paths' => array(PMXI_Plugin::$csv_path), // ftp import local copies of remote CSV files
|
234 |
'action' => 'import',
|
235 |
'elements_cloud' => (!empty($elements_cloud)) ? $elements_cloud : array(),
|
236 |
+
'pointer' => 1
|
237 |
);
|
238 |
|
239 |
foreach ($session_data as $key => $value) {
|
256 |
|
257 |
if ( empty($xml) )
|
258 |
{
|
259 |
+
$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.', 'wp_all_import_plugin'));
|
260 |
}
|
261 |
else{
|
262 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
263 |
}
|
264 |
|
265 |
} else if ('url' == $this->input->post('type') and !empty($this->errors)){
|
266 |
+
$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', 'wp_all_import_plugin'));
|
267 |
$this->data['detection_feed_extension'] = true;
|
268 |
} else {
|
269 |
+
$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.', 'wp_all_import_plugin'));
|
270 |
}
|
271 |
|
272 |
do_action("pmxi_get_file", $filePath);
|
291 |
|
292 |
$wp_uploads = wp_upload_dir();
|
293 |
|
294 |
+
if ($this->input->post('is_submitted')) {
|
295 |
check_admin_referer('choose-elements', '_wpnonce_choose-elements');
|
296 |
if ('' == $post['xpath']) {
|
297 |
+
$this->errors->add('form-validation', __('No elements selected', 'wp_all_import_plugin'));
|
298 |
} else {
|
299 |
$node_list = @ $xpath->query($post['xpath']); // make sure only element selection is allowed; prevent parsing warning to be displayed
|
300 |
|
301 |
if (FALSE === $node_list) {
|
302 |
+
$this->errors->add('form-validation', __('Your XPath is not valid.<br/><br/>Click "get default XPath" to get the default XPath.', 'wp_all_import_plugin'));
|
303 |
} else {
|
304 |
foreach ($node_list as $el) {
|
305 |
if ( ! $el instanceof DOMElement) {
|
306 |
+
$this->errors->add('form-validation', __('XPath must match only elements', 'wp_all_import_plugin'));
|
307 |
break;
|
308 |
};
|
309 |
}
|
322 |
$post['xpath'] = PMXI_Plugin::$session->xpath;
|
323 |
$this->data['elements'] = $elements = $xpath->query($post['xpath']);
|
324 |
if ( ! $elements->length and ! empty( PMXI_Plugin::$session->update_previous ) ) {
|
325 |
+
$_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.', 'wp_all_import_plugin');
|
326 |
}
|
327 |
} else {
|
328 |
// suggest 1st repeating element as default selection
|
343 |
* Helper to evaluate xpath and return matching elements as direct paths for javascript side to highlight them
|
344 |
*/
|
345 |
public function evaluate()
|
346 |
+
{
|
347 |
+
|
348 |
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
349 |
wp_redirect(add_query_arg('action', 'element', $this->baseUrl)); die();
|
350 |
+
}
|
351 |
|
352 |
// HTTP headers for no cache etc
|
353 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
360 |
$post = $this->input->post(array('xpath' => '', 'show_element' => 1, 'root_element' => PMXI_Plugin::$session->source['root_element'], 'delimiter' => '', 'is_csv' => 0));
|
361 |
$wp_uploads = wp_upload_dir();
|
362 |
|
363 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
|
364 |
+
$this->errors->add('form-validation', __('Security check', 'wp_all_import_plugin'));
|
365 |
+
}
|
366 |
+
elseif ('' == $post['xpath']) {
|
367 |
+
$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.', 'wp_all_import_plugin'));
|
368 |
} else {
|
369 |
|
370 |
$source = PMXI_Plugin::$session->get('source');
|
376 |
|
377 |
PMXI_Plugin::$session->set('is_csv', $post['delimiter']);
|
378 |
|
379 |
+
wp_all_import_remove_source(PMXI_Plugin::$session->filePath, false);
|
380 |
|
381 |
$csv = new PMXI_CsvParser( array(
|
382 |
'filename' => PMXI_Plugin::$session->get('csv_path'),
|
453 |
unset($file);
|
454 |
}
|
455 |
if ( ! $this->data['node_list_count']) {
|
456 |
+
$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.', 'wp_all_import_plugin'));
|
457 |
}
|
458 |
}
|
459 |
|
507 |
$this->data['tagno'] = max(intval($this->input->getpost('tagno', 1)), 0);
|
508 |
|
509 |
if ('' == $post['xpath']) {
|
510 |
+
$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.', 'wp_all_import_plugin'));
|
511 |
} else {
|
512 |
$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']),'{}'), '/');
|
513 |
// in default mode
|
514 |
$this->data['variation_elements'] = $elements = @ $xpath->query($post['xpath']); // prevent parsing warning to be displayed
|
515 |
$this->data['variation_list_count'] = $elements->length;
|
516 |
if (FALSE === $elements) {
|
517 |
+
$this->errors->add('form-validation', __('Your XPath is not valid.<br/><br/>Click "get default XPath" to get the default XPath.', 'wp_all_import_plugin'));
|
518 |
} elseif ( ! $elements->length) {
|
519 |
+
$this->errors->add('form-validation', __('No matching variations found for XPath specified', 'wp_all_import_plugin'));
|
520 |
} else {
|
521 |
foreach ($elements as $el) {
|
522 |
if ( ! $el instanceof DOMElement) {
|
523 |
+
$this->errors->add('form-validation', __('XPath must match only elements', 'wp_all_import_plugin'));
|
524 |
break;
|
525 |
};
|
526 |
}
|
553 |
*/
|
554 |
public function tag( $is_json = true )
|
555 |
{
|
556 |
+
|
557 |
+
if ($is_json) check_ajax_referer( 'wp_all_import_secure', 'security' );
|
558 |
|
559 |
$wp_uploads = wp_upload_dir();
|
560 |
|
574 |
$history_file->getBy('id', $history[0]['id']);
|
575 |
|
576 |
if ( PMXI_Plugin::$session->has_session() ){
|
577 |
+
PMXI_Plugin::$session->set('filePath', $history_file->path);
|
|
|
|
|
|
|
578 |
PMXI_Plugin::$session->set('count', $update_previous->count);
|
579 |
PMXI_Plugin::$session->set('encoding', ( ! empty($update_previous->options['encoding'])) ? $update_previous->options['encoding'] : 'UTF-8');
|
580 |
PMXI_Plugin::$session->save_data();
|
660 |
*/
|
661 |
public function preview()
|
662 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
663 |
|
664 |
+
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
665 |
+
exit('Nice try!');
|
666 |
+
}
|
667 |
+
|
668 |
+
if ( ! check_ajax_referer( 'wp_all_import_preview', 'security', false )){
|
669 |
+
$this->errors->add('form-validation', __('Security check', 'wp_all_import_plugin'));
|
670 |
+
}
|
671 |
|
672 |
+
if ( ! $this->errors->get_error_codes()) {
|
673 |
+
|
674 |
+
$post = $this->input->post(array(
|
675 |
+
'title' => '',
|
676 |
+
'content' => '',
|
677 |
+
'is_keep_linebreaks' => 0,
|
678 |
+
'is_leave_html' => 0,
|
679 |
+
'fix_characters' => 0,
|
680 |
+
'import_encoding' => 'UTF-8',
|
681 |
+
'tagno' => 0
|
682 |
+
));
|
683 |
+
$wp_uploads = wp_upload_dir();
|
684 |
+
|
685 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
686 |
+
|
687 |
+
$xml = '';
|
688 |
+
|
689 |
+
$local_paths = ( ! empty(PMXI_Plugin::$session->local_paths) ) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
690 |
|
691 |
+
$loop = 1;
|
692 |
+
foreach ($local_paths as $key => $path) {
|
693 |
|
694 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
695 |
+
// conver CSV to XML with selected encoding
|
696 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
697 |
+
|
698 |
+
$csv = new PMXI_CsvParser(array(
|
699 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
700 |
+
'xpath' => '',
|
701 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
702 |
+
'encoding' => $post['import_encoding'],
|
703 |
+
'xml_path' => $path
|
704 |
+
));
|
705 |
+
}
|
706 |
|
707 |
+
$file = new PMXI_Chunk($path, array(
|
708 |
+
'element' => PMXI_Plugin::$session->source['root_element'],
|
709 |
+
'encoding' => $post['import_encoding']
|
710 |
+
));
|
711 |
+
|
712 |
+
// loop through the file until all lines are read
|
713 |
+
while ($xml = $file->read()) {
|
714 |
+
|
715 |
+
if ( ! empty($xml) )
|
716 |
+
{
|
717 |
+
PMXI_Import_Record::preprocessXml($xml);
|
718 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
719 |
+
|
720 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
721 |
+
$old = libxml_use_internal_errors(true);
|
722 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
723 |
+
libxml_use_internal_errors($old);
|
724 |
+
$xpath = new DOMXPath($dom);
|
725 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
726 |
+
|
727 |
+
if ( $loop == $tagno ){
|
728 |
+
/* Merge nested XML/CSV files */
|
729 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
730 |
+
if ( ! empty($nested_files) ){
|
731 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
732 |
+
$merger->merge();
|
733 |
+
$xml = $merger->get_xml();
|
734 |
+
unset($merger);
|
735 |
+
}*/
|
736 |
+
unset($dom, $xpath, $elements);
|
737 |
+
break(2);
|
738 |
+
}
|
739 |
+
unset($dom, $xpath, $elements);
|
740 |
+
$loop++;
|
741 |
+
}
|
742 |
+
}
|
743 |
+
}
|
744 |
+
unset($file);
|
745 |
}
|
746 |
+
//$this->data['tagno'] = $tagno = 1;
|
747 |
|
748 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
749 |
+
|
750 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
751 |
+
PMXI_Plugin::$session->save_data();
|
752 |
+
|
753 |
+
// validate
|
754 |
+
try {
|
755 |
+
if (empty($xml)){
|
756 |
+
$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.', 'wp_all_import_plugin'));
|
757 |
+
} elseif (empty($post['title'])) {
|
758 |
+
$this->errors->add('form-validation', __('<strong>Warning</strong>: your title is blank.', 'wp_all_import_plugin'));
|
759 |
+
$this->data['title'] = "";
|
760 |
+
} else {
|
761 |
+
list($this->data['title']) = XmlImportParser::factory($xml, $xpath, $post['title'], $file)->parse(); unlink($file);
|
762 |
+
if ( ! isset($this->data['title']) or '' == strval(trim(strip_tags($this->data['title'], '<img><input><textarea><iframe><object><embed>')))) {
|
763 |
+
$this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post title is empty', 'wp_all_import_plugin'));
|
764 |
+
}
|
765 |
+
else $this->data['title'] = ($post['is_leave_html']) ? html_entity_decode($this->data['title']) : $this->data['title'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
766 |
}
|
767 |
+
} catch (XmlImportException $e) {
|
768 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing title: %s', 'wp_all_import_plugin'), $e->getMessage()));
|
769 |
}
|
770 |
+
try {
|
771 |
+
if (empty($xml)){
|
772 |
+
$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.', 'wp_all_import_plugin'));
|
773 |
+
} elseif (empty($post['content'])) {
|
774 |
+
$this->errors->add('form-validation', __('<strong>Warning</strong>: your content is blank.', 'wp_all_import_plugin'));
|
775 |
+
$this->data['content'] = "";
|
776 |
+
} else {
|
777 |
+
list($this->data['content']) = XmlImportParser::factory($post['is_keep_linebreaks'] ? $xml : preg_replace('%\r\n?|\n%', ' ', $xml), $xpath, $post['content'], $file)->parse(); unlink($file);
|
778 |
+
if ( ! isset($this->data['content']) or '' == strval(trim(strip_tags($this->data['content'], '<img><input><textarea><iframe><object><embed>')))) {
|
779 |
+
$this->errors->add('xml-parsing', __('<strong>Warning</strong>: resulting post content is empty', 'wp_all_import_plugin'));
|
780 |
+
}
|
781 |
+
else $this->data['content'] = ($post['is_leave_html']) ? html_entity_decode($this->data['content']) : $this->data['content'];
|
|
|
782 |
}
|
783 |
+
} catch (XmlImportException $e) {
|
784 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing content: %s', 'wp_all_import_plugin'), $e->getMessage()));
|
785 |
}
|
|
|
|
|
786 |
}
|
787 |
|
788 |
ob_start();
|
795 |
*/
|
796 |
public function preview_images()
|
797 |
{
|
798 |
+
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
799 |
+
exit('Nice try!');
|
800 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
|
802 |
+
if ( ! check_ajax_referer( 'wp_all_import_preview', 'security', false )){
|
803 |
+
$this->errors->add('form-validation', __('Security check', 'wp_all_import_plugin'));
|
804 |
+
}
|
805 |
|
806 |
+
if ( ! $this->errors->get_error_codes()) {
|
807 |
|
808 |
+
$post = $this->data['post'] = $this->input->post(array(
|
809 |
+
'download_images' => 'no',
|
810 |
+
'download_featured_delim' => '',
|
811 |
+
'featured_delim' => '',
|
812 |
+
'download_featured_image' => '',
|
813 |
+
'featured_image' => '',
|
814 |
+
'import_encoding' => 'UTF-8',
|
815 |
+
'tagno' => 0
|
816 |
+
));
|
817 |
+
$wp_uploads = wp_upload_dir();
|
818 |
+
|
819 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
820 |
|
821 |
+
$xml = '';
|
822 |
+
|
823 |
+
$local_paths = (!empty(PMXI_Plugin::$session->local_paths)) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
824 |
|
825 |
+
$loop = 1;
|
826 |
+
foreach ($local_paths as $key => $path) {
|
827 |
+
|
828 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
829 |
+
|
830 |
+
// conver CSV to XML with selected encoding
|
831 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
832 |
+
|
833 |
+
$csv = new PMXI_CsvParser(array(
|
834 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
835 |
+
'xpath' => '',
|
836 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
837 |
+
'encoding' => $post['import_encoding'],
|
838 |
+
'xml_path' => $path
|
839 |
+
));
|
840 |
+
|
841 |
+
}
|
842 |
+
|
843 |
+
$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']));
|
844 |
+
|
845 |
+
// loop through the file until all lines are read
|
846 |
+
while ($xml = $file->read()) {
|
847 |
+
if (!empty($xml))
|
848 |
+
{
|
849 |
+
PMXI_Import_Record::preprocessXml($xml);
|
850 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
851 |
+
|
852 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
853 |
+
$old = libxml_use_internal_errors(true);
|
854 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
855 |
+
libxml_use_internal_errors($old);
|
856 |
+
$xpath = new DOMXPath($dom);
|
857 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
858 |
+
|
859 |
+
if ( $loop == $tagno ){
|
860 |
+
/* Merge nested XML/CSV files */
|
861 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
862 |
+
if ( ! empty($nested_files) ){
|
863 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
864 |
+
$merger->merge();
|
865 |
+
$xml = $merger->get_xml();
|
866 |
+
unset($merger);
|
867 |
+
} */
|
868 |
+
unset($dom, $xpath, $elements);
|
869 |
+
break(2);
|
870 |
+
}
|
871 |
+
unset($dom, $xpath, $elements);
|
872 |
+
$loop++;
|
873 |
+
}
|
874 |
+
}
|
875 |
+
}
|
876 |
+
unset($file);
|
877 |
}
|
878 |
+
//$this->data['tagno'] = $tagno = 1;
|
879 |
+
|
880 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
881 |
+
|
882 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
883 |
+
PMXI_Plugin::$session->save_data();
|
884 |
+
|
885 |
+
// validate
|
886 |
+
try {
|
887 |
+
$featured_image = ( 'yes' == $post['download_images']) ? $post['download_featured_image'] : $post['featured_image'];
|
888 |
+
if (empty($xml)){
|
889 |
+
$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.', 'wp_all_import_plugin'));
|
890 |
+
} elseif (empty($featured_image)){
|
891 |
+
$this->data['featured_images'] = false;
|
892 |
+
} else{
|
893 |
+
list($this->data['featured_images']) = XmlImportParser::factory($xml, $xpath, $featured_image, $file)->parse(); unlink($file);
|
894 |
+
}
|
895 |
+
} catch (XmlImportException $e) {
|
896 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'wp_all_import_plugin'), $e->getMessage()));
|
897 |
}
|
|
|
|
|
898 |
}
|
899 |
|
900 |
ob_start();
|
907 |
*/
|
908 |
public function preview_taxonomies()
|
909 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
910 |
|
911 |
+
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
912 |
+
exit('Nice try!');
|
913 |
+
}
|
914 |
|
915 |
+
if ( ! check_ajax_referer( 'wp_all_import_preview', 'security', false )){
|
916 |
+
$this->errors->add('form-validation', __('Security check', 'wp_all_import_plugin'));
|
917 |
+
}
|
918 |
|
919 |
+
if ( ! $this->errors->get_error_codes()) {
|
920 |
|
921 |
+
$post = $this->data['post'] = $this->input->post(array(
|
922 |
+
'tax_logic' => '',
|
923 |
+
'tax_hierarchical_logic_entire' => '',
|
924 |
+
'tax_hierarchical_xpath' => '',
|
925 |
+
'tax_hierarchical_delim' => '>',
|
926 |
+
'is_tax_hierarchical_group_delim' => 0,
|
927 |
+
'tax_hierarchical_group_delim'=> '|',
|
928 |
+
'tax_enable_mapping' => '',
|
929 |
+
'tax_mapping' => '',
|
930 |
+
'tax_logic_mapping' => '',
|
931 |
+
'import_encoding' => 'UTF-8',
|
932 |
+
'tagno' => 0
|
933 |
+
));
|
934 |
+
|
935 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
936 |
|
937 |
+
$xml = '';
|
938 |
+
|
939 |
+
$local_paths = (!empty(PMXI_Plugin::$session->local_paths)) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
940 |
|
941 |
+
$loop = 1;
|
942 |
+
foreach ($local_paths as $key => $path) {
|
943 |
+
|
944 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
945 |
+
// conver CSV to XML with selected encoding
|
946 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
947 |
+
|
948 |
+
$csv = new PMXI_CsvParser(array(
|
949 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
950 |
+
'xpath' => '',
|
951 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
952 |
+
'encoding' => $post['import_encoding'],
|
953 |
+
'xml_path' => $path
|
954 |
+
));
|
955 |
+
}
|
956 |
+
|
957 |
+
$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']));
|
958 |
+
|
959 |
+
// loop through the file until all lines are read
|
960 |
+
while ($xml = $file->read()) {
|
961 |
+
if (!empty($xml))
|
962 |
+
{
|
963 |
+
PMXI_Import_Record::preprocessXml($xml);
|
964 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
965 |
+
|
966 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
967 |
+
$old = libxml_use_internal_errors(true);
|
968 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
969 |
+
libxml_use_internal_errors($old);
|
970 |
+
$xpath = new DOMXPath($dom);
|
971 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
972 |
+
|
973 |
+
if ( $loop == $tagno ){
|
974 |
+
/* Merge nested XML/CSV files */
|
975 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
976 |
+
if ( ! empty($nested_files) ){
|
977 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
978 |
+
$merger->merge();
|
979 |
+
$xml = $merger->get_xml();
|
980 |
+
unset($merger);
|
981 |
+
} */
|
982 |
+
unset($dom, $xpath, $elements);
|
983 |
+
break(2);
|
984 |
+
}
|
985 |
+
unset($dom, $xpath, $elements);
|
986 |
+
$loop++;
|
987 |
+
}
|
988 |
+
}
|
989 |
+
}
|
990 |
+
unset($file);
|
991 |
}
|
992 |
+
//$this->data['tagno'] = $tagno = 1;
|
993 |
+
|
994 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
995 |
+
|
996 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
997 |
+
PMXI_Plugin::$session->save_data();
|
998 |
+
|
999 |
+
// validate
|
1000 |
+
try {
|
1001 |
+
if (empty($xml)){
|
1002 |
+
$this->errors->add('form-validation', __('Error parsing: String could not be parsed as XML', 'wp_all_import_plugin'));
|
1003 |
+
} else{
|
1004 |
+
$data_to_preview = false;
|
1005 |
+
$this->data['tax_hierarchical'] = array();
|
1006 |
+
foreach ($post['tax_logic'] as $ctx => $logic) {
|
1007 |
+
if ( $logic == 'hierarchical' and ! empty($post['tax_hierarchical_logic_entire'][$ctx]) and is_array($post['tax_hierarchical_xpath'][$ctx])){
|
1008 |
+
foreach ($post['tax_hierarchical_xpath'][$ctx] as $ctx_path) { if (empty($ctx_path)) continue;
|
1009 |
+
list($d) = XmlImportParser::factory($xml, $xpath, $ctx_path, $file)->parse(); unlink($file);
|
1010 |
+
if ($post['is_tax_hierarchical_group_delim'][$ctx] and !empty($post['tax_hierarchical_group_delim'][$ctx])){
|
1011 |
+
|
1012 |
+
// apply mapping rules before splitting via separator symbol
|
1013 |
+
if ( ! empty($post['tax_enable_mapping'][$ctx]) and ! empty($post['tax_logic_mapping'][$ctx]) ){
|
1014 |
+
if ( ! empty($post['tax_mapping'][$ctx])){
|
1015 |
+
$mapping_rules = json_decode($post['tax_mapping'][$ctx], true);
|
1016 |
+
if ( ! empty( $mapping_rules) ){
|
1017 |
+
foreach ($mapping_rules as $rule) {
|
1018 |
+
if ( ! empty($rule[trim($d)])){
|
1019 |
+
$d = trim($rule[trim($d)]);
|
1020 |
+
break;
|
1021 |
+
}
|
1022 |
+
}
|
1023 |
+
}
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
$hierarchy_groups = explode($post['tax_hierarchical_group_delim'][$ctx], $d);
|
1028 |
+
if (!empty($hierarchy_groups) and is_array($hierarchy_groups)){
|
1029 |
+
foreach ($hierarchy_groups as $key => $group) {
|
1030 |
+
$this->data['tax_hierarchical'][$ctx][] = $group;
|
1031 |
+
}
|
1032 |
+
}
|
1033 |
+
}
|
1034 |
+
else{
|
1035 |
+
$this->data['tax_hierarchical'][$ctx][] = $d;
|
1036 |
+
}
|
1037 |
+
}
|
1038 |
+
|
1039 |
+
$data_to_preview = true;
|
1040 |
+
}
|
1041 |
}
|
1042 |
+
if ( ! $data_to_preview )
|
1043 |
+
$this->errors->add('form-validation', __('There is no data to preview', 'wp_all_import_plugin'));
|
1044 |
}
|
1045 |
+
} catch (XmlImportException $e) {
|
1046 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'wp_all_import_plugin'), $e->getMessage()));
|
1047 |
}
|
|
|
|
|
1048 |
}
|
1049 |
|
1050 |
ob_start();
|
1057 |
*/
|
1058 |
public function preview_prices()
|
1059 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1060 |
|
1061 |
+
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
1062 |
+
exit('Nice try!');
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
if ( ! check_ajax_referer( 'wp_all_import_preview', 'security', false )){
|
1066 |
+
$this->errors->add('form-validation', __('Security check', 'wp_all_import_plugin'));
|
1067 |
+
}
|
1068 |
|
1069 |
+
if ( ! $this->errors->get_error_codes()) {
|
1070 |
|
1071 |
+
$post = $this->data['post'] = $this->input->post(array(
|
1072 |
+
'single_product_regular_price' => '',
|
1073 |
+
'single_product_sale_price' => '',
|
1074 |
+
'disable_prepare_price' => 0,
|
1075 |
+
'single_product_regular_price_adjust' => '',
|
1076 |
+
'single_product_regular_price_adjust_type' => '%',
|
1077 |
+
'single_product_sale_price_adjust' => '',
|
1078 |
+
'single_product_sale_price_adjust_type' => '%',
|
1079 |
+
'import_encoding' => 'UTF-8',
|
1080 |
+
'tagno' => 0
|
1081 |
+
));
|
1082 |
+
|
1083 |
+
$this->data['tagno'] = $tagno = min(max(intval($this->input->getpost('tagno', 1)), 1), PMXI_Plugin::$session->count);
|
1084 |
|
1085 |
+
$xml = '';
|
1086 |
+
|
1087 |
+
$local_paths = (!empty(PMXI_Plugin::$session->local_paths)) ? PMXI_Plugin::$session->local_paths : array(PMXI_Plugin::$session->filePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1088 |
|
1089 |
+
$loop = 1;
|
1090 |
+
foreach ($local_paths as $key => $path) {
|
1091 |
+
|
1092 |
+
if (PMXI_Plugin::$session->encoding != $post['import_encoding'] and ! empty(PMXI_Plugin::$session->csv_paths[$key])){
|
1093 |
+
// conver CSV to XML with selected encoding
|
1094 |
+
include_once(PMXI_Plugin::ROOT_DIR.'/libraries/XmlImportCsvParse.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1095 |
|
1096 |
+
$csv = new PMXI_CsvParser(array(
|
1097 |
+
'filename' => PMXI_Plugin::$session->csv_paths[$key],
|
1098 |
+
'xpath' => '',
|
1099 |
+
'delimiter' => PMXI_Plugin::$is_csv,
|
1100 |
+
'encoding' => $post['import_encoding'],
|
1101 |
+
'xml_path' => $path
|
1102 |
+
));
|
1103 |
}
|
1104 |
+
|
1105 |
+
$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']));
|
1106 |
+
|
1107 |
+
// loop through the file until all lines are read
|
1108 |
+
while ($xml = $file->read()) {
|
1109 |
+
if (!empty($xml))
|
1110 |
+
{
|
1111 |
+
PMXI_Import_Record::preprocessXml($xml);
|
1112 |
+
$xml = "<?xml version=\"1.0\" encoding=\"". $post['import_encoding'] ."\"?>" . "\n" . $xml;
|
1113 |
+
|
1114 |
+
$dom = new DOMDocument('1.0', $post['import_encoding']);
|
1115 |
+
$old = libxml_use_internal_errors(true);
|
1116 |
+
$dom->loadXML($xml); // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
|
1117 |
+
libxml_use_internal_errors($old);
|
1118 |
+
$xpath = new DOMXPath($dom);
|
1119 |
+
if (($this->data['elements'] = $elements = @$xpath->query(PMXI_Plugin::$session->xpath)) and $elements->length){
|
1120 |
+
|
1121 |
+
if ( $loop == $tagno ){
|
1122 |
+
/* Merge nested XML/CSV files */
|
1123 |
+
/*$nested_files = json_decode(PMXI_Plugin::$session->options['nested_files'], true);
|
1124 |
+
if ( ! empty($nested_files) ){
|
1125 |
+
$merger = new PMXI_Nested($dom, $nested_files, $xml, PMXI_Plugin::$session->xpath);
|
1126 |
+
$merger->merge();
|
1127 |
+
$xml = $merger->get_xml();
|
1128 |
+
unset($merger);
|
1129 |
+
} */
|
1130 |
+
unset($dom, $xpath, $elements);
|
1131 |
+
break(2);
|
1132 |
+
}
|
1133 |
+
unset($dom, $xpath, $elements);
|
1134 |
+
$loop++;
|
1135 |
+
}
|
1136 |
+
}
|
1137 |
}
|
1138 |
+
unset($file);
|
1139 |
+
}
|
1140 |
+
//$this->data['tagno'] = $tagno = 1;
|
1141 |
+
|
1142 |
+
$xpath = "(" . PMXI_Plugin::$session->xpath . ")[1]";
|
1143 |
+
|
1144 |
+
PMXI_Plugin::$session->set('encoding', $post['import_encoding']);
|
1145 |
+
PMXI_Plugin::$session->save_data();
|
1146 |
+
|
1147 |
+
// validate
|
1148 |
+
try {
|
1149 |
+
if (empty($xml)){
|
1150 |
+
$this->errors->add('form-validation', __('Error parsing: String could not be parsed as XML', 'wp_all_import_plugin'));
|
1151 |
+
} else{
|
1152 |
+
$data_to_preview = false;
|
1153 |
+
|
1154 |
+
if ("" != $post['single_product_regular_price']){
|
1155 |
+
list($this->data['product_regular_price']) = XmlImportParser::factory($xml, $xpath, $post['single_product_regular_price'], $file)->parse(); unlink($file);
|
1156 |
+
$this->data['product_regular_price'] = pmwi_adjust_price(pmwi_prepare_price($this->data['product_regular_price'], $post['disable_prepare_price']), 'regular_price', $post);
|
1157 |
+
$data_to_preview = true;
|
1158 |
+
|
1159 |
+
}
|
1160 |
+
if ("" != $post['single_product_sale_price']){
|
1161 |
+
list($this->data['product_sale_price']) = XmlImportParser::factory($xml, $xpath, $post['single_product_sale_price'], $file)->parse(); unlink($file);
|
1162 |
+
$this->data['product_sale_price'] = pmwi_adjust_price(pmwi_prepare_price($this->data['product_sale_price'], $post['disable_prepare_price']), 'sale_price', $post);
|
1163 |
+
$data_to_preview = true;
|
1164 |
+
|
1165 |
+
}
|
1166 |
|
1167 |
+
if ( ! $data_to_preview )
|
1168 |
+
$this->errors->add('form-validation', __('There is no data to preview', 'wp_all_import_plugin'));
|
1169 |
+
}
|
1170 |
+
} catch (XmlImportException $e) {
|
1171 |
+
$this->errors->add('form-validation', sprintf(__('Error parsing: %s', 'wp_all_import_plugin'), $e->getMessage()));
|
1172 |
}
|
|
|
|
|
1173 |
}
|
1174 |
|
1175 |
ob_start();
|
1200 |
|
1201 |
} else {
|
1202 |
$this->data['source_type'] = $this->data['import']->type;
|
1203 |
+
$DefaultOptions = (is_array($this->data['import']->options)) ? $this->data['import']->options + $default : $default;
|
1204 |
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1205 |
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1206 |
}
|
1244 |
$this->_validate_template($post['title'], 'Post title');
|
1245 |
}
|
1246 |
else{
|
1247 |
+
$this->warnings->add('1', __('<strong>Warning:</strong> your title is blank.', 'wp_all_import_plugin'));
|
1248 |
}
|
1249 |
|
1250 |
if (!empty($post['content'])) {
|
1251 |
$this->_validate_template($post['content'], 'Post content');
|
1252 |
}
|
1253 |
else{
|
1254 |
+
$this->warnings->add('2', __('<strong>Warning:</strong> your content is blank.', 'wp_all_import_plugin'));
|
1255 |
}
|
1256 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
1257 |
if ( ! $this->errors->get_error_codes()) {
|
1258 |
|
1259 |
if ( ! empty($post['name'])) { // save template in database
|
1278 |
|
1279 |
// validate
|
1280 |
if (array_keys(array_filter($post['custom_name'], 'strlen')) != array_keys(array_filter($post['custom_value'], 'strlen')) and ! count(array_filter($post['custom_format'])) ) {
|
1281 |
+
$this->errors->add('form-validation', __('Both name and value must be set for all custom parameters', 'wp_all_import_plugin'));
|
1282 |
} else {
|
1283 |
foreach ($post['custom_name'] as $custom_name) {
|
1284 |
+
$this->_validate_template($custom_name, __('Custom Field Name', 'wp_all_import_plugin'));
|
1285 |
}
|
1286 |
foreach ($post['custom_value'] as $key => $custom_value) {
|
1287 |
if ( empty($post['custom_format'][$key]) )
|
1288 |
+
$this->_validate_template($custom_value, __('Custom Field Value', 'wp_all_import_plugin'));
|
|
|
|
|
|
|
|
|
|
|
1289 |
}
|
1290 |
}
|
1291 |
|
1298 |
|
1299 |
// validate
|
1300 |
if (array_keys(array_filter($post['attribute_name'], 'strlen')) != array_keys(array_filter($post['attribute_value'], 'strlen'))) {
|
1301 |
+
$this->errors->add('form-validation', __('Both name and value must be set for all woocommerce attributes', 'wp_all_import_plugin'));
|
1302 |
} else {
|
1303 |
foreach ($post['attribute_name'] as $attribute_name) {
|
1304 |
+
$this->_validate_template($attribute_name, __('Attribute Field Name', 'wp_all_import_plugin'));
|
1305 |
}
|
1306 |
foreach ($post['attribute_value'] as $custom_value) {
|
1307 |
+
$this->_validate_template($custom_value, __('Attribute Field Value', 'wp_all_import_plugin'));
|
1308 |
}
|
1309 |
}
|
1310 |
|
1311 |
}
|
1312 |
+
|
1313 |
+
/*if ('page' == $post['type'] and ! preg_match('%^(-?\d+)?$%', $post['order'])) {
|
1314 |
+
$this->errors->add('form-validation', __('Order must be an integer number', 'wp_all_import_plugin'));
|
1315 |
+
}*/
|
1316 |
+
if ('post' == $post['type']) {
|
1317 |
+
/*'' == $post['categories'] or $this->_validate_template($post['categories'], __('Categories', 'wp_all_import_plugin'));*/
|
1318 |
+
'' == $post['tags'] or $this->_validate_template($post['tags'], __('Tags', 'wp_all_import_plugin'));
|
1319 |
}
|
1320 |
if ('specific' == $post['date_type']) {
|
1321 |
+
'' == $post['date'] or $this->_validate_template($post['date'], __('Date', 'wp_all_import_plugin'));
|
1322 |
} else {
|
1323 |
+
'' == $post['date_start'] or $this->_validate_template($post['date_start'], __('Start Date', 'wp_all_import_plugin'));
|
1324 |
+
'' == $post['date_end'] or $this->_validate_template($post['date_end'], __('Start Date', 'wp_all_import_plugin'));
|
1325 |
+
}
|
1326 |
+
/*if ('' == $post['tags_delim']) {
|
1327 |
+
$this->errors->add('form-validation', __('Tag list delimiter must cannot be empty', 'wp_all_import_plugin'));
|
1328 |
+
}*/
|
1329 |
|
1330 |
$this->errors = apply_filters('pmxi_options_validation', $this->errors, $post, $this->data['import']);
|
1331 |
|
1344 |
$this->data['import']->set(array( 'options' => $post, 'settings_update_on' => date('Y-m-d H:i:s')))->update();
|
1345 |
$args = array(
|
1346 |
'page' => 'pmxi-admin-manage',
|
1347 |
+
'pmxi_nt' => urlencode(__('Template updated', 'wp_all_import_plugin'))
|
1348 |
);
|
1349 |
|
1350 |
if ($this->warnings->get_error_codes())
|
1351 |
$args['warnings'] = implode(',', $this->warnings->get_error_codes());
|
1352 |
+
|
1353 |
wp_redirect(add_query_arg( $args + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)) ,admin_url('admin.php')));
|
1354 |
die();
|
1355 |
}
|
1399 |
$meta_keys = new PMXI_Model_List();
|
1400 |
$meta_keys->setTable(PMXI_Plugin::getInstance()->getWPPrefix() . 'usermeta');
|
1401 |
$meta_keys->setColumns('umeta_id', 'meta_key')->getBy(NULL, "umeta_id", NULL, NULL, "meta_key");
|
1402 |
+
$hide_fields = array('first_name', 'last_name', 'nickname', 'description', PMXI_Plugin::getInstance()->getWPPrefix() . 'capabilities');
|
1403 |
if ( ! empty($meta_keys) and $meta_keys->count() ){
|
1404 |
foreach ($meta_keys as $meta_key) { if (in_array($meta_key['meta_key'], $hide_fields) or strpos($meta_key['meta_key'], '_wp') === 0) continue;
|
1405 |
$this->data['meta_keys'][] = $meta_key['meta_key'];
|
1425 |
$parser = new XmlImportTemplateParser($tokens);
|
1426 |
$tree = $parser->parse();
|
1427 |
} catch (XmlImportException $e) {
|
1428 |
+
$this->errors->add('form-validation', sprintf(__('%s template is invalid: %s', 'wp_all_import_plugin'), $field_title, $e->getMessage()));
|
1429 |
}
|
1430 |
}
|
1431 |
|
1449 |
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your title is blank.'));
|
1450 |
if (empty(PMXI_Plugin::$session->options['content']))
|
1451 |
$this->warnings->add('form-validation', __('<strong>Warning:</strong> your content is blank.'));
|
1452 |
+
|
|
|
|
|
|
|
|
|
1453 |
$DefaultOptions['unique_key'] = PMXI_Plugin::$session->options['title'];
|
1454 |
|
1455 |
$keys_black_list = array('programurl');
|
1480 |
|
1481 |
$DefaultOptions['unique_key'] = apply_filters('pmxi_unique_key', $DefaultOptions['unique_key'], PMXI_Plugin::$session->options);
|
1482 |
|
1483 |
+
if ($DefaultOptions['custom_type'] == "product" and class_exists('PMWI_Plugin') and $DefaultOptions['wizard_type'] != 'new'){
|
1484 |
+
$DefaultOptions['duplicate_indicator'] = 'custom field';
|
1485 |
+
$DefaultOptions['custom_duplicate_name'] = '_sku';
|
1486 |
+
}
|
1487 |
+
|
1488 |
$post = $this->input->post( $DefaultOptions );
|
1489 |
|
1490 |
} else {
|
1491 |
$this->data['source_type'] = $this->data['import']->type;
|
1492 |
+
$DefaultOptions = (is_array($this->data['import']->options)) ? $this->data['import']->options + $default : $default;
|
1493 |
foreach (PMXI_Admin_Addons::get_active_addons() as $class) {
|
1494 |
if (class_exists($class)) $DefaultOptions += call_user_func(array($class, "get_default_import_options"));
|
1495 |
}
|
1517 |
|
1518 |
if ($post['is_import_specified']) {
|
1519 |
if (empty($post['import_specified'])) {
|
1520 |
+
$this->errors->add('form-validation', __('Records to import must be specified or uncheck `Import only specified records` option to process all records', 'wp_all_import_plugin'));
|
1521 |
} else {
|
1522 |
$chanks = preg_split('% *, *%', $post['import_specified']);
|
1523 |
foreach ($chanks as $chank) {
|
1524 |
if ( ! preg_match('%^([1-9]\d*)( *- *([1-9]\d*))?$%', $chank, $mtch)) {
|
1525 |
+
$this->errors->add('form-validation', __('Wrong format of `Import only specified records` value', 'wp_all_import_plugin'));
|
1526 |
break;
|
1527 |
} elseif (isset($mtch[3]) and intval($mtch[3]) > PMXI_Plugin::$session->count) {
|
1528 |
+
$this->errors->add('form-validation', __('One of the numbers in `Import only specified records` value exceeds record quantity in XML file', 'wp_all_import_plugin'));
|
1529 |
break;
|
1530 |
}
|
1531 |
}
|
1532 |
}
|
1533 |
}
|
1534 |
if ('manual' != $post['duplicate_matching'] and '' == $post['unique_key']) {
|
1535 |
+
$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', 'wp_all_import_plugin'));
|
1536 |
} elseif ('manual' != $post['duplicate_matching']) {
|
1537 |
+
$this->_validate_template($post['unique_key'], __('Post Unique Key', 'wp_all_import_plugin'));
|
1538 |
}
|
1539 |
if ( 'manual' == $post['duplicate_matching'] and 'custom field' == $post['duplicate_indicator']){
|
1540 |
if ('' == $post['custom_duplicate_name'])
|
1541 |
+
$this->errors->add('form-validation', __('Custom field name must be specified.', 'wp_all_import_plugin'));
|
1542 |
if ('' == $post['custom_duplicate_value'])
|
1543 |
+
$this->errors->add('form-validation', __('Custom field value must be specified.', 'wp_all_import_plugin'));
|
1544 |
}
|
1545 |
|
1546 |
// Categories/taxonomies logic
|
1571 |
if ($this->data['import']['path'] != $filePath){
|
1572 |
$uploader = new PMXI_Upload($filePath, $this->errors);
|
1573 |
$upload_result = $uploader->upload();
|
1574 |
+
}
|
1575 |
|
1576 |
break;
|
1577 |
+
|
1578 |
default:
|
1579 |
|
1580 |
+
$this->errors->add('form-validation', __('WP All Import doesn\'t support this import type.', 'wp_all_import_plugin'));
|
1581 |
|
1582 |
break;
|
1583 |
}
|
1621 |
|
1622 |
if ( (int) $loop === 0 ){
|
1623 |
|
1624 |
+
$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.', 'wp_all_import_plugin'));
|
1625 |
|
1626 |
$file = new PMXI_Chunk($upload_result['filePath'], array('element' => ( ! empty($upload_result['root_element'])) ? $upload_result['root_element'] : ''));
|
1627 |
|
1666 |
|
1667 |
}
|
1668 |
else{
|
1669 |
+
$this->errors->add('form-validation', __('Root element not found for uploaded feed.', 'wp_all_import_plugin'));
|
1670 |
}
|
1671 |
|
1672 |
}
|
1718 |
'registered_on' => date('Y-m-d H:i:s'),
|
1719 |
))->save();
|
1720 |
|
1721 |
+
wp_redirect(add_query_arg(array('page' => 'pmxi-admin-manage', 'pmxi_nt' => urlencode($is_update ? __('Import updated', 'wp_all_import_plugin') : __('Import created', 'wp_all_import_plugin'))), admin_url('admin.php'))); die();
|
1722 |
}
|
1723 |
|
1724 |
} else {
|
1750 |
'type' => 'upload',
|
1751 |
'path' => $filePath,
|
1752 |
);
|
1753 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1754 |
}
|
1755 |
|
1756 |
// if new file is successfully uploaded
|
1762 |
foreach ($history as $file){
|
1763 |
if ( @file_exists($file['path']) and $file['path'] != $upload_result['filePath'] ){
|
1764 |
if (in_array($this->data['import']->type, array('upload')))
|
1765 |
+
wp_all_import_remove_source($file['path'], false);
|
1766 |
else
|
1767 |
+
wp_all_import_remove_source($file['path']);
|
1768 |
}
|
1769 |
$history_file = new PMXI_File_Record();
|
1770 |
$history_file->getBy('id', $file['id']);
|
1780 |
//'contents' => $this->get_xml(),
|
1781 |
'registered_on' => date('Y-m-d H:i:s')
|
1782 |
))->save();
|
1783 |
+
}
|
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', 'wp_all_import_plugin'))) + array_intersect_key($_GET, array_flip($this->baseUrlParamNames)), admin_url('admin.php'))); die();
|
1790 |
}
|
1791 |
else{
|
1792 |
|
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 |
}
|
1867 |
|
1868 |
$this->data['post'] =& $DefaultOptions;
|
1948 |
foreach ($historyLogs as $i => $file){
|
1949 |
$historyRecord = new PMXI_History_Record();
|
1950 |
$historyRecord->getBy('id', $file['id']);
|
1951 |
+
if ( ! $historyRecord->isEmpty()) $historyRecord->delete(); // unlink history file only
|
1952 |
if ($i == $logsToRemove)
|
1953 |
break;
|
1954 |
}
|
1985 |
foreach ($history as $file){
|
1986 |
if ( @file_exists($file['path']) and $file['path'] != PMXI_Plugin::$session->filePath ){
|
1987 |
if (in_array($import->type, array('upload')))
|
1988 |
+
wp_all_import_remove_source($file['path'], false);
|
1989 |
else
|
1990 |
+
wp_all_import_remove_source($file['path']);
|
1991 |
}
|
1992 |
$history_file = new PMXI_File_Record();
|
1993 |
$history_file->getBy('id', $file['id']);
|
2051 |
|
2052 |
if ( $chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count ){
|
2053 |
$feed .= "</pmxi_records>";
|
2054 |
+
$chunk_file_path = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY) . DIRECTORY_SEPARATOR . "pmxi_chunk_" . count($chunk_files) . "_" . basename($path);
|
2055 |
file_put_contents($chunk_file_path, $feed);
|
2056 |
$chunk_files[] = $chunk_file_path;
|
2057 |
$chunk_records_count = 0;
|
2066 |
PMXI_Plugin::$session->save_data();
|
2067 |
|
2068 |
if ( $log_storage ){
|
2069 |
+
$log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id ) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
|
2070 |
if ( PMXI_Plugin::$session->action != 'continue' and file_exists($log_file)){
|
2071 |
+
wp_all_import_remove_source($log_file, false);
|
2072 |
}
|
2073 |
}
|
2074 |
|
2094 |
|
2095 |
$ajax_processing = ("ajax" == $import->options['import_processing']) ? true : false;
|
2096 |
|
2097 |
+
if ( PMXI_Plugin::is_ajax() and $ajax_processing and ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
|
2098 |
+
exit( __('Security check', 'wp_all_import_plugin') );
|
2099 |
+
}
|
2100 |
+
|
2101 |
if ($ajax_processing)
|
2102 |
+
{
|
2103 |
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; flush();');
|
2104 |
}
|
2105 |
else
|
2106 |
{
|
2107 |
+
$logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; if ( "" != strip_tags(wp_all_import_strip_tags_content($m))) { PMXI_Plugin::$session->log .= "<p>".strip_tags(wp_all_import_strip_tags_content($m))."</p>"; flush(); }');
|
2108 |
}
|
2109 |
|
2110 |
PMXI_Plugin::$session->set('start_time', (empty(PMXI_Plugin::$session->start_time)) ? time() : PMXI_Plugin::$session->start_time);
|
2116 |
$iteration_start_time = time();
|
2117 |
|
2118 |
if ( $log_storage )
|
2119 |
+
$log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id ) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
|
2120 |
|
2121 |
if ( $ajax_processing ) {
|
2122 |
// HTTP headers for no cache etc
|
2160 |
|
2161 |
foreach (PMXI_Plugin::$session->local_paths as $key => $path) {
|
2162 |
|
2163 |
+
$import_done = ($import->imported + $import->skipped == $records_to_import ) ? true : false;
|
2164 |
|
2165 |
if ( $import_done ) {
|
2166 |
+
if (strpos($path, "pmxi_chunk_") !== false and @file_exists($path)) wp_all_import_remove_source($path, false);
|
2167 |
PMXI_Plugin::$session->set('local_paths', array());
|
2168 |
PMXI_Plugin::$session->save_data();
|
2169 |
break;
|
2209 |
|
2210 |
$feed .= $xml; $loop += $elements->length;
|
2211 |
|
2212 |
+
$processed_records = $import->imported + $import->skipped;
|
2213 |
|
2214 |
if ( $loop == $records_per_request or $processed_records + $loop == $records_to_import or $processed_records == $records_to_import) {
|
2215 |
|
2282 |
do_action( 'pmxi_after_xml_import', $import->id );
|
2283 |
|
2284 |
if ("ajax" != $import->options['import_processing'] and $log_storage ){
|
2285 |
+
$log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id ) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
|
2286 |
if (PMXI_Plugin::$session->action != 'continue'){
|
2287 |
@file_put_contents($log_file, PMXI_Plugin::$session->log);
|
2288 |
}
|
2315 |
PMXI_Plugin::$session->clean_session($import->id); // clear session data (prevent from reimporting the same data on page refresh)
|
2316 |
|
2317 |
// [indicate in header process is complete]
|
2318 |
+
$msg = ( ! empty($import->canceled) ) ? addcslashes(__('Canceled', 'wp_all_import_plugin'), "\n\r") : addcslashes(__('Complete', 'wp_all_import_plugin'), "\n\r");
|
2319 |
|
2320 |
if ( $ajax_processing ) ob_start();
|
2321 |
|
controllers/admin/license.php
DELETED
@@ -1,190 +0,0 @@
|
|
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
@@ -47,9 +47,10 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
47 |
|
48 |
$this->data['page_links'] = paginate_links(array(
|
49 |
'base' => add_query_arg('pagenum', '%#%', $this->baseUrl),
|
|
|
50 |
'format' => '',
|
51 |
-
'prev_text' => __('«', '
|
52 |
-
'next_text' => __('»', '
|
53 |
'total' => ceil($list->total() / $perPage),
|
54 |
'current' => $pagenum,
|
55 |
));
|
@@ -100,24 +101,30 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
100 |
* Cancel import processing
|
101 |
*/
|
102 |
public function cancel(){
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
/**
|
@@ -180,25 +187,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
180 |
// upload new file in case when import is not continue
|
181 |
if ( empty(PMXI_Plugin::$session->chunk_number) ) {
|
182 |
|
183 |
-
if ($item->type == '
|
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();
|
@@ -206,7 +195,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
206 |
$this->errors = $upload_result;
|
207 |
else
|
208 |
$filePath = $upload_result['filePath'];
|
209 |
-
}
|
210 |
|
211 |
if (empty($item->options['encoding'])){
|
212 |
$currentOptions = $item->options;
|
@@ -214,7 +203,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
214 |
$item->set(array(
|
215 |
'options' => $currentOptions
|
216 |
))->update();
|
217 |
-
}
|
218 |
|
219 |
@set_time_limit(0);
|
220 |
|
@@ -252,7 +241,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
252 |
}
|
253 |
|
254 |
if (empty($chunks))
|
255 |
-
$this->errors->add('form-validation', __('No matching elements found for Root element and XPath expression specified', '
|
256 |
|
257 |
}
|
258 |
|
@@ -285,7 +274,8 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
285 |
'pointer' => 1,
|
286 |
'count' => (isset($chunks)) ? $chunks : 0,
|
287 |
'local_paths' => (!empty($local_paths)) ? $local_paths : array(), // ftp import local copies of remote files
|
288 |
-
'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
|
|
|
289 |
);
|
290 |
|
291 |
foreach ($sesson_data as $key => $value) {
|
@@ -325,7 +315,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
325 |
do_action('pmxi_before_import_delete', $item, $this->input->post('is_delete_posts'));
|
326 |
|
327 |
$item->delete( ! $this->input->post('is_delete_posts'));
|
328 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Import deleted', '
|
329 |
}
|
330 |
|
331 |
$this->render();
|
@@ -353,7 +343,7 @@ class PMXI_Admin_Manage extends PMXI_Controller_Admin {
|
|
353 |
$item->delete( ! $is_delete_posts);
|
354 |
}
|
355 |
|
356 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(__('<strong>%d</strong> %s deleted', '
|
357 |
}
|
358 |
|
359 |
$this->render();
|
47 |
|
48 |
$this->data['page_links'] = paginate_links(array(
|
49 |
'base' => add_query_arg('pagenum', '%#%', $this->baseUrl),
|
50 |
+
'add_args' => array('page' => 'pmxi-admin-manage'),
|
51 |
'format' => '',
|
52 |
+
'prev_text' => __('«', 'wp_all_import_plugin'),
|
53 |
+
'next_text' => __('»', 'wp_all_import_plugin'),
|
54 |
'total' => ceil($list->total() / $perPage),
|
55 |
'current' => $pagenum,
|
56 |
));
|
101 |
* Cancel import processing
|
102 |
*/
|
103 |
public function cancel(){
|
104 |
+
|
105 |
+
$nonce = (!empty($_REQUEST['_wpnonce'])) ? $_REQUEST['_wpnonce'] : '';
|
106 |
+
if ( ! wp_verify_nonce( $nonce, '_wpnonce-cancel_import' ) ) {
|
107 |
+
die( __('Security check', 'wp_all_import_plugin') );
|
108 |
+
} else {
|
109 |
|
110 |
+
$id = $this->input->get('id');
|
111 |
+
|
112 |
+
PMXI_Plugin::$session->clean_session( $id );
|
113 |
|
114 |
+
$item = new PMXI_Import_Record();
|
115 |
+
if ( ! $id or $item->getById($id)->isEmpty()) {
|
116 |
+
wp_redirect($this->baseUrl); die();
|
117 |
+
}
|
118 |
+
$item->set(array(
|
119 |
+
'triggered' => 0,
|
120 |
+
'processing' => 0,
|
121 |
+
'executing' => 0,
|
122 |
+
'canceled' => 1,
|
123 |
+
'canceled_on' => date('Y-m-d H:i:s')
|
124 |
+
))->update();
|
125 |
+
|
126 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Import canceled', 'wp_all_import_plugin')), $this->baseUrl)); die();
|
127 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
/**
|
187 |
// upload new file in case when import is not continue
|
188 |
if ( empty(PMXI_Plugin::$session->chunk_number) ) {
|
189 |
|
190 |
+
if ( $item->type == 'upload' ){ // retrieve already uploaded file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
$uploader = new PMXI_Upload(trim($item->path), $this->errors, rtrim(str_replace(basename($item->path), '', $item->path), '/'));
|
193 |
$upload_result = $uploader->upload();
|
195 |
$this->errors = $upload_result;
|
196 |
else
|
197 |
$filePath = $upload_result['filePath'];
|
198 |
+
}
|
199 |
|
200 |
if (empty($item->options['encoding'])){
|
201 |
$currentOptions = $item->options;
|
203 |
$item->set(array(
|
204 |
'options' => $currentOptions
|
205 |
))->update();
|
206 |
+
}
|
207 |
|
208 |
@set_time_limit(0);
|
209 |
|
241 |
}
|
242 |
|
243 |
if (empty($chunks))
|
244 |
+
$this->errors->add('form-validation', __('No matching elements found for Root element and XPath expression specified', 'wp_all_import_plugin'));
|
245 |
|
246 |
}
|
247 |
|
274 |
'pointer' => 1,
|
275 |
'count' => (isset($chunks)) ? $chunks : 0,
|
276 |
'local_paths' => (!empty($local_paths)) ? $local_paths : array(), // ftp import local copies of remote files
|
277 |
+
'action' => (!empty($action_type) and $action_type == 'continue') ? 'continue' : 'update',
|
278 |
+
'nonce' => wp_create_nonce( 'import' )
|
279 |
);
|
280 |
|
281 |
foreach ($sesson_data as $key => $value) {
|
315 |
do_action('pmxi_before_import_delete', $item, $this->input->post('is_delete_posts'));
|
316 |
|
317 |
$item->delete( ! $this->input->post('is_delete_posts'));
|
318 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Import deleted', 'wp_all_import_plugin')), $this->baseUrl)); die();
|
319 |
}
|
320 |
|
321 |
$this->render();
|
343 |
$item->delete( ! $is_delete_posts);
|
344 |
}
|
345 |
|
346 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(__('<strong>%d</strong> %s deleted', 'wp_all_import_plugin'), $items->count(), _n('import', 'imports', $items->count(), 'wp_all_import_plugin'))), $this->baseUrl)); die();
|
347 |
}
|
348 |
|
349 |
$this->render();
|
controllers/admin/settings.php
CHANGED
@@ -22,7 +22,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
22 |
|
23 |
if ( ! $is_secure_import ){
|
24 |
|
25 |
-
self::$path =
|
26 |
|
27 |
}
|
28 |
else {
|
@@ -30,7 +30,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
30 |
self::$path = get_transient( self::$upload_transient );
|
31 |
|
32 |
if ( empty(self::$path) ) {
|
33 |
-
self::$path =
|
34 |
set_transient( self::$upload_transient, self::$path);
|
35 |
}
|
36 |
|
@@ -40,16 +40,16 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
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
|
46 |
check_admin_referer('edit-settings', '_wpnonce_edit-settings');
|
47 |
|
48 |
if ( ! preg_match('%^\d+$%', $post['history_file_count'])) {
|
49 |
-
$this->errors->add('form-validation', __('History File Count must be a non-negative integer', '
|
50 |
}
|
51 |
if ( ! preg_match('%^\d+$%', $post['history_file_age'])) {
|
52 |
-
$this->errors->add('form-validation', __('History Age must be a non-negative integer', '
|
53 |
}
|
54 |
if (empty($post['html_entities'])) $post['html_entities'] = 0;
|
55 |
if (empty($post['utf8_decode'])) $post['utf8_decode'] = 0;
|
@@ -57,14 +57,26 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
57 |
if ( ! $this->errors->get_error_codes()) { // no validation errors detected
|
58 |
|
59 |
PMXI_Plugin::getInstance()->updateOption($post);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$files = new PMXI_File_List(); $files->sweepHistory(); // adjust file history to new settings specified
|
61 |
|
62 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Settings saved', '
|
63 |
}
|
64 |
-
}
|
65 |
-
|
66 |
if ($this->input->post('is_templates_submitted')) { // delete templates form
|
67 |
|
|
|
|
|
68 |
if ($this->input->post('import_templates')){
|
69 |
|
70 |
if (!empty($_FILES)){
|
@@ -80,7 +92,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
80 |
|
81 |
if (($extension != "txt"))
|
82 |
{
|
83 |
-
$this->errors->add('form-validation', __('Unknown File extension. Only txt files are permitted', '
|
84 |
}
|
85 |
else {
|
86 |
$import_data = @file_get_contents($tmp_name);
|
@@ -93,22 +105,22 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
93 |
unset($template_data['id']);
|
94 |
$template->clear()->set($template_data)->insert();
|
95 |
}
|
96 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(_n('%d template imported', '%d templates imported', count($templates_data), '
|
97 |
}
|
98 |
-
else $this->errors->add('form-validation', __('Wrong imported data format', '
|
99 |
}
|
100 |
-
else $this->errors->add('form-validation', __('File is empty or doesn\'t exests', '
|
101 |
}
|
102 |
}
|
103 |
-
else $this->errors->add('form-validation', __('Undefined entry!', '
|
104 |
}
|
105 |
-
else $this->errors->add('form-validation', __('Please select file.', '
|
106 |
|
107 |
}
|
108 |
else{
|
109 |
$templates_ids = $this->input->post('templates', array());
|
110 |
if (empty($templates_ids)) {
|
111 |
-
$this->errors->add('form-validation', __('Templates must be selected', '
|
112 |
}
|
113 |
|
114 |
if ( ! $this->errors->get_error_codes()) { // no validation errors detected
|
@@ -117,7 +129,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
117 |
foreach ($templates_ids as $template_id) {
|
118 |
$template->clear()->set('id', $template_id)->delete();
|
119 |
}
|
120 |
-
wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(_n('%d template deleted', '%d templates deleted', count($templates_ids), '
|
121 |
}
|
122 |
if ($this->input->post('export_templates')){
|
123 |
$export_data = array();
|
@@ -127,7 +139,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
127 |
}
|
128 |
|
129 |
$uploads = wp_upload_dir();
|
130 |
-
$targetDir = $uploads['basedir'] .
|
131 |
$export_file_name = "templates_".uniqid().".txt";
|
132 |
file_put_contents($targetDir . DIRECTORY_SEPARATOR . $export_file_name, json_encode($export_data));
|
133 |
|
@@ -147,7 +159,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
147 |
|
148 |
$wp_uploads = wp_upload_dir();
|
149 |
|
150 |
-
$dir = $wp_uploads['basedir'] .
|
151 |
|
152 |
$cacheDir = PMXI_Plugin::ROOT_DIR . '/libraries/cache';
|
153 |
|
@@ -155,15 +167,15 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
155 |
|
156 |
$cacheFiles = array_diff(@scandir($cacheDir), array('.','..'));
|
157 |
|
158 |
-
$msg = __('Files not found', '
|
159 |
|
160 |
if ( count($files) or count($cacheFiles)){
|
161 |
|
162 |
-
|
163 |
|
164 |
-
|
165 |
|
166 |
-
$msg = __('Clean Up has been successfully completed.', '
|
167 |
}
|
168 |
|
169 |
wp_redirect(add_query_arg('pmxi_nt', urlencode($msg), $this->baseUrl)); die();
|
@@ -192,6 +204,14 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
192 |
|
193 |
public function meta_values(){
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
global $wpdb;
|
196 |
|
197 |
$meta_key = $_POST['key'];
|
@@ -222,7 +242,11 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
222 |
* License: http://www.plupload.com/license
|
223 |
* Contributing: http://www.plupload.com/contributing
|
224 |
*/
|
225 |
-
public function upload(){
|
|
|
|
|
|
|
|
|
226 |
|
227 |
// HTTP headers for no cache etc
|
228 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
@@ -235,11 +259,11 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
235 |
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
236 |
//$uploads = wp_upload_dir();
|
237 |
|
238 |
-
$targetDir = self::$path
|
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.", "
|
243 |
}
|
244 |
|
245 |
$cleanupTargetDir = true; // Remove old files
|
@@ -259,6 +283,10 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
259 |
// Clean the fileName for security reasons
|
260 |
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
|
261 |
|
|
|
|
|
|
|
|
|
262 |
// Make sure the fileName is unique but only if chunking is disabled
|
263 |
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
|
264 |
$ext = strrpos($fileName, '.');
|
@@ -292,7 +320,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
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.", "
|
296 |
}
|
297 |
|
298 |
|
@@ -317,18 +345,18 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
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.", "
|
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.", "
|
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.", "
|
332 |
}
|
333 |
} else {
|
334 |
// Open temp file
|
@@ -342,14 +370,14 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
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.", "
|
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.", "
|
353 |
}
|
354 |
}
|
355 |
|
@@ -390,7 +418,7 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
390 |
$defaultXpath = "/". $file->options['element'];
|
391 |
else
|
392 |
$is_valid = false;
|
393 |
-
|
394 |
if ( $is_valid ){
|
395 |
|
396 |
while ($xml = $file->read()) {
|
@@ -420,13 +448,13 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
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.', '
|
430 |
|
431 |
<?php
|
432 |
$response = ob_get_clean();
|
@@ -440,10 +468,6 @@ class PMXI_Admin_Settings extends PMXI_Controller_Admin {
|
|
440 |
// Return JSON-RPC response
|
441 |
exit(json_encode(array("jsonrpc" => "2.0", "error" => null, "result" => null, "id" => "id", "name" => $filePath)));
|
442 |
|
443 |
-
}
|
444 |
-
|
445 |
-
public function download(){
|
446 |
-
PMXI_download::csv(PMXI_Plugin::ROOT_DIR.'/logs/'.$_GET['file'].'.txt');
|
447 |
-
}
|
448 |
|
449 |
}
|
22 |
|
23 |
if ( ! $is_secure_import ){
|
24 |
|
25 |
+
self::$path = wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY );
|
26 |
|
27 |
}
|
28 |
else {
|
30 |
self::$path = get_transient( self::$upload_transient );
|
31 |
|
32 |
if ( empty(self::$path) ) {
|
33 |
+
self::$path = wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY );
|
34 |
set_transient( self::$upload_transient, self::$path);
|
35 |
}
|
36 |
|
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
|
46 |
check_admin_referer('edit-settings', '_wpnonce_edit-settings');
|
47 |
|
48 |
if ( ! preg_match('%^\d+$%', $post['history_file_count'])) {
|
49 |
+
$this->errors->add('form-validation', __('History File Count must be a non-negative integer', 'wp_all_import_plugin'));
|
50 |
}
|
51 |
if ( ! preg_match('%^\d+$%', $post['history_file_age'])) {
|
52 |
+
$this->errors->add('form-validation', __('History Age must be a non-negative integer', 'wp_all_import_plugin'));
|
53 |
}
|
54 |
if (empty($post['html_entities'])) $post['html_entities'] = 0;
|
55 |
if (empty($post['utf8_decode'])) $post['utf8_decode'] = 0;
|
57 |
if ( ! $this->errors->get_error_codes()) { // no validation errors detected
|
58 |
|
59 |
PMXI_Plugin::getInstance()->updateOption($post);
|
60 |
+
|
61 |
+
if (empty($_POST['pmxi_license_activate']) and empty($_POST['pmxi_license_deactivate'])) {
|
62 |
+
foreach ($this->data['addons'] as $class => $addon) {
|
63 |
+
$post['statuses'][$class] = $this->check_license($class);
|
64 |
+
}
|
65 |
+
PMXI_Plugin::getInstance()->updateOption($post);
|
66 |
+
}
|
67 |
+
|
68 |
+
isset( $_POST['pmxi_license_activate'] ) and $this->activate_licenses();
|
69 |
+
|
70 |
$files = new PMXI_File_List(); $files->sweepHistory(); // adjust file history to new settings specified
|
71 |
|
72 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Settings saved', 'wp_all_import_plugin')), $this->baseUrl)); die();
|
73 |
}
|
74 |
+
}
|
75 |
+
|
76 |
if ($this->input->post('is_templates_submitted')) { // delete templates form
|
77 |
|
78 |
+
check_admin_referer('delete-templates', '_wpnonce_delete-templates');
|
79 |
+
|
80 |
if ($this->input->post('import_templates')){
|
81 |
|
82 |
if (!empty($_FILES)){
|
92 |
|
93 |
if (($extension != "txt"))
|
94 |
{
|
95 |
+
$this->errors->add('form-validation', __('Unknown File extension. Only txt files are permitted', 'wp_all_import_plugin'));
|
96 |
}
|
97 |
else {
|
98 |
$import_data = @file_get_contents($tmp_name);
|
105 |
unset($template_data['id']);
|
106 |
$template->clear()->set($template_data)->insert();
|
107 |
}
|
108 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(_n('%d template imported', '%d templates imported', count($templates_data), 'wp_all_import_plugin'), count($templates_data))), $this->baseUrl)); die();
|
109 |
}
|
110 |
+
else $this->errors->add('form-validation', __('Wrong imported data format', 'wp_all_import_plugin'));
|
111 |
}
|
112 |
+
else $this->errors->add('form-validation', __('File is empty or doesn\'t exests', 'wp_all_import_plugin'));
|
113 |
}
|
114 |
}
|
115 |
+
else $this->errors->add('form-validation', __('Undefined entry!', 'wp_all_import_plugin'));
|
116 |
}
|
117 |
+
else $this->errors->add('form-validation', __('Please select file.', 'wp_all_import_plugin'));
|
118 |
|
119 |
}
|
120 |
else{
|
121 |
$templates_ids = $this->input->post('templates', array());
|
122 |
if (empty($templates_ids)) {
|
123 |
+
$this->errors->add('form-validation', __('Templates must be selected', 'wp_all_import_plugin'));
|
124 |
}
|
125 |
|
126 |
if ( ! $this->errors->get_error_codes()) { // no validation errors detected
|
129 |
foreach ($templates_ids as $template_id) {
|
130 |
$template->clear()->set('id', $template_id)->delete();
|
131 |
}
|
132 |
+
wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(_n('%d template deleted', '%d templates deleted', count($templates_ids), 'wp_all_import_plugin'), count($templates_ids))), $this->baseUrl)); die();
|
133 |
}
|
134 |
if ($this->input->post('export_templates')){
|
135 |
$export_data = array();
|
139 |
}
|
140 |
|
141 |
$uploads = wp_upload_dir();
|
142 |
+
$targetDir = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY;
|
143 |
$export_file_name = "templates_".uniqid().".txt";
|
144 |
file_put_contents($targetDir . DIRECTORY_SEPARATOR . $export_file_name, json_encode($export_data));
|
145 |
|
159 |
|
160 |
$wp_uploads = wp_upload_dir();
|
161 |
|
162 |
+
$dir = $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY;
|
163 |
|
164 |
$cacheDir = PMXI_Plugin::ROOT_DIR . '/libraries/cache';
|
165 |
|
167 |
|
168 |
$cacheFiles = array_diff(@scandir($cacheDir), array('.','..'));
|
169 |
|
170 |
+
$msg = __('Files not found', 'wp_all_import_plugin');
|
171 |
|
172 |
if ( count($files) or count($cacheFiles)){
|
173 |
|
174 |
+
wp_all_import_clear_directory( $dir );
|
175 |
|
176 |
+
wp_all_import_clear_directory( $cacheDir );
|
177 |
|
178 |
+
$msg = __('Clean Up has been successfully completed.', 'wp_all_import_plugin');
|
179 |
}
|
180 |
|
181 |
wp_redirect(add_query_arg('pmxi_nt', urlencode($msg), $this->baseUrl)); die();
|
204 |
|
205 |
public function meta_values(){
|
206 |
|
207 |
+
if ( ! PMXI_Plugin::getInstance()->getAdminCurrentScreen()->is_ajax) { // call is only valid when send with ajax
|
208 |
+
exit('nice try!');
|
209 |
+
}
|
210 |
+
|
211 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false ) ){
|
212 |
+
exit( json_encode(array('meta_values' => array())) );
|
213 |
+
}
|
214 |
+
|
215 |
global $wpdb;
|
216 |
|
217 |
$meta_key = $_POST['key'];
|
242 |
* License: http://www.plupload.com/license
|
243 |
* Contributing: http://www.plupload.com/contributing
|
244 |
*/
|
245 |
+
public function upload(){
|
246 |
+
|
247 |
+
if ( ! check_ajax_referer( 'wp_all_import_secure', '_wpnonce', false )){
|
248 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __('Security check', 'wp_all_import_plugin')), "id" => "id")));
|
249 |
+
}
|
250 |
|
251 |
// HTTP headers for no cache etc
|
252 |
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
259 |
//$targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
260 |
//$uploads = wp_upload_dir();
|
261 |
|
262 |
+
$targetDir = self::$path;
|
263 |
|
264 |
if (! is_dir($targetDir) || ! is_writable($targetDir)){
|
265 |
delete_transient( self::$upload_transient );
|
266 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Uploads folder is not writable.", "wp_all_import_plugin")), "id" => "id")));
|
267 |
}
|
268 |
|
269 |
$cleanupTargetDir = true; // Remove old files
|
283 |
// Clean the fileName for security reasons
|
284 |
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);
|
285 |
|
286 |
+
if ( ! preg_match('%\W(xml|gzip|zip|csv|gz|json|txt|dat|psv|sql)$%i', trim(basename($fileName)))) {
|
287 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Uploaded file must be XML, CSV, ZIP, GZIP, GZ, JSON, SQL, TXT, DAT or PSV", "wp_all_import_plugin")), "id" => "id")));
|
288 |
+
}
|
289 |
+
|
290 |
// Make sure the fileName is unique but only if chunking is disabled
|
291 |
if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
|
292 |
$ext = strrpos($fileName, '.');
|
320 |
closedir($dir);
|
321 |
} else{
|
322 |
delete_transient( self::$upload_transient );
|
323 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 100, "message" => __("Failed to open temp directory.", "wp_all_import_plugin")), "id" => "id")));
|
324 |
}
|
325 |
|
326 |
|
345 |
fwrite($out, $buff);
|
346 |
} else{
|
347 |
delete_transient( self::$upload_transient );
|
348 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 101, "message" => __("Failed to open input stream.", "wp_all_import_plugin")), "id" => "id")));
|
349 |
}
|
350 |
fclose($in);
|
351 |
fclose($out);
|
352 |
@unlink($_FILES['file']['tmp_name']);
|
353 |
} else{
|
354 |
delete_transient( self::$upload_transient );
|
355 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => __("Failed to open output stream.", "wp_all_import_plugin")), "id" => "id")));
|
356 |
}
|
357 |
} else{
|
358 |
delete_transient( self::$upload_transient );
|
359 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 103, "message" => __("Failed to move uploaded file.", "wp_all_import_plugin")), "id" => "id")));
|
360 |
}
|
361 |
} else {
|
362 |
// Open temp file
|
370 |
fwrite($out, $buff);
|
371 |
} else{
|
372 |
delete_transient( self::$upload_transient );
|
373 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 101, "message" => __("Failed to open input stream.", "wp_all_import_plugin")), "id" => "id")));
|
374 |
}
|
375 |
|
376 |
fclose($in);
|
377 |
fclose($out);
|
378 |
} else{
|
379 |
delete_transient( self::$upload_transient );
|
380 |
+
exit(json_encode(array("jsonrpc" => "2.0", "error" => array("code" => 102, "message" => __("Failed to open output stream.", "wp_all_import_plugin")), "id" => "id")));
|
381 |
}
|
382 |
}
|
383 |
|
418 |
$defaultXpath = "/". $file->options['element'];
|
419 |
else
|
420 |
$is_valid = false;
|
421 |
+
|
422 |
if ( $is_valid ){
|
423 |
|
424 |
while ($xml = $file->read()) {
|
448 |
}
|
449 |
|
450 |
unset($file);
|
451 |
+
|
452 |
if ( ! $is_valid )
|
453 |
{
|
454 |
ob_start();
|
455 |
?>
|
456 |
|
457 |
+
<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.', 'wp_all_import_plugin'); ?></p></div>
|
458 |
|
459 |
<?php
|
460 |
$response = ob_get_clean();
|
468 |
// Return JSON-RPC response
|
469 |
exit(json_encode(array("jsonrpc" => "2.0", "error" => null, "result" => null, "id" => "id", "name" => $filePath)));
|
470 |
|
471 |
+
}
|
|
|
|
|
|
|
|
|
472 |
|
473 |
}
|
controllers/controller.php
CHANGED
@@ -62,21 +62,27 @@ abstract class PMXI_Controller {
|
|
62 |
* @param string[optional] $viewPath Template path to render
|
63 |
*/
|
64 |
protected function render($viewPath = null) {
|
65 |
-
|
66 |
-
if (
|
67 |
-
|
68 |
-
|
69 |
-
}
|
70 |
-
// append file extension if not specified
|
71 |
-
if ( ! preg_match('%\.php$%', $viewPath)) {
|
72 |
-
$viewPath .= '.php';
|
73 |
-
}
|
74 |
-
$filePath = PMXI_Plugin::ROOT_DIR . '/views/' . $viewPath;
|
75 |
-
if (is_file($filePath)) {
|
76 |
-
extract($this->data);
|
77 |
-
include $filePath;
|
78 |
} else {
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
}
|
82 |
|
62 |
* @param string[optional] $viewPath Template path to render
|
63 |
*/
|
64 |
protected function render($viewPath = null) {
|
65 |
+
|
66 |
+
if ( ! get_current_user_id() or ! current_user_can('manage_options')) {
|
67 |
+
// This nonce is not valid.
|
68 |
+
die( 'Security check' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
} else {
|
70 |
+
// assume template file name depending on calling function
|
71 |
+
if (is_null($viewPath)) {
|
72 |
+
$trace = debug_backtrace();
|
73 |
+
$viewPath = str_replace('_', '/', preg_replace('%^' . preg_quote(PMXI_Plugin::PREFIX, '%') . '%', '', strtolower($trace[1]['class']))) . '/' . $trace[1]['function'];
|
74 |
+
}
|
75 |
+
// append file extension if not specified
|
76 |
+
if ( ! preg_match('%\.php$%', $viewPath)) {
|
77 |
+
$viewPath .= '.php';
|
78 |
+
}
|
79 |
+
$filePath = PMXI_Plugin::ROOT_DIR . '/views/' . $viewPath;
|
80 |
+
if (is_file($filePath)) {
|
81 |
+
extract($this->data);
|
82 |
+
include $filePath;
|
83 |
+
} else {
|
84 |
+
throw new Exception("Requested template file $filePath is not found.");
|
85 |
+
}
|
86 |
}
|
87 |
}
|
88 |
|
controllers/controller/admin.php
CHANGED
@@ -28,13 +28,25 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
28 |
|
29 |
$p_url = parse_url( site_url() );
|
30 |
|
31 |
-
$url = $p_url['scheme'] . '://' . $p_url['host']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
if ($remove) {
|
34 |
$this->baseUrl = $url . remove_query_arg($remove);
|
35 |
} else {
|
36 |
$this->baseUrl = $url . $_SERVER['REQUEST_URI'];
|
37 |
}
|
|
|
38 |
parent::__construct();
|
39 |
|
40 |
// add special filter for url fields
|
@@ -45,37 +57,37 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
45 |
if ( ! is_a($wp_styles, 'WP_Styles'))
|
46 |
$wp_styles = new WP_Styles();
|
47 |
|
48 |
-
wp_enqueue_style('jquery-ui',
|
49 |
-
wp_enqueue_style('jquery-tipsy',
|
50 |
-
wp_enqueue_style('pmxi-admin-style',
|
51 |
-
wp_enqueue_style('pmxi-admin-style-ie',
|
52 |
-
wp_enqueue_style('jquery-select2',
|
53 |
-
wp_enqueue_style('jquery-select2',
|
54 |
-
add_editor_style(
|
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',
|
61 |
}
|
62 |
if ( version_compare(get_bloginfo('version'), '4.0-beta3') >= 0 ){
|
63 |
-
wp_enqueue_style('pmxi-admin-style-wp-3.8',
|
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')) {
|
68 |
-
wp_enqueue_style('pmxi-admin-style-color',
|
69 |
}
|
70 |
|
71 |
-
wp_enqueue_script('jquery-ui-datepicker',
|
72 |
-
wp_enqueue_script('jquery-ui-autocomplete',
|
73 |
-
wp_enqueue_script('jquery-tipsy',
|
74 |
-
wp_enqueue_script('jquery-nestable',
|
75 |
-
wp_enqueue_script('jquery-moment',
|
76 |
-
wp_enqueue_script('jquery-select2',
|
77 |
-
wp_enqueue_script('jquery-ddslick',
|
78 |
-
wp_enqueue_script('jquery-contextmenu',
|
79 |
wp_enqueue_script('wp-pointer');
|
80 |
|
81 |
/* load plupload scripts */
|
@@ -83,11 +95,11 @@ abstract class PMXI_Controller_Admin extends PMXI_Controller {
|
|
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',
|
87 |
-
wp_enqueue_script('full-plupload',
|
88 |
-
wp_enqueue_script('jquery-plupload',
|
89 |
|
90 |
-
wp_enqueue_script('pmxi-admin-script',
|
91 |
|
92 |
}
|
93 |
|
28 |
|
29 |
$p_url = parse_url( site_url() );
|
30 |
|
31 |
+
$url = $p_url['scheme'] . '://' . $p_url['host'];
|
32 |
+
|
33 |
+
if (!empty($_POST['is_settings_submitted'])) { // save settings form
|
34 |
+
$post = array(
|
35 |
+
'port' => $_POST['port']
|
36 |
+
);
|
37 |
+
PMXI_Plugin::getInstance()->updateOption($post);
|
38 |
+
}
|
39 |
+
|
40 |
+
$port = PMXI_Plugin::getInstance()->getOption('port');
|
41 |
+
|
42 |
+
if (!empty($port) and is_numeric($port)) $url .= ':' . $port;
|
43 |
|
44 |
if ($remove) {
|
45 |
$this->baseUrl = $url . remove_query_arg($remove);
|
46 |
} else {
|
47 |
$this->baseUrl = $url . $_SERVER['REQUEST_URI'];
|
48 |
}
|
49 |
+
|
50 |
parent::__construct();
|
51 |
|
52 |
// add special filter for url fields
|
57 |
if ( ! is_a($wp_styles, 'WP_Styles'))
|
58 |
$wp_styles = new WP_Styles();
|
59 |
|
60 |
+
wp_enqueue_style('jquery-ui', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/redmond/jquery-ui.css');
|
61 |
+
wp_enqueue_style('jquery-tipsy', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/smoothness/jquery.tipsy.css');
|
62 |
+
wp_enqueue_style('pmxi-admin-style', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin.css');
|
63 |
+
wp_enqueue_style('pmxi-admin-style-ie', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-ie.css');
|
64 |
+
wp_enqueue_style('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/select2/select2.css');
|
65 |
+
wp_enqueue_style('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/select2/select2-bootstrap.css');
|
66 |
+
add_editor_style( WP_ALL_IMPORT_ROOT_URL . '/static/css/custom-editor-style.css' );
|
67 |
|
68 |
$wp_styles->add_data('pmxi-admin-style-ie', 'conditional', 'lte IE 7');
|
69 |
wp_enqueue_style('wp-pointer');
|
70 |
|
71 |
if ( version_compare(get_bloginfo('version'), '3.8-RC1') >= 0 ){
|
72 |
+
wp_enqueue_style('pmxi-admin-style-wp-3.8', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-wp-3.8.css');
|
73 |
}
|
74 |
if ( version_compare(get_bloginfo('version'), '4.0-beta3') >= 0 ){
|
75 |
+
wp_enqueue_style('pmxi-admin-style-wp-3.8', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-wp-4.0.css');
|
76 |
}
|
77 |
|
78 |
$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';
|
79 |
if (is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
|
80 |
+
wp_enqueue_style('pmxi-admin-style-color', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-colors-' . $scheme_color . '.css');
|
81 |
}
|
82 |
|
83 |
+
wp_enqueue_script('jquery-ui-datepicker', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
|
84 |
+
wp_enqueue_script('jquery-ui-autocomplete', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
|
85 |
+
wp_enqueue_script('jquery-tipsy', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.tipsy.js', 'jquery');
|
86 |
+
wp_enqueue_script('jquery-nestable', WP_ALL_IMPORT_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'));
|
87 |
+
wp_enqueue_script('jquery-moment', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/moment.js', 'jquery');
|
88 |
+
wp_enqueue_script('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
|
89 |
+
wp_enqueue_script('jquery-ddslick', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.ddslick.min.js', 'jquery');
|
90 |
+
wp_enqueue_script('jquery-contextmenu', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.ui-contextmenu.min.js', array('jquery', 'jquery-ui-menu'));
|
91 |
wp_enqueue_script('wp-pointer');
|
92 |
|
93 |
/* load plupload scripts */
|
95 |
wp_deregister_script('swfupload-handlers');
|
96 |
wp_enqueue_script('swfupload-handlers', get_option('siteurl') . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
|
97 |
|
98 |
+
wp_enqueue_script('jquery-browserplus-min', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/browserplus-min.js', array('jquery'));
|
99 |
+
wp_enqueue_script('full-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
|
100 |
+
wp_enqueue_script('jquery-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
|
101 |
|
102 |
+
wp_enqueue_script('pmxi-admin-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
|
103 |
|
104 |
}
|
105 |
|
helpers/backward.php
CHANGED
File without changes
|
helpers/functions.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!function_exists('pmxi_if')){
|
4 |
+
function pmxi_if($left_condition, $operand = '', $right_condition = '', $then, $else = ''){
|
5 |
+
$str = trim(implode(' ', array($left_condition, html_entity_decode($operand), $right_condition)));
|
6 |
+
return (eval ("return ($str);")) ? $then : $else;
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
if (!function_exists('is_empty')){
|
11 |
+
function is_empty($var)
|
12 |
+
{
|
13 |
+
return empty($var);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
if (!function_exists('human_filesize')){
|
18 |
+
function human_filesize($bytes, $decimals = 2) {
|
19 |
+
$sz = 'BKMGTP';
|
20 |
+
$factor = floor((strlen($bytes) - 1) / 3);
|
21 |
+
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( ! function_exists('pmxi_get_remote_image_ext')){
|
26 |
+
|
27 |
+
function pmxi_get_remote_image_ext($filePath){
|
28 |
+
|
29 |
+
$response = wp_remote_get($filePath);
|
30 |
+
$headers = wp_remote_retrieve_headers( $response );
|
31 |
+
$content_type = (!empty($headers['content-type'])) ? explode('/', $headers['content-type']) : false;
|
32 |
+
if (!empty($content_type[1])){
|
33 |
+
if (preg_match('%jpeg%i', $content_type[1])) return 'jpeg';
|
34 |
+
if (preg_match('%jpg%i', $content_type[1])) return 'jpg';
|
35 |
+
if (preg_match('%png%i', $content_type[1])) return 'png';
|
36 |
+
if (preg_match('%gif%i', $content_type[1])) return 'gif';
|
37 |
+
return $content_type[1];
|
38 |
+
}
|
39 |
+
|
40 |
+
return '';
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( ! function_exists('pmxi_getExtension')){
|
46 |
+
function pmxi_getExtension($str)
|
47 |
+
{
|
48 |
+
$i = strrpos($str,".");
|
49 |
+
if (!$i) return "";
|
50 |
+
$l = strlen($str) - $i;
|
51 |
+
$ext = substr($str,$i+1,$l);
|
52 |
+
return (strlen($ext) <= 4) ? $ext : "";
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
if ( ! function_exists('pmxi_getExtensionFromStr')){
|
57 |
+
function pmxi_getExtensionFromStr($str)
|
58 |
+
{
|
59 |
+
$i = strrpos($str,".");
|
60 |
+
if ($i === false) return "";
|
61 |
+
$l = strlen($str) - $i;
|
62 |
+
$ext = substr($str,$i+1,$l);
|
63 |
+
return (preg_match('%(jpg|jpeg|gif|png)$%i', $ext) and strlen($ext) <= 4) ? $ext : "";
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( ! function_exists('pmxi_convert_encoding')){
|
68 |
+
|
69 |
+
function pmxi_convert_encoding ( $source, $target_encoding = 'ASCII' )
|
70 |
+
{
|
71 |
+
|
72 |
+
if ( function_exists('mb_detect_encoding') ){
|
73 |
+
|
74 |
+
// detect the character encoding of the incoming file
|
75 |
+
$encoding = mb_detect_encoding( $source, "auto" );
|
76 |
+
|
77 |
+
// escape all of the question marks so we can remove artifacts from
|
78 |
+
// the unicode conversion process
|
79 |
+
$target = str_replace( "?", "[question_mark]", $source );
|
80 |
+
|
81 |
+
// convert the string to the target encoding
|
82 |
+
$target = mb_convert_encoding( $target, $target_encoding, $encoding);
|
83 |
+
|
84 |
+
// remove any question marks that have been introduced because of illegal characters
|
85 |
+
$target = str_replace( "?", "", $target );
|
86 |
+
|
87 |
+
// replace the token string "[question_mark]" with the symbol "?"
|
88 |
+
$target = str_replace( "[question_mark]", "?", $target );
|
89 |
+
|
90 |
+
return html_entity_decode($target, ENT_COMPAT, 'UTF-8');
|
91 |
+
|
92 |
+
}
|
93 |
+
|
94 |
+
return $source;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( ! function_exists('wp_all_import_get_remote_file_name')){
|
99 |
+
|
100 |
+
function wp_all_import_get_remote_file_name($filePath){
|
101 |
+
$type = (preg_match('%\W(csv|txt|dat|psv)$%i', basename($filePath))) ? 'csv' : false;
|
102 |
+
if (!$type) $type = (preg_match('%\W(xml)$%i', basename($filePath))) ? 'xml' : false;
|
103 |
+
if (!$type) $type = (preg_match('%\W(zip)$%i', basename($filePath))) ? 'zip' : false;
|
104 |
+
if (!$type) $type = (preg_match('%\W(gz)$%i', basename($filePath))) ? 'gz' : false;
|
105 |
+
|
106 |
+
return ($type) ? $type : false;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
if ( ! function_exists('wp_all_import_translate_uri') ){
|
111 |
+
function wp_all_import_translate_uri($uri) {
|
112 |
+
$parts = explode('/', $uri);
|
113 |
+
for ($i = 1; $i < count($parts); $i++) {
|
114 |
+
$parts[$i] = rawurlencode($parts[$i]);
|
115 |
+
}
|
116 |
+
return implode('/', $parts);
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( ! function_exists('wp_all_import_cdata_filter')){
|
121 |
+
function wp_all_import_cdata_filter($matches){
|
122 |
+
PMXI_Import_Record::$cdata[] = $matches[0];
|
123 |
+
return '{{CPLACE_'. count(PMXI_Import_Record::$cdata) .'}}';
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
if ( ! function_exists('wp_all_import_isValidMd5')){
|
128 |
+
function wp_all_import_isValidMd5($md5 ='')
|
129 |
+
{
|
130 |
+
return preg_match('/^[a-f0-9]{32}$/', $md5);
|
131 |
+
}
|
132 |
+
}
|
helpers/get_file_curl.php
CHANGED
@@ -2,18 +2,18 @@
|
|
2 |
|
3 |
if ( ! function_exists('get_file_curl') ):
|
4 |
|
5 |
-
function get_file_curl($url, $fullpath, $to_variable = false, $iteration = 0) {
|
6 |
|
7 |
-
$request = wp_remote_get($url);
|
8 |
|
9 |
if ( ! is_wp_error($request) ){
|
10 |
|
11 |
$rawdata = wp_remote_retrieve_body( $request );
|
12 |
|
13 |
if (empty($rawdata)){
|
14 |
-
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
15 |
if ( ! $result and ! $iteration){
|
16 |
-
$url =
|
17 |
return get_file_curl($url, $fullpath, $to_variable, 1);
|
18 |
}
|
19 |
return $result;
|
@@ -29,7 +29,7 @@ if ( ! function_exists('get_file_curl') ):
|
|
29 |
{
|
30 |
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
31 |
if ( ! $result and ! $iteration){
|
32 |
-
$url =
|
33 |
return get_file_curl($url, $fullpath, $to_variable, 1);
|
34 |
}
|
35 |
return $result;
|
@@ -43,7 +43,7 @@ if ( ! function_exists('get_file_curl') ):
|
|
43 |
$curl = pmxi_curl_download($url, $fullpath, $to_variable);
|
44 |
|
45 |
if ($curl === false and ! $iteration){
|
46 |
-
$url =
|
47 |
return get_file_curl($url, $fullpath, $to_variable, 1);
|
48 |
|
49 |
}
|
@@ -105,6 +105,14 @@ if ( ! function_exists('curl_exec_follow') ):
|
|
105 |
$original_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
106 |
$newurl = $original_url;
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
$rch = curl_copy_handle($ch);
|
109 |
|
110 |
curl_setopt($rch, CURLOPT_HEADER, true);
|
2 |
|
3 |
if ( ! function_exists('get_file_curl') ):
|
4 |
|
5 |
+
function get_file_curl($url, $fullpath, $to_variable = false, $iteration = 0) {
|
6 |
|
7 |
+
$request = wp_remote_get($url);
|
8 |
|
9 |
if ( ! is_wp_error($request) ){
|
10 |
|
11 |
$rawdata = wp_remote_retrieve_body( $request );
|
12 |
|
13 |
if (empty($rawdata)){
|
14 |
+
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
15 |
if ( ! $result and ! $iteration){
|
16 |
+
$url = wp_all_import_translate_uri($url);
|
17 |
return get_file_curl($url, $fullpath, $to_variable, 1);
|
18 |
}
|
19 |
return $result;
|
29 |
{
|
30 |
$result = pmxi_curl_download($url, $fullpath, $to_variable);
|
31 |
if ( ! $result and ! $iteration){
|
32 |
+
$url = wp_all_import_translate_uri($url);
|
33 |
return get_file_curl($url, $fullpath, $to_variable, 1);
|
34 |
}
|
35 |
return $result;
|
43 |
$curl = pmxi_curl_download($url, $fullpath, $to_variable);
|
44 |
|
45 |
if ($curl === false and ! $iteration){
|
46 |
+
$url = wp_all_import_translate_uri($url);
|
47 |
return get_file_curl($url, $fullpath, $to_variable, 1);
|
48 |
|
49 |
}
|
105 |
$original_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
106 |
$newurl = $original_url;
|
107 |
|
108 |
+
$url_data = parse_url($newurl);
|
109 |
+
|
110 |
+
if (!empty($url_data['user']) and !empty($url_data['pass'])){
|
111 |
+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
|
112 |
+
curl_setopt($ch, CURLOPT_USERPWD, $url_data['user']. ":" . $url_data['pass']);
|
113 |
+
$newurl = $url_data['scheme'] . '://' . $url_data['host'] . $url_data['path'] . '?' . $url_data['query'];
|
114 |
+
}
|
115 |
+
|
116 |
$rch = curl_copy_handle($ch);
|
117 |
|
118 |
curl_setopt($rch, CURLOPT_HEADER, true);
|
helpers/get_taxonomies_by_object_type.php
CHANGED
File without changes
|
helpers/import_custom_meta_box.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
if (!function_exists('import_custom_meta_box')){
|
3 |
-
function import_custom_meta_box($edit_post) {
|
4 |
-
?>
|
5 |
-
<div id="postcustomstuff">
|
6 |
-
<table id="list-table">
|
7 |
-
<tbody class="list:meta" id="the-list">
|
8 |
-
<?php if (!empty(PMXI_Plugin::$session->data['pmxi_import']['options']['custom_name'])): foreach (PMXI_Plugin::$session->data['pmxi_import']['options']['custom_name'] as $i => $name): ?>
|
9 |
-
<tr>
|
10 |
-
<td class="left">
|
11 |
-
<label class="screen-reader-text">Key</label>
|
12 |
-
<input type="text" value="<?php echo esc_attr($name) ?>" name="custom_name[]" size="20">
|
13 |
-
<div class="submit"><input type="submit" class="delete deletemeta" value="Delete"></div>
|
14 |
-
</td>
|
15 |
-
<td>
|
16 |
-
<label class="screen-reader-text">Value</label>
|
17 |
-
<textarea name="custom_value[]" rows="2" cols="30" class="widefat"><?php echo esc_html(PMXI_Plugin::$session->data['pmxi_import']['options']['custom_value'][$i]) ?></textarea>
|
18 |
-
</td>
|
19 |
-
</tr>
|
20 |
-
<?php endforeach; endif; ?>
|
21 |
-
</tbody>
|
22 |
-
</table>
|
23 |
-
<?php meta_form(); ?>
|
24 |
-
</div>
|
25 |
-
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
|
26 |
-
<?php
|
27 |
-
}
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
helpers/is_exists_term.php
CHANGED
File without changes
|
helpers/pmxi_findDuplicates.php
CHANGED
File without changes
|
helpers/pmxi_functions.php
DELETED
@@ -1,662 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* IF statement
|
4 |
-
*
|
5 |
-
* @access public
|
6 |
-
* @param string
|
7 |
-
* @param string
|
8 |
-
* @param string
|
9 |
-
* @param string
|
10 |
-
* @param string
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
if (!function_exists('pmxi_if')){
|
14 |
-
function pmxi_if($left_condition, $operand = '', $right_condition = '', $then, $else = ''){
|
15 |
-
$str = trim(implode(' ', array($left_condition, html_entity_decode($operand), $right_condition)));
|
16 |
-
return (eval ("return ($str);")) ? $then : $else;
|
17 |
-
}
|
18 |
-
}
|
19 |
-
|
20 |
-
if (!function_exists('is_empty')){
|
21 |
-
function is_empty($var)
|
22 |
-
{
|
23 |
-
return empty($var);
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Word Limiter
|
29 |
-
*
|
30 |
-
* Limits a string to X number of words.
|
31 |
-
*
|
32 |
-
* @access public
|
33 |
-
* @param string
|
34 |
-
* @param string
|
35 |
-
* @param string the end character. Usually an ellipsis
|
36 |
-
* @return string
|
37 |
-
*/
|
38 |
-
if ( ! function_exists('pmxi_word_limiter'))
|
39 |
-
{
|
40 |
-
function pmxi_word_limiter($str, $limit = 100, $end_char = '…')
|
41 |
-
{
|
42 |
-
if (trim($str) == '')
|
43 |
-
{
|
44 |
-
return $str;
|
45 |
-
}
|
46 |
-
|
47 |
-
preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches);
|
48 |
-
|
49 |
-
if (strlen($str) == strlen($matches[0]))
|
50 |
-
{
|
51 |
-
$end_char = '';
|
52 |
-
}
|
53 |
-
|
54 |
-
return rtrim($matches[0]).$end_char;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Character Limiter
|
60 |
-
*
|
61 |
-
* Limits the string based on the character count. Preserves complete words
|
62 |
-
* so the character count may not be exactly as specified.
|
63 |
-
*
|
64 |
-
* @access public
|
65 |
-
* @param string
|
66 |
-
* @param string
|
67 |
-
* @param string the end character. Usually an ellipsis
|
68 |
-
* @return string
|
69 |
-
*/
|
70 |
-
if ( ! function_exists('pmxi_character_limiter'))
|
71 |
-
{
|
72 |
-
function pmxi_character_limiter($str, $n = 500, $end_char = '…')
|
73 |
-
{
|
74 |
-
if (strlen($str) < $n)
|
75 |
-
{
|
76 |
-
return $str;
|
77 |
-
}
|
78 |
-
|
79 |
-
$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
|
80 |
-
|
81 |
-
if (strlen($str) <= $n)
|
82 |
-
{
|
83 |
-
return $str;
|
84 |
-
}
|
85 |
-
|
86 |
-
$out = "";
|
87 |
-
foreach (explode(' ', trim($str)) as $val)
|
88 |
-
{
|
89 |
-
$out .= $val.' ';
|
90 |
-
|
91 |
-
if (strlen($out) >= $n)
|
92 |
-
{
|
93 |
-
$out = trim($out);
|
94 |
-
return (strlen($out) == strlen($str)) ? $out : $out.$end_char;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
if ( ! function_exists('url_title')){
|
101 |
-
|
102 |
-
function url_title($str, $separator = 'dash', $lowercase = FALSE)
|
103 |
-
{
|
104 |
-
if ($separator == 'dash')
|
105 |
-
{
|
106 |
-
$search = '_';
|
107 |
-
$replace = '-';
|
108 |
-
}
|
109 |
-
else
|
110 |
-
{
|
111 |
-
$search = '-';
|
112 |
-
$replace = '_';
|
113 |
-
}
|
114 |
-
|
115 |
-
$trans = array(
|
116 |
-
'&\#\d+?;' => '',
|
117 |
-
'&\S+?;' => '',
|
118 |
-
'\s+' => $replace,
|
119 |
-
'[^a-z0-9\-\._]' => '',
|
120 |
-
$replace.'+' => $replace,
|
121 |
-
$replace.'$' => $replace,
|
122 |
-
'^'.$replace => $replace,
|
123 |
-
'\.+$' => ''
|
124 |
-
);
|
125 |
-
|
126 |
-
$str = strip_tags($str);
|
127 |
-
|
128 |
-
foreach ($trans as $key => $val)
|
129 |
-
{
|
130 |
-
$str = preg_replace("#".$key."#i", $val, $str);
|
131 |
-
}
|
132 |
-
|
133 |
-
if ($lowercase === TRUE)
|
134 |
-
{
|
135 |
-
$str = strtolower($str);
|
136 |
-
}
|
137 |
-
|
138 |
-
return trim(stripslashes($str));
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
if ( ! function_exists('rand_char')){
|
143 |
-
|
144 |
-
function rand_char($length) {
|
145 |
-
$random = '';
|
146 |
-
for ($i = 0; $i < $length; $i++) {
|
147 |
-
$random .= chr(mt_rand(33, 126));
|
148 |
-
}
|
149 |
-
return $random;
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
if ( ! function_exists('pmxi_get_remote_file_name')){
|
154 |
-
|
155 |
-
function pmxi_get_remote_file_name($filePath){
|
156 |
-
$type = (preg_match('%\W(csv|txt|dat|psv)$%i', basename($filePath))) ? 'csv' : false;
|
157 |
-
if (!$type) $type = (preg_match('%\W(xml)$%i', basename($filePath))) ? 'xml' : false;
|
158 |
-
if (!$type) $type = (preg_match('%\W(zip)$%i', basename($filePath))) ? 'zip' : false;
|
159 |
-
if (!$type) $type = (preg_match('%\W(gz)$%i', basename($filePath))) ? 'gz' : false;
|
160 |
-
|
161 |
-
if (!$type){
|
162 |
-
$response = wp_remote_get($filePath);
|
163 |
-
$headers = wp_remote_retrieve_headers( $response );
|
164 |
-
|
165 |
-
if (!empty($headers['content-disposition']) and preg_match("/filename=\".*\"/i", $headers['content-disposition'], $matches)){
|
166 |
-
$remote_file_name = str_replace(array('filename=','"'), '', $matches[0]);
|
167 |
-
if (!empty($remote_file_name)){
|
168 |
-
$type = (preg_match('%\W(csv)$%i', basename($remote_file_name))) ? 'csv' : false;
|
169 |
-
if (!$type) $type = (preg_match('%\W(xml)$%i', basename($remote_file_name))) ? 'xml' : false;
|
170 |
-
if (!$type) $type = (preg_match('%\W(zip)$%i', basename($remote_file_name))) ? 'zip' : false;
|
171 |
-
if (!$type) $type = (preg_match('%\W(gz)$%i', basename($remote_file_name))) ? 'gz' : false;
|
172 |
-
};
|
173 |
-
};
|
174 |
-
}
|
175 |
-
|
176 |
-
return ($type) ? $type : '';
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
if ( ! function_exists('pmxi_get_remote_image_ext')){
|
181 |
-
|
182 |
-
function pmxi_get_remote_image_ext($filePath){
|
183 |
-
|
184 |
-
$response = wp_remote_get($filePath);
|
185 |
-
$headers = wp_remote_retrieve_headers( $response );
|
186 |
-
$content_type = (!empty($headers['content-type'])) ? explode('/', $headers['content-type']) : false;
|
187 |
-
if (!empty($content_type[1])){
|
188 |
-
if (preg_match('%jpeg%i', $content_type[1])) return 'jpeg';
|
189 |
-
if (preg_match('%jpg%i', $content_type[1])) return 'jpg';
|
190 |
-
if (preg_match('%png%i', $content_type[1])) return 'png';
|
191 |
-
if (preg_match('%gif%i', $content_type[1])) return 'gif';
|
192 |
-
return $content_type[1];
|
193 |
-
}
|
194 |
-
|
195 |
-
return '';
|
196 |
-
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
if ( ! function_exists('pmxi_getExtension')){
|
201 |
-
function pmxi_getExtension($str)
|
202 |
-
{
|
203 |
-
$i = strrpos($str,".");
|
204 |
-
if (!$i) return "";
|
205 |
-
$l = strlen($str) - $i;
|
206 |
-
$ext = substr($str,$i+1,$l);
|
207 |
-
return (strlen($ext) <= 4) ? $ext : "";
|
208 |
-
}
|
209 |
-
}
|
210 |
-
|
211 |
-
if ( ! function_exists('pmxi_getExtensionFromStr')){
|
212 |
-
function pmxi_getExtensionFromStr($str)
|
213 |
-
{
|
214 |
-
$i = strrpos($str,".");
|
215 |
-
if ($i === false) return "";
|
216 |
-
$l = strlen($str) - $i;
|
217 |
-
$ext = substr($str,$i+1,$l);
|
218 |
-
return (preg_match('%(jpg|jpeg|gif|png)$%i', $ext) and strlen($ext) <= 4) ? $ext : "";
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Reading large files from remote server
|
224 |
-
* @ $filePath - file URL
|
225 |
-
* return local path of copied file
|
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 |
-
|
245 |
-
if (is_resource($file)){
|
246 |
-
$fp = @fopen($localPath, 'w');
|
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 |
-
}
|
254 |
-
@fclose($file);
|
255 |
-
@fclose($fp);
|
256 |
-
}
|
257 |
-
|
258 |
-
if ( ! file_exists($localPath) ) {
|
259 |
-
|
260 |
-
$request = get_file_curl($filePath, $localPath);
|
261 |
-
|
262 |
-
if ( ! is_wp_error($request) ){
|
263 |
-
|
264 |
-
if ( ! $type ){
|
265 |
-
$file = @fopen($localPath, "rb");
|
266 |
-
while (!@feof($file)) {
|
267 |
-
$chunk = @fread($file, 1024);
|
268 |
-
if (strpos($chunk, "<?") !== false) $type = 'xml'; else $type = 'csv'; // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
269 |
-
break;
|
270 |
-
}
|
271 |
-
@fclose($file);
|
272 |
-
}
|
273 |
-
}
|
274 |
-
else return $request;
|
275 |
-
|
276 |
-
}
|
277 |
-
|
278 |
-
if ( ! preg_match('%\W('. $type .')$%i', basename($localPath)) ){
|
279 |
-
if (@rename($localPath, $localPath . '.' . $type))
|
280 |
-
$localPath = $localPath . '.' . $type;
|
281 |
-
}
|
282 |
-
|
283 |
-
return ($detect) ? array('type' => $type, 'localPath' => $localPath) : $localPath;
|
284 |
-
}
|
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);
|
299 |
-
|
300 |
-
if ($file) {
|
301 |
-
$first_chunk = true;
|
302 |
-
while (!gzeof($file)) {
|
303 |
-
$chunk = gzread($file, 1024);
|
304 |
-
if ($first_chunk and strpos($chunk, "<?") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
305 |
-
@fwrite($fp, $chunk);
|
306 |
-
}
|
307 |
-
gzclose($file);
|
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) ){
|
316 |
-
|
317 |
-
$file = @gzopen($localGZpath, 'rb', $use_include_path);
|
318 |
-
|
319 |
-
if ($file) {
|
320 |
-
$first_chunk = true;
|
321 |
-
while (!gzeof($file)) {
|
322 |
-
$chunk = gzread($file, 1024);
|
323 |
-
if ($first_chunk and strpos($chunk, "<?") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
324 |
-
@fwrite($fp, $chunk);
|
325 |
-
}
|
326 |
-
gzclose($file);
|
327 |
-
}
|
328 |
-
|
329 |
-
@unlink($localGZpath);
|
330 |
-
|
331 |
-
}
|
332 |
-
else return $request;
|
333 |
-
|
334 |
-
}
|
335 |
-
@fclose($fp);
|
336 |
-
|
337 |
-
if (preg_match('%\W(gz)$%i', basename($localPath))){
|
338 |
-
if (@rename($localPath, str_replace('.gz', '.' . $type, $localPath)))
|
339 |
-
$localPath = str_replace('.gz', '.' . $type, $localPath);
|
340 |
-
}
|
341 |
-
else{
|
342 |
-
if (@rename($localPath, $localPath . '.' . $type))
|
343 |
-
$localPath = $localPath . '.' . $type;
|
344 |
-
}
|
345 |
-
|
346 |
-
return array('type' => $type, 'localPath' => $localPath);
|
347 |
-
}
|
348 |
-
}
|
349 |
-
|
350 |
-
if ( ! function_exists('pmxi_strip_tags_content')){
|
351 |
-
|
352 |
-
function pmxi_strip_tags_content($text, $tags = '', $invert = FALSE) {
|
353 |
-
|
354 |
-
preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);
|
355 |
-
$tags = array_unique($tags[1]);
|
356 |
-
|
357 |
-
if(is_array($tags) AND count($tags) > 0) {
|
358 |
-
if($invert == FALSE) {
|
359 |
-
return preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text);
|
360 |
-
}
|
361 |
-
else {
|
362 |
-
return preg_replace('@<('. implode('|', $tags) .')\b.*?>.*?</\1>@si', '', $text);
|
363 |
-
}
|
364 |
-
}
|
365 |
-
elseif($invert == FALSE) {
|
366 |
-
return preg_replace('@<(\w+)\b.*?>.*?</\1>@si', '', $text);
|
367 |
-
}
|
368 |
-
return $text;
|
369 |
-
}
|
370 |
-
}
|
371 |
-
|
372 |
-
if( !function_exists('wpai_util_map') ){
|
373 |
-
|
374 |
-
function wpai_util_map( $orig, $change, $source ){
|
375 |
-
|
376 |
-
$orig = html_entity_decode($orig);
|
377 |
-
$change = html_entity_decode($change);
|
378 |
-
$source = html_entity_decode($source);
|
379 |
-
$original_array = array_map('trim',explode(',',$orig));
|
380 |
-
|
381 |
-
if ( empty($original_array) ) return "";
|
382 |
-
|
383 |
-
$change_array = array_map('trim',explode(',',$change));
|
384 |
-
|
385 |
-
if ( empty($change_array) or count($original_array) != count($change_array)) return "";
|
386 |
-
|
387 |
-
if( count($change_array) == count($original_array) ){
|
388 |
-
$replacement = array();
|
389 |
-
foreach ($original_array as $key => $el){
|
390 |
-
$replacement[$el] = $change_array[$key];
|
391 |
-
}
|
392 |
-
$result = strtr($source,$replacement);
|
393 |
-
}
|
394 |
-
return $result;
|
395 |
-
|
396 |
-
}
|
397 |
-
|
398 |
-
}
|
399 |
-
|
400 |
-
if ( ! function_exists('pmxi_convert_encoding')){
|
401 |
-
|
402 |
-
function pmxi_convert_encoding ( $source, $target_encoding = 'ASCII' )
|
403 |
-
{
|
404 |
-
|
405 |
-
if ( function_exists('mb_detect_encoding') ){
|
406 |
-
|
407 |
-
// detect the character encoding of the incoming file
|
408 |
-
$encoding = mb_detect_encoding( $source, "auto" );
|
409 |
-
|
410 |
-
// escape all of the question marks so we can remove artifacts from
|
411 |
-
// the unicode conversion process
|
412 |
-
$target = str_replace( "?", "[question_mark]", $source );
|
413 |
-
|
414 |
-
// convert the string to the target encoding
|
415 |
-
$target = mb_convert_encoding( $target, $target_encoding, $encoding);
|
416 |
-
|
417 |
-
// remove any question marks that have been introduced because of illegal characters
|
418 |
-
$target = str_replace( "?", "", $target );
|
419 |
-
|
420 |
-
// replace the token string "[question_mark]" with the symbol "?"
|
421 |
-
$target = str_replace( "[question_mark]", "?", $target );
|
422 |
-
|
423 |
-
return html_entity_decode($target, ENT_COMPAT, 'UTF-8');
|
424 |
-
|
425 |
-
}
|
426 |
-
|
427 |
-
return $source;
|
428 |
-
}
|
429 |
-
}
|
430 |
-
|
431 |
-
if ( ! function_exists('pmxi_translate_uri') ){
|
432 |
-
function pmxi_translate_uri($uri) {
|
433 |
-
$parts = explode('/', $uri);
|
434 |
-
for ($i = 1; $i < count($parts); $i++) {
|
435 |
-
$parts[$i] = rawurlencode($parts[$i]);
|
436 |
-
}
|
437 |
-
return implode('/', $parts);
|
438 |
-
}
|
439 |
-
}
|
440 |
-
|
441 |
-
if ( ! function_exists('pmxi_imageurlencode')){
|
442 |
-
|
443 |
-
function pmxi_imageurlencode($url){
|
444 |
-
|
445 |
-
$urlArray = parse_url($url);
|
446 |
-
|
447 |
-
$url = ($urlArray['scheme'].'://'.$urlArray['host'].str_replace('%2F', '/', urlencode($urlArray['path'])));
|
448 |
-
$url .= isset($urlArray['query']) ? '?'.$urlArray['query'] : '';
|
449 |
-
|
450 |
-
return $url;
|
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_attachment.php
CHANGED
File without changes
|
helpers/pmxi_insert_post.php
CHANGED
File without changes
|
helpers/pmxi_json_to_xml.php
DELETED
@@ -1,8 +0,0 @@
|
|
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
File without changes
|
helpers/reverse_taxonomies_html.php
CHANGED
@@ -15,6 +15,7 @@ if ( ! function_exists('reverse_taxonomies_html') ) {
|
|
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>
|
15 |
?>
|
16 |
<li id="item_<?php echo $i; ?>" class="dragging">
|
17 |
<div class="drag-element">
|
18 |
+
<input type="checkbox" class="assign_term" <?php if (!empty($child_cat->assign)): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>"/>
|
19 |
<input class="widefat xpath_field" type="text" value="<?php echo esc_attr($child_cat->xpath); ?>"/>
|
20 |
<?php do_action('pmxi_category_view', $cat, $i, $ctx_name, $entry); ?>
|
21 |
</div>
|
helpers/str_getcsv.php
CHANGED
File without changes
|
helpers/wp_all_import_clear_directory.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_clear_directory') ){
|
3 |
+
function wp_all_import_clear_directory($path){
|
4 |
+
if (($dir = @opendir($path . '/')) !== false or ($dir = @opendir($path)) !== false) {
|
5 |
+
while(($file = @readdir($dir)) !== false) {
|
6 |
+
$filePath = $path . '/' . $file;
|
7 |
+
if ( is_dir($filePath) && ( ! in_array($file, array('.', '..'))) ){
|
8 |
+
wp_all_import_rmdir($filePath);
|
9 |
+
}
|
10 |
+
elseif( is_file($filePath) ){
|
11 |
+
@unlink($filePath);
|
12 |
+
}
|
13 |
+
}
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}
|
helpers/{pmxi_ctx_mapping.php → wp_all_import_ctx_mapping.php}
RENAMED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if ( ! function_exists('
|
4 |
-
function
|
5 |
if ( ! empty( $mapping_rules) and $ctx['is_mapping']){
|
6 |
foreach ($mapping_rules as $rule) {
|
7 |
if ( ! empty($rule[trim($ctx['name'])])){
|
@@ -9,7 +9,7 @@ if ( ! function_exists('pmxi_ctx_mapping')){
|
|
9 |
break;
|
10 |
}
|
11 |
}
|
12 |
-
}
|
13 |
return apply_filters('pmxi_single_category', $ctx, $tx_name);
|
14 |
}
|
15 |
}
|
1 |
<?php
|
2 |
|
3 |
+
if ( ! function_exists('wp_all_import_ctx_mapping')){
|
4 |
+
function wp_all_import_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'])])){
|
9 |
break;
|
10 |
}
|
11 |
}
|
12 |
+
}
|
13 |
return apply_filters('pmxi_single_category', $ctx, $tx_name);
|
14 |
}
|
15 |
}
|
helpers/wp_all_import_get_feed_type.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! function_exists('wp_all_import_get_feed_type')){
|
4 |
+
function wp_all_import_get_feed_type($url){
|
5 |
+
|
6 |
+
$type = wp_all_import_get_remote_file_name($url);
|
7 |
+
|
8 |
+
if ($type !== false) {
|
9 |
+
|
10 |
+
return array(
|
11 |
+
'Content-Type' => $type,
|
12 |
+
'Content-Encoding' => false
|
13 |
+
);
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
$headers = get_headers($url, 1);
|
18 |
+
$extensions = array('gzip', 'gz', 'xml', 'csv', 'json', 'sql');
|
19 |
+
$type = false;
|
20 |
+
|
21 |
+
$contentType = ( ! empty($headers['Content-Type']) ) ? $headers['Content-Type'] : false;
|
22 |
+
if ($contentType === false)
|
23 |
+
$contentType = ( ! empty($headers['content-type']) ) ? $headers['content-type'] : false;
|
24 |
+
|
25 |
+
if ( ! empty($contentType)){
|
26 |
+
if (is_array($contentType)){
|
27 |
+
foreach ($contentType as $key => $ct) {
|
28 |
+
foreach ($extensions as $ext) {
|
29 |
+
if (strpos($ct, $ext) !== false) {
|
30 |
+
$type = $ext;
|
31 |
+
break(2);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
else{
|
37 |
+
foreach ($extensions as $ext) {
|
38 |
+
if (strpos($contentType, $ext) !== false){
|
39 |
+
$type = $ext;
|
40 |
+
break;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
if ( ! empty($headers['Content-Disposition'])){
|
45 |
+
foreach ($extensions as $ext) {
|
46 |
+
if (strpos($headers['Content-Disposition'], $ext) !== false) {
|
47 |
+
$type = $ext;
|
48 |
+
break;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
return array(
|
54 |
+
'Content-Type' => $type,
|
55 |
+
'Content-Encoding' => (!empty($headers['Content-Encoding'])) ? $headers['Content-Encoding'] : false
|
56 |
+
);
|
57 |
+
}
|
58 |
+
}
|
helpers/wp_all_import_get_gz.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_get_gz')){
|
3 |
+
function wp_all_import_get_gz($filename, $use_include_path = 0, $targetDir = false) {
|
4 |
+
|
5 |
+
$type = 'csv';
|
6 |
+
$uploads = wp_upload_dir();
|
7 |
+
$targetDir = ( ! $targetDir ) ? wp_all_import_secure_file($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY ) : $targetDir;
|
8 |
+
|
9 |
+
$tmpname = wp_unique_filename($targetDir, (strlen(basename($filename)) < 30) ? basename($filename) : time() );
|
10 |
+
$localPath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname));
|
11 |
+
|
12 |
+
$fp = @fopen($localPath, 'w');
|
13 |
+
$file = @gzopen($filename, 'rb', $use_include_path);
|
14 |
+
|
15 |
+
if ($file) {
|
16 |
+
$first_chunk = true;
|
17 |
+
while (!gzeof($file)) {
|
18 |
+
$chunk = gzread($file, 1024);
|
19 |
+
if ($first_chunk and strpos($chunk, "<?") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
20 |
+
@fwrite($fp, $chunk);
|
21 |
+
}
|
22 |
+
gzclose($file);
|
23 |
+
}
|
24 |
+
else{
|
25 |
+
|
26 |
+
$tmpname = wp_unique_filename($targetDir, (strlen(basename($filename)) < 30) ? basename($filename) : time() );
|
27 |
+
$localGZpath = $targetDir .'/'. urldecode(sanitize_file_name($tmpname));
|
28 |
+
$request = get_file_curl($filename, $localGZpath, false, true);
|
29 |
+
|
30 |
+
if ( ! is_wp_error($request) ){
|
31 |
+
|
32 |
+
$file = @gzopen($localGZpath, 'rb', $use_include_path);
|
33 |
+
|
34 |
+
if ($file) {
|
35 |
+
$first_chunk = true;
|
36 |
+
while (!gzeof($file)) {
|
37 |
+
$chunk = gzread($file, 1024);
|
38 |
+
if ($first_chunk and strpos($chunk, "<?") !== false) { $type = 'xml'; $first_chunk = false; } // if it's a 1st chunk, then chunk <? symbols to detect XML file
|
39 |
+
@fwrite($fp, $chunk);
|
40 |
+
}
|
41 |
+
gzclose($file);
|
42 |
+
}
|
43 |
+
|
44 |
+
@unlink($localGZpath);
|
45 |
+
|
46 |
+
}
|
47 |
+
else return $request;
|
48 |
+
|
49 |
+
}
|
50 |
+
@fclose($fp);
|
51 |
+
|
52 |
+
if (preg_match('%\W(gz)$%i', basename($localPath))){
|
53 |
+
if (@rename($localPath, str_replace('.gz', '.' . $type, $localPath)))
|
54 |
+
$localPath = str_replace('.gz', '.' . $type, $localPath);
|
55 |
+
}
|
56 |
+
else{
|
57 |
+
if (@rename($localPath, $localPath . '.' . $type))
|
58 |
+
$localPath = $localPath . '.' . $type;
|
59 |
+
}
|
60 |
+
|
61 |
+
return array('type' => $type, 'localPath' => $localPath);
|
62 |
+
}
|
63 |
+
}
|
helpers/wp_all_import_is_json.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! function_exists('wp_all_import_is_json')){
|
4 |
+
function wp_all_import_is_json($string) {
|
5 |
+
json_decode($string);
|
6 |
+
|
7 |
+
switch (json_last_error()) {
|
8 |
+
case JSON_ERROR_NONE:
|
9 |
+
return true;
|
10 |
+
break;
|
11 |
+
case JSON_ERROR_DEPTH:
|
12 |
+
return new WP_Error( 'broke', __( "Maximum stack depth exceeded", "pmxi_plugin" ) );
|
13 |
+
break;
|
14 |
+
case JSON_ERROR_STATE_MISMATCH:
|
15 |
+
return new WP_Error( 'broke', __( "Underflow or the modes mismatch", "pmxi_plugin" ) );
|
16 |
+
break;
|
17 |
+
case JSON_ERROR_CTRL_CHAR:
|
18 |
+
return new WP_Error( 'broke', __( "Unexpected control character found", "pmxi_plugin" ) );
|
19 |
+
break;
|
20 |
+
case JSON_ERROR_SYNTAX:
|
21 |
+
return new WP_Error( 'broke', __( "Syntax error, malformed JSON", "pmxi_plugin" ) );
|
22 |
+
break;
|
23 |
+
case JSON_ERROR_UTF8:
|
24 |
+
return new WP_Error( 'broke', __( "Malformed UTF-8 characters, possibly incorrectly encoded", "pmxi_plugin" ) );
|
25 |
+
break;
|
26 |
+
default:
|
27 |
+
return new WP_Error( 'broke', __( "Unknown json error", "pmxi_plugin" ) );
|
28 |
+
break;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
helpers/wp_all_import_json_to_xml.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wp_all_import_json_to_xml( $json = array() ){
|
4 |
+
|
5 |
+
return PMXI_ArrayToXML::toXml($json);
|
6 |
+
|
7 |
+
}
|
8 |
+
|
helpers/wp_all_import_rand_char.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_rand_char')){
|
3 |
+
|
4 |
+
function wp_all_import_rand_char($length) {
|
5 |
+
$random = '';
|
6 |
+
for ($i = 0; $i < $length; $i++) {
|
7 |
+
$random .= chr(mt_rand(33, 126));
|
8 |
+
}
|
9 |
+
return $random;
|
10 |
+
}
|
11 |
+
}
|
helpers/wp_all_import_remove_source.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_remove_source')){
|
3 |
+
function wp_all_import_remove_source($file, $remove_dir = true){
|
4 |
+
|
5 |
+
@unlink($file);
|
6 |
+
|
7 |
+
$path_parts = pathinfo($file);
|
8 |
+
if ( ! empty($path_parts['dirname'])){
|
9 |
+
$path_all_parts = explode('/', $path_parts['dirname']);
|
10 |
+
$dirname = array_pop($path_all_parts);
|
11 |
+
|
12 |
+
if ( wp_all_import_isValidMd5($dirname)){
|
13 |
+
if ($remove_dir){
|
14 |
+
@unlink($path_parts['dirname'] . DIRECTORY_SEPARATOR . 'index.php' );
|
15 |
+
}
|
16 |
+
if ($remove_dir or count(@scandir($path_parts['dirname'])) == 2)
|
17 |
+
wp_all_import_rmdir($path_parts['dirname']);
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
}
|
22 |
+
}
|
helpers/wp_all_import_rmdir.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wp_all_import_rmdir($dir) {
|
3 |
+
$scanned_files = @scandir($dir);
|
4 |
+
if (!empty($scanned_files) and is_array($scanned_files)){
|
5 |
+
$files = array_diff($scanned_files, array('.','..'));
|
6 |
+
if (!empty($files)){
|
7 |
+
foreach ($files as $file) {
|
8 |
+
(is_dir("$dir/$file")) ? wp_all_import_rmdir("$dir/$file") : @unlink("$dir/$file");
|
9 |
+
}
|
10 |
+
}
|
11 |
+
return @rmdir($dir);
|
12 |
+
}
|
13 |
+
}
|
helpers/wp_all_import_secure_file.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_secure_file') ){
|
3 |
+
|
4 |
+
function wp_all_import_secure_file( $targetDir, $importID = false){
|
5 |
+
|
6 |
+
$is_secure_import = PMXI_Plugin::getInstance()->getOption('secure');
|
7 |
+
|
8 |
+
if ( $is_secure_import ){
|
9 |
+
|
10 |
+
$dir = $targetDir . DIRECTORY_SEPARATOR . ( ( $importID ) ? md5( $importID . NONCE_SALT ) : md5( time() . NONCE_SALT ) );
|
11 |
+
|
12 |
+
@mkdir($dir, 0755);
|
13 |
+
|
14 |
+
if (@is_writable($dir) and @is_dir($dir)){
|
15 |
+
$targetDir = $dir;
|
16 |
+
@touch( $dir . DIRECTORY_SEPARATOR . 'index.php' );
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
return $targetDir;
|
22 |
+
}
|
23 |
+
}
|
helpers/wp_all_import_strip_tags_content.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_strip_tags_content')){
|
3 |
+
|
4 |
+
function wp_all_import_strip_tags_content($text, $tags = '', $invert = FALSE) {
|
5 |
+
|
6 |
+
preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);
|
7 |
+
$tags = array_unique($tags[1]);
|
8 |
+
|
9 |
+
if(is_array($tags) AND count($tags) > 0) {
|
10 |
+
if($invert == FALSE) {
|
11 |
+
return preg_replace('@<(?!(?:'. implode('|', $tags) .')\b)(\w+)\b.*?>.*?</\1>@si', '', $text);
|
12 |
+
}
|
13 |
+
else {
|
14 |
+
return preg_replace('@<('. implode('|', $tags) .')\b.*?>.*?</\1>@si', '', $text);
|
15 |
+
}
|
16 |
+
}
|
17 |
+
elseif($invert == FALSE) {
|
18 |
+
return preg_replace('@<(\w+)\b.*?>.*?</\1>@si', '', $text);
|
19 |
+
}
|
20 |
+
return $text;
|
21 |
+
}
|
22 |
+
}
|
helpers/wp_all_import_url_title.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! function_exists('wp_all_import_url_title')){
|
3 |
+
|
4 |
+
function wp_all_import_url_title($str, $separator = 'dash', $lowercase = FALSE)
|
5 |
+
{
|
6 |
+
if ($separator == 'dash')
|
7 |
+
{
|
8 |
+
$search = '_';
|
9 |
+
$replace = '-';
|
10 |
+
}
|
11 |
+
else
|
12 |
+
{
|
13 |
+
$search = '-';
|
14 |
+
$replace = '_';
|
15 |
+
}
|
16 |
+
|
17 |
+
$trans = array(
|
18 |
+
'&\#\d+?;' => '',
|
19 |
+
'&\S+?;' => '',
|
20 |
+
'\s+' => $replace,
|
21 |
+
'[^a-z0-9\-\._]' => '',
|
22 |
+
$replace.'+' => $replace,
|
23 |
+
$replace.'$' => $replace,
|
24 |
+
'^'.$replace => $replace,
|
25 |
+
'\.+$' => ''
|
26 |
+
);
|
27 |
+
|
28 |
+
$str = strip_tags($str);
|
29 |
+
|
30 |
+
foreach ($trans as $key => $val)
|
31 |
+
{
|
32 |
+
$str = preg_replace("#".$key."#i", $val, $str);
|
33 |
+
}
|
34 |
+
|
35 |
+
if ($lowercase === TRUE)
|
36 |
+
{
|
37 |
+
$str = strtolower($str);
|
38 |
+
}
|
39 |
+
|
40 |
+
return trim(stripslashes($str));
|
41 |
+
}
|
42 |
+
}
|
helpers/wp_delete_attachments.php
CHANGED
File without changes
|
helpers/wp_redirect_or_javascript.php
CHANGED
File without changes
|
helpers/wpai_util_map.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if( !function_exists('wpai_util_map') ){
|
3 |
+
|
4 |
+
function wpai_util_map( $orig, $change, $source ){
|
5 |
+
|
6 |
+
$orig = html_entity_decode($orig);
|
7 |
+
$change = html_entity_decode($change);
|
8 |
+
$source = html_entity_decode($source);
|
9 |
+
$original_array = array_map('trim',explode(',',$orig));
|
10 |
+
|
11 |
+
if ( empty($original_array) ) return "";
|
12 |
+
|
13 |
+
$change_array = array_map('trim',explode(',',$change));
|
14 |
+
|
15 |
+
if ( empty($change_array) or count($original_array) != count($change_array)) return "";
|
16 |
+
|
17 |
+
if( count($change_array) == count($original_array) ){
|
18 |
+
$replacement = array();
|
19 |
+
foreach ($original_array as $key => $el){
|
20 |
+
$replacement[$el] = $change_array[$key];
|
21 |
+
}
|
22 |
+
$result = strtr($source,$replacement);
|
23 |
+
}
|
24 |
+
return $result;
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
libraries/XmlImportConfig.php
CHANGED
File without changes
|
libraries/XmlImportCsvParse.php
CHANGED
@@ -112,7 +112,7 @@ class PMXI_CsvParser
|
|
112 |
|
113 |
$wp_uploads = wp_upload_dir();
|
114 |
|
115 |
-
$this->targetDir = (empty($options['targetDir'])) ?
|
116 |
|
117 |
$this->load($options['filename']);
|
118 |
}
|
@@ -926,7 +926,7 @@ class PMXI_CsvParser
|
|
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 .'/'.
|
930 |
|
931 |
$this->toXML(true);
|
932 |
|
@@ -949,6 +949,16 @@ class PMXI_CsvParser
|
|
949 |
|
950 |
$this->is_csv = $d;
|
951 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
952 |
$res = fopen($this->_filename, 'rb');
|
953 |
|
954 |
$xmlWriter = new XMLWriter();
|
@@ -990,6 +1000,7 @@ class PMXI_CsvParser
|
|
990 |
foreach ($chunk as $header => $value)
|
991 |
{
|
992 |
$xmlWriter->startElement($header);
|
|
|
993 |
if ($fixBrokenSymbols){
|
994 |
// Remove non ASCII symbols and write CDATA
|
995 |
$xmlWriter->writeCData(preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $value));
|
112 |
|
113 |
$wp_uploads = wp_upload_dir();
|
114 |
|
115 |
+
$this->targetDir = (empty($options['targetDir'])) ? wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY) : $options['targetDir'];
|
116 |
|
117 |
$this->load($options['filename']);
|
118 |
}
|
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 .'/'. wp_all_import_url_title($tmpname);
|
930 |
|
931 |
$this->toXML(true);
|
932 |
|
949 |
|
950 |
$this->is_csv = $d;
|
951 |
|
952 |
+
$is_html = false;
|
953 |
+
$f = @fopen($this->_filename, "rb");
|
954 |
+
while (!@feof($f)) {
|
955 |
+
$chunk = @fread($f, 1024);
|
956 |
+
if (strpos($chunk, "<!DOCTYPE") === 0) $is_html = true;
|
957 |
+
break;
|
958 |
+
}
|
959 |
+
|
960 |
+
if ($is_html) return;
|
961 |
+
|
962 |
$res = fopen($this->_filename, 'rb');
|
963 |
|
964 |
$xmlWriter = new XMLWriter();
|
1000 |
foreach ($chunk as $header => $value)
|
1001 |
{
|
1002 |
$xmlWriter->startElement($header);
|
1003 |
+
$value = preg_replace('/\]\]>/s', '', preg_replace('/<!\[CDATA\[/s', '', $value ));
|
1004 |
if ($fixBrokenSymbols){
|
1005 |
// Remove non ASCII symbols and write CDATA
|
1006 |
$xmlWriter->writeCData(preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $value));
|
libraries/XmlImportException.php
CHANGED
File without changes
|
libraries/XmlImportParser.php
CHANGED
@@ -52,14 +52,14 @@ class XmlImportParser {
|
|
52 |
libxml_use_internal_errors(true);
|
53 |
try{
|
54 |
$this->xml = new SimpleXMLElement($xml);
|
55 |
-
} catch (Exception $e){
|
56 |
try{
|
57 |
$this->xml = new SimpleXMLElement(utf8_encode($xml));
|
58 |
} catch (Exception $e){
|
59 |
throw new XmlImportException($e->getMessage());
|
60 |
}
|
61 |
-
}
|
62 |
-
|
63 |
$this->rootNodeXPath = $rootNodeXPath;
|
64 |
$this->cachedTemplate = $cachedTemplate;
|
65 |
}
|
@@ -83,7 +83,7 @@ class XmlImportParser {
|
|
83 |
|
84 |
for ($i = 0; $i < count($rootNodes); $i++) {
|
85 |
if (empty($records) or in_array($i + 1, $records)) {
|
86 |
-
$rootNode = $rootNodes[$i];
|
87 |
$template = new XmlImportTemplate($rootNode, $this->cachedTemplate);
|
88 |
$result[] = $template->parse();
|
89 |
}
|
52 |
libxml_use_internal_errors(true);
|
53 |
try{
|
54 |
$this->xml = new SimpleXMLElement($xml);
|
55 |
+
} catch (Exception $e){
|
56 |
try{
|
57 |
$this->xml = new SimpleXMLElement(utf8_encode($xml));
|
58 |
} catch (Exception $e){
|
59 |
throw new XmlImportException($e->getMessage());
|
60 |
}
|
61 |
+
}
|
62 |
+
|
63 |
$this->rootNodeXPath = $rootNodeXPath;
|
64 |
$this->cachedTemplate = $cachedTemplate;
|
65 |
}
|
83 |
|
84 |
for ($i = 0; $i < count($rootNodes); $i++) {
|
85 |
if (empty($records) or in_array($i + 1, $records)) {
|
86 |
+
$rootNode = apply_filters('wpallimport_xml_row', $rootNodes[$i]);
|
87 |
$template = new XmlImportTemplate($rootNode, $this->cachedTemplate);
|
88 |
$result[] = $template->parse();
|
89 |
}
|
libraries/XmlImportReaderInterface.php
CHANGED
File without changes
|
libraries/XmlImportSQLParse.php
CHANGED
@@ -14,14 +14,14 @@ class PMXI_SQLParser{
|
|
14 |
|
15 |
$wp_uploads = wp_upload_dir();
|
16 |
|
17 |
-
$this->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 . '/' .
|
25 |
|
26 |
$this->toXML();
|
27 |
|
14 |
|
15 |
$wp_uploads = wp_upload_dir();
|
16 |
|
17 |
+
$this->targetDir = ( ! $targetDir ) ? wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY ) : $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 . '/' . wp_all_import_url_title($tmpname);
|
25 |
|
26 |
$this->toXML();
|
27 |
|
libraries/XmlImportStringReader.php
CHANGED
File without changes
|
libraries/XmlImportTemplate.php
CHANGED
File without changes
|
libraries/XmlImportTemplateCodeGenerator.php
CHANGED
@@ -105,8 +105,8 @@ class XmlImportTemplateCodeGenerator
|
|
105 |
}
|
106 |
if ( ! $filename or ! @is_writable($filename) ){
|
107 |
$uploads = wp_upload_dir();
|
108 |
-
$targetDir = $uploads['basedir'] .
|
109 |
-
$filename = $targetDir .
|
110 |
}
|
111 |
|
112 |
file_put_contents($filename, $result);
|
@@ -236,11 +236,11 @@ class XmlImportTemplateCodeGenerator
|
|
236 |
$result = $expression->getValue();
|
237 |
break;
|
238 |
|
239 |
-
case 'XmlImportAstXPath':
|
240 |
if ($inPrint)
|
241 |
{
|
242 |
$variables = $this->sequenceStack[count($this->sequenceStack) - 1]->getVariables();
|
243 |
-
$result = '$this->getValue(' . $variables[$expression->getValue()] . ')';
|
244 |
}
|
245 |
else
|
246 |
{
|
105 |
}
|
106 |
if ( ! $filename or ! @is_writable($filename) ){
|
107 |
$uploads = wp_upload_dir();
|
108 |
+
$targetDir = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY;
|
109 |
+
$filename = $targetDir . DIRECTORY_SEPARATOR . wp_unique_filename($targetDir, 'tmpfile');
|
110 |
}
|
111 |
|
112 |
file_put_contents($filename, $result);
|
236 |
$result = $expression->getValue();
|
237 |
break;
|
238 |
|
239 |
+
case 'XmlImportAstXPath':
|
240 |
if ($inPrint)
|
241 |
{
|
242 |
$variables = $this->sequenceStack[count($this->sequenceStack) - 1]->getVariables();
|
243 |
+
$result = '$this->getValue(' . $variables[$expression->getValue()] . ')';
|
244 |
}
|
245 |
else
|
246 |
{
|
libraries/XmlImportTemplateParser.php
CHANGED
File without changes
|
libraries/XmlImportTemplateScanner.php
CHANGED
@@ -52,6 +52,8 @@ final class XmlImportTemplateScanner
|
|
52 |
*/
|
53 |
private $isLangBegin = false;
|
54 |
|
|
|
|
|
55 |
/**
|
56 |
* Current parsing state
|
57 |
*
|
@@ -68,13 +70,16 @@ final class XmlImportTemplateScanner
|
|
68 |
public function scan(XmlImportReaderInterface $input)
|
69 |
{
|
70 |
$results = array();
|
|
|
71 |
while (($ch = $input->peek()) !== false)
|
72 |
{
|
73 |
switch ($this->currentState)
|
74 |
{
|
75 |
case XmlImportTemplateScanner::STATE_TEXT:
|
|
|
76 |
if ($ch == '[')
|
77 |
-
{
|
|
|
78 |
$this->currentState = XmlImportTemplateScanner::STATE_LANG;
|
79 |
$this->isLangBegin = true;
|
80 |
//omit [
|
@@ -110,20 +115,14 @@ final class XmlImportTemplateScanner
|
|
110 |
else
|
111 |
$results[] = $result;
|
112 |
}
|
113 |
-
elseif (preg_match('/(\d
|
114 |
{
|
115 |
$result = $this->scanNumber($input);
|
116 |
if (is_array($result))
|
117 |
$results = array_merge($results, $result);
|
118 |
else
|
119 |
$results[] = $result;
|
120 |
-
}
|
121 |
-
elseif ($ch == "+" || $ch == "-" || $ch == "*" || $ch == "/")
|
122 |
-
{
|
123 |
-
$this->isLangBegin = false;
|
124 |
-
$input->read();
|
125 |
-
$results[] = new XmlImportToken(XmlImportToken::KIND_OPERATION, $ch);
|
126 |
-
}
|
127 |
elseif ($ch == '"')
|
128 |
{
|
129 |
//omit "
|
@@ -161,13 +160,17 @@ final class XmlImportTemplateScanner
|
|
161 |
$input->read();
|
162 |
$results[] = new XmlImportToken(XmlImportToken::KIND_COMMA);
|
163 |
}
|
164 |
-
elseif ($ch ==
|
165 |
{
|
166 |
$this->isLangBegin = false;
|
167 |
$this->currentState = XmlImportTemplateScanner::STATE_TEXT;
|
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 '");
|
@@ -178,7 +181,7 @@ final class XmlImportTemplateScanner
|
|
178 |
}
|
179 |
|
180 |
break;
|
181 |
-
}
|
182 |
}
|
183 |
|
184 |
return $results;
|
@@ -192,9 +195,9 @@ final class XmlImportTemplateScanner
|
|
192 |
*/
|
193 |
private function scanText($input)
|
194 |
{
|
195 |
-
$accum = $input->read();
|
196 |
while (($ch = $input->peek()) !== false)
|
197 |
-
{
|
198 |
if ($ch == '{' && $accum[strlen($accum) - 1] != "\\")
|
199 |
{
|
200 |
$this->currentState = XmlImportTemplateScanner::STATE_XPATH;
|
@@ -203,15 +206,21 @@ final class XmlImportTemplateScanner
|
|
203 |
break;
|
204 |
}
|
205 |
elseif ($ch == '[' && $accum[strlen($accum) - 1] != "\\")
|
206 |
-
{
|
|
|
207 |
$this->currentState = XmlImportTemplateScanner::STATE_LANG;
|
208 |
$this->isLangBegin = true;
|
209 |
//omit [
|
210 |
$input->read();
|
211 |
break;
|
212 |
}
|
|
|
|
|
|
|
|
|
213 |
else
|
214 |
$accum .= $input->read();
|
|
|
215 |
}
|
216 |
$accum = str_replace(array("\\[", "\\{"), array('[', '{'), $accum);
|
217 |
return new XmlImportToken(XmlImportToken::KIND_TEXT, $accum);
|
@@ -264,9 +273,10 @@ final class XmlImportTemplateScanner
|
|
264 |
*/
|
265 |
private function scanName(XmlImportReaderInterface $input)
|
266 |
{
|
267 |
-
$accum = $input->read();
|
|
|
268 |
$is_function = false;
|
269 |
-
while (preg_match('/
|
270 |
{
|
271 |
$accum .= $input->read();
|
272 |
if ($input->peek() === false)
|
@@ -283,9 +293,8 @@ final class XmlImportTemplateScanner
|
|
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 |
|
@@ -294,14 +303,14 @@ final class XmlImportTemplateScanner
|
|
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\"");
|
@@ -322,6 +331,7 @@ final class XmlImportTemplateScanner
|
|
322 |
{
|
323 |
if ($ch == '"' && (strlen($accum) == 0 || $accum[strlen($accum) - 1] != "\\"))
|
324 |
{
|
|
|
325 |
//skip "
|
326 |
$input->read();
|
327 |
$accum = str_replace("\\\"", '"', $accum);
|
@@ -397,7 +407,7 @@ final class XmlImportTemplateScanner
|
|
397 |
*/
|
398 |
private function scanInt(XmlImportReaderInterface $input)
|
399 |
{
|
400 |
-
if (preg_match('/(\d
|
401 |
{
|
402 |
$accum = $input->read();
|
403 |
if ($accum == '-' && !preg_match('/\d/', $input->peek()))
|
52 |
*/
|
53 |
private $isLangBegin = false;
|
54 |
|
55 |
+
private $previous_ch = false;
|
56 |
+
|
57 |
/**
|
58 |
* Current parsing state
|
59 |
*
|
70 |
public function scan(XmlImportReaderInterface $input)
|
71 |
{
|
72 |
$results = array();
|
73 |
+
|
74 |
while (($ch = $input->peek()) !== false)
|
75 |
{
|
76 |
switch ($this->currentState)
|
77 |
{
|
78 |
case XmlImportTemplateScanner::STATE_TEXT:
|
79 |
+
|
80 |
if ($ch == '[')
|
81 |
+
{
|
82 |
+
$this->previous_ch = '[';
|
83 |
$this->currentState = XmlImportTemplateScanner::STATE_LANG;
|
84 |
$this->isLangBegin = true;
|
85 |
//omit [
|
115 |
else
|
116 |
$results[] = $result;
|
117 |
}
|
118 |
+
elseif (preg_match('/(\d)/', $ch))
|
119 |
{
|
120 |
$result = $this->scanNumber($input);
|
121 |
if (is_array($result))
|
122 |
$results = array_merge($results, $result);
|
123 |
else
|
124 |
$results[] = $result;
|
125 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
elseif ($ch == '"')
|
127 |
{
|
128 |
//omit "
|
160 |
$input->read();
|
161 |
$results[] = new XmlImportToken(XmlImportToken::KIND_COMMA);
|
162 |
}
|
163 |
+
elseif ($ch == "]")
|
164 |
{
|
165 |
$this->isLangBegin = false;
|
166 |
$this->currentState = XmlImportTemplateScanner::STATE_TEXT;
|
167 |
//omit ]
|
168 |
$input->read();
|
169 |
}
|
170 |
+
elseif ($ch == "|" || $ch == "+" || $ch == "-" || $ch == "*" || $ch == "/")
|
171 |
+
{
|
172 |
+
$results[] = $this->scanText($input);
|
173 |
+
}
|
174 |
else{
|
175 |
if ($ch == "'"){
|
176 |
throw new XmlImportException("Unexpected symbol ' - When using shortcodes/PHP functions, use double quotes \", not single quotes '");
|
181 |
}
|
182 |
|
183 |
break;
|
184 |
+
}
|
185 |
}
|
186 |
|
187 |
return $results;
|
195 |
*/
|
196 |
private function scanText($input)
|
197 |
{
|
198 |
+
$accum = $input->read();
|
199 |
while (($ch = $input->peek()) !== false)
|
200 |
+
{
|
201 |
if ($ch == '{' && $accum[strlen($accum) - 1] != "\\")
|
202 |
{
|
203 |
$this->currentState = XmlImportTemplateScanner::STATE_XPATH;
|
206 |
break;
|
207 |
}
|
208 |
elseif ($ch == '[' && $accum[strlen($accum) - 1] != "\\")
|
209 |
+
{
|
210 |
+
|
211 |
$this->currentState = XmlImportTemplateScanner::STATE_LANG;
|
212 |
$this->isLangBegin = true;
|
213 |
//omit [
|
214 |
$input->read();
|
215 |
break;
|
216 |
}
|
217 |
+
elseif ($accum == '/' && $this->previous_ch == "["){
|
218 |
+
$accum = "[" . $accum . $input->read();
|
219 |
+
//$this->previous_ch = false;
|
220 |
+
}
|
221 |
else
|
222 |
$accum .= $input->read();
|
223 |
+
$this->previous_ch = $ch;
|
224 |
}
|
225 |
$accum = str_replace(array("\\[", "\\{"), array('[', '{'), $accum);
|
226 |
return new XmlImportToken(XmlImportToken::KIND_TEXT, $accum);
|
273 |
*/
|
274 |
private function scanName(XmlImportReaderInterface $input)
|
275 |
{
|
276 |
+
$accum = $input->read();
|
277 |
+
|
278 |
$is_function = false;
|
279 |
+
while (preg_match('%[/_a-z0-9=\s\-"]%i', $input->peek(), $matches))
|
280 |
{
|
281 |
$accum .= $input->read();
|
282 |
if ($input->peek() === false)
|
293 |
}
|
294 |
else
|
295 |
{
|
296 |
+
|
297 |
+
if (strpos($accum, "=") !== false or (shortcode_exists($accum) and !$is_function) or ! $is_function) {
|
|
|
298 |
$this->isLangBegin = false;
|
299 |
return new XmlImportToken(XmlImportToken::KIND_TEXT, '[' . trim(trim($accum, "["), "]") . ']');
|
300 |
|
303 |
if ($this->isLangBegin)
|
304 |
{
|
305 |
$this->isLangBegin = false;
|
306 |
+
if ( function_exists($accum) or in_array($accum, array('array')))
|
307 |
return array(new XmlImportToken(XmlImportToken::KIND_PRINT), new XmlImportToken(XmlImportToken::KIND_FUNCTION, $accum));
|
308 |
else
|
309 |
throw new XmlImportException("Call to undefined function \"$accum\"");
|
310 |
|
311 |
}
|
312 |
else{
|
313 |
+
if ( function_exists($accum) or in_array($accum, array('array')))
|
314 |
return new XmlImportToken(XmlImportToken::KIND_FUNCTION, $accum);
|
315 |
else
|
316 |
throw new XmlImportException("Call to undefined function \"$accum\"");
|
331 |
{
|
332 |
if ($ch == '"' && (strlen($accum) == 0 || $accum[strlen($accum) - 1] != "\\"))
|
333 |
{
|
334 |
+
|
335 |
//skip "
|
336 |
$input->read();
|
337 |
$accum = str_replace("\\\"", '"', $accum);
|
407 |
*/
|
408 |
private function scanInt(XmlImportReaderInterface $input)
|
409 |
{
|
410 |
+
if (preg_match('/(\d)/', $input->peek()))
|
411 |
{
|
412 |
$accum = $input->read();
|
413 |
if ($accum == '-' && !preg_match('/\d/', $input->peek()))
|
libraries/XmlImportToken.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstElseif.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstExpression.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstFloat.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstForeach.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstFunction.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstIf.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstInteger.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstLiteral.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstMath.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstPrint.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstSequence.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstSpintax.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstStatement.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstString.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstText.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstWith.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstXPath.php
CHANGED
File without changes
|
libraries/ast/XmlImportAstXpathClause.php
CHANGED
File without changes
|
libraries/cache/.gitkeep
DELETED
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['basedir'] .
|
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'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY . DIRECTORY_SEPARATOR );
|
70 |
}
|
71 |
|
72 |
// ----- Optional threshold ratio for use of temporary files
|
models/file/list.php
CHANGED
File without changes
|
models/file/record.php
CHANGED
@@ -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 |
}
|
47 |
|
48 |
if (isset($this->id) and ! is_null($file_contents)) {
|
49 |
$uploads = wp_upload_dir();
|
50 |
+
file_put_contents($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::HISTORY_DIRECTORY . DIRECTORY_SEPARATOR . $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'] . DIRECTORY_SEPARATOR . PMXI_Plugin::HISTORY_DIRECTORY . DIRECTORY_SEPARATOR . $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'] . DIRECTORY_SEPARATOR . PMXI_Plugin::HISTORY_DIRECTORY . DIRECTORY_SEPARATOR . $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'] . DIRECTORY_SEPARATOR . PMXI_Plugin::HISTORY_DIRECTORY . DIRECTORY_SEPARATOR . $this->id;
|
80 |
+
@file_exists($file_name) and @is_file($file_name) and wp_all_import_remove_source($file_name, false);
|
81 |
}
|
82 |
return parent::delete();
|
83 |
}
|
models/history/list.php
CHANGED
File without changes
|
models/history/record.php
CHANGED
@@ -14,10 +14,10 @@ class PMXI_History_Record extends PMXI_Model_Record {
|
|
14 |
public function delete( $db = true ) {
|
15 |
if ($this->id) { // delete history file first
|
16 |
$uploads = wp_upload_dir();
|
17 |
-
$file_name = $uploads['basedir'] .
|
18 |
-
@file_exists($file_name) and @is_file($file_name) and
|
19 |
-
$file_name =
|
20 |
-
@file_exists($file_name) and @is_file($file_name) and
|
21 |
}
|
22 |
return ($db) ? parent::delete() : true;
|
23 |
}
|
14 |
public function delete( $db = true ) {
|
15 |
if ($this->id) { // delete history file first
|
16 |
$uploads = wp_upload_dir();
|
17 |
+
$file_name = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY . DIRECTORY_SEPARATOR . $this->id . '.html';
|
18 |
+
@file_exists($file_name) and @is_file($file_name) and wp_all_import_remove_source($file_name, true);
|
19 |
+
$file_name = wp_all_import_secure_file( $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $this->id ) . DIRECTORY_SEPARATOR . $this->id . '.html';
|
20 |
+
@file_exists($file_name) and @is_file($file_name) and wp_all_import_remove_source($file_name, true);
|
21 |
}
|
22 |
return ($db) ? parent::delete() : true;
|
23 |
}
|
models/import/list.php
CHANGED
File without changes
|
models/import/record.php
CHANGED
@@ -16,7 +16,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
16 |
|
17 |
self::$cdata = array();
|
18 |
|
19 |
-
$xml = preg_replace_callback('/<!\[CDATA\[[^\]\]>]*\]\]>/s', '
|
20 |
|
21 |
$xml = str_replace("&", "&", str_replace("&","&", $xml));
|
22 |
|
@@ -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', __('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.', '
|
40 |
} else {
|
41 |
|
42 |
PMXI_Import_Record::preprocessXml($xml);
|
@@ -48,12 +48,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
48 |
$xml_errors = libxml_get_errors();
|
49 |
libxml_clear_errors();
|
50 |
if ($xml_errors) {
|
51 |
-
$error_msg = '<strong>' . __('Invalid XML', '
|
52 |
foreach($xml_errors as $error) {
|
53 |
$error_msg .= '<li>';
|
54 |
-
$error_msg .= __('Line', '
|
55 |
-
$error_msg .= __('Column', '
|
56 |
-
$error_msg .= __('Code', '
|
57 |
$error_msg .= '<em>' . trim(esc_html($error->message)) . '</em>';
|
58 |
$error_msg .= '</li>';
|
59 |
}
|
@@ -64,8 +64,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
64 |
}
|
65 |
}
|
66 |
else{
|
67 |
-
$errors and $errors->add('form-validation', __('Required PHP components are missing.', '
|
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.', '
|
69 |
}
|
70 |
}
|
71 |
return false;
|
@@ -79,7 +79,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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 |
|
@@ -115,7 +115,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
115 |
|
116 |
try {
|
117 |
|
118 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', '
|
119 |
if ( ! empty($this->options['title'])){
|
120 |
$titles = XmlImportParser::factory($xml, $cxpath, $this->options['title'], $file)->parse($records); $tmp_files[] = $file;
|
121 |
}
|
@@ -123,7 +123,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
123 |
$loop and $titles = array_fill(0, $loop, '');
|
124 |
}
|
125 |
|
126 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing excerpts...', '
|
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;
|
@@ -133,17 +133,65 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
133 |
}
|
134 |
|
135 |
if ( "xpath" == $this->options['status'] ){
|
136 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing statuses...', '
|
137 |
$post_status = array();
|
138 |
if (!empty($this->options['status_xpath'])){
|
139 |
-
$post_status = XmlImportParser::factory($xml, $cxpath, $this->options['status_xpath'], $file)->parse($records); $tmp_files[] = $file;
|
140 |
}
|
141 |
else{
|
142 |
count($titles) and $post_status = array_fill(0, count($titles), '');
|
143 |
}
|
144 |
}
|
145 |
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
$post_author = array();
|
148 |
$current_user = wp_get_current_user();
|
149 |
|
@@ -158,7 +206,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
158 |
count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
|
159 |
}
|
160 |
|
161 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing slugs...', '
|
162 |
$post_slug = array();
|
163 |
if (!empty($this->options['post_slug'])){
|
164 |
$post_slug = XmlImportParser::factory($xml, $cxpath, $this->options['post_slug'], $file)->parse($records); $tmp_files[] = $file;
|
@@ -167,7 +215,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
167 |
count($titles) and $post_slug = array_fill(0, count($titles), '');
|
168 |
}
|
169 |
|
170 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing menu order...', '
|
171 |
$menu_order = array();
|
172 |
if (!empty($this->options['order'])){
|
173 |
$menu_order = XmlImportParser::factory($xml, $cxpath, $this->options['order'], $file)->parse($records); $tmp_files[] = $file;
|
@@ -176,7 +224,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
176 |
count($titles) and $menu_order = array_fill(0, count($titles), '');
|
177 |
}
|
178 |
|
179 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing contents...', '
|
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)),
|
@@ -189,7 +237,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
189 |
count($titles) and $contents = array_fill(0, count($titles), '');
|
190 |
}
|
191 |
|
192 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing dates...', '
|
193 |
if ('specific' == $this->options['date_type']) {
|
194 |
$dates = XmlImportParser::factory($xml, $cxpath, $this->options['date'], $file)->parse($records); $tmp_files[] = $file;
|
195 |
$warned = array(); // used to prevent the same notice displaying several times
|
@@ -197,7 +245,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
197 |
if ($d == 'now') $d = current_time('mysql'); // Replace 'now' with the WordPress local time to account for timezone offsets (WordPress references its local time during publishing rather than the server’s time so it should use that)
|
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', '
|
201 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
202 |
$time = time();
|
203 |
}
|
@@ -210,13 +258,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
210 |
foreach ($dates_start as $i => $d) {
|
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', '
|
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', '
|
220 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
221 |
$time_end = time();
|
222 |
}
|
@@ -228,11 +276,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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', 'product_shipping_class') : 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...', '
|
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();
|
@@ -240,103 +288,185 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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,
|
244 |
foreach ($txes as $i => $tx) {
|
245 |
-
$taxonomies[$tx_name][$i][] =
|
246 |
'name' => $tx,
|
247 |
'parent' => false,
|
248 |
-
'assign' => $this->options['
|
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,
|
257 |
foreach ($txes as $i => $tx) {
|
258 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
if ( ! empty($delimeted_taxonomies) ){
|
260 |
foreach ($delimeted_taxonomies as $cc) {
|
261 |
-
$taxonomies[$tx_name][$i][] =
|
262 |
'name' => $cc,
|
263 |
'parent' => false,
|
264 |
-
'assign' => $this->options['
|
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['
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
|
|
|
|
278 |
foreach ($txes as $i => $tx) {
|
279 |
-
$
|
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 |
-
|
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 |
-
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
}
|
339 |
-
}
|
340 |
break;
|
341 |
|
342 |
default:
|
@@ -346,15 +476,15 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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>', '
|
354 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>: No featured images will be created. Uploads folder is not found.', '
|
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...', '
|
358 |
$featured_images = array();
|
359 |
if ( "no" == $this->options['download_images']){
|
360 |
if ($this->options['featured_image']) {
|
@@ -374,7 +504,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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)...', '
|
378 |
$image_meta_titles = array();
|
379 |
|
380 |
if ($this->options['image_meta_title']) {
|
@@ -386,7 +516,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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)...', '
|
390 |
$image_meta_captions = array();
|
391 |
if ($this->options['image_meta_caption']) {
|
392 |
$image_meta_captions = XmlImportParser::factory($xml, $cxpath, $this->options['image_meta_caption'], $file)->parse($records); $tmp_files[] = $file;
|
@@ -397,7 +527,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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)...', '
|
401 |
$image_meta_alts = array();
|
402 |
if ($this->options['image_meta_alt']) {
|
403 |
$image_meta_alts = XmlImportParser::factory($xml, $cxpath, $this->options['image_meta_alt'], $file)->parse($records); $tmp_files[] = $file;
|
@@ -408,7 +538,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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)...', '
|
412 |
$image_meta_descriptions = array();
|
413 |
if ($this->options['image_meta_description']) {
|
414 |
$image_meta_descriptions = XmlImportParser::factory($xml, $cxpath, $this->options['image_meta_description'], $file)->parse($records); $tmp_files[] = $file;
|
@@ -419,7 +549,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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...', '
|
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;
|
@@ -429,7 +559,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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...', '
|
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;
|
@@ -441,11 +571,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
441 |
|
442 |
// Composing attachments
|
443 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
444 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>', '
|
445 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>: No attachments will be created', '
|
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...', '
|
449 |
$attachments = array();
|
450 |
|
451 |
if ($this->options['attachments']) {
|
@@ -474,7 +604,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
474 |
}
|
475 |
}
|
476 |
|
477 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing unique keys...', '
|
478 |
if (!empty($this->options['unique_key'])){
|
479 |
$unique_keys = XmlImportParser::factory($xml, $cxpath, $this->options['unique_key'], $file)->parse($records); $tmp_files[] = $file;
|
480 |
}
|
@@ -482,7 +612,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
482 |
count($titles) and $unique_keys = array_fill(0, count($titles), '');
|
483 |
}
|
484 |
|
485 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', '
|
486 |
|
487 |
if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
|
488 |
$post_type = $this->options['custom_type'];
|
@@ -496,7 +626,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
496 |
$addons_data = array();
|
497 |
|
498 |
// data parsing for WP All Import add-ons
|
499 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Data parsing via add-ons...', '
|
500 |
$parsingData = array(
|
501 |
'import' => $this,
|
502 |
'count' => count($titles),
|
@@ -525,7 +655,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
525 |
$specified_records = array();
|
526 |
|
527 |
if ($this->options['is_import_specified']) {
|
528 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Calculate specified records to import...', '
|
529 |
foreach (preg_split('% *, *%', $this->options['import_specified'], -1, PREG_SPLIT_NO_EMPTY) as $chank) {
|
530 |
if (preg_match('%^(\d+)-(\d+)$%', $chank, $mtch)) {
|
531 |
$specified_records = array_merge($specified_records, range(intval($mtch[1]), intval($mtch[2])));
|
@@ -540,12 +670,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
540 |
|
541 |
if ($is_cron and $cron_sleep) sleep($cron_sleep);
|
542 |
|
543 |
-
$logger and call_user_func($logger, __('---', '
|
544 |
-
$logger and call_user_func($logger, sprintf(__('Record #%s', '
|
545 |
|
546 |
wp_cache_flush();
|
547 |
|
548 |
-
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_before_post_import ...', '
|
549 |
do_action('pmxi_before_post_import', $this->id);
|
550 |
|
551 |
if ( empty($titles[$i]) ) {
|
@@ -553,7 +683,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
553 |
$titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
|
554 |
}
|
555 |
else{
|
556 |
-
$logger and call_user_func($logger, __('<b>WARNING</b>: title is empty.', '
|
557 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
558 |
}
|
559 |
}
|
@@ -571,16 +701,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
571 |
'last_name' => $addons_data['PMUI_Plugin']['pmui_last_name'][$i],
|
572 |
'description' => $addons_data['PMUI_Plugin']['pmui_description'][$i],
|
573 |
'nickname' => $addons_data['PMUI_Plugin']['pmui_nickname'][$i],
|
574 |
-
'role' => ('' == $addons_data['PMUI_Plugin']['pmui_role'][$i]) ? 'subscriber' : $addons_data['PMUI_Plugin']['pmui_role'][$i],
|
575 |
);
|
576 |
-
$logger and call_user_func($logger, sprintf(__('Combine all data for user %s...', '
|
577 |
}
|
578 |
else {
|
579 |
$articleData = array(
|
580 |
'post_type' => $post_type,
|
581 |
'post_status' => ("xpath" == $this->options['status']) ? $post_status[$i] : $this->options['status'],
|
582 |
-
'comment_status' => $this->options['comment_status'],
|
583 |
-
'ping_status' => $this->options['ping_status'],
|
584 |
'post_title' => (!empty($this->options['is_leave_html'])) ? html_entity_decode($titles[$i]) : $titles[$i],
|
585 |
'post_excerpt' => apply_filters('pmxi_the_excerpt', ((!empty($this->options['is_leave_html'])) ? html_entity_decode($post_excerpt[$i]) : $post_excerpt[$i]), $this->id),
|
586 |
'post_name' => $post_slug[$i],
|
@@ -589,9 +719,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
589 |
'post_date_gmt' => get_gmt_from_date($dates[$i]),
|
590 |
'post_author' => $post_author[$i],
|
591 |
'menu_order' => (int) $menu_order[$i],
|
592 |
-
'post_parent' => (int) $this->options['parent']
|
593 |
);
|
594 |
-
$logger and call_user_func($logger, sprintf(__('Combine all data for post `%s`...', '
|
595 |
}
|
596 |
|
597 |
// Re-import Records Matching
|
@@ -601,7 +731,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
601 |
if ( "manual" != $this->options['duplicate_matching'] ){
|
602 |
|
603 |
// find corresponding article among previously imported
|
604 |
-
$logger and call_user_func($logger, sprintf(__('Find corresponding article among previously imported for post `%s`...', '
|
605 |
$postRecord->clear();
|
606 |
$postRecord->getBy(array(
|
607 |
'unique_key' => $unique_keys[$i],
|
@@ -609,7 +739,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
609 |
));
|
610 |
|
611 |
if ( ! $postRecord->isEmpty() ) {
|
612 |
-
$logger and call_user_func($logger, sprintf(__('Duplicate post was founded for post %s with unique key `%s`...', '
|
613 |
if ( $this->options['custom_type'] == 'import_users'){
|
614 |
$post_to_update = get_user_by('id', $post_to_update_id = $postRecord->post_id);
|
615 |
}
|
@@ -618,7 +748,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
618 |
}
|
619 |
}
|
620 |
else{
|
621 |
-
$logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'t founded with unique key `%s`...', '
|
622 |
}
|
623 |
|
624 |
// if Manual Matching re-import option seleted
|
@@ -632,12 +762,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
632 |
count($titles) and $custom_duplicate_name = $custom_duplicate_value = array_fill(0, count($titles), '');
|
633 |
}
|
634 |
|
635 |
-
$logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', '
|
636 |
// handle duplicates according to import settings
|
637 |
if ($duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'])) {
|
638 |
$duplicate_id = array_shift($duplicates);
|
639 |
if ($duplicate_id) {
|
640 |
-
$logger and call_user_func($logger, sprintf(__('Duplicate post was founded for post `%s`...', '
|
641 |
if ( $this->options['custom_type'] == 'import_users'){
|
642 |
$post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
|
643 |
}
|
@@ -646,7 +776,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
646 |
}
|
647 |
}
|
648 |
else{
|
649 |
-
$logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'n founded for post `%s`...', '
|
650 |
}
|
651 |
}
|
652 |
}
|
@@ -658,10 +788,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
658 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
659 |
|
660 |
$skipped++;
|
661 |
-
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', '
|
662 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
663 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
664 |
-
PMXI_Plugin::$session->save_data();
|
665 |
continue;
|
666 |
}
|
667 |
}
|
@@ -669,7 +799,22 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
669 |
// Duplicate record is founded
|
670 |
if ($post_to_update){
|
671 |
|
672 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
673 |
|
674 |
// Do not update already existing records option selected
|
675 |
if ("yes" == $this->options['is_keep_former_posts']) {
|
@@ -679,10 +824,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
679 |
do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration);
|
680 |
|
681 |
$skipped++;
|
682 |
-
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', '
|
683 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
684 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
685 |
-
PMXI_Plugin::$session->save_data();
|
686 |
continue;
|
687 |
}
|
688 |
|
@@ -694,12 +839,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
694 |
|
695 |
// preserve date of already existing article when duplicate is found
|
696 |
if ( ! $this->options['is_update_categories'] or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
|
697 |
-
$logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', '
|
698 |
$existing_taxonomies = array();
|
699 |
foreach (array_keys($taxonomies) as $tx_name) {
|
700 |
$txes_list = get_the_terms($articleData['ID'], $tx_name);
|
701 |
if (is_wp_error($txes_list)) {
|
702 |
-
$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', '
|
703 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
704 |
} else {
|
705 |
$txes_new = array();
|
@@ -716,39 +861,39 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
716 |
if ( ! $this->options['is_update_dates']) { // preserve date of already existing article when duplicate is found
|
717 |
$articleData['post_date'] = $post_to_update->post_date;
|
718 |
$articleData['post_date_gmt'] = $post_to_update->post_date_gmt;
|
719 |
-
$logger and call_user_func($logger, sprintf(__('Preserve date of already existing article for `%s`', '
|
720 |
}
|
721 |
if ( ! $this->options['is_update_status']) { // preserve status and trashed flag
|
722 |
$articleData['post_status'] = $post_to_update->post_status;
|
723 |
-
$logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', '
|
724 |
}
|
725 |
if ( ! $this->options['is_update_content']){
|
726 |
$articleData['post_content'] = $post_to_update->post_content;
|
727 |
-
$logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', '
|
728 |
}
|
729 |
if ( ! $this->options['is_update_title']){
|
730 |
$articleData['post_title'] = $post_to_update->post_title;
|
731 |
-
$logger and call_user_func($logger, sprintf(__('Preserve title of already existing article for `%s`', '
|
732 |
}
|
733 |
if ( ! $this->options['is_update_slug']){
|
734 |
$articleData['post_name'] = $post_to_update->post_name;
|
735 |
-
$logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', '
|
736 |
}
|
737 |
if ( ! $this->options['is_update_excerpt']){
|
738 |
$articleData['post_excerpt'] = $post_to_update->post_excerpt;
|
739 |
-
$logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', '
|
740 |
}
|
741 |
if ( ! $this->options['is_update_menu_order']){
|
742 |
$articleData['menu_order'] = $post_to_update->menu_order;
|
743 |
-
$logger and call_user_func($logger, sprintf(__('Preserve menu order of already existing article for `%s`', '
|
744 |
}
|
745 |
if ( ! $this->options['is_update_parent']){
|
746 |
$articleData['post_parent'] = $post_to_update->post_parent;
|
747 |
-
$logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', '
|
748 |
}
|
749 |
if ( ! $this->options['is_update_author']){
|
750 |
$articleData['post_author'] = $post_to_update->post_author;
|
751 |
-
$logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', '
|
752 |
}
|
753 |
}
|
754 |
else {
|
@@ -766,7 +911,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
766 |
if ( ! $this->options['is_update_url'] ) $articleData['user_url'] = $post_to_update->user_url;
|
767 |
}
|
768 |
|
769 |
-
$logger and call_user_func($logger, sprintf(__('Applying filter `pmxi_article_data` for `%s`', '
|
770 |
$articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update);
|
771 |
|
772 |
}
|
@@ -774,13 +919,13 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
774 |
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
775 |
|
776 |
if ( $this->options['update_all_data'] == 'yes' or ( $this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
|
777 |
-
$logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', '
|
778 |
wp_delete_attachments($articleData['ID'], true, 'files');
|
779 |
}
|
780 |
// handle obsolete attachments (i.e. delete or keep) according to import settings
|
781 |
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")){
|
782 |
-
$logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', '
|
783 |
-
wp_delete_attachments($articleData['ID'], ($this->options['download_images'] == 'yes'), 'images');
|
784 |
}
|
785 |
|
786 |
}
|
@@ -797,11 +942,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
797 |
|
798 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
799 |
|
800 |
-
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by do not create new posts option.', '
|
801 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
802 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
803 |
$skipped++;
|
804 |
-
PMXI_Plugin::$session->save_data();
|
805 |
continue;
|
806 |
}
|
807 |
|
@@ -869,7 +1014,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
869 |
));
|
870 |
$dest->insert();
|
871 |
} else {
|
872 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to create cloaked link for %s', '
|
873 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
874 |
$link = NULL;
|
875 |
}
|
@@ -883,15 +1028,20 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
883 |
}
|
884 |
|
885 |
// insert article being imported
|
|
|
|
|
|
|
|
|
|
|
|
|
886 |
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
887 |
if (empty($articleData['ID'])){
|
888 |
-
$logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', '
|
889 |
}
|
890 |
else{
|
891 |
-
$logger and call_user_func($logger, sprintf(__('<b>UPDATING</b> `%s` `%s`', '
|
892 |
-
}
|
893 |
-
|
894 |
-
$pid = ($this->options['is_fast_mode']) ? pmxi_insert_post($articleData, true) : wp_insert_post($articleData, true);
|
895 |
}
|
896 |
else{
|
897 |
$pid = (empty($articleData['ID'])) ? wp_insert_user( $articleData ) : wp_update_user( $articleData );
|
@@ -899,8 +1049,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
899 |
}
|
900 |
|
901 |
if (is_wp_error($pid)) {
|
902 |
-
$logger and call_user_func($logger, __('<b>ERROR</b>', '
|
903 |
$logger and !$is_cron and PMXI_Plugin::$session->errors++;
|
|
|
904 |
} else {
|
905 |
|
906 |
if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
|
@@ -914,16 +1065,17 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
914 |
|
915 |
$postRecord->set(array('iteration' => $this->iteration))->update();
|
916 |
|
917 |
-
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with current import ...', '
|
918 |
}
|
919 |
|
920 |
// [post format]
|
921 |
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ){
|
922 |
set_post_format($pid, $this->options['post_format'] );
|
923 |
-
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', '
|
924 |
}
|
925 |
// [/post format]
|
926 |
|
|
|
927 |
// [addons import]
|
928 |
|
929 |
// prepare data for import
|
@@ -952,7 +1104,9 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
952 |
// [/addons import]
|
953 |
|
954 |
// Page Template
|
955 |
-
if ('
|
|
|
|
|
956 |
|
957 |
// [featured image]
|
958 |
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']))) {
|
@@ -962,11 +1116,11 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
962 |
$targetDir = $uploads['path'];
|
963 |
$targetUrl = $uploads['url'];
|
964 |
|
965 |
-
$logger and call_user_func($logger, __('<b>IMAGES:</b>', '
|
966 |
|
967 |
if ( ! @is_writable($targetDir) ){
|
968 |
|
969 |
-
$logger and call_user_func($logger, sprintf(__('<b>ERROR</b>: Target directory %s is not writable', '
|
970 |
|
971 |
}
|
972 |
else{
|
@@ -983,8 +1137,38 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
983 |
if ( ! empty($line_imgs) )
|
984 |
foreach ($line_imgs as $line_img)
|
985 |
$imgs = array_merge($imgs, ( ! empty($featured_delim) ) ? str_getcsv($line_img, $featured_delim) : array($line_img) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
|
987 |
-
if (!empty($imgs)) {
|
988 |
|
989 |
if ( $this->options['set_image_meta_title'] ){
|
990 |
$img_titles = array();
|
@@ -1012,17 +1196,19 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1012 |
}
|
1013 |
if ( $this->options['set_image_meta_description'] ){
|
1014 |
$img_descriptions = array();
|
1015 |
-
$line_img_descriptions = explode("\n", $
|
1016 |
if ( ! empty($line_img_descriptions) )
|
1017 |
foreach ($line_img_descriptions as $line_img_description)
|
1018 |
$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) );
|
1019 |
|
1020 |
}
|
1021 |
|
1022 |
-
foreach ($imgs as $k => $img_url) { if (empty($img_url)) continue;
|
|
|
|
|
1023 |
|
1024 |
$url = str_replace(" ", "%20", trim($img_url));
|
1025 |
-
$bn
|
1026 |
|
1027 |
if ( "yes" == $this->options['download_images'] and ! empty($auto_extensions[$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions[$i])){
|
1028 |
$img_ext = $auto_extensions[$i];
|
@@ -1034,26 +1220,26 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1034 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
1035 |
}
|
1036 |
|
1037 |
-
$logger and call_user_func($logger, sprintf(__('- Importing image `%s` for `%s` ...', '
|
1038 |
|
1039 |
// generate local file name
|
1040 |
$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 : '');
|
1041 |
|
1042 |
// if wizard store image data to custom field
|
1043 |
-
$create_image
|
1044 |
$download_image = true;
|
1045 |
|
1046 |
if (base64_decode($url, true) !== false){
|
1047 |
$img = @imagecreatefromstring(base64_decode($url));
|
1048 |
if($img)
|
1049 |
{
|
1050 |
-
$logger and call_user_func($logger, __('- Founded base64_encoded image', '
|
1051 |
|
1052 |
$image_filename = md5(time()) . '.jpg';
|
1053 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1054 |
imagejpeg($img, $image_filepath);
|
1055 |
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1056 |
-
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', '
|
1057 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1058 |
} else {
|
1059 |
$create_image = true;
|
@@ -1065,68 +1251,85 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1065 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1066 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1067 |
|
1068 |
-
$logger and call_user_func($logger, sprintf(__('- Image `%s` will be saved with name `%s` ...', '
|
1069 |
|
1070 |
// keep existing and add newest images
|
1071 |
-
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"){
|
|
|
|
|
1072 |
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
'
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
if ( ! has_post_thumbnail($pid) and $this->options['is_featured'] )
|
1087 |
-
set_post_thumbnail($pid, $attachment_img->ID);
|
1088 |
-
elseif ( ! in_array($attachment_img->ID, $gallery_attachment_ids))
|
1089 |
-
$gallery_attachment_ids[] = $attachment_img->ID;
|
1090 |
-
|
1091 |
-
$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']));
|
1092 |
}
|
1093 |
-
}
|
1094 |
}
|
1095 |
|
1096 |
}
|
1097 |
|
1098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1099 |
|
1100 |
-
|
1101 |
-
if ( "yes" != $this->options['download_images'] ){
|
1102 |
|
1103 |
-
|
|
|
1104 |
|
1105 |
$image_filename = $image_name;
|
1106 |
-
$image_filepath = $targetDir . '/' . $image_filename;
|
1107 |
-
|
1108 |
|
1109 |
-
$wpai_uploads = $uploads['basedir'] .
|
1110 |
-
$wpai_image_path = $wpai_uploads . $
|
1111 |
|
1112 |
-
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` in `%s` folder', '
|
1113 |
|
1114 |
if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
|
1115 |
$download_image = false;
|
1116 |
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1117 |
-
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', '
|
1118 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1119 |
@unlink($image_filepath);
|
1120 |
} else {
|
1121 |
$create_image = true;
|
1122 |
-
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully founded', '
|
1123 |
}
|
1124 |
}
|
1125 |
}
|
1126 |
-
|
1127 |
-
if ($download_image){
|
1128 |
|
1129 |
-
$logger and call_user_func($logger, sprintf(__('- Downloading image from `%s`', '
|
1130 |
|
1131 |
$request = get_file_curl($url, $image_filepath);
|
1132 |
|
@@ -1134,7 +1337,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1134 |
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1135 |
} elseif( ($image_info = @getimagesize($image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1136 |
$create_image = true;
|
1137 |
-
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', '
|
1138 |
}
|
1139 |
|
1140 |
if ( ! $create_image ){
|
@@ -1144,30 +1347,30 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
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 |
-
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s cannot be saved locally as %s', '
|
1148 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1149 |
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1150 |
} elseif( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1151 |
-
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', '
|
1152 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1153 |
@unlink($image_filepath);
|
1154 |
} else {
|
1155 |
$create_image = true;
|
1156 |
-
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', '
|
1157 |
}
|
1158 |
}
|
1159 |
-
}
|
1160 |
}
|
1161 |
}
|
1162 |
|
1163 |
if ($create_image){
|
1164 |
|
1165 |
-
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for image `%s`', '
|
1166 |
|
1167 |
$attachment = array(
|
1168 |
'post_mime_type' => image_type_to_mime_type($image_info[2]),
|
1169 |
'guid' => $targetUrl . '/' . $image_filename,
|
1170 |
-
'post_title' => $
|
1171 |
'post_content' => '',
|
1172 |
'post_author' => $post_author[$i],
|
1173 |
);
|
@@ -1176,12 +1379,12 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1176 |
$attachment['post_title'] = $image_meta['title'];
|
1177 |
if (trim($image_meta['caption']))
|
1178 |
$attachment['post_content'] = $image_meta['caption'];
|
1179 |
-
}
|
1180 |
|
1181 |
-
$attid =
|
1182 |
|
1183 |
if (is_wp_error($attid)) {
|
1184 |
-
$logger and call_user_func($logger, __('- <b>WARNING</b>', '
|
1185 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1186 |
} else {
|
1187 |
// you must first include the image.php file
|
@@ -1196,28 +1399,37 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1196 |
if ( $this->options['set_image_meta_alt'] and ! empty($img_alts[$k]) ) update_post_meta($attid, '_wp_attachment_image_alt', $img_alts[$k]);
|
1197 |
|
1198 |
if ( ! empty($update_attachment_meta)) $this->wpdb->update( $this->wpdb->posts, $update_attachment_meta, array('ID' => $attid) );
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
|
|
|
|
|
|
|
|
|
|
1202 |
|
1203 |
-
|
1204 |
-
if ( ! has_post_thumbnail($pid) and $this->options['is_featured'] )
|
1205 |
-
set_post_thumbnail($pid, $attid);
|
1206 |
-
elseif ( ! in_array($attid, $gallery_attachment_ids))
|
1207 |
-
$gallery_attachment_ids[] = $attid;
|
1208 |
|
1209 |
-
|
|
|
|
|
1210 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1211 |
}
|
1212 |
}
|
1213 |
-
}
|
1214 |
// Set product gallery images
|
1215 |
-
if ( $post_type == "product"
|
1216 |
-
update_post_meta($pid, '_product_image_gallery', implode(',', $gallery_attachment_ids));
|
1217 |
// Create entry as Draft if no images are downloaded successfully
|
1218 |
if ( ! $success_images and "yes" == $this->options['create_draft'] ) {
|
1219 |
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1220 |
-
$logger and call_user_func($logger, sprintf(__('- Post `%s` saved as Draft, because no images are downloaded successfully', '
|
1221 |
}
|
1222 |
}
|
1223 |
}
|
@@ -1225,7 +1437,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1225 |
// Create entry as Draft if no images are downloaded successfully
|
1226 |
if ( "yes" == $this->options['create_draft'] ){
|
1227 |
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1228 |
-
$logger and call_user_func($logger, sprintf(__('Post `%s` saved as Draft, because no images are downloaded successfully', '
|
1229 |
}
|
1230 |
}
|
1231 |
}
|
@@ -1237,10 +1449,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1237 |
$targetDir = $uploads['path'];
|
1238 |
$targetUrl = $uploads['url'];
|
1239 |
|
1240 |
-
$logger and call_user_func($logger, __('<b>ATTACHMENTS:</b>', '
|
1241 |
|
1242 |
if ( ! @is_writable($targetDir) ){
|
1243 |
-
$logger and call_user_func($logger, sprintf(__('- <b>ERROR</b>: Target directory %s is not writable', '
|
1244 |
}
|
1245 |
else{
|
1246 |
// you must first include the image.php file
|
@@ -1249,7 +1461,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1249 |
|
1250 |
if ( ! is_array($attachments[$i]) ) $attachments[$i] = array($attachments[$i]);
|
1251 |
|
1252 |
-
$logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', '
|
1253 |
|
1254 |
foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
|
1255 |
|
@@ -1257,47 +1469,69 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1257 |
|
1258 |
if ( ! empty($atchs) ) {
|
1259 |
|
1260 |
-
foreach ($atchs as $atch_url) { if (empty($atch_url)) continue;
|
|
|
|
|
1261 |
|
1262 |
$atch_url = str_replace(" ", "%20", trim($atch_url));
|
1263 |
|
1264 |
-
$attachment_filename =
|
1265 |
-
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
1266 |
|
1267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1268 |
|
1269 |
-
|
1270 |
-
|
1271 |
-
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($attachment_filepath, @file_get_contents(trim($atch_url)))) {
|
1272 |
-
$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));
|
1273 |
-
is_wp_error($request) and $logger and call_user_func($logger, sprintf(__('- <b>WP Error</b>: %s', 'pmxi_plugin'), $request->get_error_message()));
|
1274 |
-
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1275 |
-
unlink($attachment_filepath); // delete file since failed upload may result in empty file created
|
1276 |
-
} elseif( ! $wp_filetype = wp_check_filetype(basename($attachment_filename), null )) {
|
1277 |
-
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Can\'t detect attachment file type %s', 'pmxi_plugin'), trim($atch_url)));
|
1278 |
-
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1279 |
-
} else {
|
1280 |
-
$logger and call_user_func($logger, sprintf(__('- File %s has been successfully downloaded', 'pmxi_plugin'), $atch_url));
|
1281 |
-
$attachment_data = array(
|
1282 |
-
'guid' => $targetUrl . '/' . basename($attachment_filepath),
|
1283 |
-
'post_mime_type' => $wp_filetype['type'],
|
1284 |
-
'post_title' => preg_replace('/\.[^.]+$/', '', basename($attachment_filepath)),
|
1285 |
-
'post_content' => '',
|
1286 |
-
'post_status' => 'inherit',
|
1287 |
-
'post_author' => $post_author[$i],
|
1288 |
-
);
|
1289 |
-
$attach_id = ($this->options['is_fast_mode']) ? pmxi_insert_attachment( $attachment_data, $attachment_filepath, $pid ) : wp_insert_attachment( $attachment_data, $attachment_filepath, $pid );
|
1290 |
|
1291 |
-
|
1292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1293 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1294 |
-
} else {
|
1295 |
-
|
1296 |
-
$
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1301 |
}
|
1302 |
}
|
1303 |
}
|
@@ -1308,7 +1542,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1308 |
// [custom taxonomies]
|
1309 |
if ( ! empty($taxonomies) ){
|
1310 |
|
1311 |
-
$logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', '
|
1312 |
|
1313 |
$custom_type = get_post_type_object( $this->options['custom_type'] );
|
1314 |
|
@@ -1319,21 +1553,21 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1319 |
|
1320 |
if ( empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] )) {
|
1321 |
|
1322 |
-
$logger and call_user_func($logger, sprintf(__('- Importing taxonomy `%s` ...', '
|
1323 |
|
1324 |
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'){
|
1325 |
-
$logger and call_user_func($logger, sprintf(__('- Auto-nest enabled with separator `%s` ...', '
|
1326 |
}
|
1327 |
|
1328 |
if (!empty($articleData['ID'])){
|
1329 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1330 |
and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){
|
1331 |
-
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Leave these taxonomies alone, update all others`...', '
|
1332 |
continue;
|
1333 |
}
|
1334 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1335 |
and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){
|
1336 |
-
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Update only these taxonomies, leave the rest alone`...', '
|
1337 |
continue;
|
1338 |
}
|
1339 |
}
|
@@ -1370,17 +1604,17 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1370 |
if ( ! is_wp_error($term) ){
|
1371 |
$is_created_term = true;
|
1372 |
if ( empty($parent_id) ){
|
1373 |
-
$logger and call_user_func($logger, sprintf(__('- Creating parent %s %s `%s` ...', '
|
1374 |
}
|
1375 |
else{
|
1376 |
-
$logger and call_user_func($logger, sprintf(__('- Creating child %s %s for %s named `%s` ...', '
|
1377 |
}
|
1378 |
}
|
1379 |
}
|
1380 |
}
|
1381 |
|
1382 |
if ( is_wp_error($term) ){
|
1383 |
-
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: `%s`', '
|
1384 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1385 |
}
|
1386 |
elseif ( ! empty($term)) {
|
@@ -1391,10 +1625,10 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1391 |
if (!in_array($term->slug, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;
|
1392 |
if (!$is_created_term){
|
1393 |
if ( empty($parent_id) ){
|
1394 |
-
$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` ...', '
|
1395 |
}
|
1396 |
else{
|
1397 |
-
$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` ...', '
|
1398 |
}
|
1399 |
}
|
1400 |
}
|
@@ -1404,7 +1638,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1404 |
endif;
|
1405 |
|
1406 |
// associate taxes with post
|
1407 |
-
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger);
|
1408 |
|
1409 |
}
|
1410 |
}
|
@@ -1415,16 +1649,16 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1415 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1416 |
|
1417 |
if (!empty($txes[$i]))
|
1418 |
-
$this->associate_terms($pid, $txes[$i], $tx_name, $logger);
|
1419 |
}
|
1420 |
}
|
1421 |
}
|
1422 |
// [/custom taxonomies]
|
1423 |
|
1424 |
if (empty($articleData['ID'])) {
|
1425 |
-
$logger and call_user_func($logger, sprintf(__('<b>CREATED</b> `%s` `%s` (ID: %s)', '
|
1426 |
} else {
|
1427 |
-
$logger and call_user_func($logger, sprintf(__('<b>UPDATED</b> `%s` `%s` (ID: %s)', '
|
1428 |
}
|
1429 |
|
1430 |
// [addons import]
|
@@ -1448,18 +1682,18 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1448 |
}
|
1449 |
|
1450 |
// [/addons import]
|
1451 |
-
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', '
|
1452 |
do_action( 'pmxi_saved_post', $pid); // hook that was triggered immediately after post saved
|
1453 |
|
1454 |
if (empty($articleData['ID'])) $created++; else $updated++;
|
1455 |
|
1456 |
if ( ! $is_cron and "default" == $this->options['import_processing'] ){
|
1457 |
-
$processed_records = $created + $updated + $skipped
|
1458 |
-
$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>', '
|
1459 |
}
|
1460 |
|
1461 |
}
|
1462 |
-
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_after_post_import', '
|
1463 |
do_action('pmxi_after_post_import', $this->id);
|
1464 |
|
1465 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
@@ -1479,14 +1713,14 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1479 |
|
1480 |
PMXI_Plugin::$session->save_data();
|
1481 |
|
1482 |
-
$records_count = $this->created + $this->updated + $this->skipped
|
1483 |
|
1484 |
$is_import_complete = ($records_count == $this->count);
|
1485 |
|
1486 |
// Delete posts that are no longer present in your file
|
1487 |
if ( $is_import_complete and ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') {
|
1488 |
|
1489 |
-
$logger and call_user_func($logger, __('Removing previously imported posts which are no longer actual...', '
|
1490 |
$postList = new PMXI_Post_List();
|
1491 |
|
1492 |
$missing_ids = array();
|
@@ -1497,77 +1731,86 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1497 |
foreach ($missingPosts as $missingPost) {
|
1498 |
|
1499 |
$missing_ids[] = $missingPost['post_id'];
|
|
|
|
|
1500 |
|
1501 |
-
|
1502 |
-
if ($this->options['is_update_missing_cf']){
|
1503 |
-
update_post_meta( $missingPost['post_id'], $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
1504 |
-
$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']));
|
1505 |
-
}
|
1506 |
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
}
|
1512 |
|
1513 |
-
|
1514 |
-
if ( ! $this->options['is_update_missing_cf'] and ! $this->options['set_missing_to_draft']){
|
1515 |
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
$
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1534 |
}
|
1535 |
|
1536 |
-
|
1537 |
-
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'));
|
1538 |
|
1539 |
-
|
1540 |
-
|
1541 |
-
}
|
1542 |
|
1543 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1544 |
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
do_action('pmxi_delete_post', $missing_ids);
|
1550 |
-
|
1551 |
-
if ( $this->options['custom_type'] == "import_users" ){
|
1552 |
-
$sql = "delete a,b
|
1553 |
-
FROM ".$this->wpdb->users." a
|
1554 |
-
LEFT JOIN ".$this->wpdb->usermeta." b ON ( a.ID = b.user_id )
|
1555 |
-
WHERE a.ID IN (".implode(',', $missing_ids).");";
|
1556 |
-
}
|
1557 |
-
else {
|
1558 |
-
$sql = "delete a,b,c
|
1559 |
-
FROM ".$this->wpdb->posts." a
|
1560 |
-
LEFT JOIN ".$this->wpdb->term_relationships." b ON ( a.ID = b.object_id )
|
1561 |
-
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
1562 |
-
WHERE a.ID IN (".implode(',', $missing_ids).");";
|
1563 |
-
}
|
1564 |
-
|
1565 |
-
$logger and call_user_func($logger, __('Deleting posts from database', 'pmxi_plugin'));
|
1566 |
-
$this->wpdb->query(
|
1567 |
-
$this->wpdb->prepare($sql, '')
|
1568 |
-
);
|
1569 |
-
|
1570 |
-
$this->set(array('deleted' => count($missing_ids)))->update();
|
1571 |
}
|
1572 |
|
1573 |
}
|
@@ -1575,40 +1818,45 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1575 |
// Set out of stock status for missing records [Woocommerce add-on option]
|
1576 |
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'])) {
|
1577 |
|
1578 |
-
$logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', '
|
1579 |
$postList = new PMXI_Post_List();
|
1580 |
$missingPosts = $postList->getBy(array('import_id' => $this->id, 'iteration !=' => $this->iteration));
|
1581 |
if ( ! $missingPosts->isEmpty() ){
|
1582 |
foreach ($missingPosts as $missingPost) {
|
1583 |
update_post_meta( $missingPost['post_id'], '_stock_status', 'outofstock' );
|
1584 |
update_post_meta( $missingPost['post_id'], '_stock', 0 );
|
|
|
|
|
|
|
|
|
|
|
1585 |
}
|
1586 |
}
|
1587 |
}
|
1588 |
}
|
1589 |
|
1590 |
} catch (XmlImportException $e) {
|
1591 |
-
$logger and call_user_func($logger, __('<b>ERROR</b>', '
|
1592 |
$logger and !$is_cron and PMXI_Plugin::$session->errors++;
|
1593 |
}
|
1594 |
|
1595 |
-
$logger and $is_import_complete and call_user_func($logger, __('Cleaning temporary data...', '
|
1596 |
foreach ($tmp_files as $file) { // remove all temporary files created
|
1597 |
@unlink($file);
|
1598 |
}
|
1599 |
|
1600 |
if (($is_cron or $is_import_complete) and $this->options['is_delete_source']) {
|
1601 |
-
$logger and call_user_func($logger, __('Deleting source XML file...', '
|
1602 |
|
1603 |
// Delete chunks
|
1604 |
-
foreach (PMXI_Helper::safe_glob($uploads['basedir'] . '
|
1605 |
-
$logger and call_user_func($logger, __('Deleting chunks files...', '
|
1606 |
-
@file_exists($filePath) and
|
1607 |
}
|
1608 |
|
1609 |
if ($this->type != "ftp"){
|
1610 |
if ( ! @unlink($this->path)) {
|
1611 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', '
|
1612 |
}
|
1613 |
}
|
1614 |
else{
|
@@ -1616,7 +1864,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1616 |
if (!empty($file_path_array)){
|
1617 |
foreach ($file_path_array as $path) {
|
1618 |
if ( ! @unlink($path)) {
|
1619 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', '
|
1620 |
}
|
1621 |
}
|
1622 |
}
|
@@ -1682,7 +1930,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1682 |
return $caps;
|
1683 |
}
|
1684 |
|
1685 |
-
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger){
|
1686 |
|
1687 |
$terms = wp_get_object_terms( $pid, $tx_name );
|
1688 |
$term_ids = array();
|
@@ -1713,8 +1961,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1713 |
|
1714 |
if ( $values ){
|
1715 |
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)" ) ){
|
1716 |
-
$logger and call_user_func($logger, __('<b>ERROR</b> Could not insert term relationship into the database', '
|
1717 |
-
$logger and PMXI_Plugin::$session['pmxi_import']['errors'] = ++PMXI_Plugin::$session->data['pmxi_import']['errors'];
|
1718 |
}
|
1719 |
}
|
1720 |
|
@@ -1735,8 +1982,8 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1735 |
// Remove attachments
|
1736 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($p->post_id, true, 'files');
|
1737 |
// Remove images
|
1738 |
-
empty($this->options['is_keep_imgs']) and wp_delete_attachments($p->post_id, ($this->options['download_images'] == 'yes'));
|
1739 |
-
$ids[] = $p->post_id;
|
1740 |
}
|
1741 |
|
1742 |
if ( ! empty($ids) ){
|
@@ -1781,7 +2028,7 @@ class PMXI_Import_Record extends PMXI_Model_Record {
|
|
1781 |
$fileList = new PMXI_File_List();
|
1782 |
foreach($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {
|
1783 |
if ( @file_exists($f->path) ){
|
1784 |
-
|
1785 |
}
|
1786 |
$f->delete();
|
1787 |
}
|
16 |
|
17 |
self::$cdata = array();
|
18 |
|
19 |
+
$xml = preg_replace_callback('/<!\[CDATA\[[^\]\]>]*\]\]>/s', 'wp_all_import_cdata_filter', $xml );
|
20 |
|
21 |
$xml = str_replace("&", "&", str_replace("&","&", $xml));
|
22 |
|
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.', 'wp_all_import_plugin'));
|
40 |
} else {
|
41 |
|
42 |
PMXI_Import_Record::preprocessXml($xml);
|
48 |
$xml_errors = libxml_get_errors();
|
49 |
libxml_clear_errors();
|
50 |
if ($xml_errors) {
|
51 |
+
$error_msg = '<strong>' . __('Invalid XML', 'wp_all_import_plugin') . '</strong><ul>';
|
52 |
foreach($xml_errors as $error) {
|
53 |
$error_msg .= '<li>';
|
54 |
+
$error_msg .= __('Line', 'wp_all_import_plugin') . ' ' . $error->line . ', ';
|
55 |
+
$error_msg .= __('Column', 'wp_all_import_plugin') . ' ' . $error->column . ', ';
|
56 |
+
$error_msg .= __('Code', 'wp_all_import_plugin') . ' ' . $error->code . ': ';
|
57 |
$error_msg .= '<em>' . trim(esc_html($error->message)) . '</em>';
|
58 |
$error_msg .= '</li>';
|
59 |
}
|
64 |
}
|
65 |
}
|
66 |
else{
|
67 |
+
$errors and $errors->add('form-validation', __('Required PHP components are missing.', 'wp_all_import_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.', 'wp_all_import_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 |
|
115 |
|
116 |
try {
|
117 |
|
118 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing titles...', 'wp_all_import_plugin'));
|
119 |
if ( ! empty($this->options['title'])){
|
120 |
$titles = XmlImportParser::factory($xml, $cxpath, $this->options['title'], $file)->parse($records); $tmp_files[] = $file;
|
121 |
}
|
123 |
$loop and $titles = array_fill(0, $loop, '');
|
124 |
}
|
125 |
|
126 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing excerpts...', 'wp_all_import_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;
|
133 |
}
|
134 |
|
135 |
if ( "xpath" == $this->options['status'] ){
|
136 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing statuses...', 'wp_all_import_plugin'));
|
137 |
$post_status = array();
|
138 |
if (!empty($this->options['status_xpath'])){
|
139 |
+
$post_status = XmlImportParser::factory($xml, $cxpath, $this->options['status_xpath'], $file)->parse($records); $tmp_files[] = $file;
|
140 |
}
|
141 |
else{
|
142 |
count($titles) and $post_status = array_fill(0, count($titles), '');
|
143 |
}
|
144 |
}
|
145 |
|
146 |
+
if ( "xpath" == $this->options['comment_status'] ){
|
147 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing comment statuses...', 'wp_all_import_plugin'));
|
148 |
+
$comment_status = array();
|
149 |
+
if (!empty($this->options['comment_status_xpath'])){
|
150 |
+
$comment_status = XmlImportParser::factory($xml, $cxpath, $this->options['comment_status_xpath'], $file)->parse($records); $tmp_files[] = $file;
|
151 |
+
}
|
152 |
+
else{
|
153 |
+
count($titles) and $comment_status = array_fill(0, count($titles), 'open');
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
if ( "xpath" == $this->options['ping_status'] ){
|
158 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing ping statuses...', 'wp_all_import_plugin'));
|
159 |
+
$ping_status = array();
|
160 |
+
if (!empty($this->options['ping_status_xpath'])){
|
161 |
+
$ping_status = XmlImportParser::factory($xml, $cxpath, $this->options['ping_status_xpath'], $file)->parse($records); $tmp_files[] = $file;
|
162 |
+
}
|
163 |
+
else{
|
164 |
+
count($titles) and $ping_status = array_fill(0, count($titles), 'open');
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
if ( "no" == $this->options['is_multiple_page_template'] ){
|
169 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing page templates...', 'wp_all_import_plugin'));
|
170 |
+
$page_template = array();
|
171 |
+
if (!empty($this->options['single_page_template'])){
|
172 |
+
$page_template = XmlImportParser::factory($xml, $cxpath, $this->options['single_page_template'], $file)->parse($records); $tmp_files[] = $file;
|
173 |
+
}
|
174 |
+
else{
|
175 |
+
count($titles) and $page_template = array_fill(0, count($titles), 'default');
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
if ( "no" == $this->options['is_multiple_page_parent'] ){
|
180 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing page parent...', 'wp_all_import_plugin'));
|
181 |
+
$page_parent = array();
|
182 |
+
if (!empty($this->options['single_page_parent'])){
|
183 |
+
$page_parent = XmlImportParser::factory($xml, $cxpath, $this->options['single_page_parent'], $file)->parse($records); $tmp_files[] = $file;
|
184 |
+
foreach ($page_parent as $key => $identity) {
|
185 |
+
$page = get_page_by_title($identity) or $page = get_page_by_path($identity) or ctype_digit($identity) and $page = get_post($identity);
|
186 |
+
$page_parent[$key] = (!empty($page)) ? $page->ID : 0;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
else{
|
190 |
+
count($titles) and $page_parent = array_fill(0, count($titles), 0);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing authors...', 'wp_all_import_plugin'));
|
195 |
$post_author = array();
|
196 |
$current_user = wp_get_current_user();
|
197 |
|
206 |
count($titles) and $post_author = array_fill(0, count($titles), $current_user->ID);
|
207 |
}
|
208 |
|
209 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing slugs...', 'wp_all_import_plugin'));
|
210 |
$post_slug = array();
|
211 |
if (!empty($this->options['post_slug'])){
|
212 |
$post_slug = XmlImportParser::factory($xml, $cxpath, $this->options['post_slug'], $file)->parse($records); $tmp_files[] = $file;
|
215 |
count($titles) and $post_slug = array_fill(0, count($titles), '');
|
216 |
}
|
217 |
|
218 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing menu order...', 'wp_all_import_plugin'));
|
219 |
$menu_order = array();
|
220 |
if (!empty($this->options['order'])){
|
221 |
$menu_order = XmlImportParser::factory($xml, $cxpath, $this->options['order'], $file)->parse($records); $tmp_files[] = $file;
|
224 |
count($titles) and $menu_order = array_fill(0, count($titles), '');
|
225 |
}
|
226 |
|
227 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing contents...', 'wp_all_import_plugin'));
|
228 |
if (!empty($this->options['content'])){
|
229 |
$contents = XmlImportParser::factory(
|
230 |
((!empty($this->options['is_keep_linebreaks']) and intval($this->options['is_keep_linebreaks'])) ? $xml : preg_replace('%\r\n?|\n%', ' ', $xml)),
|
237 |
count($titles) and $contents = array_fill(0, count($titles), '');
|
238 |
}
|
239 |
|
240 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing dates...', 'wp_all_import_plugin'));
|
241 |
if ('specific' == $this->options['date_type']) {
|
242 |
$dates = XmlImportParser::factory($xml, $cxpath, $this->options['date'], $file)->parse($records); $tmp_files[] = $file;
|
243 |
$warned = array(); // used to prevent the same notice displaying several times
|
245 |
if ($d == 'now') $d = current_time('mysql'); // Replace 'now' with the WordPress local time to account for timezone offsets (WordPress references its local time during publishing rather than the server’s time so it should use that)
|
246 |
$time = strtotime($d);
|
247 |
if (FALSE === $time) {
|
248 |
+
in_array($d, $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'wp_all_import_plugin'), $warned[] = $d));
|
249 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
250 |
$time = time();
|
251 |
}
|
258 |
foreach ($dates_start as $i => $d) {
|
259 |
$time_start = strtotime($dates_start[$i]);
|
260 |
if (FALSE === $time_start) {
|
261 |
+
in_array($dates_start[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'wp_all_import_plugin'), $warned[] = $dates_start[$i]));
|
262 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
263 |
$time_start = time();
|
264 |
}
|
265 |
$time_end = strtotime($dates_end[$i]);
|
266 |
if (FALSE === $time_end) {
|
267 |
+
in_array($dates_end[$i], $warned) or $logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: unrecognized date format `%s`, assigning current date', 'wp_all_import_plugin'), $warned[] = $dates_end[$i]));
|
268 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
269 |
$time_end = time();
|
270 |
}
|
276 |
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
|
277 |
|
278 |
$taxonomies = array();
|
279 |
+
$exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class') : array('post_format'));
|
280 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($this->options['custom_type']), 'object'), array_flip($exclude_taxonomies));
|
281 |
if ( ! empty($post_taxonomies) ):
|
282 |
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;
|
283 |
+
$chunk == 1 and $logger and call_user_func($logger, sprintf(__('Composing terms for `%s` taxonomy...', 'wp_all_import_plugin'), $ctx->labels->name));
|
284 |
$tx_name = $ctx->name;
|
285 |
$mapping_rules = ( ! empty($this->options['tax_mapping'][$tx_name])) ? json_decode($this->options['tax_mapping'][$tx_name], true) : false;
|
286 |
$taxonomies[$tx_name] = array();
|
288 |
switch ($this->options['tax_logic'][$tx_name]){
|
289 |
case 'single':
|
290 |
if ( ! empty($this->options['tax_single_xpath'][$tx_name]) ){
|
291 |
+
$txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_single_xpath'][$tx_name], $file)->parse($records); $tmp_files[] = $file;
|
292 |
foreach ($txes as $i => $tx) {
|
293 |
+
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
|
294 |
'name' => $tx,
|
295 |
'parent' => false,
|
296 |
+
'assign' => (isset($this->options['term_assing'][$tx_name])) ? $this->options['term_assing'][$tx_name] : true,
|
297 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name])),
|
298 |
+
'hierarchy_level' => 1,
|
299 |
+
'max_hierarchy_level' => 1
|
300 |
), $mapping_rules, $tx_name);
|
301 |
}
|
302 |
}
|
303 |
break;
|
304 |
case 'multiple':
|
305 |
if ( ! empty($this->options['tax_multiple_xpath'][$tx_name]) ){
|
306 |
+
$txes = XmlImportParser::factory($xml, $cxpath, $this->options['tax_multiple_xpath'][$tx_name], $file)->parse($records); $tmp_files[] = $file;
|
307 |
foreach ($txes as $i => $tx) {
|
308 |
+
$_tx = $tx;
|
309 |
+
// apply mapping rules before splitting via separator symbol
|
310 |
+
if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
|
311 |
+
if ( ! empty( $mapping_rules) ){
|
312 |
+
foreach ($mapping_rules as $rule) {
|
313 |
+
if ( ! empty($rule[trim($_tx)])){
|
314 |
+
$_tx = trim($rule[trim($_tx)]);
|
315 |
+
break;
|
316 |
+
}
|
317 |
+
}
|
318 |
+
}
|
319 |
+
}
|
320 |
+
$delimeted_taxonomies = explode( ! empty($this->options['tax_multiple_delim'][$tx_name]) ? $this->options['tax_multiple_delim'][$tx_name] : ',', $_tx);
|
321 |
if ( ! empty($delimeted_taxonomies) ){
|
322 |
foreach ($delimeted_taxonomies as $cc) {
|
323 |
+
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
|
324 |
'name' => $cc,
|
325 |
'parent' => false,
|
326 |
+
'assign' => (isset($this->options['multiple_term_assing'][$tx_name])) ? $this->options['multiple_term_assing'][$tx_name] : true,
|
327 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
328 |
+
'hierarchy_level' => 1,
|
329 |
+
'max_hierarchy_level' => 1
|
330 |
), $mapping_rules, $tx_name);
|
331 |
}
|
332 |
+
}
|
333 |
}
|
334 |
}
|
335 |
break;
|
336 |
case 'hierarchical':
|
337 |
+
if ( ! empty($this->options['tax_hierarchical_logic_entire'][$tx_name])){
|
338 |
+
if (! empty($this->options['tax_hierarchical_xpath'][$tx_name]) and is_array($this->options['tax_hierarchical_xpath'][$tx_name])){
|
339 |
+
count($titles) and $iterator = array_fill(0, count($titles), 0);
|
340 |
+
$taxonomies_hierarchy_groups = array_fill(0, count($titles), array());
|
341 |
+
|
342 |
+
// separate hierarchy groups via symbol
|
343 |
+
if ( ! empty($this->options['is_tax_hierarchical_group_delim'][$tx_name]) and ! empty($this->options['tax_hierarchical_group_delim'][$tx_name])){
|
344 |
+
foreach ($this->options['tax_hierarchical_xpath'][$tx_name] as $k => $tx_xpath) {
|
345 |
+
if (empty($tx_xpath)) continue;
|
346 |
+
$txes = XmlImportParser::factory($xml, $cxpath, $tx_xpath, $file)->parse($records); $tmp_files[] = $file;
|
347 |
foreach ($txes as $i => $tx) {
|
348 |
+
$_tx = $tx;
|
349 |
+
// apply mapping rules before splitting via separator symbol
|
350 |
+
if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
|
351 |
+
if ( ! empty( $mapping_rules) ){
|
352 |
+
foreach ($mapping_rules as $rule) {
|
353 |
+
if ( ! empty($rule[trim($_tx)])){
|
354 |
+
$_tx = trim($rule[trim($_tx)]);
|
355 |
+
break;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
$delimeted_groups = explode($this->options['tax_hierarchical_group_delim'][$tx_name], $_tx);
|
361 |
+
if ( ! empty($delimeted_groups) and is_array($delimeted_groups)){
|
362 |
+
foreach ($delimeted_groups as $group) {
|
363 |
+
if ( ! empty($group) ) array_push($taxonomies_hierarchy_groups[$i], $group);
|
364 |
}
|
365 |
}
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
else{
|
370 |
+
foreach ($this->options['tax_hierarchical_xpath'][$tx_name] as $k => $tx_xpath) {
|
371 |
+
if (empty($tx_xpath)) continue;
|
372 |
+
$txes = XmlImportParser::factory($xml, $cxpath, $tx_xpath, $file)->parse($records); $tmp_files[] = $file;
|
373 |
+
foreach ($txes as $i => $tx) {
|
374 |
+
array_push($taxonomies_hierarchy_groups[$i], $tx);
|
375 |
}
|
376 |
}
|
377 |
+
}
|
378 |
+
|
379 |
+
foreach ($taxonomies_hierarchy_groups as $i => $groups) { if (empty($groups)) continue;
|
380 |
+
foreach ($groups as $kk => $tx) {
|
381 |
+
$_tx = $tx;
|
382 |
+
// apply mapping rules before splitting via separator symbol
|
383 |
+
if ( ! empty($this->options['tax_enable_mapping'][$tx_name]) and ! empty($this->options['tax_logic_mapping'][$tx_name]) ){
|
384 |
+
if ( ! empty( $mapping_rules) ){
|
385 |
+
foreach ($mapping_rules as $rule) {
|
386 |
+
if ( ! empty($rule[trim($_tx)])){
|
387 |
+
$_tx = trim($rule[trim($_tx)]);
|
388 |
+
break;
|
389 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
}
|
392 |
}
|
393 |
+
$delimeted_taxonomies = explode( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',', $_tx);
|
394 |
+
if ( ! empty($delimeted_taxonomies) ){
|
395 |
+
foreach ($delimeted_taxonomies as $j => $cc) {
|
396 |
+
$is_assign_term = (isset($this->options['tax_hierarchical_assing'][$tx_name][$k])) ? $this->options['tax_hierarchical_assing'][$tx_name][$k] : true;
|
397 |
+
if ( ! empty($this->options['tax_hierarchical_last_level_assign'][$tx_name]) ){
|
398 |
+
$is_assign_term = (count($delimeted_taxonomies) == $j + 1) ? 1 : 0;
|
399 |
+
}
|
400 |
+
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
|
401 |
+
'name' => $cc,
|
402 |
+
'parent' => (!empty($taxonomies[$tx_name][$i][$iterator[$i] - 1]) and $j) ? $taxonomies[$tx_name][$i][$iterator[$i] - 1] : false,
|
403 |
+
'assign' => $is_assign_term,
|
404 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name]) and empty($this->options['tax_logic_mapping'][$tx_name])),
|
405 |
+
'hierarchy_level' => $j + 1,
|
406 |
+
'max_hierarchy_level' => count($delimeted_taxonomies)
|
407 |
+
), $mapping_rules, $tx_name);
|
408 |
+
$iterator[$i]++;
|
409 |
+
}
|
410 |
+
}
|
411 |
}
|
412 |
+
}
|
413 |
+
}
|
414 |
+
}
|
415 |
+
if ( ! empty($this->options['tax_hierarchical_logic_manual'][$tx_name])){
|
416 |
+
if ( ! empty($this->options['post_taxonomies'][$tx_name]) ){
|
417 |
+
$taxonomies_hierarchy = json_decode($this->options['post_taxonomies'][$tx_name], true);
|
418 |
+
|
419 |
+
foreach ($taxonomies_hierarchy as $k => $taxonomy){ if ("" == $taxonomy['xpath']) continue;
|
420 |
+
$txes_raw = XmlImportParser::factory($xml, $cxpath, $taxonomy['xpath'], $file)->parse($records); $tmp_files[] = $file;
|
421 |
+
$warned = array();
|
422 |
|
423 |
+
foreach ($txes_raw as $i => $cc) {
|
424 |
+
|
425 |
+
if ( ! empty($this->options['tax_manualhierarchy_delim'][$tx_name])){
|
426 |
+
$delimeted_taxonomies = explode($this->options['tax_manualhierarchy_delim'][$tx_name], $cc);
|
427 |
+
}
|
428 |
+
|
429 |
+
if ( empty($delimeted_taxonomies) ) continue;
|
430 |
+
|
431 |
+
if (empty($taxonomies_hierarchy[$k]['txn_names'][$i])) $taxonomies_hierarchy[$k]['txn_names'][$i] = array();
|
432 |
+
if (empty($taxonomies[$tx_name][$i])) $taxonomies[$tx_name][$i] = array();
|
433 |
+
$count_cats = count($taxonomies[$tx_name][$i]);
|
434 |
+
|
435 |
+
foreach ($delimeted_taxonomies as $j => $dc) {
|
436 |
+
|
437 |
+
if (!empty($taxonomy['parent_id'])) {
|
438 |
+
foreach ($taxonomies_hierarchy as $key => $value){
|
439 |
+
if ($value['item_id'] == $taxonomy['parent_id'] and !empty($value['txn_names'][$i])){
|
440 |
+
foreach ($value['txn_names'][$i] as $parent) {
|
441 |
+
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
|
442 |
+
'name' => trim($dc),
|
443 |
+
'parent' => $parent,
|
444 |
+
'assign' => (isset($taxonomy['assign'])) ? $taxonomy['assign'] : true,
|
445 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name])),
|
446 |
+
'hierarchy_level' => 1,
|
447 |
+
'max_hierarchy_level' => 1
|
448 |
+
), $mapping_rules, $tx_name);
|
449 |
+
}
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
453 |
+
else {
|
454 |
+
$taxonomies[$tx_name][$i][] = wp_all_import_ctx_mapping(array(
|
455 |
+
'name' => trim($dc),
|
456 |
+
'parent' => false,
|
457 |
+
'assign' => (isset($taxonomy['assign'])) ? $taxonomy['assign'] : true,
|
458 |
+
'is_mapping' => (!empty($this->options['tax_enable_mapping'][$tx_name])),
|
459 |
+
'hierarchy_level' => 1,
|
460 |
+
'max_hierarchy_level' => 1
|
461 |
+
), $mapping_rules, $tx_name);
|
462 |
+
}
|
463 |
+
|
464 |
+
if ($count_cats < count($taxonomies[$tx_name][$i])) $taxonomies_hierarchy[$k]['txn_names'][$i][] = $taxonomies[$tx_name][$i][count($taxonomies[$tx_name][$i]) - 1];
|
465 |
+
}
|
466 |
+
}
|
467 |
+
}
|
468 |
}
|
469 |
+
}
|
470 |
break;
|
471 |
|
472 |
default:
|
476 |
}
|
477 |
endforeach;
|
478 |
endif;
|
479 |
+
// [/custom taxonomies]
|
480 |
|
481 |
// Composing featured images
|
482 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
483 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $uploads['error']);
|
484 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>: No featured images will be created. Uploads folder is not found.', 'wp_all_import_plugin'));
|
485 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
486 |
} else {
|
487 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for featured images...', 'wp_all_import_plugin'));
|
488 |
$featured_images = array();
|
489 |
if ( "no" == $this->options['download_images']){
|
490 |
if ($this->options['featured_image']) {
|
504 |
|
505 |
// Composing images meta titles
|
506 |
if ( $this->options['set_image_meta_title'] ){
|
507 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (titles)...', 'wp_all_import_plugin'));
|
508 |
$image_meta_titles = array();
|
509 |
|
510 |
if ($this->options['image_meta_title']) {
|
516 |
|
517 |
// Composing images meta captions
|
518 |
if ( $this->options['set_image_meta_caption'] ){
|
519 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (captions)...', 'wp_all_import_plugin'));
|
520 |
$image_meta_captions = array();
|
521 |
if ($this->options['image_meta_caption']) {
|
522 |
$image_meta_captions = XmlImportParser::factory($xml, $cxpath, $this->options['image_meta_caption'], $file)->parse($records); $tmp_files[] = $file;
|
527 |
|
528 |
// Composing images meta alt text
|
529 |
if ( $this->options['set_image_meta_alt'] ){
|
530 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (alt text)...', 'wp_all_import_plugin'));
|
531 |
$image_meta_alts = array();
|
532 |
if ($this->options['image_meta_alt']) {
|
533 |
$image_meta_alts = XmlImportParser::factory($xml, $cxpath, $this->options['image_meta_alt'], $file)->parse($records); $tmp_files[] = $file;
|
538 |
|
539 |
// Composing images meta description
|
540 |
if ( $this->options['set_image_meta_description'] ){
|
541 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing image meta data (description)...', 'wp_all_import_plugin'));
|
542 |
$image_meta_descriptions = array();
|
543 |
if ($this->options['image_meta_description']) {
|
544 |
$image_meta_descriptions = XmlImportParser::factory($xml, $cxpath, $this->options['image_meta_description'], $file)->parse($records); $tmp_files[] = $file;
|
549 |
|
550 |
if ( "yes" == $this->options['download_images'] ){
|
551 |
// Composing images suffix
|
552 |
+
$chunk == 1 and $this->options['auto_rename_images'] and $logger and call_user_func($logger, __('Composing images suffix...', 'wp_all_import_plugin'));
|
553 |
$auto_rename_images = array();
|
554 |
if ( $this->options['auto_rename_images'] and ! empty($this->options['auto_rename_images_suffix'])){
|
555 |
$auto_rename_images = XmlImportParser::factory($xml, $cxpath, $this->options['auto_rename_images_suffix'], $file)->parse($records); $tmp_files[] = $file;
|
559 |
}
|
560 |
|
561 |
// Composing images extensions
|
562 |
+
$chunk == 1 and $this->options['auto_set_extension'] and $logger and call_user_func($logger, __('Composing images extensions...', 'wp_all_import_plugin'));
|
563 |
$auto_extensions = array();
|
564 |
if ( $this->options['auto_set_extension'] and ! empty($this->options['new_extension'])){
|
565 |
$auto_extensions = XmlImportParser::factory($xml, $cxpath, $this->options['new_extension'], $file)->parse($records); $tmp_files[] = $file;
|
571 |
|
572 |
// Composing attachments
|
573 |
if ( ! (($uploads = wp_upload_dir()) && false === $uploads['error'])) {
|
574 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $uploads['error']);
|
575 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>: No attachments will be created', 'wp_all_import_plugin'));
|
576 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
577 |
} else {
|
578 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing URLs for attachments files...', 'wp_all_import_plugin'));
|
579 |
$attachments = array();
|
580 |
|
581 |
if ($this->options['attachments']) {
|
604 |
}
|
605 |
}
|
606 |
|
607 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Composing unique keys...', 'wp_all_import_plugin'));
|
608 |
if (!empty($this->options['unique_key'])){
|
609 |
$unique_keys = XmlImportParser::factory($xml, $cxpath, $this->options['unique_key'], $file)->parse($records); $tmp_files[] = $file;
|
610 |
}
|
612 |
count($titles) and $unique_keys = array_fill(0, count($titles), '');
|
613 |
}
|
614 |
|
615 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Processing posts...', 'wp_all_import_plugin'));
|
616 |
|
617 |
if ('post' == $this->options['type'] and '' != $this->options['custom_type']) {
|
618 |
$post_type = $this->options['custom_type'];
|
626 |
$addons_data = array();
|
627 |
|
628 |
// data parsing for WP All Import add-ons
|
629 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Data parsing via add-ons...', 'wp_all_import_plugin'));
|
630 |
$parsingData = array(
|
631 |
'import' => $this,
|
632 |
'count' => count($titles),
|
655 |
$specified_records = array();
|
656 |
|
657 |
if ($this->options['is_import_specified']) {
|
658 |
+
$chunk == 1 and $logger and call_user_func($logger, __('Calculate specified records to import...', 'wp_all_import_plugin'));
|
659 |
foreach (preg_split('% *, *%', $this->options['import_specified'], -1, PREG_SPLIT_NO_EMPTY) as $chank) {
|
660 |
if (preg_match('%^(\d+)-(\d+)$%', $chank, $mtch)) {
|
661 |
$specified_records = array_merge($specified_records, range(intval($mtch[1]), intval($mtch[2])));
|
670 |
|
671 |
if ($is_cron and $cron_sleep) sleep($cron_sleep);
|
672 |
|
673 |
+
$logger and call_user_func($logger, __('---', 'wp_all_import_plugin'));
|
674 |
+
$logger and call_user_func($logger, sprintf(__('Record #%s', 'wp_all_import_plugin'), $this->imported + $this->skipped + $i + 1));
|
675 |
|
676 |
wp_cache_flush();
|
677 |
|
678 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_before_post_import ...', 'wp_all_import_plugin'));
|
679 |
do_action('pmxi_before_post_import', $this->id);
|
680 |
|
681 |
if ( empty($titles[$i]) ) {
|
683 |
$titles[$i] = $addons_data['PMWI_Plugin']['single_product_parent_ID'][$i] . ' Product Variation';
|
684 |
}
|
685 |
else{
|
686 |
+
$logger and call_user_func($logger, __('<b>WARNING</b>: title is empty.', 'wp_all_import_plugin'));
|
687 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
688 |
}
|
689 |
}
|
701 |
'last_name' => $addons_data['PMUI_Plugin']['pmui_last_name'][$i],
|
702 |
'description' => $addons_data['PMUI_Plugin']['pmui_description'][$i],
|
703 |
'nickname' => $addons_data['PMUI_Plugin']['pmui_nickname'][$i],
|
704 |
+
'role' => ('' == $addons_data['PMUI_Plugin']['pmui_role'][$i]) ? 'subscriber' : strtolower($addons_data['PMUI_Plugin']['pmui_role'][$i]),
|
705 |
);
|
706 |
+
$logger and call_user_func($logger, sprintf(__('Combine all data for user %s...', 'wp_all_import_plugin'), $articleData['user_login']));
|
707 |
}
|
708 |
else {
|
709 |
$articleData = array(
|
710 |
'post_type' => $post_type,
|
711 |
'post_status' => ("xpath" == $this->options['status']) ? $post_status[$i] : $this->options['status'],
|
712 |
+
'comment_status' => ("xpath" == $this->options['comment_status']) ? $comment_status[$i] : $this->options['comment_status'],
|
713 |
+
'ping_status' => ("xpath" == $this->options['ping_status']) ? $ping_status[$i] : $this->options['ping_status'],
|
714 |
'post_title' => (!empty($this->options['is_leave_html'])) ? html_entity_decode($titles[$i]) : $titles[$i],
|
715 |
'post_excerpt' => apply_filters('pmxi_the_excerpt', ((!empty($this->options['is_leave_html'])) ? html_entity_decode($post_excerpt[$i]) : $post_excerpt[$i]), $this->id),
|
716 |
'post_name' => $post_slug[$i],
|
719 |
'post_date_gmt' => get_gmt_from_date($dates[$i]),
|
720 |
'post_author' => $post_author[$i],
|
721 |
'menu_order' => (int) $menu_order[$i],
|
722 |
+
'post_parent' => ("no" == $this->options['is_multiple_page_parent']) ? (int) $page_parent[$i] : (int) $this->options['parent']
|
723 |
);
|
724 |
+
$logger and call_user_func($logger, sprintf(__('Combine all data for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
|
725 |
}
|
726 |
|
727 |
// Re-import Records Matching
|
731 |
if ( "manual" != $this->options['duplicate_matching'] ){
|
732 |
|
733 |
// find corresponding article among previously imported
|
734 |
+
$logger and call_user_func($logger, sprintf(__('Find corresponding article among previously imported for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
|
735 |
$postRecord->clear();
|
736 |
$postRecord->getBy(array(
|
737 |
'unique_key' => $unique_keys[$i],
|
739 |
));
|
740 |
|
741 |
if ( ! $postRecord->isEmpty() ) {
|
742 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post was founded for post %s with unique key `%s`...', 'wp_all_import_plugin'), $articleData['post_title'], $unique_keys[$i]));
|
743 |
if ( $this->options['custom_type'] == 'import_users'){
|
744 |
$post_to_update = get_user_by('id', $post_to_update_id = $postRecord->post_id);
|
745 |
}
|
748 |
}
|
749 |
}
|
750 |
else{
|
751 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'t founded with unique key `%s`...', 'wp_all_import_plugin'), $unique_keys[$i]));
|
752 |
}
|
753 |
|
754 |
// if Manual Matching re-import option seleted
|
762 |
count($titles) and $custom_duplicate_name = $custom_duplicate_value = array_fill(0, count($titles), '');
|
763 |
}
|
764 |
|
765 |
+
$logger and call_user_func($logger, sprintf(__('Find corresponding article among database for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
|
766 |
// handle duplicates according to import settings
|
767 |
if ($duplicates = pmxi_findDuplicates($articleData, $custom_duplicate_name[$i], $custom_duplicate_value[$i], $this->options['duplicate_indicator'])) {
|
768 |
$duplicate_id = array_shift($duplicates);
|
769 |
if ($duplicate_id) {
|
770 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post was founded for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
|
771 |
if ( $this->options['custom_type'] == 'import_users'){
|
772 |
$post_to_update = get_user_by('id', $post_to_update_id = $duplicate_id);
|
773 |
}
|
776 |
}
|
777 |
}
|
778 |
else{
|
779 |
+
$logger and call_user_func($logger, sprintf(__('Duplicate post wasn\'n founded for post `%s`...', 'wp_all_import_plugin'), $articleData['post_title']));
|
780 |
}
|
781 |
}
|
782 |
}
|
788 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
789 |
|
790 |
$skipped++;
|
791 |
+
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by specified records option', 'wp_all_import_plugin'));
|
792 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
793 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
794 |
+
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
795 |
continue;
|
796 |
}
|
797 |
}
|
799 |
// Duplicate record is founded
|
800 |
if ($post_to_update){
|
801 |
|
802 |
+
$continue_import = true;
|
803 |
+
$continue_import = apply_filters('wp_all_import_is_post_to_update', $post_to_update_id);
|
804 |
+
|
805 |
+
if ( ! $continue_import ){
|
806 |
+
|
807 |
+
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
808 |
+
|
809 |
+
$skipped++;
|
810 |
+
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: By filter wp_all_import_is_post_to_update `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
811 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
812 |
+
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
813 |
+
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
814 |
+
continue;
|
815 |
+
}
|
816 |
+
|
817 |
+
//$logger and call_user_func($logger, sprintf(__('Duplicate record is founded for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
818 |
|
819 |
// Do not update already existing records option selected
|
820 |
if ("yes" == $this->options['is_keep_former_posts']) {
|
824 |
do_action('pmxi_do_not_update_existing', $post_to_update_id, $this->id, $this->iteration);
|
825 |
|
826 |
$skipped++;
|
827 |
+
$logger and call_user_func($logger, sprintf(__('<b>SKIPPED</b>: Previously imported record found for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
828 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
829 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
830 |
+
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
831 |
continue;
|
832 |
}
|
833 |
|
839 |
|
840 |
// preserve date of already existing article when duplicate is found
|
841 |
if ( ! $this->options['is_update_categories'] or ($this->options['is_update_categories'] and $this->options['update_categories_logic'] != "full_update")) {
|
842 |
+
$logger and call_user_func($logger, sprintf(__('Preserve taxonomies of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
843 |
$existing_taxonomies = array();
|
844 |
foreach (array_keys($taxonomies) as $tx_name) {
|
845 |
$txes_list = get_the_terms($articleData['ID'], $tx_name);
|
846 |
if (is_wp_error($txes_list)) {
|
847 |
+
$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', 'wp_all_import_plugin'), $articleData['ID']));
|
848 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
849 |
} else {
|
850 |
$txes_new = array();
|
861 |
if ( ! $this->options['is_update_dates']) { // preserve date of already existing article when duplicate is found
|
862 |
$articleData['post_date'] = $post_to_update->post_date;
|
863 |
$articleData['post_date_gmt'] = $post_to_update->post_date_gmt;
|
864 |
+
$logger and call_user_func($logger, sprintf(__('Preserve date of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
865 |
}
|
866 |
if ( ! $this->options['is_update_status']) { // preserve status and trashed flag
|
867 |
$articleData['post_status'] = $post_to_update->post_status;
|
868 |
+
$logger and call_user_func($logger, sprintf(__('Preserve status of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
869 |
}
|
870 |
if ( ! $this->options['is_update_content']){
|
871 |
$articleData['post_content'] = $post_to_update->post_content;
|
872 |
+
$logger and call_user_func($logger, sprintf(__('Preserve content of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
873 |
}
|
874 |
if ( ! $this->options['is_update_title']){
|
875 |
$articleData['post_title'] = $post_to_update->post_title;
|
876 |
+
$logger and call_user_func($logger, sprintf(__('Preserve title of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
877 |
}
|
878 |
if ( ! $this->options['is_update_slug']){
|
879 |
$articleData['post_name'] = $post_to_update->post_name;
|
880 |
+
$logger and call_user_func($logger, sprintf(__('Preserve slug of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
881 |
}
|
882 |
if ( ! $this->options['is_update_excerpt']){
|
883 |
$articleData['post_excerpt'] = $post_to_update->post_excerpt;
|
884 |
+
$logger and call_user_func($logger, sprintf(__('Preserve excerpt of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
885 |
}
|
886 |
if ( ! $this->options['is_update_menu_order']){
|
887 |
$articleData['menu_order'] = $post_to_update->menu_order;
|
888 |
+
$logger and call_user_func($logger, sprintf(__('Preserve menu order of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
889 |
}
|
890 |
if ( ! $this->options['is_update_parent']){
|
891 |
$articleData['post_parent'] = $post_to_update->post_parent;
|
892 |
+
$logger and call_user_func($logger, sprintf(__('Preserve post parent of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
893 |
}
|
894 |
if ( ! $this->options['is_update_author']){
|
895 |
$articleData['post_author'] = $post_to_update->post_author;
|
896 |
+
$logger and call_user_func($logger, sprintf(__('Preserve post author of already existing article for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
897 |
}
|
898 |
}
|
899 |
else {
|
911 |
if ( ! $this->options['is_update_url'] ) $articleData['user_url'] = $post_to_update->user_url;
|
912 |
}
|
913 |
|
914 |
+
$logger and call_user_func($logger, sprintf(__('Applying filter `pmxi_article_data` for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
915 |
$articleData = apply_filters('pmxi_article_data', $articleData, $this, $post_to_update);
|
916 |
|
917 |
}
|
919 |
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
920 |
|
921 |
if ( $this->options['update_all_data'] == 'yes' or ( $this->options['update_all_data'] == 'no' and $this->options['is_update_attachments'])) {
|
922 |
+
$logger and call_user_func($logger, sprintf(__('Deleting attachments for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
923 |
wp_delete_attachments($articleData['ID'], true, 'files');
|
924 |
}
|
925 |
// handle obsolete attachments (i.e. delete or keep) according to import settings
|
926 |
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")){
|
927 |
+
$logger and call_user_func($logger, sprintf(__('Deleting images for `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
928 |
+
wp_delete_attachments($articleData['ID'], ( $this->options['download_images'] == 'yes' ), 'images');
|
929 |
}
|
930 |
|
931 |
}
|
942 |
|
943 |
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $this->iteration))->update();
|
944 |
|
945 |
+
$logger and call_user_func($logger, __('<b>SKIPPED</b>: by do not create new posts option.', 'wp_all_import_plugin'));
|
946 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
947 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
948 |
$skipped++;
|
949 |
+
$logger and !$is_cron and PMXI_Plugin::$session->save_data();
|
950 |
continue;
|
951 |
}
|
952 |
|
1014 |
));
|
1015 |
$dest->insert();
|
1016 |
} else {
|
1017 |
+
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to create cloaked link for %s', 'wp_all_import_plugin'), $url));
|
1018 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1019 |
$link = NULL;
|
1020 |
}
|
1028 |
}
|
1029 |
|
1030 |
// insert article being imported
|
1031 |
+
if ($this->options['is_fast_mode']){
|
1032 |
+
foreach (array('save_post', 'pre_post_update', 'add_attachment', 'edit_attachment', 'edit_post', 'post_updated', 'wp_insert_post', 'save_post_' . $post_type) as $act) {
|
1033 |
+
remove_all_actions($act);
|
1034 |
+
}
|
1035 |
+
}
|
1036 |
+
|
1037 |
if ( ! in_array($this->options['custom_type'], array('import_users'))){
|
1038 |
if (empty($articleData['ID'])){
|
1039 |
+
$logger and call_user_func($logger, sprintf(__('<b>CREATING</b> `%s` `%s`', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
|
1040 |
}
|
1041 |
else{
|
1042 |
+
$logger and call_user_func($logger, sprintf(__('<b>UPDATING</b> `%s` `%s`', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name));
|
1043 |
+
}
|
1044 |
+
$pid = wp_insert_post($articleData, true);
|
|
|
1045 |
}
|
1046 |
else{
|
1047 |
$pid = (empty($articleData['ID'])) ? wp_insert_user( $articleData ) : wp_update_user( $articleData );
|
1049 |
}
|
1050 |
|
1051 |
if (is_wp_error($pid)) {
|
1052 |
+
$logger and call_user_func($logger, __('<b>ERROR</b>', 'wp_all_import_plugin') . ': ' . $pid->get_error_message());
|
1053 |
$logger and !$is_cron and PMXI_Plugin::$session->errors++;
|
1054 |
+
$skipped++;
|
1055 |
} else {
|
1056 |
|
1057 |
if ("manual" != $this->options['duplicate_matching'] or empty($articleData['ID'])){
|
1065 |
|
1066 |
$postRecord->set(array('iteration' => $this->iteration))->update();
|
1067 |
|
1068 |
+
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with current import ...', 'wp_all_import_plugin'), $articleData['post_title']));
|
1069 |
}
|
1070 |
|
1071 |
// [post format]
|
1072 |
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ){
|
1073 |
set_post_format($pid, $this->options['post_format'] );
|
1074 |
+
$logger and call_user_func($logger, sprintf(__('Associate post `%s` with post format %s ...', 'wp_all_import_plugin'), $articleData['post_title'], (!empty($this->options['post_format'])) ? $this->options['post_format'] : 'Standart'));
|
1075 |
}
|
1076 |
// [/post format]
|
1077 |
|
1078 |
+
|
1079 |
// [addons import]
|
1080 |
|
1081 |
// prepare data for import
|
1104 |
// [/addons import]
|
1105 |
|
1106 |
// Page Template
|
1107 |
+
if ('page' == $articleData['post_type'] and ( !empty($this->options['page_template']) or "no" == $this->options['is_multiple_page_template']) ){
|
1108 |
+
update_post_meta($pid, '_wp_page_template', ("no" == $this->options['is_multiple_page_template']) ? $page_template[$i] : $this->options['page_template']);
|
1109 |
+
}
|
1110 |
|
1111 |
// [featured image]
|
1112 |
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']))) {
|
1116 |
$targetDir = $uploads['path'];
|
1117 |
$targetUrl = $uploads['url'];
|
1118 |
|
1119 |
+
$logger and call_user_func($logger, __('<b>IMAGES:</b>', 'wp_all_import_plugin'));
|
1120 |
|
1121 |
if ( ! @is_writable($targetDir) ){
|
1122 |
|
1123 |
+
$logger and call_user_func($logger, sprintf(__('<b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), $targetDir));
|
1124 |
|
1125 |
}
|
1126 |
else{
|
1137 |
if ( ! empty($line_imgs) )
|
1138 |
foreach ($line_imgs as $line_img)
|
1139 |
$imgs = array_merge($imgs, ( ! empty($featured_delim) ) ? str_getcsv($line_img, $featured_delim) : array($line_img) );
|
1140 |
+
|
1141 |
+
// keep existing and add newest images
|
1142 |
+
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"){
|
1143 |
+
|
1144 |
+
$logger and call_user_func($logger, __('- Keep existing and add newest images ...', 'wp_all_import_plugin'));
|
1145 |
+
|
1146 |
+
$attachment_imgs = get_attached_media( 'image', $pid );
|
1147 |
+
|
1148 |
+
if ( $post_type == "product" )
|
1149 |
+
$gallery_attachment_ids = array_filter(explode(",", get_post_meta($pid, '_product_image_gallery', true)));
|
1150 |
+
|
1151 |
+
if ( $attachment_imgs ) {
|
1152 |
+
foreach ( $attachment_imgs as $attachment_img ) {
|
1153 |
+
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
1154 |
+
if ( empty($post_thumbnail_id) and $this->options['is_featured'] ) {
|
1155 |
+
set_post_thumbnail($pid, $attachment_img->ID);
|
1156 |
+
}
|
1157 |
+
elseif(!in_array($attachment_img->ID, $gallery_attachment_ids) and $post_thumbnail_id != $attachment_img->ID) {
|
1158 |
+
$gallery_attachment_ids[] = $attachment_img->ID;
|
1159 |
+
}
|
1160 |
+
}
|
1161 |
+
$success_images = true;
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
if ( ! empty($gallery_attachment_ids) ){
|
1165 |
+
foreach ($gallery_attachment_ids as $aid){
|
1166 |
+
do_action( 'pmxi_gallery_image', $pid, $aid, '');
|
1167 |
+
}
|
1168 |
+
}
|
1169 |
+
}
|
1170 |
|
1171 |
+
if ( ! empty($imgs) ) {
|
1172 |
|
1173 |
if ( $this->options['set_image_meta_title'] ){
|
1174 |
$img_titles = array();
|
1196 |
}
|
1197 |
if ( $this->options['set_image_meta_description'] ){
|
1198 |
$img_descriptions = array();
|
1199 |
+
$line_img_descriptions = explode("\n", $image_meta_descriptions[$i]);
|
1200 |
if ( ! empty($line_img_descriptions) )
|
1201 |
foreach ($line_img_descriptions as $line_img_description)
|
1202 |
$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) );
|
1203 |
|
1204 |
}
|
1205 |
|
1206 |
+
foreach ($imgs as $k => $img_url) { if (empty($img_url)) continue;
|
1207 |
+
|
1208 |
+
$attid = false;
|
1209 |
|
1210 |
$url = str_replace(" ", "%20", trim($img_url));
|
1211 |
+
$bn = preg_replace('/[\\?|&].*/', '', basename($url));
|
1212 |
|
1213 |
if ( "yes" == $this->options['download_images'] and ! empty($auto_extensions[$i]) and preg_match('%^(jpg|jpeg|png|gif)$%i', $auto_extensions[$i])){
|
1214 |
$img_ext = $auto_extensions[$i];
|
1220 |
if ($img_ext == "") $img_ext = pmxi_get_remote_image_ext($url);
|
1221 |
}
|
1222 |
|
1223 |
+
$logger and call_user_func($logger, sprintf(__('- Importing image `%s` for `%s` ...', 'wp_all_import_plugin'), $img_url, $articleData['post_title']));
|
1224 |
|
1225 |
// generate local file name
|
1226 |
$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 : '');
|
1227 |
|
1228 |
// if wizard store image data to custom field
|
1229 |
+
$create_image = false;
|
1230 |
$download_image = true;
|
1231 |
|
1232 |
if (base64_decode($url, true) !== false){
|
1233 |
$img = @imagecreatefromstring(base64_decode($url));
|
1234 |
if($img)
|
1235 |
{
|
1236 |
+
$logger and call_user_func($logger, __('- Founded base64_encoded image', 'wp_all_import_plugin'));
|
1237 |
|
1238 |
$image_filename = md5(time()) . '.jpg';
|
1239 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1240 |
imagejpeg($img, $image_filepath);
|
1241 |
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1242 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
1243 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1244 |
} else {
|
1245 |
$create_image = true;
|
1251 |
$image_filename = wp_unique_filename($targetDir, $image_name);
|
1252 |
$image_filepath = $targetDir . '/' . $image_filename;
|
1253 |
|
1254 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` will be saved with name `%s` ...', 'wp_all_import_plugin'), $img_url, $image_filename));
|
1255 |
|
1256 |
// keep existing and add newest images
|
1257 |
+
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"){
|
1258 |
+
|
1259 |
+
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE (post_title = %s OR post_title = %s OR post_name = %s) AND post_type = %s AND post_parent = %d;", $image_name, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name), sanitize_title($image_name), "attachment", $pid ) );
|
1260 |
|
1261 |
+
if ( $attch != null ){
|
1262 |
+
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
1263 |
+
if ( $post_thumbnail_id == $attch->ID or in_array($attch->ID, $gallery_attachment_ids) ) continue;
|
1264 |
+
}
|
1265 |
+
elseif (file_exists($targetDir . '/' . $image_name)){
|
1266 |
+
if (($img_meta = wp_read_image_metadata($targetDir . '/' . $image_name))) {
|
1267 |
+
if (trim($img_meta['title']) && ! is_numeric(sanitize_title($img_meta['title']))){
|
1268 |
+
$img_title = $img_meta['title'];
|
1269 |
+
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE post_title = %s AND post_type = %s AND post_parent = %d;", $img_title, "attachment", $pid ) );
|
1270 |
+
if ( $attch != null ){
|
1271 |
+
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
1272 |
+
if ( $post_thumbnail_id == $attch->ID or in_array($attch->ID, $gallery_attachment_ids) ) continue;
|
1273 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1274 |
}
|
1275 |
+
}
|
1276 |
}
|
1277 |
|
1278 |
}
|
1279 |
|
1280 |
+
// search existing attachment
|
1281 |
+
if ($this->options['search_existing_images']){
|
1282 |
+
|
1283 |
+
$image_filename = $image_name;
|
1284 |
+
|
1285 |
+
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE (post_title = %s OR post_title = %s OR post_name = %s) AND post_type = %s;", $image_name, preg_replace('/\\.[^.\\s]{3,4}$/', '', $image_name), sanitize_title($image_name), "attachment" ) );
|
1286 |
+
|
1287 |
+
if ( $attch != null ){
|
1288 |
+
$download_image = false;
|
1289 |
+
$attid = $attch->ID;
|
1290 |
+
}
|
1291 |
+
elseif (@file_exists($targetDir . '/' . $image_name)){
|
1292 |
+
if (($img_meta = wp_read_image_metadata($targetDir . '/' . $image_name))) {
|
1293 |
+
if (trim($img_meta['title']) && ! is_numeric(sanitize_title($img_meta['title']))){
|
1294 |
+
$img_title = $img_meta['title'];
|
1295 |
+
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE post_title = %s AND post_type = %s AND post_parent = %d;", $img_title, "attachment", $pid ) );
|
1296 |
+
if ( $attch != null ){
|
1297 |
+
$download_image = false;
|
1298 |
+
$attid = $attch->ID;
|
1299 |
+
}
|
1300 |
+
}
|
1301 |
+
}
|
1302 |
+
}
|
1303 |
+
}
|
1304 |
|
1305 |
+
if ($download_image){
|
|
|
1306 |
|
1307 |
+
// do not download images
|
1308 |
+
if ( "yes" != $this->options['download_images'] ){
|
1309 |
|
1310 |
$image_filename = $image_name;
|
1311 |
+
$image_filepath = $targetDir . '/' . $image_filename;
|
|
|
1312 |
|
1313 |
+
$wpai_uploads = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR;
|
1314 |
+
$wpai_image_path = $wpai_uploads . str_replace('%20', ' ', $url);
|
1315 |
|
1316 |
+
$logger and call_user_func($logger, sprintf(__('- Searching for existing image `%s` in `%s` folder', 'wp_all_import_plugin'), $wpai_image_path, $wpai_uploads));
|
1317 |
|
1318 |
if ( @file_exists($wpai_image_path) and @copy( $wpai_image_path, $image_filepath )){
|
1319 |
$download_image = false;
|
1320 |
if( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1321 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $image_filepath));
|
1322 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1323 |
@unlink($image_filepath);
|
1324 |
} else {
|
1325 |
$create_image = true;
|
1326 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully founded', 'wp_all_import_plugin'), $wpai_image_path));
|
1327 |
}
|
1328 |
}
|
1329 |
}
|
1330 |
+
else {
|
|
|
1331 |
|
1332 |
+
$logger and call_user_func($logger, sprintf(__('- Downloading image from `%s`', 'wp_all_import_plugin'), $url));
|
1333 |
|
1334 |
$request = get_file_curl($url, $image_filepath);
|
1335 |
|
1337 |
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1338 |
} elseif( ($image_info = @getimagesize($image_filepath)) and in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1339 |
$create_image = true;
|
1340 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
1341 |
}
|
1342 |
|
1343 |
if ( ! $create_image ){
|
1347 |
$request = get_file_curl($url, $image_filepath);
|
1348 |
|
1349 |
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($image_filepath, @file_get_contents($url))) {
|
1350 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s cannot be saved locally as %s', 'wp_all_import_plugin'), $url, $image_filepath));
|
1351 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1352 |
@unlink($image_filepath); // delete file since failed upload may result in empty file created
|
1353 |
} elseif( ! ($image_info = @getimagesize($image_filepath)) or ! in_array($image_info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
|
1354 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: File %s is not a valid image and cannot be set as featured one', 'wp_all_import_plugin'), $url));
|
1355 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1356 |
@unlink($image_filepath);
|
1357 |
} else {
|
1358 |
$create_image = true;
|
1359 |
+
$logger and call_user_func($logger, sprintf(__('- Image `%s` has been successfully downloaded', 'wp_all_import_plugin'), $url));
|
1360 |
}
|
1361 |
}
|
1362 |
+
}
|
1363 |
}
|
1364 |
}
|
1365 |
|
1366 |
if ($create_image){
|
1367 |
|
1368 |
+
$logger and call_user_func($logger, sprintf(__('- Creating an attachment for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
|
1369 |
|
1370 |
$attachment = array(
|
1371 |
'post_mime_type' => image_type_to_mime_type($image_info[2]),
|
1372 |
'guid' => $targetUrl . '/' . $image_filename,
|
1373 |
+
'post_title' => $image_name,
|
1374 |
'post_content' => '',
|
1375 |
'post_author' => $post_author[$i],
|
1376 |
);
|
1379 |
$attachment['post_title'] = $image_meta['title'];
|
1380 |
if (trim($image_meta['caption']))
|
1381 |
$attachment['post_content'] = $image_meta['caption'];
|
1382 |
+
}
|
1383 |
|
1384 |
+
$attid = wp_insert_attachment($attachment, $image_filepath, $pid);
|
1385 |
|
1386 |
if (is_wp_error($attid)) {
|
1387 |
+
$logger and call_user_func($logger, __('- <b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $attid->get_error_message());
|
1388 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1389 |
} else {
|
1390 |
// you must first include the image.php file
|
1399 |
if ( $this->options['set_image_meta_alt'] and ! empty($img_alts[$k]) ) update_post_meta($attid, '_wp_attachment_image_alt', $img_alts[$k]);
|
1400 |
|
1401 |
if ( ! empty($update_attachment_meta)) $this->wpdb->update( $this->wpdb->posts, $update_attachment_meta, array('ID' => $attid) );
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
if ($attid){
|
1407 |
+
|
1408 |
+
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_gallery_image', 'wp_all_import_plugin'));
|
1409 |
+
do_action( 'pmxi_gallery_image', $pid, $attid, $image_filepath);
|
1410 |
|
1411 |
+
$success_images = true;
|
|
|
|
|
|
|
|
|
1412 |
|
1413 |
+
$post_thumbnail_id = get_post_thumbnail_id( $pid );
|
1414 |
+
if ( empty($post_thumbnail_id) and $this->options['is_featured'] ) {
|
1415 |
+
set_post_thumbnail($pid, $attid);
|
1416 |
}
|
1417 |
+
elseif(!in_array($attid, $gallery_attachment_ids) and $post_thumbnail_id != $attid){
|
1418 |
+
$gallery_attachment_ids[] = $attid;
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for image `%s`', 'wp_all_import_plugin'), $targetUrl . '/' . $image_filename));
|
1422 |
+
|
1423 |
}
|
1424 |
}
|
1425 |
+
}
|
1426 |
// Set product gallery images
|
1427 |
+
if ( $post_type == "product" )
|
1428 |
+
update_post_meta($pid, '_product_image_gallery', (!empty($gallery_attachment_ids)) ? implode(',', $gallery_attachment_ids) : '');
|
1429 |
// Create entry as Draft if no images are downloaded successfully
|
1430 |
if ( ! $success_images and "yes" == $this->options['create_draft'] ) {
|
1431 |
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1432 |
+
$logger and call_user_func($logger, sprintf(__('- Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $articleData['post_title']));
|
1433 |
}
|
1434 |
}
|
1435 |
}
|
1437 |
// Create entry as Draft if no images are downloaded successfully
|
1438 |
if ( "yes" == $this->options['create_draft'] ){
|
1439 |
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $pid) );
|
1440 |
+
$logger and call_user_func($logger, sprintf(__('Post `%s` saved as Draft, because no images are downloaded successfully', 'wp_all_import_plugin'), $articleData['post_title']));
|
1441 |
}
|
1442 |
}
|
1443 |
}
|
1449 |
$targetDir = $uploads['path'];
|
1450 |
$targetUrl = $uploads['url'];
|
1451 |
|
1452 |
+
$logger and call_user_func($logger, __('<b>ATTACHMENTS:</b>', 'wp_all_import_plugin'));
|
1453 |
|
1454 |
if ( ! @is_writable($targetDir) ){
|
1455 |
+
$logger and call_user_func($logger, sprintf(__('- <b>ERROR</b>: Target directory %s is not writable', 'wp_all_import_plugin'), trim($targetDir)));
|
1456 |
}
|
1457 |
else{
|
1458 |
// you must first include the image.php file
|
1461 |
|
1462 |
if ( ! is_array($attachments[$i]) ) $attachments[$i] = array($attachments[$i]);
|
1463 |
|
1464 |
+
$logger and call_user_func($logger, sprintf(__('- Importing attachments for `%s` ...', 'wp_all_import_plugin'), $articleData['post_title']));
|
1465 |
|
1466 |
foreach ($attachments[$i] as $attachment) { if ("" == $attachment) continue;
|
1467 |
|
1469 |
|
1470 |
if ( ! empty($atchs) ) {
|
1471 |
|
1472 |
+
foreach ($atchs as $atch_url) { if (empty($atch_url)) continue;
|
1473 |
+
|
1474 |
+
$download_file = true;
|
1475 |
|
1476 |
$atch_url = str_replace(" ", "%20", trim($atch_url));
|
1477 |
|
1478 |
+
$attachment_filename = urldecode(basename(parse_url(trim($atch_url), PHP_URL_PATH)));
|
1479 |
+
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
1480 |
|
1481 |
+
if ($this->options['is_search_existing_attach']){
|
1482 |
+
// search existing attachment
|
1483 |
+
$attch = $this->wpdb->get_row( $this->wpdb->prepare( "SELECT * FROM " . $this->wpdb->posts . " WHERE (post_title = %s OR post_title = %s OR post_name = %s OR post_name = %s) AND post_type = %s;", $attachment_filename, preg_replace('/\\.[^.\\s]{3,4}$/', '', $attachment_filename), sanitize_title($attachment_filename), sanitize_title(preg_replace('/\\.[^.\\s]{3,4}$/', '', $attachment_filename)), "attachment" ) );
|
1484 |
+
|
1485 |
+
if ( $attch != null ){
|
1486 |
+
$download_file = false;
|
1487 |
+
$attach_id = $attch->ID;
|
1488 |
+
}
|
1489 |
+
}
|
1490 |
|
1491 |
+
if ($download_file){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1492 |
|
1493 |
+
$attachment_filename = wp_unique_filename($targetDir, $attachment_filename);
|
1494 |
+
$attachment_filepath = $targetDir . '/' . sanitize_file_name($attachment_filename);
|
1495 |
+
|
1496 |
+
$logger and call_user_func($logger, sprintf(__('- Filename for attachment was generated as %s', 'wp_all_import_plugin'), $attachment_filename));
|
1497 |
+
|
1498 |
+
$request = get_file_curl(trim($atch_url), $attachment_filepath);
|
1499 |
+
|
1500 |
+
if ( (is_wp_error($request) or $request === false) and ! @file_put_contents($attachment_filepath, @file_get_contents(trim($atch_url)))) {
|
1501 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Attachment file %s cannot be saved locally as %s', 'wp_all_import_plugin'), trim($atch_url), $attachment_filepath));
|
1502 |
+
is_wp_error($request) and $logger and call_user_func($logger, sprintf(__('- <b>WP Error</b>: %s', 'wp_all_import_plugin'), $request->get_error_message()));
|
1503 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1504 |
+
unlink($attachment_filepath); // delete file since failed upload may result in empty file created
|
1505 |
+
} elseif( ! $wp_filetype = wp_check_filetype(basename($attachment_filename), null )) {
|
1506 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Can\'t detect attachment file type %s', 'wp_all_import_plugin'), trim($atch_url)));
|
1507 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1508 |
+
} else {
|
1509 |
+
$logger and call_user_func($logger, sprintf(__('- File %s has been successfully downloaded', 'wp_all_import_plugin'), $atch_url));
|
1510 |
+
$attachment_data = array(
|
1511 |
+
'guid' => $targetUrl . '/' . basename($attachment_filepath),
|
1512 |
+
'post_mime_type' => $wp_filetype['type'],
|
1513 |
+
'post_title' => preg_replace('/\.[^.]+$/', '', basename($attachment_filepath)),
|
1514 |
+
'post_content' => '',
|
1515 |
+
'post_status' => 'inherit',
|
1516 |
+
'post_author' => $post_author[$i],
|
1517 |
+
);
|
1518 |
+
$attach_id = wp_insert_attachment( $attachment_data, $attachment_filepath, $pid );
|
1519 |
+
|
1520 |
+
if (is_wp_error($attach_id)) {
|
1521 |
+
$logger and call_user_func($logger, __('- <b>WARNING</b>', 'wp_all_import_plugin') . ': ' . $pid->get_error_message());
|
1522 |
+
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1523 |
+
} else {
|
1524 |
+
wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $attachment_filepath));
|
1525 |
+
$logger and call_user_func($logger, sprintf(__('- Attachment has been successfully created for post `%s`', 'wp_all_import_plugin'), $articleData['post_title']));
|
1526 |
+
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
|
1527 |
+
do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $attachment_filepath);
|
1528 |
+
}
|
1529 |
+
}
|
1530 |
+
}
|
1531 |
+
else{
|
1532 |
+
$logger and call_user_func($logger, __('- <b>ACTION</b>: pmxi_attachment_uploaded', 'wp_all_import_plugin'));
|
1533 |
+
do_action( 'pmxi_attachment_uploaded', $pid, $attach_id, $attachment_filepath);
|
1534 |
+
}
|
1535 |
}
|
1536 |
}
|
1537 |
}
|
1542 |
// [custom taxonomies]
|
1543 |
if ( ! empty($taxonomies) ){
|
1544 |
|
1545 |
+
$logger and call_user_func($logger, __('<b>TAXONOMIES:</b>', 'wp_all_import_plugin'));
|
1546 |
|
1547 |
$custom_type = get_post_type_object( $this->options['custom_type'] );
|
1548 |
|
1553 |
|
1554 |
if ( empty($articleData['ID']) or $this->options['update_all_data'] == "yes" or ( $this->options['update_all_data'] == "no" and $this->options['is_update_categories'] )) {
|
1555 |
|
1556 |
+
$logger and call_user_func($logger, sprintf(__('- Importing taxonomy `%s` ...', 'wp_all_import_plugin'), $tx_name));
|
1557 |
|
1558 |
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'){
|
1559 |
+
$logger and call_user_func($logger, sprintf(__('- Auto-nest enabled with separator `%s` ...', 'wp_all_import_plugin'), ( ! empty($this->options['tax_hierarchical_delim'][$tx_name]) ? $this->options['tax_hierarchical_delim'][$tx_name] : ',')));
|
1560 |
}
|
1561 |
|
1562 |
if (!empty($articleData['ID'])){
|
1563 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "all_except" and !empty($this->options['taxonomies_list'])
|
1564 |
and is_array($this->options['taxonomies_list']) and in_array($tx_name, $this->options['taxonomies_list'])){
|
1565 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Leave these taxonomies alone, update all others`...', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name']));
|
1566 |
continue;
|
1567 |
}
|
1568 |
if ($this->options['update_all_data'] == "no" and $this->options['update_categories_logic'] == "only" and ((!empty($this->options['taxonomies_list'])
|
1569 |
and is_array($this->options['taxonomies_list']) and ! in_array($tx_name, $this->options['taxonomies_list'])) or empty($this->options['taxonomies_list']))){
|
1570 |
+
$logger and call_user_func($logger, sprintf(__('- %s %s `%s` has been skipped attempted to `Update only these taxonomies, leave the rest alone`...', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name']));
|
1571 |
continue;
|
1572 |
}
|
1573 |
}
|
1604 |
if ( ! is_wp_error($term) ){
|
1605 |
$is_created_term = true;
|
1606 |
if ( empty($parent_id) ){
|
1607 |
+
$logger and call_user_func($logger, sprintf(__('- Creating parent %s %s `%s` ...', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $tx_name, $single_tax['name']));
|
1608 |
}
|
1609 |
else{
|
1610 |
+
$logger and call_user_func($logger, sprintf(__('- Creating child %s %s for %s named `%s` ...', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $tx_name, (is_array($single_tax['parent']) ? $single_tax['parent']['name'] : $single_tax['parent']), $single_tax['name']));
|
1611 |
}
|
1612 |
}
|
1613 |
}
|
1614 |
}
|
1615 |
|
1616 |
if ( is_wp_error($term) ){
|
1617 |
+
$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: `%s`', 'wp_all_import_plugin'), $term->get_error_message()));
|
1618 |
$logger and !$is_cron and PMXI_Plugin::$session->warnings++;
|
1619 |
}
|
1620 |
elseif ( ! empty($term)) {
|
1625 |
if (!in_array($term->slug, $assign_taxes)) $assign_taxes[] = $term->term_taxonomy_id;
|
1626 |
if (!$is_created_term){
|
1627 |
if ( empty($parent_id) ){
|
1628 |
+
$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` ...', 'wp_all_import_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));
|
1629 |
}
|
1630 |
else{
|
1631 |
+
$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` ...', 'wp_all_import_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));
|
1632 |
}
|
1633 |
}
|
1634 |
}
|
1638 |
endif;
|
1639 |
|
1640 |
// associate taxes with post
|
1641 |
+
$this->associate_terms($pid, ( empty($assign_taxes) ? false : $assign_taxes ), $tx_name, $logger, $is_cron);
|
1642 |
|
1643 |
}
|
1644 |
}
|
1649 |
if ( PMXI_Admin_Addons::get_addon('PMWI_Plugin') and strpos($tx_name, "pa_") === 0 ) continue;
|
1650 |
|
1651 |
if (!empty($txes[$i]))
|
1652 |
+
$this->associate_terms($pid, $txes[$i], $tx_name, $logger, $is_cron);
|
1653 |
}
|
1654 |
}
|
1655 |
}
|
1656 |
// [/custom taxonomies]
|
1657 |
|
1658 |
if (empty($articleData['ID'])) {
|
1659 |
+
$logger and call_user_func($logger, sprintf(__('<b>CREATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name, $pid));
|
1660 |
} else {
|
1661 |
+
$logger and call_user_func($logger, sprintf(__('<b>UPDATED</b> `%s` `%s` (ID: %s)', 'wp_all_import_plugin'), $articleData['post_title'], $custom_type_details->labels->singular_name, $pid));
|
1662 |
}
|
1663 |
|
1664 |
// [addons import]
|
1682 |
}
|
1683 |
|
1684 |
// [/addons import]
|
1685 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_saved_post', 'wp_all_import_plugin'));
|
1686 |
do_action( 'pmxi_saved_post', $pid); // hook that was triggered immediately after post saved
|
1687 |
|
1688 |
if (empty($articleData['ID'])) $created++; else $updated++;
|
1689 |
|
1690 |
if ( ! $is_cron and "default" == $this->options['import_processing'] ){
|
1691 |
+
$processed_records = $created + $updated + $skipped;
|
1692 |
+
$logger and call_user_func($logger, sprintf(__('<span class="processing_info"><span class="created_count">%s</span><span class="updated_count">%s</span><span class="percents_count">%s</span></span>', 'wp_all_import_plugin'), $created, $updated, ceil(($processed_records/$this->count) * 100)));
|
1693 |
}
|
1694 |
|
1695 |
}
|
1696 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_after_post_import', 'wp_all_import_plugin'));
|
1697 |
do_action('pmxi_after_post_import', $this->id);
|
1698 |
|
1699 |
$logger and !$is_cron and PMXI_Plugin::$session->chunk_number++;
|
1713 |
|
1714 |
PMXI_Plugin::$session->save_data();
|
1715 |
|
1716 |
+
$records_count = $this->created + $this->updated + $this->skipped;
|
1717 |
|
1718 |
$is_import_complete = ($records_count == $this->count);
|
1719 |
|
1720 |
// Delete posts that are no longer present in your file
|
1721 |
if ( $is_import_complete and ! empty($this->options['is_delete_missing']) and $this->options['duplicate_matching'] == 'auto') {
|
1722 |
|
1723 |
+
$logger and call_user_func($logger, __('Removing previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
|
1724 |
$postList = new PMXI_Post_List();
|
1725 |
|
1726 |
$missing_ids = array();
|
1731 |
foreach ($missingPosts as $missingPost) {
|
1732 |
|
1733 |
$missing_ids[] = $missingPost['post_id'];
|
1734 |
+
|
1735 |
+
}
|
1736 |
|
1737 |
+
endif;
|
|
|
|
|
|
|
|
|
1738 |
|
1739 |
+
// Delete posts from database
|
1740 |
+
if ( ! empty($missing_ids) && is_array($missing_ids) ){
|
1741 |
+
|
1742 |
+
$logger and call_user_func($logger, __('<b>ACTION</b>: pmxi_delete_post', 'wp_all_import_plugin'));
|
|
|
1743 |
|
1744 |
+
$logger and call_user_func($logger, __('Deleting posts from database', 'wp_all_import_plugin'));
|
|
|
1745 |
|
1746 |
+
$missing_ids_arr = array_chunk($missing_ids, 100);
|
1747 |
+
|
1748 |
+
foreach ($missing_ids_arr as $key => $ids) {
|
1749 |
+
|
1750 |
+
if ( ! empty($ids) ) {
|
1751 |
+
|
1752 |
+
foreach ( $ids as $k => $id ) {
|
1753 |
+
|
1754 |
+
$to_delete = true;
|
1755 |
+
|
1756 |
+
// Instead of deletion, set Custom Field
|
1757 |
+
if ($this->options['is_update_missing_cf']){
|
1758 |
+
update_post_meta( $id, $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value'] );
|
1759 |
+
$to_delete = false;
|
1760 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion post with ID `%s`, set Custom Field `%s` to value `%s`', 'wp_all_import_plugin'), $id, $this->options['update_missing_cf_name'], $this->options['update_missing_cf_value']));
|
1761 |
+
}
|
1762 |
+
|
1763 |
+
// Instead of deletion, change post status to Draft
|
1764 |
+
if ($this->options['set_missing_to_draft']){
|
1765 |
+
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'draft'), array('ID' => $id) );
|
1766 |
+
$to_delete = false;
|
1767 |
+
$logger and call_user_func($logger, sprintf(__('Instead of deletion, change post with ID `%s` status to Draft', 'wp_all_import_plugin'), $id));
|
1768 |
+
}
|
1769 |
+
if ($to_delete){
|
1770 |
+
// Remove attachments
|
1771 |
+
empty($this->options['is_keep_attachments']) and wp_delete_attachments($id, true, 'files');
|
1772 |
+
// Remove images
|
1773 |
+
empty($this->options['is_keep_imgs']) and wp_delete_attachments($id, ($this->options['download_images'] == 'yes'));
|
1774 |
+
|
1775 |
+
// Clear post's relationships
|
1776 |
+
if ( $post_type != "import_users" ) wp_delete_object_term_relationships($id, get_object_taxonomies('' != $this->options['custom_type'] ? $this->options['custom_type'] : 'post'));
|
1777 |
+
|
1778 |
+
}
|
1779 |
+
else{
|
1780 |
+
unset($ids[$k]);
|
1781 |
+
}
|
1782 |
}
|
1783 |
|
1784 |
+
if ( ! empty($ids) ){
|
|
|
1785 |
|
1786 |
+
do_action('pmxi_delete_post', $ids);
|
|
|
|
|
1787 |
|
1788 |
+
if ( $this->options['custom_type'] == "import_users" ){
|
1789 |
+
$sql = "delete a,b
|
1790 |
+
FROM ".$this->wpdb->users." a
|
1791 |
+
LEFT JOIN ".$this->wpdb->usermeta." b ON ( a.ID = b.user_id )
|
1792 |
+
WHERE a.ID IN (" . implode(',', $ids) . ");";
|
1793 |
+
}
|
1794 |
+
else {
|
1795 |
+
$sql = "delete a,b,c
|
1796 |
+
FROM ".$this->wpdb->posts." a
|
1797 |
+
LEFT JOIN ".$this->wpdb->term_relationships." b ON ( a.ID = b.object_id )
|
1798 |
+
LEFT JOIN ".$this->wpdb->postmeta." c ON ( a.ID = c.post_id )
|
1799 |
+
WHERE a.ID IN (" . implode(',', $ids) . ");";
|
1800 |
+
}
|
1801 |
+
|
1802 |
+
$this->wpdb->query( $sql );
|
1803 |
+
|
1804 |
+
// Delete record form pmxi_posts
|
1805 |
+
$sql = "DELETE FROM " . PMXI_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (".implode(',', $ids).") AND import_id = %d";
|
1806 |
+
$this->wpdb->query(
|
1807 |
+
$this->wpdb->prepare($sql, $this->id)
|
1808 |
+
);
|
1809 |
|
1810 |
+
$this->set(array('deleted' => $this->deleted + count($ids)))->update();
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
}
|
1815 |
|
1816 |
}
|
1818 |
// Set out of stock status for missing records [Woocommerce add-on option]
|
1819 |
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'])) {
|
1820 |
|
1821 |
+
$logger and call_user_func($logger, __('Update stock status previously imported posts which are no longer actual...', 'wp_all_import_plugin'));
|
1822 |
$postList = new PMXI_Post_List();
|
1823 |
$missingPosts = $postList->getBy(array('import_id' => $this->id, 'iteration !=' => $this->iteration));
|
1824 |
if ( ! $missingPosts->isEmpty() ){
|
1825 |
foreach ($missingPosts as $missingPost) {
|
1826 |
update_post_meta( $missingPost['post_id'], '_stock_status', 'outofstock' );
|
1827 |
update_post_meta( $missingPost['post_id'], '_stock', 0 );
|
1828 |
+
$missingPostRecord = new PMXI_Post_Record();
|
1829 |
+
$missingPostRecord->getBy('id', $missingPost['id']);
|
1830 |
+
if ( ! $missingPostRecord->isEmpty())
|
1831 |
+
$missingPostRecord->set(array('iteration' => $this->iteration))->update();
|
1832 |
+
unset($missingPostRecord);
|
1833 |
}
|
1834 |
}
|
1835 |
}
|
1836 |
}
|
1837 |
|
1838 |
} catch (XmlImportException $e) {
|
1839 |
+
$logger and call_user_func($logger, __('<b>ERROR</b>', 'wp_all_import_plugin') . ': ' . $e->getMessage());
|
1840 |
$logger and !$is_cron and PMXI_Plugin::$session->errors++;
|
1841 |
}
|
1842 |
|
1843 |
+
$logger and $is_import_complete and call_user_func($logger, __('Cleaning temporary data...', 'wp_all_import_plugin'));
|
1844 |
foreach ($tmp_files as $file) { // remove all temporary files created
|
1845 |
@unlink($file);
|
1846 |
}
|
1847 |
|
1848 |
if (($is_cron or $is_import_complete) and $this->options['is_delete_source']) {
|
1849 |
+
$logger and call_user_func($logger, __('Deleting source XML file...', 'wp_all_import_plugin'));
|
1850 |
|
1851 |
// Delete chunks
|
1852 |
+
foreach (PMXI_Helper::safe_glob($uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY . DIRECTORY_SEPARATOR . 'pmxi_chunk_*', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
1853 |
+
$logger and call_user_func($logger, __('Deleting chunks files...', 'wp_all_import_plugin'));
|
1854 |
+
@file_exists($filePath) and wp_all_import_remove_source($filePath, false);
|
1855 |
}
|
1856 |
|
1857 |
if ($this->type != "ftp"){
|
1858 |
if ( ! @unlink($this->path)) {
|
1859 |
+
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', 'wp_all_import_plugin'), $this->path));
|
1860 |
}
|
1861 |
}
|
1862 |
else{
|
1864 |
if (!empty($file_path_array)){
|
1865 |
foreach ($file_path_array as $path) {
|
1866 |
if ( ! @unlink($path)) {
|
1867 |
+
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Unable to remove %s', 'wp_all_import_plugin'), $path));
|
1868 |
}
|
1869 |
}
|
1870 |
}
|
1930 |
return $caps;
|
1931 |
}
|
1932 |
|
1933 |
+
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger, $is_cron = false){
|
1934 |
|
1935 |
$terms = wp_get_object_terms( $pid, $tx_name );
|
1936 |
$term_ids = array();
|
1961 |
|
1962 |
if ( $values ){
|
1963 |
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)" ) ){
|
1964 |
+
$logger and call_user_func($logger, __('<b>ERROR</b> Could not insert term relationship into the database', 'wp_all_import_plugin') . ': '. $this->wpdb->last_error);
|
|
|
1965 |
}
|
1966 |
}
|
1967 |
|
1982 |
// Remove attachments
|
1983 |
empty($this->options['is_keep_attachments']) and wp_delete_attachments($p->post_id, true, 'files');
|
1984 |
// Remove images
|
1985 |
+
empty($this->options['is_keep_imgs']) and wp_delete_attachments($p->post_id, ($this->options['download_images'] == 'yes'));
|
1986 |
+
$ids[] = $p->post_id;
|
1987 |
}
|
1988 |
|
1989 |
if ( ! empty($ids) ){
|
2028 |
$fileList = new PMXI_File_List();
|
2029 |
foreach($fileList->getBy('import_id', $this->id)->convertRecords() as $f) {
|
2030 |
if ( @file_exists($f->path) ){
|
2031 |
+
wp_all_import_remove_source($f->path);
|
2032 |
}
|
2033 |
$f->delete();
|
2034 |
}
|
models/model.php
CHANGED
File without changes
|
models/model/list.php
CHANGED
File without changes
|
models/model/record.php
CHANGED
File without changes
|
models/post/list.php
CHANGED
File without changes
|
models/post/record.php
CHANGED
File without changes
|
models/template/list.php
CHANGED
File without changes
|
models/template/record.php
CHANGED
File without changes
|
plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP All Import
|
4 |
Plugin URI: http://www.wpallimport.com/upgrade-to-pro?utm_source=wordpress.org&utm_medium=plugins-page&utm_campaign=free+plugin
|
5 |
Description: The most powerful solution for importing XML and CSV files to WordPress. Create Posts and Pages with content from any XML or CSV file. A paid upgrade to WP All Import Pro is available for support and additional features.
|
6 |
-
Version: 3.2.
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
@@ -11,24 +11,55 @@ Author: Soflyy
|
|
11 |
* Plugin root dir with forward slashes as directory separator regardless of actuall DIRECTORY_SEPARATOR value
|
12 |
* @var string
|
13 |
*/
|
14 |
-
define('
|
15 |
/**
|
16 |
* Plugin root url for referencing static content
|
17 |
* @var string
|
18 |
*/
|
19 |
-
define('
|
20 |
/**
|
21 |
* Plugin prefix for making names unique (be aware that this variable is used in conjuction with naming convention,
|
22 |
* i.e. in order to change it one must not only modify this constant but also rename all constants, classes and functions which
|
23 |
* names composed using this prefix)
|
24 |
* @var string
|
25 |
*/
|
26 |
-
define('
|
27 |
|
28 |
-
define('PMXI_VERSION', '3.2.
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
/**
|
33 |
* Main plugin file, Introduces MVC pattern
|
34 |
*
|
@@ -52,17 +83,17 @@ final class PMXI_Plugin {
|
|
52 |
* Plugin root dir
|
53 |
* @var string
|
54 |
*/
|
55 |
-
const ROOT_DIR =
|
56 |
/**
|
57 |
* Plugin root URL
|
58 |
* @var string
|
59 |
*/
|
60 |
-
const ROOT_URL =
|
61 |
/**
|
62 |
* Prefix used for names of shortcodes, action handlers, filter functions etc.
|
63 |
* @var string
|
64 |
*/
|
65 |
-
const PREFIX =
|
66 |
/**
|
67 |
* Plugin file path
|
68 |
* @var string
|
@@ -74,14 +105,39 @@ final class PMXI_Plugin {
|
|
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 |
|
83 |
-
public static $csv_path = false;
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
/**
|
86 |
* Return singletone instance
|
87 |
* @return PMXI_Plugin
|
@@ -93,6 +149,10 @@ final class PMXI_Plugin {
|
|
93 |
return self::$instance;
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
96 |
/**
|
97 |
* Common logic for requestin plugin info fields
|
98 |
*/
|
@@ -179,28 +239,15 @@ final class PMXI_Plugin {
|
|
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();
|
|
|
201 |
$this->options = array_intersect_key(get_option($option_name, array()), $options_default) + $options_default;
|
202 |
$this->options = array_intersect_key($options_default, array_flip(array('info_api_url'))) + $this->options; // make sure hidden options apply upon plugin reactivation
|
203 |
-
if ('' == $this->options['cron_job_key']) $this->options['cron_job_key'] =
|
204 |
|
205 |
update_option($option_name, $this->options);
|
206 |
$this->options = get_option(get_class($this) . '_Options');
|
@@ -218,7 +265,7 @@ final class PMXI_Plugin {
|
|
218 |
$priority = 10;
|
219 |
}
|
220 |
add_action($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
|
221 |
-
}
|
222 |
|
223 |
// register filter handlers
|
224 |
if (is_dir(self::ROOT_DIR . '/filters')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/filters/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
@@ -243,13 +290,29 @@ final class PMXI_Plugin {
|
|
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
|
251 |
*/
|
252 |
public function _fix_options(){
|
|
|
|
|
253 |
|
254 |
$imports = new PMXI_Import_List();
|
255 |
$post = new PMXI_Post_Record();
|
@@ -261,12 +324,14 @@ final class PMXI_Plugin {
|
|
261 |
|
262 |
$uploads = wp_upload_dir();
|
263 |
|
264 |
-
if ( empty($is_migrated) or version_compare($is_migrated, PMXI_VERSION) < 0 ){
|
265 |
|
266 |
-
|
267 |
|
268 |
-
|
269 |
-
|
|
|
|
|
270 |
|
271 |
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
272 |
|
@@ -276,7 +341,7 @@ final class PMXI_Plugin {
|
|
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
|
@@ -284,7 +349,7 @@ final class PMXI_Plugin {
|
|
284 |
|
285 |
if ($imp->type == 'file'){
|
286 |
$imp->set(array(
|
287 |
-
'path' => $uploads['basedir'] .
|
288 |
))->update();
|
289 |
}
|
290 |
}
|
@@ -314,28 +379,69 @@ final class PMXI_Plugin {
|
|
314 |
|
315 |
}
|
316 |
|
317 |
-
}
|
318 |
|
319 |
-
$this->__fix_db_schema(); // feature to version 3.2.
|
320 |
|
321 |
}
|
322 |
else {
|
323 |
|
324 |
// migration fixes for vesions
|
325 |
switch ($is_migrated) {
|
326 |
-
|
327 |
case '3.2.0':
|
328 |
-
case '3.2.1':
|
329 |
-
|
|
|
|
|
330 |
break;
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
default:
|
333 |
# code...
|
334 |
break;
|
335 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
|
|
|
337 |
}
|
338 |
-
update_option('pmxi_is_migrated', PMXI_VERSION);
|
339 |
}
|
340 |
}
|
341 |
|
@@ -367,7 +473,8 @@ final class PMXI_Plugin {
|
|
367 |
$options['tax_assing'] = array();
|
368 |
$options['tax_multiple_xpath'] = array();
|
369 |
$options['tax_multiple_delim'] = array();
|
370 |
-
$options['
|
|
|
371 |
|
372 |
if ( ! empty($post_taxonomies)):
|
373 |
foreach ($post_taxonomies as $ctx):
|
@@ -392,10 +499,8 @@ final class PMXI_Plugin {
|
|
392 |
$options['tax_multiple_xpath'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['xpath'])) ? $taxonomies_hierarchy[0]['xpath'] : '';
|
393 |
$options['tax_multiple_delim'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['delim'])) ? $taxonomies_hierarchy[0]['delim'] : '';
|
394 |
}
|
395 |
-
else{
|
396 |
-
|
397 |
-
$options['tax_hierarchical_logic'][$ctx->name] = 'manual';
|
398 |
-
|
399 |
}
|
400 |
}
|
401 |
|
@@ -403,12 +508,49 @@ final class PMXI_Plugin {
|
|
403 |
endif;
|
404 |
}
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
/**
|
407 |
* pre-dispatching logic for admin page controllers
|
408 |
*/
|
409 |
public function __adminInit() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
-
self::$session = new PMXI_Handler();
|
412 |
|
413 |
$input = new PMXI_Input();
|
414 |
$page = strtolower($input->getpost('page', ''));
|
@@ -427,38 +569,50 @@ final class PMXI_Plugin {
|
|
427 |
}
|
428 |
$actionName = str_replace('-', '_', $action);
|
429 |
if (method_exists($controllerName, $actionName)) {
|
430 |
-
$this->_admin_current_screen = (object)array(
|
431 |
-
'id' => $controllerName,
|
432 |
-
'base' => $controllerName,
|
433 |
-
'action' => $actionName,
|
434 |
-
'is_ajax' => strpos($_SERVER["HTTP_ACCEPT"], 'json') !== false,
|
435 |
-
'is_network' => is_network_admin(),
|
436 |
-
'is_user' => is_user_admin(),
|
437 |
-
);
|
438 |
-
add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
|
439 |
-
add_filter('admin_body_class', create_function('', 'return "' . 'wpallimport-plugin";'));
|
440 |
-
|
441 |
-
$controller = new $controllerName();
|
442 |
-
if ( ! $controller instanceof PMXI_Controller_Admin) {
|
443 |
-
throw new Exception("Administration page `$page` matches to a wrong controller type.");
|
444 |
-
}
|
445 |
|
446 |
-
if (
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
} elseif ( ! $controller->isInline) {
|
451 |
-
@ob_start();
|
452 |
-
$controller->$action();
|
453 |
-
self::$buffer = @ob_get_clean();
|
454 |
} else {
|
455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
}
|
|
|
457 |
} else { // redirect to dashboard if requested page and/or action don't exist
|
458 |
wp_redirect(admin_url()); die();
|
459 |
}
|
460 |
|
461 |
-
}
|
|
|
|
|
462 |
|
463 |
}
|
464 |
|
@@ -489,7 +643,8 @@ final class PMXI_Plugin {
|
|
489 |
* The method is called twice: 1st time as handler `parse_header` action and then as admin menu item handler
|
490 |
* @param string[optional] $page When $page set to empty string ealier buffered content is outputted, otherwise controller is called based on $page value
|
491 |
*/
|
492 |
-
public function adminDispatcher($page = '', $action = 'index') {
|
|
|
493 |
if ('' === $page) {
|
494 |
if ( ! is_null(self::$buffer)) {
|
495 |
echo '<div class="wrap">';
|
@@ -505,6 +660,7 @@ final class PMXI_Plugin {
|
|
505 |
throw new Exception('There is no previousely buffered content to display.');
|
506 |
}
|
507 |
}
|
|
|
508 |
}
|
509 |
|
510 |
public function replace_callback($matches){
|
@@ -621,7 +777,7 @@ final class PMXI_Plugin {
|
|
621 |
}
|
622 |
}
|
623 |
|
624 |
-
dbDelta($plugin_queries);
|
625 |
|
626 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
627 |
|
@@ -639,25 +795,29 @@ final class PMXI_Plugin {
|
|
639 |
* @return void
|
640 |
*/
|
641 |
public function load_plugin_textdomain() {
|
642 |
-
$locale = apply_filters( 'plugin_locale', get_locale(), '
|
643 |
|
644 |
-
load_plugin_textdomain( '
|
645 |
-
}
|
646 |
|
647 |
-
public function __fix_db_schema(){
|
648 |
|
649 |
-
$uploads = wp_upload_dir();
|
650 |
|
651 |
-
if ( ! is_dir($uploads['basedir'] .
|
652 |
-
die(sprintf(__('Uploads folder %s must be writable', '
|
653 |
}
|
654 |
|
655 |
-
if ( ! is_dir($uploads['basedir'] .
|
656 |
-
die(sprintf(__('Uploads folder %s must be writable', '
|
657 |
}
|
658 |
|
659 |
-
$table = $table = $this->getTablePrefix() . 'files';
|
660 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
661 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
662 |
// For every field in the table
|
663 |
foreach ($tablefields as $tablefield) {
|
@@ -669,7 +829,8 @@ final class PMXI_Plugin {
|
|
669 |
}
|
670 |
}
|
671 |
|
672 |
-
$wpdb->query("ALTER TABLE {$table} DROP " . $tablefield->Field);
|
|
|
673 |
break;
|
674 |
}
|
675 |
}
|
@@ -677,41 +838,79 @@ final class PMXI_Plugin {
|
|
677 |
$table = $this->getTablePrefix() . 'imports';
|
678 |
|
679 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
680 |
-
$
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
|
|
|
|
690 |
|
691 |
// Check if field exists
|
692 |
foreach ($tablefields as $tablefield) {
|
693 |
-
if (
|
694 |
-
|
695 |
-
|
696 |
-
if ('executing' == $tablefield->Field) $executing = true;
|
697 |
-
if ('canceled' == $tablefield->Field) $canceled = true;
|
698 |
-
if ('canceled_on' == $tablefield->Field) $canceled_on = true;
|
699 |
-
if ('failed' == $tablefield->Field) $failed = true;
|
700 |
-
if ('failed_on' == $tablefield->Field) $failed_on = true;
|
701 |
-
if ('settings_update_on' == $tablefield->Field) $settings_update_on = true;
|
702 |
-
if ('last_activity' == $tablefield->Field) $last_activity = true;
|
703 |
}
|
704 |
|
705 |
-
if (
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
|
716 |
$table = $this->getTablePrefix() . 'posts';
|
717 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
@@ -722,7 +921,23 @@ final class PMXI_Plugin {
|
|
722 |
if ('iteration' == $tablefield->Field) $iteration = true;
|
723 |
}
|
724 |
|
725 |
-
if (!$iteration)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
726 |
|
727 |
if ( ! empty($wpdb->charset))
|
728 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
@@ -740,6 +955,8 @@ final class PMXI_Plugin {
|
|
740 |
summary TEXT,
|
741 |
PRIMARY KEY (id)
|
742 |
) $charset_collate;");
|
|
|
|
|
743 |
}
|
744 |
|
745 |
/**
|
@@ -753,11 +970,16 @@ final class PMXI_Plugin {
|
|
753 |
'custom_type' => '',
|
754 |
'featured_delim' => ',',
|
755 |
'atch_delim' => ',',
|
|
|
756 |
'post_taxonomies' => array(),
|
757 |
'parent' => 0,
|
|
|
|
|
758 |
'order' => 0,
|
759 |
'status' => 'publish',
|
760 |
'page_template' => 'default',
|
|
|
|
|
761 |
'page_taxonomies' => array(),
|
762 |
'date_type' => 'specific',
|
763 |
'date' => 'now',
|
@@ -770,7 +992,9 @@ final class PMXI_Plugin {
|
|
770 |
'serialized_values' => array(),
|
771 |
'custom_mapping_rules' => array(),
|
772 |
'comment_status' => 'open',
|
|
|
773 |
'ping_status' => 'open',
|
|
|
774 |
'create_draft' => 'no',
|
775 |
'author' => '',
|
776 |
'post_excerpt' => '',
|
@@ -783,6 +1007,7 @@ final class PMXI_Plugin {
|
|
783 |
'unique_key' => '',
|
784 |
'tmp_unique_key' => '',
|
785 |
'feed_type' => 'auto',
|
|
|
786 |
|
787 |
'create_new_records' => 1,
|
788 |
'is_delete_missing' => 0,
|
@@ -868,14 +1093,23 @@ final class PMXI_Plugin {
|
|
868 |
'new_extension' => '',
|
869 |
'tax_logic' => array(),
|
870 |
'tax_assing' => array(),
|
|
|
|
|
|
|
|
|
871 |
'tax_single_xpath' => array(),
|
872 |
'tax_multiple_xpath' => array(),
|
873 |
'tax_hierarchical_xpath' => array(),
|
874 |
'tax_multiple_delim' => array(),
|
875 |
'tax_hierarchical_delim' => array(),
|
876 |
-
'
|
|
|
|
|
877 |
'tax_enable_mapping' => array(),
|
878 |
'tax_mapping' => array(),
|
|
|
|
|
|
|
879 |
'nested_files' => array()
|
880 |
);
|
881 |
}
|
@@ -903,5 +1137,5 @@ final class PMXI_Plugin {
|
|
903 |
|
904 |
}
|
905 |
|
906 |
-
PMXI_Plugin::getInstance();
|
907 |
|
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.4
|
7 |
Author: Soflyy
|
8 |
*/
|
9 |
|
11 |
* Plugin root dir with forward slashes as directory separator regardless of actuall DIRECTORY_SEPARATOR value
|
12 |
* @var string
|
13 |
*/
|
14 |
+
define('WP_ALL_IMPORT_ROOT_DIR', str_replace('\\', '/', dirname(__FILE__)));
|
15 |
/**
|
16 |
* Plugin root url for referencing static content
|
17 |
* @var string
|
18 |
*/
|
19 |
+
define('WP_ALL_IMPORT_ROOT_URL', rtrim(plugin_dir_url(__FILE__), '/'));
|
20 |
/**
|
21 |
* Plugin prefix for making names unique (be aware that this variable is used in conjuction with naming convention,
|
22 |
* i.e. in order to change it one must not only modify this constant but also rename all constants, classes and functions which
|
23 |
* names composed using this prefix)
|
24 |
* @var string
|
25 |
*/
|
26 |
+
define('WP_ALL_IMPORT_PREFIX', 'pmxi_');
|
27 |
|
28 |
+
define('PMXI_VERSION', '3.2.4');
|
29 |
|
30 |
define('PMXI_EDITION', 'free');
|
31 |
|
32 |
+
/**
|
33 |
+
* Plugin root uploads folder name
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
define('WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY', 'wpallimport');
|
37 |
+
/**
|
38 |
+
* Plugin logs folder name
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
define('WP_ALL_IMPORT_LOGS_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'logs');
|
42 |
+
/**
|
43 |
+
* Plugin files folder name
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
define('WP_ALL_IMPORT_FILES_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'files');
|
47 |
+
/**
|
48 |
+
* Plugin uploads folder name
|
49 |
+
* @var string
|
50 |
+
*/
|
51 |
+
define('WP_ALL_IMPORT_UPLOADS_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'uploads');
|
52 |
+
/**
|
53 |
+
* Plugin history folder name
|
54 |
+
* @var string
|
55 |
+
*/
|
56 |
+
define('WP_ALL_IMPORT_HISTORY_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'history');
|
57 |
+
/**
|
58 |
+
* Plugin temp folder name
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
define('WP_ALL_IMPORT_TEMP_DIRECTORY', WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY . DIRECTORY_SEPARATOR . 'temp');
|
62 |
+
|
63 |
/**
|
64 |
* Main plugin file, Introduces MVC pattern
|
65 |
*
|
83 |
* Plugin root dir
|
84 |
* @var string
|
85 |
*/
|
86 |
+
const ROOT_DIR = WP_ALL_IMPORT_ROOT_DIR;
|
87 |
/**
|
88 |
* Plugin root URL
|
89 |
* @var string
|
90 |
*/
|
91 |
+
const ROOT_URL = WP_ALL_IMPORT_ROOT_URL;
|
92 |
/**
|
93 |
* Prefix used for names of shortcodes, action handlers, filter functions etc.
|
94 |
* @var string
|
95 |
*/
|
96 |
+
const PREFIX = WP_ALL_IMPORT_PREFIX;
|
97 |
/**
|
98 |
* Plugin file path
|
99 |
* @var string
|
105 |
*/
|
106 |
const LARGE_SIZE = 0; // all files will importing in large import mode
|
107 |
|
108 |
+
public static $session = null;
|
|
|
|
|
109 |
|
110 |
public static $is_csv = false;
|
111 |
|
112 |
+
public static $csv_path = false;
|
113 |
|
114 |
+
/**
|
115 |
+
* WP All Import logs folder
|
116 |
+
* @var string
|
117 |
+
*/
|
118 |
+
const LOGS_DIRECTORY = WP_ALL_IMPORT_LOGS_DIRECTORY;
|
119 |
+
/**
|
120 |
+
* WP All Import files folder
|
121 |
+
* @var string
|
122 |
+
*/
|
123 |
+
const FILES_DIRECTORY = WP_ALL_IMPORT_FILES_DIRECTORY;
|
124 |
+
/**
|
125 |
+
* WP All Import temp folder
|
126 |
+
* @var string
|
127 |
+
*/
|
128 |
+
const TEMP_DIRECTORY = WP_ALL_IMPORT_TEMP_DIRECTORY;
|
129 |
+
/**
|
130 |
+
* WP All Import uploads folder
|
131 |
+
* @var string
|
132 |
+
*/
|
133 |
+
const UPLOADS_DIRECTORY = WP_ALL_IMPORT_UPLOADS_DIRECTORY;
|
134 |
+
|
135 |
+
/**
|
136 |
+
* WP All Import history folder
|
137 |
+
* @var string
|
138 |
+
*/
|
139 |
+
const HISTORY_DIRECTORY = WP_ALL_IMPORT_HISTORY_DIRECTORY;
|
140 |
+
|
141 |
/**
|
142 |
* Return singletone instance
|
143 |
* @return PMXI_Plugin
|
149 |
return self::$instance;
|
150 |
}
|
151 |
|
152 |
+
static public function getEddName(){
|
153 |
+
return 'WP All Import';
|
154 |
+
}
|
155 |
+
|
156 |
/**
|
157 |
* Common logic for requestin plugin info fields
|
158 |
*/
|
239 |
// register helpers
|
240 |
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) {
|
241 |
require_once $filePath;
|
242 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
// init plugin options
|
245 |
$option_name = get_class($this) . '_Options';
|
246 |
$options_default = PMXI_Config::createFromFile(self::ROOT_DIR . '/config/options.php')->toArray();
|
247 |
+
|
248 |
$this->options = array_intersect_key(get_option($option_name, array()), $options_default) + $options_default;
|
249 |
$this->options = array_intersect_key($options_default, array_flip(array('info_api_url'))) + $this->options; // make sure hidden options apply upon plugin reactivation
|
250 |
+
if ('' == $this->options['cron_job_key']) $this->options['cron_job_key'] = wp_all_import_url_title(wp_all_import_rand_char(12));
|
251 |
|
252 |
update_option($option_name, $this->options);
|
253 |
$this->options = get_option(get_class($this) . '_Options');
|
265 |
$priority = 10;
|
266 |
}
|
267 |
add_action($actionName, self::PREFIX . str_replace('-', '_', $function), $priority, 99); // since we don't know at this point how many parameters each plugin expects, we make sure they will be provided with all of them (it's unlikely any developer will specify more than 99 parameters in a function)
|
268 |
+
}
|
269 |
|
270 |
// register filter handlers
|
271 |
if (is_dir(self::ROOT_DIR . '/filters')) foreach (PMXI_Helper::safe_glob(self::ROOT_DIR . '/filters/*.php', PMXI_Helper::GLOB_RECURSE | PMXI_Helper::GLOB_PATH) as $filePath) {
|
290 |
add_action('admin_init', array($this, '__adminInit'));
|
291 |
add_action('admin_init', array($this, '_fix_options'));
|
292 |
|
293 |
+
}
|
294 |
+
|
295 |
+
public function plugin_row_meta($links, $file)
|
296 |
+
{
|
297 |
+
if ( $file == plugin_basename( __FILE__ ) ) {
|
298 |
+
$row_meta = array(
|
299 |
+
'pro' => '<a href="http://www.wpallimport.com" target="_blank" title="' . esc_attr( __( 'WP All Import Pro Version', 'wp_all_import_plugin' ) ) . '">' . __( 'Pro Version', 'wp_all_import_plugin' ) . '</a>',
|
300 |
+
);
|
301 |
+
|
302 |
+
return array_merge( $links, $row_meta );
|
303 |
+
}
|
304 |
+
|
305 |
+
return (array) $links;
|
306 |
}
|
307 |
|
308 |
+
|
309 |
/**
|
310 |
* convert imports options
|
311 |
+
* compatibility with version 3.2.3
|
312 |
*/
|
313 |
public function _fix_options(){
|
314 |
+
|
315 |
+
global $wpdb;
|
316 |
|
317 |
$imports = new PMXI_Import_List();
|
318 |
$post = new PMXI_Post_Record();
|
324 |
|
325 |
$uploads = wp_upload_dir();
|
326 |
|
327 |
+
if ( empty($is_migrated) or version_compare($is_migrated, PMXI_VERSION) < 0 ){ //PMXI_VERSION
|
328 |
|
329 |
+
$commit_migration = true;
|
330 |
|
331 |
+
if ( empty($is_migrated) ){ // plugin version less than 3.2.3
|
332 |
+
|
333 |
+
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_history');
|
334 |
+
wp_all_import_rmdir($uploads['basedir'] . '/wpallimport_logs');
|
335 |
|
336 |
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
337 |
|
341 |
|
342 |
$options = array_merge($imp->options, $imp->template);
|
343 |
|
344 |
+
$this->__ver_4_transition_fix($options);
|
345 |
|
346 |
$imp->set(array(
|
347 |
'options' => $options
|
349 |
|
350 |
if ($imp->type == 'file'){
|
351 |
$imp->set(array(
|
352 |
+
'path' => $uploads['basedir'] . DIRECTORY_SEPARATOR . self::FILES_DIRECTORY . DIRECTORY_SEPARATOR . basename($imp->path)
|
353 |
))->update();
|
354 |
}
|
355 |
}
|
379 |
|
380 |
}
|
381 |
|
382 |
+
}
|
383 |
|
384 |
+
$commit_migration = $this->__fix_db_schema(); // feature to version 3.2.3
|
385 |
|
386 |
}
|
387 |
else {
|
388 |
|
389 |
// migration fixes for vesions
|
390 |
switch ($is_migrated) {
|
391 |
+
|
392 |
case '3.2.0':
|
393 |
+
case '3.2.1':
|
394 |
+
|
395 |
+
$commit_migration = $this->__fix_db_schema(); // feature to version 3.2.3
|
396 |
+
|
397 |
break;
|
398 |
|
399 |
+
case '4.0.2':
|
400 |
+
case '4.0.3':
|
401 |
+
case '4.0.4':
|
402 |
+
|
403 |
+
break;
|
404 |
+
|
405 |
default:
|
406 |
# code...
|
407 |
break;
|
408 |
}
|
409 |
+
|
410 |
+
foreach ($imports->setColumns($imports->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $imp){
|
411 |
+
|
412 |
+
$imp->getById($imp->id);
|
413 |
+
|
414 |
+
if ( ! $imp->isEmpty() ){
|
415 |
+
|
416 |
+
$options = $imp->options;
|
417 |
+
|
418 |
+
$this->__ver_4x_transition_fix($options, $is_migrated);
|
419 |
+
|
420 |
+
$imp->set(array(
|
421 |
+
'options' => $options
|
422 |
+
))->update();
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
foreach ($templates->setColumns($templates->getTable() . '.*')->getBy(array('id !=' => ''))->convertRecords() as $tpl){
|
427 |
+
|
428 |
+
$tpl->getById($tpl->id);
|
429 |
+
|
430 |
+
if ( ! $tpl->isEmpty() ) {
|
431 |
+
|
432 |
+
$options = ( empty($tpl->options) ) ? array() : $tpl->options;
|
433 |
+
|
434 |
+
$this->__ver_4x_transition_fix($options, $is_migrated);
|
435 |
+
|
436 |
+
$tpl->set(array(
|
437 |
+
'options' => $options
|
438 |
+
))->update();
|
439 |
+
|
440 |
+
}
|
441 |
|
442 |
+
}
|
443 |
}
|
444 |
+
if ($commit_migration) update_option('pmxi_is_migrated', PMXI_VERSION);
|
445 |
}
|
446 |
}
|
447 |
|
473 |
$options['tax_assing'] = array();
|
474 |
$options['tax_multiple_xpath'] = array();
|
475 |
$options['tax_multiple_delim'] = array();
|
476 |
+
$options['tax_hierarchical_logic_entire'] = array();
|
477 |
+
$options['tax_hierarchical_logic_manual'] = array();
|
478 |
|
479 |
if ( ! empty($post_taxonomies)):
|
480 |
foreach ($post_taxonomies as $ctx):
|
499 |
$options['tax_multiple_xpath'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['xpath'])) ? $taxonomies_hierarchy[0]['xpath'] : '';
|
500 |
$options['tax_multiple_delim'][$ctx->name] = (!empty($taxonomies_hierarchy[0]['delim'])) ? $taxonomies_hierarchy[0]['delim'] : '';
|
501 |
}
|
502 |
+
else{
|
503 |
+
$options['tax_hierarchical_logic_manual'][$ctx->name] = 1;
|
|
|
|
|
504 |
}
|
505 |
}
|
506 |
|
508 |
endif;
|
509 |
}
|
510 |
|
511 |
+
public function __ver_4x_transition_fix(&$options, $version){
|
512 |
+
if ( version_compare($version, '4.0.5') < 0 ){
|
513 |
+
if ( ! empty($options['tax_hierarchical_logic']) and is_array($options['tax_hierarchical_logic']) ){
|
514 |
+
foreach ($options['tax_hierarchical_logic'] as $tx => $type) {
|
515 |
+
switch ($type){
|
516 |
+
case 'entire':
|
517 |
+
$options['tax_hierarchical_logic_entire'][$tx] = 1;
|
518 |
+
break;
|
519 |
+
case 'manual':
|
520 |
+
$options['tax_hierarchical_logic_manual'][$tx] = 1;
|
521 |
+
break;
|
522 |
+
default:
|
523 |
+
|
524 |
+
break;
|
525 |
+
}
|
526 |
+
}
|
527 |
+
unset($options['tax_hierarchical_logic']);
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
}
|
532 |
+
|
533 |
/**
|
534 |
* pre-dispatching logic for admin page controllers
|
535 |
*/
|
536 |
public function __adminInit() {
|
537 |
+
|
538 |
+
// create history folder
|
539 |
+
$uploads = wp_upload_dir();
|
540 |
+
|
541 |
+
$wpallimportDirs = array( WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY, self::LOGS_DIRECTORY, self::FILES_DIRECTORY, self::TEMP_DIRECTORY, self::UPLOADS_DIRECTORY, self::HISTORY_DIRECTORY);
|
542 |
+
|
543 |
+
foreach ($wpallimportDirs as $destination) {
|
544 |
+
|
545 |
+
$dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . $destination;
|
546 |
+
|
547 |
+
if ( !is_dir($dir)) wp_mkdir_p($dir);
|
548 |
+
|
549 |
+
if ( ! @file_exists($dir . DIRECTORY_SEPARATOR . 'index.php') ) @touch( $dir . DIRECTORY_SEPARATOR . 'index.php' );
|
550 |
+
|
551 |
+
}
|
552 |
|
553 |
+
self::$session = new PMXI_Handler();
|
554 |
|
555 |
$input = new PMXI_Input();
|
556 |
$page = strtolower($input->getpost('page', ''));
|
569 |
}
|
570 |
$actionName = str_replace('-', '_', $action);
|
571 |
if (method_exists($controllerName, $actionName)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
572 |
|
573 |
+
if ( ! get_current_user_id() or ! current_user_can('manage_options')) {
|
574 |
+
// This nonce is not valid.
|
575 |
+
die( 'Security check' );
|
576 |
+
|
|
|
|
|
|
|
|
|
577 |
} else {
|
578 |
+
|
579 |
+
$this->_admin_current_screen = (object)array(
|
580 |
+
'id' => $controllerName,
|
581 |
+
'base' => $controllerName,
|
582 |
+
'action' => $actionName,
|
583 |
+
'is_ajax' => strpos($_SERVER["HTTP_ACCEPT"], 'json') !== false,
|
584 |
+
'is_network' => is_network_admin(),
|
585 |
+
'is_user' => is_user_admin(),
|
586 |
+
);
|
587 |
+
add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
|
588 |
+
add_filter('admin_body_class', create_function('', 'return "' . 'wpallimport-plugin";'));
|
589 |
+
|
590 |
+
$controller = new $controllerName();
|
591 |
+
if ( ! $controller instanceof PMXI_Controller_Admin) {
|
592 |
+
throw new Exception("Administration page `$page` matches to a wrong controller type.");
|
593 |
+
}
|
594 |
+
|
595 |
+
if ($this->_admin_current_screen->is_ajax) { // ajax request
|
596 |
+
$controller->$action();
|
597 |
+
do_action('pmxi_action_after');
|
598 |
+
die(); // stop processing since we want to output only what controller is randered, nothing in addition
|
599 |
+
} elseif ( ! $controller->isInline) {
|
600 |
+
@ob_start();
|
601 |
+
$controller->$action();
|
602 |
+
self::$buffer = @ob_get_clean();
|
603 |
+
} else {
|
604 |
+
self::$buffer_callback = array($controller, $action);
|
605 |
+
}
|
606 |
+
|
607 |
}
|
608 |
+
|
609 |
} else { // redirect to dashboard if requested page and/or action don't exist
|
610 |
wp_redirect(admin_url()); die();
|
611 |
}
|
612 |
|
613 |
+
}
|
614 |
+
|
615 |
+
add_filter('plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
616 |
|
617 |
}
|
618 |
|
643 |
* The method is called twice: 1st time as handler `parse_header` action and then as admin menu item handler
|
644 |
* @param string[optional] $page When $page set to empty string ealier buffered content is outputted, otherwise controller is called based on $page value
|
645 |
*/
|
646 |
+
public function adminDispatcher($page = '', $action = 'index') {
|
647 |
+
|
648 |
if ('' === $page) {
|
649 |
if ( ! is_null(self::$buffer)) {
|
650 |
echo '<div class="wrap">';
|
660 |
throw new Exception('There is no previousely buffered content to display.');
|
661 |
}
|
662 |
}
|
663 |
+
|
664 |
}
|
665 |
|
666 |
public function replace_callback($matches){
|
777 |
}
|
778 |
}
|
779 |
|
780 |
+
dbDelta($plugin_queries);
|
781 |
|
782 |
// sync data between plugin tables and wordpress (mostly for the case when plugin is reactivated)
|
783 |
|
795 |
* @return void
|
796 |
*/
|
797 |
public function load_plugin_textdomain() {
|
798 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'wp_all_import_plugin' );
|
799 |
|
800 |
+
load_plugin_textdomain( 'wp_all_import_plugin', false, dirname( plugin_basename( __FILE__ ) ) . "/i18n/languages" );
|
801 |
+
}
|
802 |
|
803 |
+
public function __fix_db_schema(){
|
804 |
|
805 |
+
$uploads = wp_upload_dir();
|
806 |
|
807 |
+
if ( ! is_dir($uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY) or ! is_writable($uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY)) {
|
808 |
+
die(sprintf(__('Uploads folder %s must be writable', 'wp_all_import_plugin'), $uploads['basedir'] . DIRECTORY_SEPARATOR . self::LOGS_DIRECTORY));
|
809 |
}
|
810 |
|
811 |
+
if ( ! is_dir($uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY) or ! is_writable($uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY)) {
|
812 |
+
die(sprintf(__('Uploads folder %s must be writable', 'wp_all_import_plugin'), $uploads['basedir'] . DIRECTORY_SEPARATOR . WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY));
|
813 |
}
|
814 |
|
|
|
815 |
global $wpdb;
|
816 |
+
// do not execute ALTER TABLE queries if sql user doesn't have ALTER privileges
|
817 |
+
$grands = $wpdb->get_results("SELECT * FROM information_schema.user_privileges WHERE grantee LIKE \"'" . DB_USER . "'%\" AND PRIVILEGE_TYPE = 'ALTER' AND IS_GRANTABLE = 'YES';");
|
818 |
+
|
819 |
+
$table = $table = $this->getTablePrefix() . 'files';
|
820 |
+
|
821 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
822 |
// For every field in the table
|
823 |
foreach ($tablefields as $tablefield) {
|
829 |
}
|
830 |
}
|
831 |
|
832 |
+
if (!empty($grands)) $wpdb->query("ALTER TABLE {$table} DROP " . $tablefield->Field);
|
833 |
+
|
834 |
break;
|
835 |
}
|
836 |
}
|
838 |
$table = $this->getTablePrefix() . 'imports';
|
839 |
|
840 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
841 |
+
$fields_to_alter = array(
|
842 |
+
'parent_import_id',
|
843 |
+
'iteration',
|
844 |
+
'deleted',
|
845 |
+
'executing',
|
846 |
+
'canceled',
|
847 |
+
'canceled_on',
|
848 |
+
'failed',
|
849 |
+
'failed_on',
|
850 |
+
'settings_update_on',
|
851 |
+
'last_activity'
|
852 |
+
);
|
853 |
|
854 |
// Check if field exists
|
855 |
foreach ($tablefields as $tablefield) {
|
856 |
+
if (in_array($tablefield->Field, $fields_to_alter)){
|
857 |
+
$fields_to_alter = array_diff($fields_to_alter, array($tablefield->Field));
|
858 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
859 |
}
|
860 |
|
861 |
+
if ( ! empty($fields_to_alter) ){
|
862 |
+
|
863 |
+
if (empty($grands)) {
|
864 |
+
?>
|
865 |
+
<div class="error"><p>
|
866 |
+
<?php printf(
|
867 |
+
__('<b>%s Plugin</b>: Current sql user %s doesn\'t have ALTER privileges', 'pmwi_plugin'),
|
868 |
+
self::getInstance()->getName(), DB_USER
|
869 |
+
) ?>
|
870 |
+
</p></div>
|
871 |
+
<?php
|
872 |
+
return false;
|
873 |
+
}
|
874 |
+
|
875 |
+
foreach ($fields_to_alter as $field) {
|
876 |
+
switch ($field) {
|
877 |
+
case 'parent_import_id':
|
878 |
+
$wpdb->query("ALTER TABLE {$table} ADD `parent_import_id` BIGINT(20) NOT NULL DEFAULT 0;");
|
879 |
+
break;
|
880 |
+
case 'iteration':
|
881 |
+
$wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
882 |
+
break;
|
883 |
+
case 'deleted':
|
884 |
+
$wpdb->query("ALTER TABLE {$table} ADD `deleted` BIGINT(20) NOT NULL DEFAULT 0;");
|
885 |
+
break;
|
886 |
+
case 'executing':
|
887 |
+
$wpdb->query("ALTER TABLE {$table} ADD `executing` BOOL NOT NULL DEFAULT 0;");
|
888 |
+
break;
|
889 |
+
case 'canceled':
|
890 |
+
$wpdb->query("ALTER TABLE {$table} ADD `canceled` BOOL NOT NULL DEFAULT 0;");
|
891 |
+
break;
|
892 |
+
case 'canceled_on':
|
893 |
+
$wpdb->query("ALTER TABLE {$table} ADD `canceled_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
894 |
+
break;
|
895 |
+
case 'failed':
|
896 |
+
$wpdb->query("ALTER TABLE {$table} ADD `failed` BOOL NOT NULL DEFAULT 0;");
|
897 |
+
break;
|
898 |
+
case 'failed_on':
|
899 |
+
$wpdb->query("ALTER TABLE {$table} ADD `failed_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
900 |
+
break;
|
901 |
+
case 'settings_update_on':
|
902 |
+
$wpdb->query("ALTER TABLE {$table} ADD `settings_update_on` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
903 |
+
break;
|
904 |
+
case 'last_activity':
|
905 |
+
$wpdb->query("ALTER TABLE {$table} ADD `last_activity` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';");
|
906 |
+
break;
|
907 |
+
|
908 |
+
default:
|
909 |
+
# code...
|
910 |
+
break;
|
911 |
+
}
|
912 |
+
}
|
913 |
+
}
|
914 |
|
915 |
$table = $this->getTablePrefix() . 'posts';
|
916 |
$tablefields = $wpdb->get_results("DESCRIBE {$table};");
|
921 |
if ('iteration' == $tablefield->Field) $iteration = true;
|
922 |
}
|
923 |
|
924 |
+
if (!$iteration){
|
925 |
+
|
926 |
+
if (empty($grands)) {
|
927 |
+
?>
|
928 |
+
<div class="error"><p>
|
929 |
+
<?php printf(
|
930 |
+
__('<b>%s Plugin</b>: Current sql user %s doesn\'t have ALTER privileges', 'pmwi_plugin'),
|
931 |
+
self::getInstance()->getName(), DB_USER
|
932 |
+
) ?>
|
933 |
+
</p></div>
|
934 |
+
<?php
|
935 |
+
return false;
|
936 |
+
}
|
937 |
+
|
938 |
+
$wpdb->query("ALTER TABLE {$table} ADD `iteration` BIGINT(20) NOT NULL DEFAULT 0;");
|
939 |
+
|
940 |
+
}
|
941 |
|
942 |
if ( ! empty($wpdb->charset))
|
943 |
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
955 |
summary TEXT,
|
956 |
PRIMARY KEY (id)
|
957 |
) $charset_collate;");
|
958 |
+
|
959 |
+
return true;
|
960 |
}
|
961 |
|
962 |
/**
|
970 |
'custom_type' => '',
|
971 |
'featured_delim' => ',',
|
972 |
'atch_delim' => ',',
|
973 |
+
'is_search_existing_attach' => 0,
|
974 |
'post_taxonomies' => array(),
|
975 |
'parent' => 0,
|
976 |
+
'is_multiple_page_parent' => 'yes',
|
977 |
+
'single_page_parent' => '',
|
978 |
'order' => 0,
|
979 |
'status' => 'publish',
|
980 |
'page_template' => 'default',
|
981 |
+
'is_multiple_page_template' => 'yes',
|
982 |
+
'single_page_template' => '',
|
983 |
'page_taxonomies' => array(),
|
984 |
'date_type' => 'specific',
|
985 |
'date' => 'now',
|
992 |
'serialized_values' => array(),
|
993 |
'custom_mapping_rules' => array(),
|
994 |
'comment_status' => 'open',
|
995 |
+
'comment_status_xpath' => '',
|
996 |
'ping_status' => 'open',
|
997 |
+
'ping_status_xpath' => '',
|
998 |
'create_draft' => 'no',
|
999 |
'author' => '',
|
1000 |
'post_excerpt' => '',
|
1007 |
'unique_key' => '',
|
1008 |
'tmp_unique_key' => '',
|
1009 |
'feed_type' => 'auto',
|
1010 |
+
'search_existing_images' => 1,
|
1011 |
|
1012 |
'create_new_records' => 1,
|
1013 |
'is_delete_missing' => 0,
|
1093 |
'new_extension' => '',
|
1094 |
'tax_logic' => array(),
|
1095 |
'tax_assing' => array(),
|
1096 |
+
'term_assing' => array(),
|
1097 |
+
'multiple_term_assing' => array(),
|
1098 |
+
'tax_hierarchical_assing' => array(),
|
1099 |
+
'tax_hierarchical_last_level_assign' => array(),
|
1100 |
'tax_single_xpath' => array(),
|
1101 |
'tax_multiple_xpath' => array(),
|
1102 |
'tax_hierarchical_xpath' => array(),
|
1103 |
'tax_multiple_delim' => array(),
|
1104 |
'tax_hierarchical_delim' => array(),
|
1105 |
+
'tax_manualhierarchy_delim' => array(),
|
1106 |
+
'tax_hierarchical_logic_entire' => array(),
|
1107 |
+
'tax_hierarchical_logic_manual' => array(),
|
1108 |
'tax_enable_mapping' => array(),
|
1109 |
'tax_mapping' => array(),
|
1110 |
+
'tax_logic_mapping' => array(),
|
1111 |
+
'is_tax_hierarchical_group_delim' => array(),
|
1112 |
+
'tax_hierarchical_group_delim' => array(),
|
1113 |
'nested_files' => array()
|
1114 |
);
|
1115 |
}
|
1137 |
|
1138 |
}
|
1139 |
|
1140 |
+
PMXI_Plugin::getInstance();
|
1141 |
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 3.6.1
|
4 |
Tested up to: 4.1
|
5 |
-
Stable tag: 3.2.
|
6 |
Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
|
7 |
|
8 |
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
|
@@ -103,6 +103,15 @@ Does it work with special character encoding like Hebrew, Arabic, Chinese, etc?
|
|
103 |
|
104 |
== Changelog ==
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
= 3.2.3 =
|
107 |
* fixed re-count record when a file has been changed at an import setting screen
|
108 |
* fixed unlink attachment source when posts updated/deleted
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 3.6.1
|
4 |
Tested up to: 4.1
|
5 |
+
Stable tag: 3.2.4
|
6 |
Tags: wordpress csv import, wordpress xml import, xml, csv, datafeed, import, migrate, import csv to wordpress, import xml to wordpress, advanced xml import, advanced csv import, bulk csv import, bulk xml import, bulk data import, xml to custom post type, csv to custom post type, woocommerce csv import, woocommerce xml import, csv import, import csv, xml import, import xml, csv importer
|
7 |
|
8 |
WP All Import is an extremely powerful importer that makes it easy to import any XML or CSV file to WordPress.
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 3.2.4 =
|
107 |
+
* critical security fix - stopping non-logged in users from accessing adminInit http://www.wpallimport.com/2015/02/wp-import-4-1-1-mandatory-security-update/
|
108 |
+
* added new option 'Search for existing attachments to prevent duplicates in media library'
|
109 |
+
* added new filter 'wp_all_import_is_post_to_update' to skip needed posts
|
110 |
+
* fixed imports pagination
|
111 |
+
* fixed preview taxonomies
|
112 |
+
* fixed upload folder creation when 'upload_dir' filter defined
|
113 |
+
* fixed db schema for wpmu when new site added
|
114 |
+
|
115 |
= 3.2.3 =
|
116 |
* fixed re-count record when a file has been changed at an import setting screen
|
117 |
* fixed unlink attachment source when posts updated/deleted
|
static/css/admin.css
CHANGED
@@ -423,7 +423,8 @@
|
|
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;
|
@@ -495,12 +496,18 @@
|
|
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: #
|
503 |
-
border: 1px solid #
|
|
|
504 |
}
|
505 |
.wpallimport-plugin .pmxi_stars{
|
506 |
display: inline-block;
|
@@ -521,7 +528,7 @@
|
|
521 |
border-width: 1px;
|
522 |
}
|
523 |
.wpallimport-plugin .upgrade_link{
|
524 |
-
color: #
|
525 |
font-size: 1.3em;
|
526 |
text-decoration: underline !important;
|
527 |
}
|
@@ -864,7 +871,8 @@
|
|
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;
|
423 |
height: 16px;
|
424 |
margin: 0px 3px;
|
425 |
}
|
426 |
+
.wpallimport-plugin .add-new-ico,
|
427 |
+
.wpallimport-plugin .add-new-cat,
|
428 |
.wpallimport-plugin .add-new-custom,
|
429 |
.wpallimport-plugin .add-new-key{
|
430 |
background: url("../img/ui_4.0/add.png") no-repeat 0px 5px;
|
496 |
.wpallimport-plugin .tipsy{
|
497 |
font-size: 14px !important;
|
498 |
}
|
499 |
+
.wpallimport-plugin .assign_term{
|
500 |
+
left: -20px;
|
501 |
+
position: absolute;
|
502 |
+
top: 15px;
|
503 |
+
}
|
504 |
.wpallimport-plugin .wpallimport-free-edition-notice{
|
505 |
display: block;
|
506 |
margin-top: 40px;
|
507 |
padding: 20px;
|
508 |
+
background-color: #FFB8B8;
|
509 |
+
border: 1px solid #FF8383;
|
510 |
+
color: #000;
|
511 |
}
|
512 |
.wpallimport-plugin .pmxi_stars{
|
513 |
display: inline-block;
|
528 |
border-width: 1px;
|
529 |
}
|
530 |
.wpallimport-plugin .upgrade_link{
|
531 |
+
color: #000 !important;
|
532 |
font-size: 1.3em;
|
533 |
text-decoration: underline !important;
|
534 |
}
|
871 |
margin-left: 0;
|
872 |
}
|
873 |
.wpallimport-plugin table.form-table tr.template,
|
874 |
+
.wpallimport-plugin table.form-table ol li.template,
|
875 |
+
.wpallimport-plugin table.form-table ul li.template,
|
876 |
.wpallimport-plugin table.cf-form-table tr.template,
|
877 |
.wpallimport-plugin table.tax-form-table tr.template {
|
878 |
display: none;
|
static/js/admin.js
CHANGED
@@ -2,6 +2,7 @@
|
|
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
|
@@ -516,7 +517,7 @@
|
|
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();
|
@@ -534,7 +535,7 @@
|
|
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();
|
@@ -579,7 +580,8 @@
|
|
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 |
|
@@ -703,6 +705,7 @@
|
|
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 |
};
|
@@ -804,7 +807,8 @@
|
|
804 |
});
|
805 |
|
806 |
var request = {
|
807 |
-
action:'test_images',
|
|
|
808 |
download: ths.attr('rel'),
|
809 |
imgs:imgs
|
810 |
};
|
@@ -833,140 +837,7 @@
|
|
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;
|
@@ -1068,7 +939,7 @@
|
|
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);
|
@@ -1240,7 +1111,7 @@
|
|
1240 |
else
|
1241 |
filter += node.replace(/->/g, '/');
|
1242 |
|
1243 |
-
if (is_attr) filter += '
|
1244 |
|
1245 |
switch (condition){
|
1246 |
case 'equals':
|
@@ -1268,16 +1139,16 @@
|
|
1268 |
filter += '[not(contains(.,"%s"))]';
|
1269 |
break;
|
1270 |
case 'is_empty':
|
1271 |
-
filter += '[not(
|
1272 |
break;
|
1273 |
case 'is_not_empty':
|
1274 |
-
filter += '[
|
1275 |
break;
|
1276 |
}
|
1277 |
|
1278 |
filter = filter.replace('%s', value);
|
1279 |
|
1280 |
-
if (is_attr) filter += ']';
|
1281 |
|
1282 |
if (clause) filter += ' ' + clause + ' ';
|
1283 |
|
@@ -1345,7 +1216,7 @@
|
|
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();
|
@@ -1361,7 +1232,7 @@
|
|
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();
|
@@ -1399,7 +1270,7 @@
|
|
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),
|
@@ -1463,6 +1334,10 @@
|
|
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 |
|
@@ -1485,6 +1360,15 @@
|
|
1485 |
|
1486 |
});
|
1487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1488 |
$('ol.sortable').each(function(){
|
1489 |
if ( ! $(this).children('li').not('.template').length ) $(this).next('.add-new-ico').click();
|
1490 |
});
|
@@ -1630,7 +1514,7 @@
|
|
1630 |
|
1631 |
wplupload = $('#select-files').wplupload({
|
1632 |
runtimes : 'gears,browserplus,html5,flash,silverlight,html4',
|
1633 |
-
url : 'admin.php?page=pmxi-admin-settings&action=upload',
|
1634 |
container: 'plupload-ui',
|
1635 |
browse_button : 'select-files',
|
1636 |
file_data_name : 'async-upload',
|
2 |
* plugin admin area javascript
|
3 |
*/
|
4 |
(function($){$(function () {
|
5 |
+
|
6 |
if ( ! $('body.wpallimport-plugin').length) return; // do not execute any code if we are not on plugin page
|
7 |
|
8 |
// fix wpallimport-layout position
|
517 |
tagno += '#prev' == $(this).attr('href') ? -1 : 1;
|
518 |
$tag.addClass('loading').css('opacity', 0.7);
|
519 |
$preview.addClass('loading').css('opacity', 0.7);
|
520 |
+
$.post($tagURL, {tagno: tagno, import_action: import_action, security: wp_all_import_security}, function (data) {
|
521 |
var $indicator = $('<span />').insertBefore($tag);
|
522 |
$tag.replaceWith(data.html);
|
523 |
fix_tag_position();
|
535 |
$preview.find('input[name="tagno"]').unbind('click').die('click').live('change', function () {
|
536 |
tagno = (parseInt($(this).val()) > parseInt($preview.find('.pmxi_count').html())) ? $preview.find('.pmxi_count').html() : ( (parseInt($(this).val())) ? $(this).val() : 1 );
|
537 |
$tag.addClass('loading').css('opacity', 0.7);
|
538 |
+
$.post($tagURL, {tagno: tagno, security: wp_all_import_security}, function (data) {
|
539 |
var $indicator = $('<span />').insertBefore($tag);
|
540 |
$tag.replaceWith(data.html);
|
541 |
fix_tag_position();
|
580 |
var request = {
|
581 |
action:'auto_detect_cf',
|
582 |
fields: $('#existing_meta_keys').val().split(','),
|
583 |
+
post_type: $('input[name=custom_type]').val(),
|
584 |
+
security: wp_all_import_security
|
585 |
};
|
586 |
$(this).attr({'disabled':'disabled'});
|
587 |
|
705 |
if ($cf_name != ''){
|
706 |
var request = {
|
707 |
action:'auto_detect_sf',
|
708 |
+
security: wp_all_import_security,
|
709 |
post_type: $('input[name=custom_type]').val(),
|
710 |
name: $cf_name
|
711 |
};
|
807 |
});
|
808 |
|
809 |
var request = {
|
810 |
+
action:'test_images',
|
811 |
+
security: wp_all_import_security,
|
812 |
download: ths.attr('rel'),
|
813 |
imgs:imgs
|
814 |
};
|
837 |
dataType: "json"
|
838 |
});
|
839 |
|
840 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
841 |
|
842 |
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
|
843 |
var is_safari = navigator.userAgent.indexOf("Safari") > -1;
|
939 |
go_to_template = false;
|
940 |
$submit.hide();
|
941 |
var evaluate = function(){
|
942 |
+
$.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(), security: wp_all_import_security}, function (response) {
|
943 |
if (response.result){
|
944 |
$('.wpallimport-elements-preloader').hide();
|
945 |
$('.ajax-console').html(response.html);
|
1111 |
else
|
1112 |
filter += node.replace(/->/g, '/');
|
1113 |
|
1114 |
+
if (is_attr) filter += '@' + attr_name;
|
1115 |
|
1116 |
switch (condition){
|
1117 |
case 'equals':
|
1139 |
filter += '[not(contains(.,"%s"))]';
|
1140 |
break;
|
1141 |
case 'is_empty':
|
1142 |
+
filter += '[not(string())]';
|
1143 |
break;
|
1144 |
case 'is_not_empty':
|
1145 |
+
filter += '[string()]';
|
1146 |
break;
|
1147 |
}
|
1148 |
|
1149 |
filter = filter.replace('%s', value);
|
1150 |
|
1151 |
+
//if (is_attr) filter += ']';
|
1152 |
|
1153 |
if (clause) filter += ' ' + clause + ' ';
|
1154 |
|
1216 |
$tag.find('.navigation a').live('click', function () {
|
1217 |
tagno += '#prev' == $(this).attr('href') ? -1 : 1;
|
1218 |
$tag.addClass('loading').css('opacity', 0.7);
|
1219 |
+
$.post($tagURL, {tagno: tagno, import_action: import_action, security: wp_all_import_security}, function (data) {
|
1220 |
var $indicator = $('<span />').insertBefore($tag);
|
1221 |
$tag.replaceWith(data.html);
|
1222 |
fix_tag_position();
|
1232 |
tagno = (parseInt($(this).val()) > parseInt($tag.find('.pmxi_count').html())) ? $tag.find('.pmxi_count').html() : ( (parseInt($(this).val())) ? $(this).val() : 1 );
|
1233 |
$(this).val(tagno);
|
1234 |
$tag.addClass('loading').css('opacity', 0.7);
|
1235 |
+
$.post($tagURL, {tagno: tagno, import_action: import_action, security: wp_all_import_security}, function (data) {
|
1236 |
var $indicator = $('<span />').insertBefore($tag);
|
1237 |
$tag.replaceWith(data.html);
|
1238 |
fix_tag_position();
|
1270 |
|
1271 |
if ($key != "" && $custom_name.attr('rel') != "done"){
|
1272 |
$ths.addClass('loading');
|
1273 |
+
$.post('admin.php?page=pmxi-admin-settings&action=meta_values', {key: $key, security: wp_all_import_security}, function (data) {
|
1274 |
if (data.meta_values.length){
|
1275 |
$ths.autocomplete({
|
1276 |
source: eval(data.meta_values),
|
1334 |
if (parent_td.find('input:first').val() == '') parent_td.find('.hierarhy-output').val('');
|
1335 |
});
|
1336 |
|
1337 |
+
$('.tax_hierarchical_logic').find('.remove-ico').live('click', function(){
|
1338 |
+
$(this).parents('li:first').remove();
|
1339 |
+
});
|
1340 |
+
|
1341 |
$('.add-new-ico').live('click', function(){
|
1342 |
var count = $(this).parents('tr:first').find('ol.sortable').find('li.dragging').length + 1;
|
1343 |
|
1360 |
|
1361 |
});
|
1362 |
|
1363 |
+
$('.add-new-cat').click(function(){
|
1364 |
+
var $template = $(this).parents('td:first').find('ul.tax_hierarchical_logic').children('li.template');
|
1365 |
+
var $number = $(this).parents('td:first').find('ul.tax_hierarchical_logic').children('li').length - 1;
|
1366 |
+
var $cloneName = $template.find('input.assign_term').attr('name').replace('NUMBER', $number);
|
1367 |
+
$clone = $template.clone(true);
|
1368 |
+
$clone.find('input[name^=tax_hierarchical_assing]').attr('name', $cloneName);
|
1369 |
+
$clone.insertBefore($template).css('display', 'none').removeClass('template').fadeIn().find('input.switcher').change();
|
1370 |
+
});
|
1371 |
+
|
1372 |
$('ol.sortable').each(function(){
|
1373 |
if ( ! $(this).children('li').not('.template').length ) $(this).next('.add-new-ico').click();
|
1374 |
});
|
1514 |
|
1515 |
wplupload = $('#select-files').wplupload({
|
1516 |
runtimes : 'gears,browserplus,html5,flash,silverlight,html4',
|
1517 |
+
url : 'admin.php?page=pmxi-admin-settings&action=upload&_wpnonce=' + wp_all_import_security,
|
1518 |
container: 'plupload-ui',
|
1519 |
browse_button : 'select-files',
|
1520 |
file_data_name : 'async-upload',
|
static/js/{pmxi.js → wp-all-import.js}
RENAMED
File without changes
|
views/admin/addons/index.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<div class="wrap" style="max-width:970px;">
|
2 |
|
3 |
-
<h2><?php _e('WP All Import Add-ons', '
|
4 |
|
5 |
<div id="pmxi-add-ons" class="clear">
|
6 |
|
7 |
<div class="pmxi-add-on-group clear">
|
8 |
-
<h3><?php _e('Premium Add-ons', '
|
9 |
<?php foreach( $premium as $addon ): ?>
|
10 |
<div class="pmxi-add-on wp-box <?php if( $addon['active'] ): ?>pmxi-add-on-active<?php endif; ?>">
|
11 |
<a target="_blank" href="<?php echo $addon['url']; ?>">
|
@@ -26,7 +26,7 @@
|
|
26 |
foreach ($addon['required_plugins'] as $name => $active):
|
27 |
if (!$active){
|
28 |
?>
|
29 |
-
<p style="margin:3px 0px;"><?php echo $name . __(' required', '
|
30 |
<?php
|
31 |
$all_required_plugins_installed = false;
|
32 |
}
|
@@ -46,7 +46,7 @@
|
|
46 |
</div>
|
47 |
|
48 |
<div class="pmxi-add-on-group clear">
|
49 |
-
<h3><?php _e('Free Add-ons', '
|
50 |
<?php foreach( $free as $addon ): ?>
|
51 |
<div class="pmxi-add-on wp-box <?php if( $addon['active'] ): ?>pmxi-add-on-active<?php endif; ?>">
|
52 |
<a target="_blank" href="<?php echo $addon['url']; ?>">
|
@@ -67,7 +67,7 @@
|
|
67 |
foreach ($addon['required_plugins'] as $name => $active):
|
68 |
if (!$active){
|
69 |
?>
|
70 |
-
<p style="margin:3px 0px;"><?php echo $name . __(' required', '
|
71 |
<?php
|
72 |
$all_required_plugins_installed = false;
|
73 |
}
|
1 |
<div class="wrap" style="max-width:970px;">
|
2 |
|
3 |
+
<h2><?php _e('WP All Import Add-ons', 'wp_all_import_plugin') ?></h2>
|
4 |
|
5 |
<div id="pmxi-add-ons" class="clear">
|
6 |
|
7 |
<div class="pmxi-add-on-group clear">
|
8 |
+
<h3><?php _e('Premium Add-ons', 'wp_all_import_plugin'); ?></h3>
|
9 |
<?php foreach( $premium as $addon ): ?>
|
10 |
<div class="pmxi-add-on wp-box <?php if( $addon['active'] ): ?>pmxi-add-on-active<?php endif; ?>">
|
11 |
<a target="_blank" href="<?php echo $addon['url']; ?>">
|
26 |
foreach ($addon['required_plugins'] as $name => $active):
|
27 |
if (!$active){
|
28 |
?>
|
29 |
+
<p style="margin:3px 0px;"><?php echo $name . __(' required', 'wp_all_import_plugin'); ?></p>
|
30 |
<?php
|
31 |
$all_required_plugins_installed = false;
|
32 |
}
|
46 |
</div>
|
47 |
|
48 |
<div class="pmxi-add-on-group clear">
|
49 |
+
<h3><?php _e('Free Add-ons', 'wp_all_import_plugin'); ?></h3>
|
50 |
<?php foreach( $free as $addon ): ?>
|
51 |
<div class="pmxi-add-on wp-box <?php if( $addon['active'] ): ?>pmxi-add-on-active<?php endif; ?>">
|
52 |
<a target="_blank" href="<?php echo $addon['url']; ?>">
|
67 |
foreach ($addon['required_plugins'] as $name => $active):
|
68 |
if (!$active){
|
69 |
?>
|
70 |
+
<p style="margin:3px 0px;"><?php echo $name . __(' required', 'wp_all_import_plugin'); ?></p>
|
71 |
<?php
|
72 |
$all_required_plugins_installed = false;
|
73 |
}
|
views/admin/help/index.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<h2><?php _e('WP All Import Support', '
|
2 |
|
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', '
|
9 |
</p>
|
10 |
|
11 |
-
<p style="font-size: 1.3em;"><?php _e('Thanks for installing the free version of WP All Import.', '
|
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.', '
|
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.', '
|
16 |
|
17 |
</td>
|
18 |
<td class="right"> </td>
|
1 |
+
<h2><?php _e('WP All Import Support', 'wp_all_import_plugin') ?></h2>
|
2 |
|
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', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_plugin'); ?></a></p>
|
16 |
|
17 |
</td>
|
18 |
<td class="right"> </td>
|
views/admin/history/index.php
CHANGED
@@ -7,14 +7,14 @@
|
|
7 |
if ( ! empty($path_parts['dirname'])){
|
8 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
9 |
$dirname = array_pop($path_all_parts);
|
10 |
-
if (
|
11 |
$path = str_replace($dirname . '/', '', str_replace('temp/','',$import->path));
|
12 |
}
|
13 |
}
|
14 |
?>
|
15 |
-
<em><?php printf(__('%s - Import History', '
|
16 |
<?php else:?>
|
17 |
-
<em><?php printf(__('%s - Import History', '
|
18 |
<?php endif; ?>
|
19 |
<?php endif ?>
|
20 |
</h2>
|
@@ -26,17 +26,17 @@
|
|
26 |
<?php
|
27 |
// define the columns to display, the syntax is 'internal name' => 'display name'
|
28 |
$columns = array(
|
29 |
-
'id' => __('ID', '
|
30 |
-
'date' => __('Date', '
|
31 |
-
'time_run' => __('Run Time', '
|
32 |
-
'type' => __('Type', '
|
33 |
-
'summary' => __('Summary', '
|
34 |
'download' => '',
|
35 |
);
|
36 |
?>
|
37 |
|
38 |
<?php if ( $import->triggered ): ?>
|
39 |
-
<p> <strong><?php _e('Scheduling Status', '
|
40 |
<?php endif; ?>
|
41 |
|
42 |
<form method="post" id="import-list" action="<?php echo remove_query_arg('pmxi_nt') ?>">
|
@@ -46,16 +46,16 @@ $columns = array(
|
|
46 |
<div class="tablenav">
|
47 |
<div class="alignleft actions">
|
48 |
<select name="bulk-action">
|
49 |
-
<option value="" selected="selected"><?php _e('Bulk Actions', '
|
50 |
-
<option value="delete"><?php _e('Delete', '
|
51 |
</select>
|
52 |
-
<input type="submit" value="<?php esc_attr_e('Apply', '
|
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', '
|
59 |
number_format_i18n(($pagenum - 1) * $perPage + 1),
|
60 |
number_format_i18n(min($pagenum * $perPage, $list->total())),
|
61 |
number_format_i18n($list->total()),
|
@@ -102,7 +102,7 @@ $columns = array(
|
|
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.', '
|
106 |
</tr>
|
107 |
<?php else: ?>
|
108 |
<?php
|
@@ -130,7 +130,7 @@ $columns = array(
|
|
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', '
|
134 |
<?php endif ?>
|
135 |
</td>
|
136 |
<?php
|
@@ -155,16 +155,16 @@ $columns = array(
|
|
155 |
<?php
|
156 |
switch ($item['type']) {
|
157 |
case 'manual':
|
158 |
-
_e('manual run', '
|
159 |
break;
|
160 |
case 'continue':
|
161 |
-
_e('continue run', '
|
162 |
break;
|
163 |
case 'processing':
|
164 |
-
_e('cron processing', '
|
165 |
break;
|
166 |
case 'trigger':
|
167 |
-
_e('triggered by cron', '
|
168 |
break;
|
169 |
default:
|
170 |
# code...
|
@@ -180,15 +180,15 @@ $columns = array(
|
|
180 |
<?php
|
181 |
if ( ! in_array($item['type'], array('trigger'))){
|
182 |
$wp_uploads = wp_upload_dir();
|
183 |
-
$log_file =
|
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', '
|
188 |
<?php
|
189 |
}
|
190 |
else {
|
191 |
-
_e('Log Unavailable', '
|
192 |
}
|
193 |
}
|
194 |
else {
|
@@ -221,17 +221,17 @@ $columns = array(
|
|
221 |
|
222 |
<div class="alignleft actions">
|
223 |
<select name="bulk-action2">
|
224 |
-
<option value="" selected="selected"><?php _e('Bulk Actions', '
|
225 |
<?php if ( empty($type) or 'trash' != $type): ?>
|
226 |
-
<option value="delete"><?php _e('Delete', '
|
227 |
<?php else: ?>
|
228 |
-
<option value="restore"><?php _e('Restore', '
|
229 |
-
<option value="delete"><?php _e('Delete Permanently', '
|
230 |
<?php endif ?>
|
231 |
</select>
|
232 |
-
<input type="submit" value="<?php esc_attr_e('Apply', '
|
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', '
|
237 |
</form>
|
7 |
if ( ! empty($path_parts['dirname'])){
|
8 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
9 |
$dirname = array_pop($path_all_parts);
|
10 |
+
if ( wp_all_import_isValidMd5($dirname)){
|
11 |
$path = str_replace($dirname . '/', '', str_replace('temp/','',$import->path));
|
12 |
}
|
13 |
}
|
14 |
?>
|
15 |
+
<em><?php printf(__('%s - Import History', 'wp_all_import_plugin'), str_replace("\\", '/', preg_replace('%^(\w+://[^:]+:)[^@]+@%', '$1*****@', $path))); ?></em>
|
16 |
<?php else:?>
|
17 |
+
<em><?php printf(__('%s - Import History', 'wp_all_import_plugin'), str_replace("\\", '/', preg_replace('%^(\w+://[^:]+:)[^@]+@%', '$1*****@', $import->path))); ?></em>
|
18 |
<?php endif; ?>
|
19 |
<?php endif ?>
|
20 |
</h2>
|
26 |
<?php
|
27 |
// define the columns to display, the syntax is 'internal name' => 'display name'
|
28 |
$columns = array(
|
29 |
+
'id' => __('ID', 'wp_all_import_plugin'),
|
30 |
+
'date' => __('Date', 'wp_all_import_plugin'),
|
31 |
+
'time_run' => __('Run Time', 'wp_all_import_plugin'),
|
32 |
+
'type' => __('Type', 'wp_all_import_plugin'),
|
33 |
+
'summary' => __('Summary', 'wp_all_import_plugin'),
|
34 |
'download' => '',
|
35 |
);
|
36 |
?>
|
37 |
|
38 |
<?php if ( $import->triggered ): ?>
|
39 |
+
<p> <strong><?php _e('Scheduling Status', 'wp_all_import_plugin'); ?>:</strong> <?php _e('triggered'); ?> <?php if ($import->processing) _e('and processing', 'wp_all_import_plugin'); ?>...</p>
|
40 |
<?php endif; ?>
|
41 |
|
42 |
<form method="post" id="import-list" action="<?php echo remove_query_arg('pmxi_nt') ?>">
|
46 |
<div class="tablenav">
|
47 |
<div class="alignleft actions">
|
48 |
<select name="bulk-action">
|
49 |
+
<option value="" selected="selected"><?php _e('Bulk Actions', 'wp_all_import_plugin') ?></option>
|
50 |
+
<option value="delete"><?php _e('Delete', 'wp_all_import_plugin') ?></option>
|
51 |
</select>
|
52 |
+
<input type="submit" value="<?php esc_attr_e('Apply', 'wp_all_import_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', 'wp_all_import_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()),
|
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.', 'wp_all_import_plugin') ?></td>
|
106 |
</tr>
|
107 |
<?php else: ?>
|
108 |
<?php
|
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', 'wp_all_import_plugin'), $item['date']) ?>
|
134 |
<?php endif ?>
|
135 |
</td>
|
136 |
<?php
|
155 |
<?php
|
156 |
switch ($item['type']) {
|
157 |
case 'manual':
|
158 |
+
_e('manual run', 'wp_all_import_plugin');
|
159 |
break;
|
160 |
case 'continue':
|
161 |
+
_e('continue run', 'wp_all_import_plugin');
|
162 |
break;
|
163 |
case 'processing':
|
164 |
+
_e('cron processing', 'wp_all_import_plugin');
|
165 |
break;
|
166 |
case 'trigger':
|
167 |
+
_e('triggered by cron', 'wp_all_import_plugin');
|
168 |
break;
|
169 |
default:
|
170 |
# code...
|
180 |
<?php
|
181 |
if ( ! in_array($item['type'], array('trigger'))){
|
182 |
$wp_uploads = wp_upload_dir();
|
183 |
+
$log_file = wp_all_import_secure_file( $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $item['id'] ) . DIRECTORY_SEPARATOR . $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'], '_wpnonce' => wp_create_nonce( '_wpnonce-download_log' )), $this->baseUrl); ?>"><?php _e('Download Log', 'wp_all_import_plugin'); ?></a>
|
188 |
<?php
|
189 |
}
|
190 |
else {
|
191 |
+
_e('Log Unavailable', 'wp_all_import_plugin');
|
192 |
}
|
193 |
}
|
194 |
else {
|
221 |
|
222 |
<div class="alignleft actions">
|
223 |
<select name="bulk-action2">
|
224 |
+
<option value="" selected="selected"><?php _e('Bulk Actions', 'wp_all_import_plugin') ?></option>
|
225 |
<?php if ( empty($type) or 'trash' != $type): ?>
|
226 |
+
<option value="delete"><?php _e('Delete', 'wp_all_import_plugin') ?></option>
|
227 |
<?php else: ?>
|
228 |
+
<option value="restore"><?php _e('Restore', 'wp_all_import_plugin')?></option>
|
229 |
+
<option value="delete"><?php _e('Delete Permanently', 'wp_all_import_plugin')?></option>
|
230 |
<?php endif ?>
|
231 |
</select>
|
232 |
+
<input type="submit" value="<?php esc_attr_e('Apply', 'wp_all_import_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', 'wp_all_import_plugin'); ?> <span></span></a>
|
237 |
</form>
|
views/admin/home/index.php
CHANGED
File without changes
|
views/admin/import/confirm.php
CHANGED
@@ -8,11 +8,11 @@
|
|
8 |
<div class="wpallimport-header">
|
9 |
<div class="wpallimport-logo"></div>
|
10 |
<div class="wpallimport-title">
|
11 |
-
<p><?php _e('WP All Import', '
|
12 |
-
<h2><?php _e('Import XML / CSV', '
|
13 |
</div>
|
14 |
<div class="wpallimport-links">
|
15 |
-
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', '
|
16 |
</div>
|
17 |
</div>
|
18 |
<div class="clear"></div>
|
@@ -33,15 +33,15 @@
|
|
33 |
<div class="wpallimport-ready-to-go">
|
34 |
|
35 |
<?php if ($is_new_import):?>
|
36 |
-
<h3><?php _e('Your file is all set up!', '
|
37 |
<?php else: ?>
|
38 |
-
<h3><?php _e('This import did not finish successfuly last time it was run.', '
|
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.', '
|
43 |
<?php else: ?>
|
44 |
-
<h4><?php _e('You can attempt to continue where it left off.', '
|
45 |
<?php endif; ?>
|
46 |
|
47 |
</div>
|
@@ -49,7 +49,7 @@
|
|
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', '
|
53 |
</form>
|
54 |
<?php else: ?>
|
55 |
<form class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post" style="float: right;">
|
@@ -59,16 +59,16 @@
|
|
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', '
|
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', '
|
67 |
</div>
|
68 |
</div>
|
69 |
-
<input type="submit" class="rad10" value="<?php _e('Continue Import', '
|
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', '
|
72 |
</div-->
|
73 |
</form>
|
74 |
<?php endif; ?>
|
@@ -87,13 +87,13 @@
|
|
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', '
|
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', '
|
97 |
<?php endif;?>
|
98 |
|
99 |
<!-- General -->
|
@@ -105,24 +105,24 @@
|
|
105 |
if ( ! empty($path_parts['dirname'])){
|
106 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
107 |
$dirname = array_pop($path_all_parts);
|
108 |
-
if (
|
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>', '
|
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>', '
|
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', '
|
120 |
-
<?php }
|
121 |
-
<p><?php printf(__('WP All Import will process all %s <span style="color:#46ba69; font-weight:bold;"><%s></span> records in your file', '
|
122 |
<?php } ?>
|
123 |
|
124 |
<?php if ( $post['is_import_specified']): ?>
|
125 |
-
<p><?php printf(__('WP All Import will process only specified records: %s', '
|
126 |
<?php endif;?>
|
127 |
|
128 |
<!-- Record Matching -->
|
@@ -130,22 +130,22 @@
|
|
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>', '
|
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.', '
|
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.', '
|
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.', '
|
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.', '
|
149 |
<?php endif; ?>
|
150 |
|
151 |
<?php endif; ?>
|
@@ -158,56 +158,56 @@
|
|
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', '
|
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.', '
|
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>', '
|
168 |
<ul style="padding-left: 35px;">
|
169 |
<?php if ( $post['is_update_status']): ?>
|
170 |
-
<li> <?php _e('status', '
|
171 |
<?php endif; ?>
|
172 |
<?php if ( $post['is_update_title']): ?>
|
173 |
-
<li> <?php _e('title', '
|
174 |
<?php endif; ?>
|
175 |
<?php if ( $post['is_update_slug']): ?>
|
176 |
-
<li> <?php _e('slug', '
|
177 |
<?php endif; ?>
|
178 |
<?php if ( $post['is_update_content']): ?>
|
179 |
-
<li> <?php _e('content', '
|
180 |
<?php endif; ?>
|
181 |
<?php if ( $post['is_update_excerpt']): ?>
|
182 |
-
<li> <?php _e('excerpt', '
|
183 |
<?php endif; ?>
|
184 |
<?php if ( $post['is_update_dates']): ?>
|
185 |
-
<li> <?php _e('dates', '
|
186 |
<?php endif; ?>
|
187 |
<?php if ( $post['is_update_menu_order']): ?>
|
188 |
-
<li> <?php _e('menu order', '
|
189 |
<?php endif; ?>
|
190 |
<?php if ( $post['is_update_parent']): ?>
|
191 |
-
<li> <?php _e('parent post', '
|
192 |
<?php endif; ?>
|
193 |
<?php if ( $post['is_update_attachments']): ?>
|
194 |
-
<li> <?php _e('attachments', '
|
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', '
|
202 |
break;
|
203 |
case 'mapped':
|
204 |
-
_e('only ACF presented in import options', '
|
205 |
break;
|
206 |
case 'only':
|
207 |
-
printf(__('only these ACF : %s', '
|
208 |
break;
|
209 |
case 'all_except':
|
210 |
-
printf(__('all ACF except these: %s', '
|
211 |
break;
|
212 |
} ?>
|
213 |
</li>
|
@@ -217,10 +217,10 @@
|
|
217 |
<?php
|
218 |
switch($post['update_images_logic']){
|
219 |
case 'full_update':
|
220 |
-
_e('old images will be updated with new', '
|
221 |
break;
|
222 |
case 'add_new':
|
223 |
-
_e('only new images will be added', '
|
224 |
break;
|
225 |
} ?>
|
226 |
</li>
|
@@ -230,13 +230,13 @@
|
|
230 |
<?php
|
231 |
switch($post['update_custom_fields_logic']){
|
232 |
case 'full_update':
|
233 |
-
_e('all custom fields', '
|
234 |
break;
|
235 |
case 'only':
|
236 |
-
printf(__('only these custom fields : %s', '
|
237 |
break;
|
238 |
case 'all_except':
|
239 |
-
printf(__('all cusom fields except these: %s', '
|
240 |
break;
|
241 |
} ?>
|
242 |
</li>
|
@@ -246,16 +246,16 @@
|
|
246 |
<?php
|
247 |
switch($post['update_categories_logic']){
|
248 |
case 'full_update':
|
249 |
-
_e('remove existing taxonomies, add new taxonomies', '
|
250 |
break;
|
251 |
case 'add_new':
|
252 |
-
_e('only add new', '
|
253 |
break;
|
254 |
case 'only':
|
255 |
-
printf(__('update only these taxonomies: %s , leave the rest alone', '
|
256 |
break;
|
257 |
case 'all_except':
|
258 |
-
printf(__('leave these taxonomies: %s alone, update all others', '
|
259 |
break;
|
260 |
} ?>
|
261 |
</li>
|
@@ -264,23 +264,23 @@
|
|
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.', '
|
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.', '
|
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.', '
|
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.', '
|
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.', '
|
284 |
<?php endif; ?>
|
285 |
|
286 |
</div>
|
@@ -296,17 +296,17 @@
|
|
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', '
|
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', '
|
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', '
|
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', '
|
311 |
|
312 |
</div>
|
8 |
<div class="wpallimport-header">
|
9 |
<div class="wpallimport-logo"></div>
|
10 |
<div class="wpallimport-title">
|
11 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
12 |
+
<h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
|
13 |
</div>
|
14 |
<div class="wpallimport-links">
|
15 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
|
16 |
</div>
|
17 |
</div>
|
18 |
<div class="clear"></div>
|
33 |
<div class="wpallimport-ready-to-go">
|
34 |
|
35 |
<?php if ($is_new_import):?>
|
36 |
+
<h3><?php _e('Your file is all set up!', 'wp_all_import_plugin'); ?></h3>
|
37 |
<?php else: ?>
|
38 |
+
<h3><?php _e('This import did not finish successfuly last time it was run.', 'wp_all_import_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.', 'wp_all_import_plugin'); ?></h4>
|
43 |
<?php else: ?>
|
44 |
+
<h4><?php _e('You can attempt to continue where it left off.', 'wp_all_import_plugin'); ?></h4>
|
45 |
<?php endif; ?>
|
46 |
|
47 |
</div>
|
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', 'wp_all_import_plugin') ?>" />
|
53 |
</form>
|
54 |
<?php else: ?>
|
55 |
<form class="confirm <?php echo ! $isWizard ? 'edit' : '' ?>" method="post" style="float: right;">
|
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', 'wp_all_import_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', 'wp_all_import_plugin'); ?></label>
|
67 |
</div>
|
68 |
</div>
|
69 |
+
<input type="submit" class="rad10" value="<?php _e('Continue Import', 'wp_all_import_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', 'wp_all_import_plugin'); ?></a>
|
72 |
</div-->
|
73 |
</form>
|
74 |
<?php endif; ?>
|
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', 'wp_all_import_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', 'wp_all_import_plugin'), $max_execution_time); ?></p>
|
97 |
<?php endif;?>
|
98 |
|
99 |
<!-- General -->
|
105 |
if ( ! empty($path_parts['dirname'])){
|
106 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
107 |
$dirname = array_pop($path_all_parts);
|
108 |
+
if ( wp_all_import_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>', 'wp_all_import_plugin'), $path, (isset($locfilePath)) ? human_filesize(filesize($locfilePath)) : __('undefined', 'wp_all_import_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>', 'wp_all_import_plugin'), $xpath); ?></p>
|
118 |
+
<?php } elseif ($post['delimiter'] and $isWizard ) { ?>
|
119 |
+
<p><?php printf(__('WP All Import will process <span style="color:#46ba69; font-weight:bold;">%s</span> rows in your file', 'wp_all_import_plugin'), $count); ?></p>
|
120 |
+
<?php } elseif ( $isWizard ) { ?>
|
121 |
+
<p><?php printf(__('WP All Import will process all %s <span style="color:#46ba69; font-weight:bold;"><%s></span> records in your file', 'wp_all_import_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', 'wp_all_import_plugin'), $post['import_specified']); ?></p>
|
126 |
<?php endif;?>
|
127 |
|
128 |
<!-- Record Matching -->
|
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>', 'wp_all_import_plugin'), $post['unique_key']); ?></p>
|
134 |
|
135 |
+
<?php if ( ! $isWizard and !empty($custom_type)): ?>
|
136 |
|
137 |
+
<p><?php printf(__('%ss previously imported by this import (ID: %s) with the same unique key will be updated.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $import->id); ?></p>
|
149 |
<?php endif; ?>
|
150 |
|
151 |
<?php endif; ?>
|
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', 'wp_all_import_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.', 'wp_all_import_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>', 'wp_all_import_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', 'wp_all_import_plugin'); ?></li>
|
171 |
<?php endif; ?>
|
172 |
<?php if ( $post['is_update_title']): ?>
|
173 |
+
<li> <?php _e('title', 'wp_all_import_plugin'); ?></li>
|
174 |
<?php endif; ?>
|
175 |
<?php if ( $post['is_update_slug']): ?>
|
176 |
+
<li> <?php _e('slug', 'wp_all_import_plugin'); ?></li>
|
177 |
<?php endif; ?>
|
178 |
<?php if ( $post['is_update_content']): ?>
|
179 |
+
<li> <?php _e('content', 'wp_all_import_plugin'); ?></li>
|
180 |
<?php endif; ?>
|
181 |
<?php if ( $post['is_update_excerpt']): ?>
|
182 |
+
<li> <?php _e('excerpt', 'wp_all_import_plugin'); ?></li>
|
183 |
<?php endif; ?>
|
184 |
<?php if ( $post['is_update_dates']): ?>
|
185 |
+
<li> <?php _e('dates', 'wp_all_import_plugin'); ?></li>
|
186 |
<?php endif; ?>
|
187 |
<?php if ( $post['is_update_menu_order']): ?>
|
188 |
+
<li> <?php _e('menu order', 'wp_all_import_plugin'); ?></li>
|
189 |
<?php endif; ?>
|
190 |
<?php if ( $post['is_update_parent']): ?>
|
191 |
+
<li> <?php _e('parent post', 'wp_all_import_plugin'); ?></li>
|
192 |
<?php endif; ?>
|
193 |
<?php if ( $post['is_update_attachments']): ?>
|
194 |
+
<li> <?php _e('attachments', 'wp_all_import_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', 'wp_all_import_plugin');
|
202 |
break;
|
203 |
case 'mapped':
|
204 |
+
_e('only ACF presented in import options', 'wp_all_import_plugin');
|
205 |
break;
|
206 |
case 'only':
|
207 |
+
printf(__('only these ACF : %s', 'wp_all_import_plugin'), $post['acf_only_list']);
|
208 |
break;
|
209 |
case 'all_except':
|
210 |
+
printf(__('all ACF except these: %s', 'wp_all_import_plugin'), $post['acf_except_list']);
|
211 |
break;
|
212 |
} ?>
|
213 |
</li>
|
217 |
<?php
|
218 |
switch($post['update_images_logic']){
|
219 |
case 'full_update':
|
220 |
+
_e('old images will be updated with new', 'wp_all_import_plugin');
|
221 |
break;
|
222 |
case 'add_new':
|
223 |
+
_e('only new images will be added', 'wp_all_import_plugin');
|
224 |
break;
|
225 |
} ?>
|
226 |
</li>
|
230 |
<?php
|
231 |
switch($post['update_custom_fields_logic']){
|
232 |
case 'full_update':
|
233 |
+
_e('all custom fields', 'wp_all_import_plugin');
|
234 |
break;
|
235 |
case 'only':
|
236 |
+
printf(__('only these custom fields : %s', 'wp_all_import_plugin'), $post['custom_fields_only_list']);
|
237 |
break;
|
238 |
case 'all_except':
|
239 |
+
printf(__('all cusom fields except these: %s', 'wp_all_import_plugin'), $post['custom_fields_except_list']);
|
240 |
break;
|
241 |
} ?>
|
242 |
</li>
|
246 |
<?php
|
247 |
switch($post['update_categories_logic']){
|
248 |
case 'full_update':
|
249 |
+
_e('remove existing taxonomies, add new taxonomies', 'wp_all_import_plugin');
|
250 |
break;
|
251 |
case 'add_new':
|
252 |
+
_e('only add new', 'wp_all_import_plugin');
|
253 |
break;
|
254 |
case 'only':
|
255 |
+
printf(__('update only these taxonomies: %s , leave the rest alone', 'wp_all_import_plugin'), $post['taxonomies_only_list']);
|
256 |
break;
|
257 |
case 'all_except':
|
258 |
+
printf(__('leave these taxonomies: %s alone, update all others', 'wp_all_import_plugin'), $post['taxonomies_except_list']);
|
259 |
break;
|
260 |
} ?>
|
261 |
</li>
|
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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_plugin'); ?></p>
|
284 |
<?php endif; ?>
|
285 |
|
286 |
</div>
|
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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_plugin'); ?> <span></span></a>
|
311 |
|
312 |
</div>
|
views/admin/import/element.php
CHANGED
@@ -5,11 +5,11 @@
|
|
5 |
<div class="wpallimport-header">
|
6 |
<div class="wpallimport-logo"></div>
|
7 |
<div class="wpallimport-title">
|
8 |
-
<p><?php _e('WP All Import', '
|
9 |
-
<h2><?php _e('Import XML / CSV', '
|
10 |
</div>
|
11 |
<div class="wpallimport-links">
|
12 |
-
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', '
|
13 |
</div>
|
14 |
</div>
|
15 |
<div class="clear"></div>
|
@@ -20,7 +20,7 @@
|
|
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', '
|
24 |
</div>
|
25 |
|
26 |
<div class="wpallimport-content-section wpallimport-elements-preloader">
|
@@ -33,7 +33,7 @@
|
|
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?', '
|
37 |
<?php
|
38 |
if ( ! empty($elements_cloud) and ! $is_csv ){
|
39 |
foreach ($elements_cloud as $tag => $count){
|
@@ -62,7 +62,7 @@
|
|
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>','
|
66 |
</span>
|
67 |
|
68 |
</td>
|
@@ -83,7 +83,7 @@
|
|
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', '
|
87 |
</div>
|
88 |
|
89 |
<?php else: ?>
|
@@ -117,45 +117,45 @@
|
|
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', '
|
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', '
|
128 |
-
<th><?php _e('Rule', '
|
129 |
-
<th><?php _e('Value', '
|
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', '
|
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', '
|
142 |
-
<option value="equals"><?php _e('equals', '
|
143 |
-
<option value="not_equals"><?php _e('not equals', '
|
144 |
-
<option value="greater"><?php _e('greater than', '
|
145 |
-
<option value="equals_or_greater"><?php _e('equals or greater than', '
|
146 |
-
<option value="less"><?php _e('less than', '
|
147 |
-
<option value="equals_or_less"><?php _e('equals or less than', '
|
148 |
-
<option value="contains"><?php _e('contains', '
|
149 |
-
<option value="not_contains"><?php _e('not contains', '
|
150 |
-
<option value="is_empty"><?php _e('is empty', '
|
151 |
-
<option value="is_not_empty"><?php _e('is not empty', '
|
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', '
|
159 |
</td>
|
160 |
</tr>
|
161 |
</table>
|
@@ -164,7 +164,7 @@
|
|
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','
|
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']; ?>"/>
|
@@ -176,20 +176,20 @@
|
|
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', '
|
180 |
-
<td style="width:20%;"><?php _e('Rule', '
|
181 |
-
<td style="width:20%;"><?php _e('Value', '
|
182 |
-
<td style="width:25%;"><?php _e('Condition', '
|
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.', '
|
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', '
|
193 |
</fieldset>
|
194 |
</div>
|
195 |
</div>
|
@@ -198,13 +198,13 @@
|
|
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','
|
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', '
|
206 |
</p>
|
207 |
|
208 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
209 |
|
210 |
</form>
|
5 |
<div class="wpallimport-header">
|
6 |
<div class="wpallimport-logo"></div>
|
7 |
<div class="wpallimport-title">
|
8 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
9 |
+
<h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
|
10 |
</div>
|
11 |
<div class="wpallimport-links">
|
12 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
|
13 |
</div>
|
14 |
</div>
|
15 |
<div class="clear"></div>
|
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', 'wp_all_import_plugin'); ?>" style="position:absolute; top:45px; right:10px;"/>
|
24 |
</div>
|
25 |
|
26 |
<div class="wpallimport-content-section wpallimport-elements-preloader">
|
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?', 'wp_all_import_plugin'); ?></h3>
|
37 |
<?php
|
38 |
if ( ! empty($elements_cloud) and ! $is_csv ){
|
39 |
foreach ($elements_cloud as $tag => $count){
|
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>','wp_all_import_plugin'), PMXI_Plugin::$session->count);?>
|
66 |
</span>
|
67 |
|
68 |
</td>
|
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', 'wp_all_import_plugin'); ?>"/>
|
87 |
</div>
|
88 |
|
89 |
<?php else: ?>
|
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', 'wp_all_import_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', 'wp_all_import_plugin'); ?></th>
|
128 |
+
<th><?php _e('Rule', 'wp_all_import_plugin'); ?></th>
|
129 |
+
<th><?php _e('Value', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_plugin'); ?></option>
|
142 |
+
<option value="equals"><?php _e('equals', 'wp_all_import_plugin'); ?></option>
|
143 |
+
<option value="not_equals"><?php _e('not equals', 'wp_all_import_plugin'); ?></option>
|
144 |
+
<option value="greater"><?php _e('greater than', 'wp_all_import_plugin');?></option>
|
145 |
+
<option value="equals_or_greater"><?php _e('equals or greater than', 'wp_all_import_plugin'); ?></option>
|
146 |
+
<option value="less"><?php _e('less than', 'wp_all_import_plugin'); ?></option>
|
147 |
+
<option value="equals_or_less"><?php _e('equals or less than', 'wp_all_import_plugin'); ?></option>
|
148 |
+
<option value="contains"><?php _e('contains', 'wp_all_import_plugin'); ?></option>
|
149 |
+
<option value="not_contains"><?php _e('not contains', 'wp_all_import_plugin'); ?></option>
|
150 |
+
<option value="is_empty"><?php _e('is empty', 'wp_all_import_plugin'); ?></option>
|
151 |
+
<option value="is_not_empty"><?php _e('is not empty', 'wp_all_import_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', 'wp_all_import_plugin');?></a>
|
159 |
</td>
|
160 |
</tr>
|
161 |
</table>
|
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','wp_all_import_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']; ?>"/>
|
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', 'wp_all_import_plugin'); ?></td>
|
180 |
+
<td style="width:20%;"><?php _e('Rule', 'wp_all_import_plugin'); ?></td>
|
181 |
+
<td style="width:20%;"><?php _e('Value', 'wp_all_import_plugin'); ?></td>
|
182 |
+
<td style="width:25%;"><?php _e('Condition', 'wp_all_import_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.', 'wp_all_import_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', 'wp_all_import_plugin');?></a>
|
193 |
</fieldset>
|
194 |
</div>
|
195 |
</div>
|
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','wp_all_import_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', 'wp_all_import_plugin'); ?>" />
|
206 |
</p>
|
207 |
|
208 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
209 |
|
210 |
</form>
|
views/admin/import/evaluate.php
CHANGED
@@ -1,12 +1,12 @@
|
|
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', '
|
4 |
<?php else:?>
|
5 |
-
<h3><?php printf(__('<span class="matches_count">%s</span> <strong>%s</strong> %s will be imported', '
|
6 |
<?php endif; ?>
|
7 |
-
<h4><?php _e('Click an element to select it, or scroll down to add filtering options.', '
|
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.', '
|
10 |
<?php endif ?>
|
11 |
</div>
|
12 |
<div id="current_xml">
|
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', 'wp_all_import_plugin'), $node_list_count, _n('row', 'rows', $node_list_count, 'wp_all_import_plugin')); ?></h3>
|
4 |
<?php else:?>
|
5 |
+
<h3><?php printf(__('<span class="matches_count">%s</span> <strong>%s</strong> %s will be imported', 'wp_all_import_plugin'), $node_list_count, PMXI_Plugin::$session->source['root_element'], _n('element', 'elements', $node_list_count, 'wp_all_import_plugin')); ?></h3>
|
6 |
<?php endif; ?>
|
7 |
+
<h4><?php _e('Click an element to select it, or scroll down to add filtering options.', 'wp_all_import_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.', 'wp_all_import_plugin') ?></p>
|
10 |
<?php endif ?>
|
11 |
</div>
|
12 |
<div id="current_xml">
|
views/admin/import/evaluate_variations.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php if (!empty($variation_list_count)):?>
|
2 |
<div class="updated">
|
3 |
-
<p><?php printf(__('Current selection matches <span class="matches_count">%s</span> %s.', '
|
4 |
<?php if (PMXI_Plugin::getInstance()->getOption('highlight_limit') and $variation_list_count > PMXI_Plugin::getInstance()->getOption('highlight_limit')): ?>
|
5 |
-
<p><?php _e('<strong>Note</strong>: Highlighting is turned off since can be very slow on large sets of elements.', '
|
6 |
<?php endif ?>
|
7 |
</div>
|
8 |
<div id="current_xml">
|
@@ -11,7 +11,7 @@
|
|
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>', '
|
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>
|
1 |
<?php if (!empty($variation_list_count)):?>
|
2 |
<div class="updated">
|
3 |
+
<p><?php printf(__('Current selection matches <span class="matches_count">%s</span> %s.', 'wp_all_import_plugin'), $variation_list_count, _n('element', 'elements', $variation_list_count, 'wp_all_import_plugin')) ?></p>
|
4 |
<?php if (PMXI_Plugin::getInstance()->getOption('highlight_limit') and $variation_list_count > PMXI_Plugin::getInstance()->getOption('highlight_limit')): ?>
|
5 |
+
<p><?php _e('<strong>Note</strong>: Highlighting is turned off since can be very slow on large sets of elements.', 'wp_all_import_plugin') ?></p>
|
6 |
<?php endif ?>
|
7 |
</div>
|
8 |
<div id="current_xml">
|
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>', 'wp_all_import_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>
|
views/admin/import/index.php
CHANGED
@@ -28,7 +28,7 @@ $l10n = array(
|
|
28 |
|
29 |
?>
|
30 |
<script type="text/javascript">
|
31 |
-
var plugin_url = '<?php echo
|
32 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
33 |
</script>
|
34 |
|
@@ -40,11 +40,11 @@ $l10n = array(
|
|
40 |
<div class="wpallimport-header">
|
41 |
<div class="wpallimport-logo"></div>
|
42 |
<div class="wpallimport-title">
|
43 |
-
<p><?php _e('WP All Import', '
|
44 |
-
<h2><?php _e('Import XML / CSV', '
|
45 |
</div>
|
46 |
<div class="wpallimport-links">
|
47 |
-
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', '
|
48 |
</div>
|
49 |
</div>
|
50 |
|
@@ -58,8 +58,8 @@ $l10n = array(
|
|
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>' , '
|
62 |
-
<p><span><?php _e( 'Last imported on ' . date("m-d-Y H:i:s", strtotime($reimported_import->registered_on)) , '
|
63 |
</div>
|
64 |
<?php
|
65 |
endif;
|
@@ -71,25 +71,23 @@ $l10n = array(
|
|
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', '
|
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', '
|
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', '
|
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', '
|
93 |
</a>
|
94 |
</div>
|
95 |
|
@@ -99,7 +97,7 @@ $l10n = array(
|
|
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...', '
|
103 |
<div id="progressbar" class="wpallimport-progressbar">
|
104 |
|
105 |
</div>
|
@@ -113,13 +111,13 @@ $l10n = array(
|
|
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', '
|
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.', '
|
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.', '
|
123 |
</div>
|
124 |
</div>
|
125 |
<input type="hidden" name="downloaded" value="<?php echo $post['downloaded']; ?>"/>
|
@@ -132,7 +130,7 @@ $l10n = array(
|
|
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', '
|
136 |
</a>
|
137 |
<span class="dd-pointer dd-pointer-down"></span>
|
138 |
</div>
|
@@ -141,9 +139,9 @@ $l10n = array(
|
|
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', '
|
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.', '
|
147 |
</div>
|
148 |
</div>
|
149 |
</div>
|
@@ -156,15 +154,15 @@ $l10n = array(
|
|
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...', '
|
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', '
|
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', '
|
168 |
<span class="wpallimport-import-to-arrow"></span>
|
169 |
</a>
|
170 |
</div>
|
@@ -186,12 +184,12 @@ $l10n = array(
|
|
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', '
|
190 |
-
<div class="wpallimport-existing-records"><?php _e('Import to existing', '
|
191 |
</div>
|
192 |
<div class="wpallimport-extra-text-right">
|
193 |
-
<div class="wpallimport-new-records"><?php _e('for each record in my data file.', '
|
194 |
-
<div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', '
|
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>
|
@@ -220,8 +218,8 @@ $l10n = array(
|
|
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.', '
|
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.', '
|
225 |
</div-->
|
226 |
</div>
|
227 |
</div>
|
@@ -233,12 +231,12 @@ $l10n = array(
|
|
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', '
|
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', '
|
242 |
</div>
|
243 |
</td>
|
244 |
</tr>
|
28 |
|
29 |
?>
|
30 |
<script type="text/javascript">
|
31 |
+
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
32 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
33 |
</script>
|
34 |
|
40 |
<div class="wpallimport-header">
|
41 |
<div class="wpallimport-logo"></div>
|
42 |
<div class="wpallimport-title">
|
43 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
44 |
+
<h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
|
45 |
</div>
|
46 |
<div class="wpallimport-links">
|
47 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
|
48 |
</div>
|
49 |
</div>
|
50 |
|
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>' , 'wp_all_import_plugin' );?></p>
|
62 |
+
<p><span><?php _e( 'Last imported on ' . date("m-d-Y H:i:s", strtotime($reimported_import->registered_on)) , 'wp_all_import_plugin' ); ?></span></p>
|
63 |
</div>
|
64 |
<?php
|
65 |
endif;
|
71 |
|
72 |
<div class="wpallimport-upload-resource-step-one">
|
73 |
|
74 |
+
<input type="hidden" name="is_submitted" value="1" />
|
|
|
|
|
75 |
|
76 |
<div class="clear"></div>
|
77 |
|
78 |
<div class="wpallimport-import-types">
|
79 |
+
<h2><?php _e('First, specify how you want to import your data', 'wp_all_import_plugin'); ?></h2>
|
80 |
<a class="wpallimport-import-from wpallimport-upload-type <?php echo ('upload' == $post['type'] and ! empty($_POST)) ? 'selected' : '' ?>" rel="upload_type" href="javascript:void(0);">
|
81 |
<span class="wpallimport-icon"></span>
|
82 |
+
<span class="wpallimport-icon-label"><?php _e('Upload a file', 'wp_all_import_plugin'); ?></span>
|
83 |
</a>
|
84 |
<a class="wpallimport-import-from wpallimport-url-type <?php echo 'url' == $post['type'] ? 'selected' : '' ?>" rel="url_type" href="javascript:void(0);">
|
85 |
<span class="wpallimport-icon"></span>
|
86 |
+
<span class="wpallimport-icon-label"><?php _e('Download from URL', 'wp_all_import_plugin'); ?></span>
|
87 |
</a>
|
88 |
<a class="wpallimport-import-from wpallimport-file-type <?php echo 'file' == $post['type'] ? 'selected' : '' ?>" rel="file_type" href="javascript:void(0);">
|
89 |
<span class="wpallimport-icon"></span>
|
90 |
+
<span class="wpallimport-icon-label"><?php _e('Use existing file', 'wp_all_import_plugin'); ?></span>
|
91 |
</a>
|
92 |
</div>
|
93 |
|
97 |
<div id="plupload-ui" class="wpallimport-file-type-options">
|
98 |
<div>
|
99 |
<input type="hidden" name="filepath" value="<?php echo $post['filepath'] ?>" id="filepath"/>
|
100 |
+
<a id="select-files" href="javascript:void(0);"/><?php _e('Click here to select file from your computer...', 'wp_all_import_plugin'); ?></a>
|
101 |
<div id="progressbar" class="wpallimport-progressbar">
|
102 |
|
103 |
</div>
|
111 |
<div class="wpallimport-file-type-options">
|
112 |
<span class="wpallimport-url-icon"></span>
|
113 |
<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..."/>
|
114 |
+
<a class="wpallimport-download-from-url rad4" href="javascript:void(0);"><?php _e('Download', 'wp_all_import_plugin'); ?></a>
|
115 |
<span class="img_preloader" style="top:0; left: 5px; visibility: hidden; display: inline;"></span>
|
116 |
</div>
|
117 |
<div class="wpallimport-note" style="margin: 20px auto 0; font-size: 13px;">
|
118 |
+
<?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.', 'wp_all_import_plugin'); ?>
|
119 |
<div class="wpallimport-free-edition-notice" style="display:none;">
|
120 |
+
<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.', 'wp_all_import_plugin');?></a>
|
121 |
</div>
|
122 |
</div>
|
123 |
<input type="hidden" name="downloaded" value="<?php echo $post['downloaded']; ?>"/>
|
130 |
<div class="dd-select" style="width: 600px; background: none repeat scroll 0% 0% rgb(238, 238, 238);">
|
131 |
<input type="hidden" class="dd-selected-value" value="">
|
132 |
<a class="dd-selected" style="color: rgb(207, 206, 202);">
|
133 |
+
<label class="dd-selected-text "><?php _e('Select a previously uploaded file', 'wp_all_import_plugin');?></label>
|
134 |
</a>
|
135 |
<span class="dd-pointer dd-pointer-down"></span>
|
136 |
</div>
|
139 |
<input type="hidden" name="file" value="<?php echo esc_attr($post['file']); ?>"/>
|
140 |
|
141 |
<div class="wpallimport-note" style="margin: 0 auto; font-size: 13px;">
|
142 |
+
<?php printf(__('Upload files to <strong>%s</strong> and they will appear in this list', 'wp_all_import_plugin'), $upload_dir['basedir'] . '/wpallimport/files') ?>
|
143 |
<div class="wpallimport-free-edition-notice">
|
144 |
+
<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.', 'wp_all_import_plugin');?></a>
|
145 |
</div>
|
146 |
</div>
|
147 |
</div>
|
154 |
|
155 |
<input type="hidden" name="wizard_type" value="<?php echo $post['wizard_type']; ?>"/>
|
156 |
|
157 |
+
<h2 style="margin-top:0;"><?php _e('Import data from this file into...', 'wp_all_import_plugin'); ?></h2>
|
158 |
|
159 |
<div class="wpallimport-choose-data-type">
|
160 |
<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);">
|
161 |
+
<span class="wpallimport-import-to-title"><?php _e('New Items', 'wp_all_import_plugin'); ?></span>
|
162 |
<span class="wpallimport-import-to-arrow"></span>
|
163 |
</a>
|
164 |
<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);">
|
165 |
+
<span class="wpallimport-import-to-title"><?php _e('Existing Items', 'wp_all_import_plugin'); ?></span>
|
166 |
<span class="wpallimport-import-to-arrow"></span>
|
167 |
</a>
|
168 |
</div>
|
184 |
?>
|
185 |
<div class="wpallimport-choose-import-direction">
|
186 |
<div class="wpallimport-extra-text-left">
|
187 |
+
<div class="wpallimport-new-records"><?php _e('Create new', 'wp_all_import_plugin'); ?></div>
|
188 |
+
<div class="wpallimport-existing-records"><?php _e('Import to existing', 'wp_all_import_plugin'); ?></div>
|
189 |
</div>
|
190 |
<div class="wpallimport-extra-text-right">
|
191 |
+
<div class="wpallimport-new-records"><?php _e('for each record in my data file.', 'wp_all_import_plugin'); ?></div>
|
192 |
+
<div class="wpallimport-existing-records"><?php _e('and update some or all of their data.', 'wp_all_import_plugin'); ?>
|
193 |
<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>
|
194 |
</div>
|
195 |
</div>
|
218 |
</div>
|
219 |
<div class="clear wpallimport-extra-text-below">
|
220 |
<!--div class="wpallimport-existing-records">
|
221 |
+
<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.', 'wp_all_import_plugin'); ?></p>
|
222 |
+
<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.', 'wp_all_import_plugin'); ?></p>
|
223 |
</div-->
|
224 |
</div>
|
225 |
</div>
|
231 |
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
232 |
<input type="hidden" name="is_submitted" value="1" />
|
233 |
<?php wp_nonce_field('choose-file', '_wpnonce_choose-file'); ?>
|
234 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Continue to Step 2', 'wp_all_import_plugin') ?>" id="advanced_upload"/>
|
235 |
</p>
|
236 |
|
237 |
<table><tr><td class="wpallimport-note"></td></tr></table>
|
238 |
</form>
|
239 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
240 |
</div>
|
241 |
</td>
|
242 |
</tr>
|
views/admin/import/options.php
CHANGED
@@ -15,11 +15,11 @@
|
|
15 |
<div class="wpallimport-header">
|
16 |
<div class="wpallimport-logo"></div>
|
17 |
<div class="wpallimport-title">
|
18 |
-
<p><?php _e('WP All Import', '
|
19 |
-
<h2><?php _e('Import XML / CSV', '
|
20 |
</div>
|
21 |
<div class="wpallimport-links">
|
22 |
-
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', '
|
23 |
</div>
|
24 |
</div>
|
25 |
<div class="clear"></div>
|
@@ -46,8 +46,8 @@
|
|
46 |
|
47 |
<?php $post_type = $post['custom_type']; ?>
|
48 |
|
49 |
-
<?php
|
50 |
-
|
51 |
<?php include( 'options/_import_file.php' ); ?>
|
52 |
|
53 |
<?php endif; ?>
|
@@ -66,7 +66,7 @@
|
|
66 |
|
67 |
</form>
|
68 |
|
69 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
70 |
|
71 |
</td>
|
72 |
<td class="right template-sidebar ">
|
15 |
<div class="wpallimport-header">
|
16 |
<div class="wpallimport-logo"></div>
|
17 |
<div class="wpallimport-title">
|
18 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
19 |
+
<h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
|
20 |
</div>
|
21 |
<div class="wpallimport-links">
|
22 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
|
23 |
</div>
|
24 |
</div>
|
25 |
<div class="clear"></div>
|
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; ?>
|
66 |
|
67 |
</form>
|
68 |
|
69 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
70 |
|
71 |
</td>
|
72 |
<td class="right template-sidebar ">
|
views/admin/import/options/_buttons_template.php
CHANGED
@@ -8,17 +8,17 @@
|
|
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', '
|
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', '
|
16 |
<?php endif ?>
|
17 |
|
18 |
-
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Continue', '
|
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', '
|
22 |
-
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Save Import Configuration', '
|
23 |
<?php endif ?>
|
24 |
</p>
|
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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_plugin') ?></a>
|
22 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e('Save Import Configuration', 'wp_all_import_plugin') ?>" />
|
23 |
<?php endif ?>
|
24 |
</p>
|
views/admin/import/options/_import_file.php
CHANGED
@@ -24,14 +24,14 @@ $l10n = array(
|
|
24 |
|
25 |
?>
|
26 |
<script type="text/javascript">
|
27 |
-
var plugin_url = '<?php echo
|
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','
|
35 |
</div>
|
36 |
<div class="wpallimport-collapsed-content" style="padding-bottom: 40px;">
|
37 |
<hr>
|
@@ -40,18 +40,18 @@ $l10n = array(
|
|
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.', '
|
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', '
|
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', '
|
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', '
|
55 |
</a>
|
56 |
</div>
|
57 |
|
@@ -61,9 +61,9 @@ $l10n = array(
|
|
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...', '
|
65 |
<div id="progressbar" class="wpallimport-progressbar">
|
66 |
-
<?php if ('upload' == $import->type) _e( '<span>Upload Complete</span> - '.basename($import->path).' 100%', '
|
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>
|
@@ -76,7 +76,7 @@ $l10n = array(
|
|
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.', '
|
80 |
</div>
|
81 |
</div>
|
82 |
<input type="hidden" name="downloaded"/>
|
@@ -89,7 +89,7 @@ $l10n = array(
|
|
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', '
|
93 |
</a>
|
94 |
<span class="dd-pointer dd-pointer-down"></span>
|
95 |
</div>
|
@@ -98,10 +98,10 @@ $l10n = array(
|
|
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', '
|
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.', '
|
105 |
</div>
|
106 |
</div>
|
107 |
</div>
|
24 |
|
25 |
?>
|
26 |
<script type="text/javascript">
|
27 |
+
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
28 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
29 |
</script>
|
30 |
|
31 |
<div class="change_file">
|
32 |
<div class="wpallimport-content-section">
|
33 |
<div class="wpallimport-collapsed-header" style="padding-left:30px;">
|
34 |
+
<h3><?php _e('Import File','wp_all_import_plugin');?></h3>
|
35 |
</div>
|
36 |
<div class="wpallimport-collapsed-content" style="padding-bottom: 40px;">
|
37 |
<hr>
|
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.', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_plugin'); ?></span>
|
55 |
</a>
|
56 |
</div>
|
57 |
|
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...', 'wp_all_import_plugin'); ?></a>
|
65 |
<div id="progressbar" class="wpallimport-progressbar">
|
66 |
+
<?php if ('upload' == $import->type) _e( '<span>Upload Complete</span> - '.basename($import->path).' 100%', 'wp_all_import_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>
|
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.', 'wp_all_import_plugin');?></a>
|
80 |
</div>
|
81 |
</div>
|
82 |
<input type="hidden" name="downloaded"/>
|
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', 'wp_all_import_plugin'); ?></label>
|
93 |
</a>
|
94 |
<span class="dd-pointer dd-pointer-down"></span>
|
95 |
</div>
|
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', 'wp_all_import_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.', 'wp_all_import_plugin');?></a>
|
105 |
</div>
|
106 |
</div>
|
107 |
</div>
|
views/admin/import/options/_reimport_options.php
CHANGED
@@ -1,36 +1,37 @@
|
|
1 |
-
<h4><?php _e('When WP All Import finds new or changed data...', '
|
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', '
|
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', '
|
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.', '
|
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', '
|
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', '
|
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', '
|
29 |
<div class="switcher-target-is_update_missing_cf" style="padding-left:17px;">
|
30 |
<div class="input">
|
31 |
-
<?php _e('Name', '
|
32 |
<input type="text" name="update_missing_cf_name" value="<?php echo esc_attr($post['update_missing_cf_name']) ?>" />
|
33 |
-
<?php _e('Value', '
|
34 |
<input type="text" name="update_missing_cf_value" value="<?php echo esc_attr($post['update_missing_cf_value']) ?>" />
|
35 |
</div>
|
36 |
</div>
|
@@ -38,72 +39,73 @@
|
|
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', '
|
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', '
|
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', '
|
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', '
|
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', '
|
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.', '
|
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', '
|
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', '
|
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', '
|
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', '
|
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', '
|
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', '
|
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', '
|
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', '
|
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', '
|
107 |
</div>
|
108 |
|
109 |
<?php
|
@@ -116,16 +118,16 @@
|
|
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', '
|
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.', '
|
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', '
|
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', '
|
129 |
</div>
|
130 |
</div>
|
131 |
</div>
|
@@ -133,16 +135,16 @@
|
|
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', '
|
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.', '
|
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', '
|
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', '
|
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"/>
|
@@ -150,7 +152,7 @@
|
|
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', '
|
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"/>
|
@@ -162,7 +164,7 @@
|
|
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)', '
|
166 |
<div class="switcher-target-is_update_categories" style="padding-left:17px;">
|
167 |
<?php
|
168 |
$existing_taxonomies = array();
|
@@ -176,7 +178,7 @@
|
|
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', '
|
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"/>
|
@@ -184,7 +186,7 @@
|
|
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', '
|
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"/>
|
@@ -192,11 +194,11 @@
|
|
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', '
|
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', '
|
200 |
</div>
|
201 |
</div>
|
202 |
</div>
|
1 |
+
<h4><?php _e('When WP All Import finds new or changed data...', 'wp_all_import_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', 'wp_all_import_plugin') ?></label>
|
6 |
</div>
|
7 |
+
<?php if ( "new" == $post['wizard_type']): ?>
|
8 |
<div class="switcher-target-auto_matching">
|
9 |
<div class="input">
|
10 |
<input type="hidden" name="is_delete_missing" value="0" />
|
11 |
<input type="checkbox" id="is_delete_missing" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher"/>
|
12 |
+
<label for="is_delete_missing"><?php _e('Delete posts that are no longer present in your file', 'wp_all_import_plugin') ?></label>
|
13 |
+
<!--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.', 'wp_all_import_plugin') ?>">?</a-->
|
14 |
</div>
|
15 |
<div class="switcher-target-is_delete_missing" style="padding-left:17px;">
|
16 |
<div class="input">
|
17 |
<input type="hidden" name="is_keep_attachments" value="0" />
|
18 |
<input type="checkbox" id="is_keep_attachments" name="is_keep_attachments" value="1" <?php echo $post['is_keep_attachments'] ? 'checked="checked"': '' ?> />
|
19 |
+
<label for="is_keep_attachments"><?php _e('Do not remove attachments', 'wp_all_import_plugin') ?></label>
|
20 |
</div>
|
21 |
<div class="input">
|
22 |
<input type="hidden" name="is_keep_imgs" value="0" />
|
23 |
<input type="checkbox" id="is_keep_imgs" name="is_keep_imgs" value="1" <?php echo $post['is_keep_imgs'] ? 'checked="checked"': '' ?> />
|
24 |
+
<label for="is_keep_imgs"><?php _e('Do not remove images', 'wp_all_import_plugin') ?></label>
|
25 |
</div>
|
26 |
<div class="input">
|
27 |
<input type="hidden" name="is_update_missing_cf" value="0" />
|
28 |
<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"/>
|
29 |
+
<label for="is_update_missing_cf"><?php _e('Instead of deletion, set Custom Field', 'wp_all_import_plugin') ?></label>
|
30 |
<div class="switcher-target-is_update_missing_cf" style="padding-left:17px;">
|
31 |
<div class="input">
|
32 |
+
<?php _e('Name', 'wp_all_import_plugin') ?>
|
33 |
<input type="text" name="update_missing_cf_name" value="<?php echo esc_attr($post['update_missing_cf_name']) ?>" />
|
34 |
+
<?php _e('Value', 'wp_all_import_plugin') ?>
|
35 |
<input type="text" name="update_missing_cf_value" value="<?php echo esc_attr($post['update_missing_cf_value']) ?>" />
|
36 |
</div>
|
37 |
</div>
|
39 |
<div class="input">
|
40 |
<input type="hidden" name="set_missing_to_draft" value="0" />
|
41 |
<input type="checkbox" id="set_missing_to_draft" name="set_missing_to_draft" value="1" <?php echo $post['set_missing_to_draft'] ? 'checked="checked"': '' ?> />
|
42 |
+
<label for="set_missing_to_draft"><?php _e('Instead of deletion, change post status to Draft', 'wp_all_import_plugin') ?></label>
|
43 |
</div>
|
44 |
</div>
|
45 |
+
</div>
|
46 |
+
<?php endif; ?>
|
47 |
<div class="input">
|
48 |
<input type="hidden" id="is_keep_former_posts" name="is_keep_former_posts" value="yes" />
|
49 |
<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" />
|
50 |
+
<label for="is_not_keep_former_posts"><?php _e('Update existing posts with changed data in your file', 'wp_all_import_plugin') ?></label>
|
51 |
|
52 |
<div class="switcher-target-is_not_keep_former_posts" style="padding-left:17px;">
|
53 |
<input type="radio" id="update_all_data" class="switcher" name="update_all_data" value="yes" <?php echo 'no' != $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
54 |
+
<label for="update_all_data"><?php _e('Update all data', 'wp_all_import_plugin' )?></label><br>
|
55 |
|
56 |
<input type="radio" id="update_choosen_data" class="switcher" name="update_all_data" value="no" <?php echo 'no' == $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
57 |
+
<label for="update_choosen_data"><?php _e('Choose which data to update', 'wp_all_import_plugin' )?></label><br>
|
58 |
<div class="switcher-target-update_choosen_data" style="padding-left:17px;">
|
59 |
<div class="input">
|
60 |
<input type="hidden" name="is_update_status" value="0" />
|
61 |
<input type="checkbox" id="is_update_status" name="is_update_status" value="1" <?php echo $post['is_update_status'] ? 'checked="checked"': '' ?> />
|
62 |
+
<label for="is_update_status"><?php _e('Post status', 'wp_all_import_plugin') ?></label>
|
63 |
+
<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.', 'wp_all_import_plugin') ?>">?</a>
|
64 |
</div>
|
65 |
<div class="input">
|
66 |
<input type="hidden" name="is_update_title" value="0" />
|
67 |
<input type="checkbox" id="is_update_title" name="is_update_title" value="1" <?php echo $post['is_update_title'] ? 'checked="checked"': '' ?> />
|
68 |
+
<label for="is_update_title"><?php _e('Title', 'wp_all_import_plugin') ?></label>
|
69 |
</div>
|
70 |
<div class="input">
|
71 |
<input type="hidden" name="is_update_author" value="0" />
|
72 |
<input type="checkbox" id="is_update_author" name="is_update_author" value="1" <?php echo $post['is_update_author'] ? 'checked="checked"': '' ?> />
|
73 |
+
<label for="is_update_author"><?php _e('Author', 'wp_all_import_plugin') ?></label>
|
74 |
</div>
|
75 |
<div class="input">
|
76 |
<input type="hidden" name="is_update_slug" value="0" />
|
77 |
<input type="checkbox" id="is_update_slug" name="is_update_slug" value="1" <?php echo $post['is_update_slug'] ? 'checked="checked"': '' ?> />
|
78 |
+
<label for="is_update_slug"><?php _e('Slug', 'wp_all_import_plugin') ?></label>
|
79 |
</div>
|
80 |
<div class="input">
|
81 |
<input type="hidden" name="is_update_content" value="0" />
|
82 |
<input type="checkbox" id="is_update_content" name="is_update_content" value="1" <?php echo $post['is_update_content'] ? 'checked="checked"': '' ?> />
|
83 |
+
<label for="is_update_content"><?php _e('Content', 'wp_all_import_plugin') ?></label>
|
84 |
</div>
|
85 |
<div class="input">
|
86 |
<input type="hidden" name="is_update_excerpt" value="0" />
|
87 |
<input type="checkbox" id="is_update_excerpt" name="is_update_excerpt" value="1" <?php echo $post['is_update_excerpt'] ? 'checked="checked"': '' ?> />
|
88 |
+
<label for="is_update_excerpt"><?php _e('Excerpt/Short Description', 'wp_all_import_plugin') ?></label>
|
89 |
</div>
|
90 |
<div class="input">
|
91 |
<input type="hidden" name="is_update_dates" value="0" />
|
92 |
<input type="checkbox" id="is_update_dates" name="is_update_dates" value="1" <?php echo $post['is_update_dates'] ? 'checked="checked"': '' ?> />
|
93 |
+
<label for="is_update_dates"><?php _e('Dates', 'wp_all_import_plugin') ?></label>
|
94 |
</div>
|
95 |
<div class="input">
|
96 |
<input type="hidden" name="is_update_menu_order" value="0" />
|
97 |
<input type="checkbox" id="is_update_menu_order" name="is_update_menu_order" value="1" <?php echo $post['is_update_menu_order'] ? 'checked="checked"': '' ?> />
|
98 |
+
<label for="is_update_menu_order"><?php _e('Menu order', 'wp_all_import_plugin') ?></label>
|
99 |
</div>
|
100 |
<div class="input">
|
101 |
<input type="hidden" name="is_update_parent" value="0" />
|
102 |
<input type="checkbox" id="is_update_parent" name="is_update_parent" value="1" <?php echo $post['is_update_parent'] ? 'checked="checked"': '' ?> />
|
103 |
+
<label for="is_update_parent"><?php _e('Parent post', 'wp_all_import_plugin') ?></label>
|
104 |
</div>
|
105 |
<div class="input">
|
106 |
<input type="hidden" name="is_update_attachments" value="0" />
|
107 |
<input type="checkbox" id="is_update_attachments" name="is_update_attachments" value="1" <?php echo $post['is_update_attachments'] ? 'checked="checked"': '' ?> />
|
108 |
+
<label for="is_update_attachments"><?php _e('Attachments', 'wp_all_import_plugin') ?></label>
|
109 |
</div>
|
110 |
|
111 |
<?php
|
118 |
<div class="input">
|
119 |
<input type="hidden" name="is_update_images" value="0" />
|
120 |
<input type="checkbox" id="is_update_images" name="is_update_images" value="1" <?php echo $post['is_update_images'] ? 'checked="checked"': '' ?> class="switcher" />
|
121 |
+
<label for="is_update_images"><?php _e('Images', 'wp_all_import_plugin') ?></label>
|
122 |
+
<!--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.', 'wp_all_import_plugin') ?>">?</a-->
|
123 |
<div class="switcher-target-is_update_images" style="padding-left:17px;">
|
124 |
<div class="input" style="margin-bottom:3px;">
|
125 |
<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"': '' ?> />
|
126 |
+
<label for="update_images_logic_full_update"><?php _e('Update all images', 'wp_all_import_plugin') ?></label>
|
127 |
</div>
|
128 |
<div class="input" style="margin-bottom:3px;">
|
129 |
<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"': '' ?> />
|
130 |
+
<label for="update_images_logic_add_new"><?php _e('Don\'t touch existing images, append new images', 'wp_all_import_plugin') ?></label>
|
131 |
</div>
|
132 |
</div>
|
133 |
</div>
|
135 |
<input type="hidden" name="custom_fields_list" value="0" />
|
136 |
<input type="hidden" name="is_update_custom_fields" value="0" />
|
137 |
<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"/>
|
138 |
+
<label for="is_update_custom_fields"><?php _e('Custom Fields', 'wp_all_import_plugin') ?></label>
|
139 |
+
<!--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.', 'wp_all_import_plugin') ?>">?</a-->
|
140 |
<div class="switcher-target-is_update_custom_fields" style="padding-left:17px;">
|
141 |
<div class="input">
|
142 |
<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"/>
|
143 |
+
<label for="update_custom_fields_logic_full_update"><?php _e('Update all Custom Fields', 'wp_all_import_plugin') ?></label>
|
144 |
</div>
|
145 |
<div class="input">
|
146 |
<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"/>
|
147 |
+
<label for="update_custom_fields_logic_only"><?php _e('Update only these Custom Fields, leave the rest alone', 'wp_all_import_plugin') ?></label>
|
148 |
<div class="switcher-target-update_custom_fields_logic_only pmxi_choosen" style="padding-left:17px;">
|
149 |
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo implode(',', $existing_meta_keys);?></span>
|
150 |
<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"/>
|
152 |
</div>
|
153 |
<div class="input">
|
154 |
<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"/>
|
155 |
+
<label for="update_custom_fields_logic_all_except"><?php _e('Leave these fields alone, update all other Custom Fields', 'wp_all_import_plugin') ?></label>
|
156 |
<div class="switcher-target-update_custom_fields_logic_all_except pmxi_choosen" style="padding-left:17px;">
|
157 |
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo implode(',', $existing_meta_keys);?></span>
|
158 |
<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"/>
|
164 |
<input type="hidden" name="taxonomies_list" value="0" />
|
165 |
<input type="hidden" name="is_update_categories" value="0" />
|
166 |
<input type="checkbox" id="is_update_categories" name="is_update_categories" value="1" class="switcher" <?php echo $post['is_update_categories'] ? 'checked="checked"': '' ?> />
|
167 |
+
<label for="is_update_categories"><?php _e('Taxonomies (incl. Categories and Tags)', 'wp_all_import_plugin') ?></label>
|
168 |
<div class="switcher-target-is_update_categories" style="padding-left:17px;">
|
169 |
<?php
|
170 |
$existing_taxonomies = array();
|
178 |
?>
|
179 |
<div class="input" style="margin-bottom:3px;">
|
180 |
<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"/>
|
181 |
+
<label for="update_categories_logic_all_except"><?php _e('Leave these taxonomies alone, update all others', 'wp_all_import_plugin') ?></label>
|
182 |
<div class="switcher-target-update_categories_logic_all_except pmxi_choosen" style="padding-left:17px;">
|
183 |
<span class="hidden choosen_values"><?php if (!empty($existing_taxonomies)) echo implode(',', $existing_taxonomies);?></span>
|
184 |
<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"/>
|
186 |
</div>
|
187 |
<div class="input" style="margin-bottom:3px;">
|
188 |
<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"/>
|
189 |
+
<label for="update_categories_logic_only"><?php _e('Update only these taxonomies, leave the rest alone', 'wp_all_import_plugin') ?></label>
|
190 |
<div class="switcher-target-update_categories_logic_only pmxi_choosen" style="padding-left:17px;">
|
191 |
<span class="hidden choosen_values"><?php if (!empty($existing_taxonomies)) echo implode(',', $existing_taxonomies);?></span>
|
192 |
<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"/>
|
194 |
</div>
|
195 |
<div class="input" style="margin-bottom:3px;">
|
196 |
<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"/>
|
197 |
+
<label for="update_categories_logic_full_update"><?php _e('Remove existing taxonomies, add new taxonomies', 'wp_all_import_plugin') ?></label>
|
198 |
</div>
|
199 |
<div class="input" style="margin-bottom:3px;">
|
200 |
<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"/>
|
201 |
+
<label for="update_categories_logic_add_new"><?php _e('Only add new', 'wp_all_import_plugin') ?></label>
|
202 |
</div>
|
203 |
</div>
|
204 |
</div>
|
views/admin/import/options/_reimport_template.php
CHANGED
@@ -7,9 +7,9 @@
|
|
7 |
<div class="wpallimport-collapsed-header">
|
8 |
<?php if ( "new" == $post['wizard_type']): ?>
|
9 |
<?php if ( ! $this->isWizard ):?>
|
10 |
-
<h3><?php _e('Record Matching', '
|
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.','
|
13 |
<?php endif; ?>
|
14 |
</div>
|
15 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
@@ -19,7 +19,7 @@
|
|
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.','
|
23 |
<?php endif; ?>
|
24 |
<div class="wpallimport-unique-key-wrapper">
|
25 |
<label style="font-weight: bold;"><?php _e("Unique Identifier", "pmxi_plugin"); ?></label>
|
@@ -28,20 +28,20 @@
|
|
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', '
|
32 |
<?php else: ?>
|
33 |
-
<a href="javascript:void(0);" class="wpallimport-change-unique-key"><?php _e('Edit', '
|
34 |
-
<div id="dialog-confirm" title="<?php _e('Warning: Are you sure you want to edit the Unique Identifier?','
|
35 |
-
<p><?php printf(__('It is recommended you delete all %s associated with this import before editing the unique identifier.', '
|
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.', '
|
37 |
-
<p><?php _e('You really should just re-create your import, and pick the right unique identifier to start with.', '
|
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.', '
|
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.', '
|
45 |
<?php endif; ?>
|
46 |
</div>
|
47 |
<?php if ( ! $this->isWizard ):?>
|
@@ -56,9 +56,9 @@
|
|
56 |
</div>
|
57 |
<?php else: ?>
|
58 |
<?php if ( ! $this->isWizard ):?>
|
59 |
-
<h3><?php _e('Record Matching', '
|
60 |
<?php else: ?>
|
61 |
-
<h3 style="padding-left:0;"><?php printf(__('WP All Import will merge data into existing %s.','
|
62 |
<?php endif; ?>
|
63 |
</div>
|
64 |
<div class="wpallimport-collapsed-content" style="padding:0;">
|
@@ -68,19 +68,19 @@
|
|
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...', '
|
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', '
|
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', '
|
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', '
|
80 |
<span class="switcher-target-duplicate_indicator_custom_field" style="vertical-align:middle; padding-left:17px;">
|
81 |
-
<?php _e('Name', '
|
82 |
<input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
|
83 |
-
<?php _e('Value', '
|
84 |
<input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
|
85 |
</span>
|
86 |
</div>
|
7 |
<div class="wpallimport-collapsed-header">
|
8 |
<?php if ( "new" == $post['wizard_type']): ?>
|
9 |
<?php if ( ! $this->isWizard ):?>
|
10 |
+
<h3><?php _e('Record Matching', 'wp_all_import_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.','wp_all_import_plugin'), $custom_type->labels->name);?></h3>
|
13 |
<?php endif; ?>
|
14 |
</div>
|
15 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
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.','wp_all_import_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>
|
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', 'wp_all_import_plugin'); ?></a>
|
32 |
<?php else: ?>
|
33 |
+
<a href="javascript:void(0);" class="wpallimport-change-unique-key"><?php _e('Edit', 'wp_all_import_plugin'); ?></a>
|
34 |
+
<div id="dialog-confirm" title="<?php _e('Warning: Are you sure you want to edit the Unique Identifier?','wp_all_import_plugin');?>" style="display:none;">
|
35 |
+
<p><?php printf(__('It is recommended you delete all %s associated with this import before editing the unique identifier.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></p>
|
45 |
<?php endif; ?>
|
46 |
</div>
|
47 |
<?php if ( ! $this->isWizard ):?>
|
56 |
</div>
|
57 |
<?php else: ?>
|
58 |
<?php if ( ! $this->isWizard ):?>
|
59 |
+
<h3><?php _e('Record Matching', 'wp_all_import_plugin'); ?></h3>
|
60 |
<?php else: ?>
|
61 |
+
<h3 style="padding-left:0;"><?php printf(__('WP All Import will merge data into existing %s.','wp_all_import_plugin'), $custom_type->labels->name);?></h3>
|
62 |
<?php endif; ?>
|
63 |
</div>
|
64 |
<div class="wpallimport-collapsed-content" style="padding:0;">
|
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...', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_plugin' )?></label><br>
|
80 |
<span class="switcher-target-duplicate_indicator_custom_field" style="vertical-align:middle; padding-left:17px;">
|
81 |
+
<?php _e('Name', 'wp_all_import_plugin') ?>
|
82 |
<input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
|
83 |
+
<?php _e('Value', 'wp_all_import_plugin') ?>
|
84 |
<input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
|
85 |
</span>
|
86 |
</div>
|
views/admin/import/options/_settings_template.php
CHANGED
@@ -1,45 +1,45 @@
|
|
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','
|
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', '
|
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', '
|
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', '
|
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', '
|
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.', '
|
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.', '
|
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.','
|
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.', '
|
38 |
</div>
|
39 |
<?php if ( ! $this->isWizard ): ?>
|
40 |
|
41 |
-
<h4><?php _e('Post Type', '
|
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.', '
|
43 |
|
44 |
|
45 |
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
@@ -84,18 +84,18 @@
|
|
84 |
</select>
|
85 |
</div>
|
86 |
|
87 |
-
<h4><?php _e('XPath', '
|
88 |
-
<p><?php _e('Editing this can break your entire import. You will have to re-create it from scratch.', '
|
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', '
|
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', '
|
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;"/>
|
@@ -106,19 +106,19 @@
|
|
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', '
|
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', '
|
117 |
</div>
|
118 |
<?php endif; ?>
|
119 |
|
120 |
<div class="input" style="margin-top: 15px;">
|
121 |
-
<p><?php _e('Friendly Name','
|
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>
|
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','wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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.', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_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.','wp_all_import_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.', 'wp_all_import_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.', 'wp_all_import_plugin') ?>">?</a></label>
|
38 |
</div>
|
39 |
<?php if ( ! $this->isWizard ): ?>
|
40 |
|
41 |
+
<h4><?php _e('Post Type', 'wp_all_import_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.', 'wp_all_import_plugin');?></p> <br>
|
43 |
|
44 |
|
45 |
<input type="hidden" name="custom_type" value="<?php echo $post['custom_type'];?>">
|
84 |
</select>
|
85 |
</div>
|
86 |
|
87 |
+
<h4><?php _e('XPath', 'wp_all_import_plugin'); ?></h4>
|
88 |
+
<p><?php _e('Editing this can break your entire import. You will have to re-create it from scratch.', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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.', 'wp_all_import_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;"/>
|
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', 'wp_all_import_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.', 'wp_all_import_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', 'wp_all_import_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', 'wp_all_import_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','wp_all_import_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>
|
views/admin/import/preview_prices.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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>', '
|
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>
|
@@ -13,10 +13,10 @@
|
|
13 |
<?php $this->error() ?>
|
14 |
<?php endif ?>
|
15 |
|
16 |
-
<h3><?php _e('Preview Prices', '
|
17 |
|
18 |
-
<p><?php _e('Regular Price', '
|
19 |
-
<p><?php _e('Sale Price', '
|
20 |
|
21 |
</div>
|
22 |
|
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>', 'wp_all_import_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>
|
13 |
<?php $this->error() ?>
|
14 |
<?php endif ?>
|
15 |
|
16 |
+
<h3><?php _e('Preview Prices', 'wp_all_import_plugin'); ?></h3>
|
17 |
|
18 |
+
<p><?php _e('Regular Price', 'wp_all_import_plugin'); ?>: <?php echo $product_regular_price; ?></p>
|
19 |
+
<p><?php _e('Sale Price', 'wp_all_import_plugin'); ?>: <?php echo $product_sale_price; ?></p>
|
20 |
|
21 |
</div>
|
22 |
|
views/admin/import/preview_taxonomies.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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>', '
|
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>
|
@@ -13,41 +13,45 @@
|
|
13 |
<?php $this->error() ?>
|
14 |
<?php endif ?>
|
15 |
|
16 |
-
<h3><?php _e('Test Taxonomies Hierarchy', '
|
17 |
|
18 |
<?php
|
19 |
if ( ! empty($tax_hierarchical) ):
|
20 |
-
foreach ($tax_hierarchical as $ctx => $
|
21 |
$tax_info = get_taxonomy($ctx);
|
22 |
?>
|
23 |
<p><?php echo $tax_info->labels->name; ?></p>
|
24 |
-
<?php
|
|
|
|
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
}
|
38 |
-
}
|
|
|
|
|
|
|
39 |
}
|
40 |
}
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
}
|
45 |
}
|
46 |
-
else{
|
47 |
-
?>
|
48 |
-
<p><?php echo $terms_a; ?></p>
|
49 |
-
<?php
|
50 |
-
}
|
51 |
|
52 |
endforeach;
|
53 |
endif; ?>
|
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>', 'wp_all_import_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>
|
13 |
<?php $this->error() ?>
|
14 |
<?php endif ?>
|
15 |
|
16 |
+
<h3><?php _e('Test Taxonomies Hierarchy', 'wp_all_import_plugin'); ?></h3>
|
17 |
|
18 |
<?php
|
19 |
if ( ! empty($tax_hierarchical) ):
|
20 |
+
foreach ($tax_hierarchical as $ctx => $terms_arr):
|
21 |
$tax_info = get_taxonomy($ctx);
|
22 |
?>
|
23 |
<p><?php echo $tax_info->labels->name; ?></p>
|
24 |
+
<?php
|
25 |
+
if (!empty($terms_arr) and is_array($terms_arr)){
|
26 |
+
foreach ($terms_arr as $terms) {
|
27 |
+
|
28 |
+
$terms_a = ( ! empty($post['tax_hierarchical_delim'][$ctx])) ? explode($post['tax_hierarchical_delim'][$ctx], $terms) : explode(',', $terms);
|
29 |
|
30 |
+
if ( ! empty($terms_a) and is_array($terms_a)){
|
31 |
+
foreach ($terms_a as $lvl => $term) {
|
32 |
+
if ( ! empty($post['tax_mapping'][$ctx])){
|
33 |
+
$mapping_rules = json_decode($post['tax_mapping'][$ctx], true);
|
34 |
+
if ( ! empty($mapping_rules) ){
|
35 |
+
foreach ($mapping_rules as $rule_number => $rule) {
|
36 |
+
if ( ! empty($rule[trim($term)])){
|
37 |
+
$term = trim($rule[trim($term)]);
|
38 |
+
break;
|
39 |
+
}
|
40 |
+
}
|
41 |
}
|
42 |
+
}
|
43 |
+
?>
|
44 |
+
<p><?php echo str_pad(trim($term), strlen(trim($term)) + $lvl, "-", STR_PAD_LEFT); ?></p>
|
45 |
+
<?php
|
46 |
}
|
47 |
}
|
48 |
+
else{
|
49 |
+
?>
|
50 |
+
<p><?php echo $terms_a; ?></p>
|
51 |
+
<?php
|
52 |
+
}
|
53 |
}
|
54 |
}
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
endforeach;
|
57 |
endif; ?>
|
views/admin/import/process.php
CHANGED
@@ -5,11 +5,11 @@
|
|
5 |
<div class="wpallimport-header">
|
6 |
<div class="wpallimport-logo"></div>
|
7 |
<div class="wpallimport-title">
|
8 |
-
<p><?php _e('WP All Import', '
|
9 |
-
<h2><?php _e('Import XML / CSV', '
|
10 |
</div>
|
11 |
<div class="wpallimport-links">
|
12 |
-
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', '
|
13 |
</div>
|
14 |
|
15 |
<div class="clear"></div>
|
@@ -18,47 +18,47 @@
|
|
18 |
<div class="clear"></div>
|
19 |
|
20 |
<div class="step_description">
|
21 |
-
<h2><?php _e('Import <span id="status">in Progress</span>', '
|
22 |
-
<h3 id="process_notice"><?php _e('Importing may take some time. Please do not close your browser or refresh the page until the process is complete.', '
|
23 |
|
24 |
</div>
|
25 |
<div id="processbar" class="rad14">
|
26 |
<div class="rad14"></div>
|
27 |
</div>
|
28 |
<div id="import_progress">
|
29 |
-
<span id="left_progress"><?php _e('Time Elapsed', '
|
30 |
<span id="center_progress"><span id="percents_count">0</span>%</span>
|
31 |
-
<span id="right_progress"><?php _e('Created','
|
32 |
</div>
|
33 |
</div>
|
34 |
|
35 |
<div id="import_finished">
|
36 |
-
<h1><?php _e('Import Complete!', '
|
37 |
-
<h3><?php printf(__('WP All Import successfully imported your file <span>%s</span> into your WordPress installation!','
|
38 |
<?php if ($ajax_processing): ?>
|
39 |
-
<p class="wpallimport-log-details"><?php printf(__('There were <span class="wpallimport-errors-count">%s</span> errors and <span class="wpallimport-warnings-count">%s</span> warnings in this import. You can see these in the import log.', '
|
40 |
<?php elseif ((int) PMXI_Plugin::$session->errors or (int) PMXI_Plugin::$session->warnings): ?>
|
41 |
-
<p class="wpallimport-log-details" style="display:block;"><?php printf(__('There were <span class="wpallimport-errors-count">%s</span> errors and <span class="wpallimport-warnings-count">%s</span> warnings in this import. You can see these in the import log.', '
|
42 |
<?php endif; ?>
|
43 |
<hr>
|
44 |
-
<a href="<?php echo add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-history'), $this->baseUrl); ?>" id="download_log"><?php _e('View Logs','
|
45 |
-
<a href="<?php echo add_query_arg(array('page' => 'pmxi-admin-manage'), remove_query_arg(array('id','page'), $this->baseUrl)); ?>" id="manage_imports"><?php _e('Manage Imports', '
|
46 |
</div>
|
47 |
|
48 |
</div>
|
49 |
|
50 |
-
<div class="wpallimport-modal-message rad4"><?php printf(__('WP All Import tried to process <span id="wpallimport-records-per-iteration">%s</span> records in one iteration, but your server terminated the process before it could finish. <a href="javascript:void(0);" id="wpallimport-try-again">Click here to try again</a>, but with only <span id="wpallimport-new-records-per-iteration">%s</span> records per iteration.', '
|
51 |
|
52 |
<fieldset id="logwrapper">
|
53 |
-
<legend><?php _e('Log','
|
54 |
<div id="loglist"></div>
|
55 |
</fieldset>
|
56 |
|
57 |
<input type="hidden" class="count_failures" value="0"/>
|
58 |
<input type="hidden" class="records_per_request" value="<?php echo $update_previous->options['records_per_request']; ?>"/>
|
59 |
-
<span id="wpallimport-error-terminated" style="display:none;"><?php printf(__('Unfortunately, your server terminated the import process. Click here for our <a href="%s" target="_blank">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to run your import, and fix whatever setting is causing the import to fail.', '
|
60 |
|
61 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
62 |
|
63 |
</div>
|
64 |
|
@@ -133,7 +133,7 @@
|
|
133 |
|
134 |
function parse_element(failures){
|
135 |
|
136 |
-
$.post('admin.php?page=pmxi-admin-import&action=process&id=' + import_id + '&failures=' + failures, {}, function (data) {
|
137 |
|
138 |
// responce with error
|
139 |
if (data != null && typeof data.created != "undefined"){
|
@@ -194,7 +194,8 @@
|
|
194 |
|
195 |
var request = {
|
196 |
action:'import_failed',
|
197 |
-
id: '<?php echo $update_previous->id; ?>'
|
|
|
198 |
};
|
199 |
|
200 |
$.ajax({
|
5 |
<div class="wpallimport-header">
|
6 |
<div class="wpallimport-logo"></div>
|
7 |
<div class="wpallimport-title">
|
8 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
9 |
+
<h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
|
10 |
</div>
|
11 |
<div class="wpallimport-links">
|
12 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
|
13 |
</div>
|
14 |
|
15 |
<div class="clear"></div>
|
18 |
<div class="clear"></div>
|
19 |
|
20 |
<div class="step_description">
|
21 |
+
<h2><?php _e('Import <span id="status">in Progress</span>', 'wp_all_import_plugin') ?></h2>
|
22 |
+
<h3 id="process_notice"><?php _e('Importing may take some time. Please do not close your browser or refresh the page until the process is complete.', 'wp_all_import_plugin'); ?></h3>
|
23 |
|
24 |
</div>
|
25 |
<div id="processbar" class="rad14">
|
26 |
<div class="rad14"></div>
|
27 |
</div>
|
28 |
<div id="import_progress">
|
29 |
+
<span id="left_progress"><?php _e('Time Elapsed', 'wp_all_import_plugin');?> <span id="then">00:00:00</span></span>
|
30 |
<span id="center_progress"><span id="percents_count">0</span>%</span>
|
31 |
+
<span id="right_progress"><?php _e('Created','wp_all_import_plugin');?> <span id="created_count"><?php echo $update_previous->created; ?></span> / <?php _e('Updated','wp_all_import_plugin');?> <span id="updated_count"><?php echo $update_previous->updated; ?></span> <?php _e('of', 'wp_all_import_plugin');?> <span id="of"><?php echo $update_previous->count; ?></span> <?php _e('records', 'wp_all_import_plugin'); ?></span>
|
32 |
</div>
|
33 |
</div>
|
34 |
|
35 |
<div id="import_finished">
|
36 |
+
<h1><?php _e('Import Complete!', 'wp_all_import_plugin'); ?></h1>
|
37 |
+
<h3><?php printf(__('WP All Import successfully imported your file <span>%s</span> into your WordPress installation!','wp_all_import_plugin'), (PMXI_Plugin::$session->source['type'] != 'url') ? basename(PMXI_Plugin::$session->source['path']) : PMXI_Plugin::$session->source['path'])?></h3>
|
38 |
<?php if ($ajax_processing): ?>
|
39 |
+
<p class="wpallimport-log-details"><?php printf(__('There were <span class="wpallimport-errors-count">%s</span> errors and <span class="wpallimport-warnings-count">%s</span> warnings in this import. You can see these in the import log.', 'wp_all_import_plugin'), 0, 0); ?></p>
|
40 |
<?php elseif ((int) PMXI_Plugin::$session->errors or (int) PMXI_Plugin::$session->warnings): ?>
|
41 |
+
<p class="wpallimport-log-details" style="display:block;"><?php printf(__('There were <span class="wpallimport-errors-count">%s</span> errors and <span class="wpallimport-warnings-count">%s</span> warnings in this import. You can see these in the import log.', 'wp_all_import_plugin'), PMXI_Plugin::$session->errors, PMXI_Plugin::$session->warnings); ?></p>
|
42 |
<?php endif; ?>
|
43 |
<hr>
|
44 |
+
<a href="<?php echo add_query_arg(array('id' => $update_previous->id, 'page' => 'pmxi-admin-history'), $this->baseUrl); ?>" id="download_log"><?php _e('View Logs','wp_all_import_plugin');?></a>
|
45 |
+
<a href="<?php echo add_query_arg(array('page' => 'pmxi-admin-manage'), remove_query_arg(array('id','page'), $this->baseUrl)); ?>" id="manage_imports"><?php _e('Manage Imports', 'wp_all_import_plugin') ?></a>
|
46 |
</div>
|
47 |
|
48 |
</div>
|
49 |
|
50 |
+
<div class="wpallimport-modal-message rad4"><?php printf(__('WP All Import tried to process <span id="wpallimport-records-per-iteration">%s</span> records in one iteration, but your server terminated the process before it could finish. <a href="javascript:void(0);" id="wpallimport-try-again">Click here to try again</a>, but with only <span id="wpallimport-new-records-per-iteration">%s</span> records per iteration.', 'wp_all_import_plugin'), $update_previous->options['records_per_request'], ((ceil($update_previous->options['records_per_request']/2)) ? ceil($update_previous->options['records_per_request']/2) : 1)); ?></div>
|
51 |
|
52 |
<fieldset id="logwrapper">
|
53 |
+
<legend><?php _e('Log','wp_all_import_plugin');?></legend>
|
54 |
<div id="loglist"></div>
|
55 |
</fieldset>
|
56 |
|
57 |
<input type="hidden" class="count_failures" value="0"/>
|
58 |
<input type="hidden" class="records_per_request" value="<?php echo $update_previous->options['records_per_request']; ?>"/>
|
59 |
+
<span id="wpallimport-error-terminated" style="display:none;"><?php printf(__('Unfortunately, your server terminated the import process. Click here for our <a href="%s" target="_blank">troubleshooting guide</a>, or ask your web host to look in your error_log file for an error that takes place at the same time you are trying to run your import, and fix whatever setting is causing the import to fail.', 'wp_all_import_plugin'), 'http://www.wpallimport.com/documentation/advanced/troubleshooting/'); ?></span>
|
60 |
|
61 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
62 |
|
63 |
</div>
|
64 |
|
133 |
|
134 |
function parse_element(failures){
|
135 |
|
136 |
+
$.post('admin.php?page=pmxi-admin-import&action=process&id=' + import_id + '&failures=' + failures + '&_wpnonce=' + wp_all_import_security, {}, function (data) {
|
137 |
|
138 |
// responce with error
|
139 |
if (data != null && typeof data.created != "undefined"){
|
194 |
|
195 |
var request = {
|
196 |
action:'import_failed',
|
197 |
+
id: '<?php echo $update_previous->id; ?>',
|
198 |
+
security: wp_all_import_security
|
199 |
};
|
200 |
|
201 |
$.ajax({
|
views/admin/import/tag.php
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
<div>
|
3 |
<?php if ( ! empty($elements->length) ):?>
|
4 |
<div class="title">
|
5 |
-
<!--h3><?php _e('Elements', '
|
6 |
<div class="navigation">
|
7 |
<?php if ($tagno > 1): ?><a href="#prev" class="previous_element"> </a><?php else: ?><span class="previous_element"> </span><?php endif ?>
|
8 |
-
<?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>', '
|
9 |
<?php if ($tagno < PMXI_Plugin::$session->count): ?><a href="#next" class="next_element"> </a><?php else: ?><span class="next_element"> </span><?php endif ?>
|
10 |
</div>
|
11 |
</div>
|
@@ -24,7 +24,7 @@
|
|
24 |
</div>
|
25 |
<?php else: ?>
|
26 |
<div class="error inline below-h2" style="padding:10px; margin-top:45px;">
|
27 |
-
<?php printf(__('History file not found. Probably you are using wrong encoding.', '
|
28 |
</div>
|
29 |
<?php endif; ?>
|
30 |
</div>
|
2 |
<div>
|
3 |
<?php if ( ! empty($elements->length) ):?>
|
4 |
<div class="title">
|
5 |
+
<!--h3><?php _e('Elements', 'wp_all_import_plugin'); ?></h3-->
|
6 |
<div class="navigation">
|
7 |
<?php if ($tagno > 1): ?><a href="#prev" class="previous_element"> </a><?php else: ?><span class="previous_element"> </span><?php endif ?>
|
8 |
+
<?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>', 'wp_all_import_plugin'), $tagno, PMXI_Plugin::$session->count); ?>
|
9 |
<?php if ($tagno < PMXI_Plugin::$session->count): ?><a href="#next" class="next_element"> </a><?php else: ?><span class="next_element"> </span><?php endif ?>
|
10 |
</div>
|
11 |
</div>
|
24 |
</div>
|
25 |
<?php else: ?>
|
26 |
<div class="error inline below-h2" style="padding:10px; margin-top:45px;">
|
27 |
+
<?php printf(__('History file not found. Probably you are using wrong encoding.', 'wp_all_import_plugin')); ?>
|
28 |
</div>
|
29 |
<?php endif; ?>
|
30 |
</div>
|
views/admin/import/template.php
CHANGED
@@ -6,11 +6,11 @@
|
|
6 |
<div class="wpallimport-header">
|
7 |
<div class="wpallimport-logo"></div>
|
8 |
<div class="wpallimport-title">
|
9 |
-
<p><?php _e('WP All Import', '
|
10 |
-
<h2><?php _e('Import XML / CSV', '
|
11 |
</div>
|
12 |
<div class="wpallimport-links">
|
13 |
-
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', '
|
14 |
</div>
|
15 |
</div>
|
16 |
<div class="clear"></div>
|
@@ -38,14 +38,14 @@
|
|
38 |
<div class="wpallimport-collapsed wpallimport-section">
|
39 |
<div class="wpallimport-content-section" style="overflow: hidden; padding-bottom: 0;">
|
40 |
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
41 |
-
<h3><?php _e('Title & Content', '
|
42 |
</div>
|
43 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
44 |
|
45 |
<div style="padding: 15px 25px 65px;">
|
46 |
<div id="titlediv" style="margin-bottom:20px;">
|
47 |
<div id="titlewrap">
|
48 |
-
<input id="wpallimport-title" class="widefat" type="text" name="title" value="<?php echo esc_attr($post['title']) ?>" placeholder="<?php _e('Drag & drop any element on the right to set the title.', '
|
49 |
</div>
|
50 |
</div>
|
51 |
|
@@ -64,30 +64,30 @@
|
|
64 |
|
65 |
<?php if ($post_type != 'page'):?>
|
66 |
<div class="template_input">
|
67 |
-
<input type="text" name="post_excerpt" style="width:100%; line-height: 25px;" value="<?php echo esc_attr($post['post_excerpt']) ?>" placeholder="<?php echo ($post_type == 'product' and class_exists('PMWI_Plugin')) ? __('WooCommerce Short Description', '
|
68 |
</div>
|
69 |
<?php endif; ?>
|
70 |
|
71 |
-
<a class="preview" href="javascript:void(0);" rel="preview"><?php _e('Preview', '
|
72 |
</div>
|
73 |
|
74 |
<div class="wpallimport-collapsed closed wpallimport-section">
|
75 |
<div class="wpallimport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2;">
|
76 |
<div class="wpallimport-collapsed-header">
|
77 |
-
<h3 style="color:#40acad;"><?php _e('Advanced Options','
|
78 |
</div>
|
79 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
80 |
<div class="wpallimport-collapsed-content-inner">
|
81 |
<div class="input pmxi_option">
|
82 |
<input type="hidden" name="is_keep_linebreaks" value="0" />
|
83 |
<input type="checkbox" id="is_keep_linebreaks" name="is_keep_linebreaks" class="fix_checkbox" value="1" <?php echo $post['is_keep_linebreaks'] ? 'checked="checked"' : '' ?> />
|
84 |
-
<label for="is_keep_linebreaks"><?php _e('Keep line breaks from file', '
|
85 |
</div>
|
86 |
<div class="input pmxi_option">
|
87 |
<input type="hidden" name="is_leave_html" value="0" />
|
88 |
<input type="checkbox" id="is_leave_html" name="is_leave_html" class="fix_checkbox" value="1" <?php echo $post['is_leave_html'] ? 'checked="checked"' : '' ?> style="position:relative;"/>
|
89 |
-
<label for="is_leave_html"><?php _e('Decode HTML entities with <b>html_entity_decode</b>', '
|
90 |
-
<a class="wpallimport-help" href="#help" style="position:relative; top:1px;" original-title="If HTML code is showing up in your posts, use this option. You can also use <br /><br /><i>[html_entity_decode({my/xpath})]</i><br /><br /> or <br /><br /><i>[htmlentities({my/xpath})]</i><br /><br /> to decode or encode HTML in your file.">?</a>
|
91 |
</div>
|
92 |
</div>
|
93 |
</div>
|
@@ -139,15 +139,15 @@
|
|
139 |
|
140 |
<p style="margin: 11px; float: left;">
|
141 |
<input type="checkbox" id="save_template_as" name="save_template_as" class="switcher-horizontal fix_checkbox" value="1" <?php echo ( ! empty($post['save_template_as'])) ? 'checked="checked"' : '' ?> />
|
142 |
-
<label for="save_template_as"><?php _e('Save settings as a template','
|
143 |
</p>
|
144 |
<div class="switcher-target-save_template_as" style="float: left;">
|
145 |
-
<input type="text" name="name" placeholder="<?php _e('Template name...', '
|
146 |
</div>
|
147 |
<?php $templates = new PMXI_Template_List(); ?>
|
148 |
<div class="load-template">
|
149 |
<select name="load_template" id="load_template" style="padding:2px; width: auto; height: 40px;">
|
150 |
-
<option value=""><?php _e('Load Template...', '
|
151 |
<?php foreach ($templates->getBy()->convertRecords() as $t): ?>
|
152 |
<option value="<?php echo $t->id ?>"><?php echo $t->name ?></option>
|
153 |
<?php endforeach ?>
|
@@ -162,19 +162,21 @@
|
|
162 |
|
163 |
<div style="text-align:center; width:100%;">
|
164 |
<?php wp_nonce_field('template', '_wpnonce_template'); ?>
|
|
|
165 |
<input type="hidden" name="is_submitted" value="1" />
|
|
|
166 |
|
167 |
<?php if ($this->isWizard):?>
|
168 |
-
<a href="<?php echo add_query_arg('action', 'element', $this->baseUrl) ?>" class="back rad3" style="float:none;"><?php _e('Back to Step 2', '
|
169 |
<?php else: ?>
|
170 |
-
<a href="<?php echo remove_query_arg('id', remove_query_arg('action', $this->baseUrl)); ?>" class="back rad3" style="float:none;"><?php _e('Back to Manage Imports', '
|
171 |
<?php endif; ?>
|
172 |
-
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e( ($this->isWizard) ? 'Continue to Step 4' : 'Update Template', '
|
173 |
</div>
|
174 |
|
175 |
</div>
|
176 |
|
177 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
178 |
|
179 |
</td>
|
180 |
<?php if ($this->isWizard or $this->isTemplateEdit): ?>
|
6 |
<div class="wpallimport-header">
|
7 |
<div class="wpallimport-logo"></div>
|
8 |
<div class="wpallimport-title">
|
9 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
10 |
+
<h2><?php _e('Import XML / CSV', 'wp_all_import_plugin'); ?></h2>
|
11 |
</div>
|
12 |
<div class="wpallimport-links">
|
13 |
+
<a href="http://www.wpallimport.com/support/" target="_blank"><?php _e('Support', 'wp_all_import_plugin'); ?></a> | <a href="http://www.wpallimport.com/documentation/" target="_blank"><?php _e('Documentation', 'wp_all_import_plugin'); ?></a>
|
14 |
</div>
|
15 |
</div>
|
16 |
<div class="clear"></div>
|
38 |
<div class="wpallimport-collapsed wpallimport-section">
|
39 |
<div class="wpallimport-content-section" style="overflow: hidden; padding-bottom: 0;">
|
40 |
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
41 |
+
<h3><?php _e('Title & Content', 'wp_all_import_plugin'); ?></h3>
|
42 |
</div>
|
43 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
44 |
|
45 |
<div style="padding: 15px 25px 65px;">
|
46 |
<div id="titlediv" style="margin-bottom:20px;">
|
47 |
<div id="titlewrap">
|
48 |
+
<input id="wpallimport-title" class="widefat" type="text" name="title" value="<?php echo esc_attr($post['title']) ?>" placeholder="<?php _e('Drag & drop any element on the right to set the title.', 'wp_all_import_plugin'); ?>"/>
|
49 |
</div>
|
50 |
</div>
|
51 |
|
64 |
|
65 |
<?php if ($post_type != 'page'):?>
|
66 |
<div class="template_input">
|
67 |
+
<input type="text" name="post_excerpt" style="width:100%; line-height: 25px;" value="<?php echo esc_attr($post['post_excerpt']) ?>" placeholder="<?php echo ($post_type == 'product' and class_exists('PMWI_Plugin')) ? __('WooCommerce Short Description', 'wp_all_import_plugin') : __('Excerpt', 'wp_all_import_plugin'); ?>"/>
|
68 |
</div>
|
69 |
<?php endif; ?>
|
70 |
|
71 |
+
<a class="preview" href="javascript:void(0);" rel="preview"><?php _e('Preview', 'wp_all_import_plugin'); ?></a>
|
72 |
</div>
|
73 |
|
74 |
<div class="wpallimport-collapsed closed wpallimport-section">
|
75 |
<div class="wpallimport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2;">
|
76 |
<div class="wpallimport-collapsed-header">
|
77 |
+
<h3 style="color:#40acad;"><?php _e('Advanced Options','wp_all_import_plugin');?></h3>
|
78 |
</div>
|
79 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
80 |
<div class="wpallimport-collapsed-content-inner">
|
81 |
<div class="input pmxi_option">
|
82 |
<input type="hidden" name="is_keep_linebreaks" value="0" />
|
83 |
<input type="checkbox" id="is_keep_linebreaks" name="is_keep_linebreaks" class="fix_checkbox" value="1" <?php echo $post['is_keep_linebreaks'] ? 'checked="checked"' : '' ?> />
|
84 |
+
<label for="is_keep_linebreaks"><?php _e('Keep line breaks from file', 'wp_all_import_plugin') ?></label>
|
85 |
</div>
|
86 |
<div class="input pmxi_option">
|
87 |
<input type="hidden" name="is_leave_html" value="0" />
|
88 |
<input type="checkbox" id="is_leave_html" name="is_leave_html" class="fix_checkbox" value="1" <?php echo $post['is_leave_html'] ? 'checked="checked"' : '' ?> style="position:relative;"/>
|
89 |
+
<label for="is_leave_html"><?php _e('Decode HTML entities with <b>html_entity_decode</b>', 'wp_all_import_plugin') ?></label>
|
90 |
+
<a class="wpallimport-help" href="#help" style="position:relative; top:1px;" original-title="If HTML code is showing up in your posts, use this option. You can also use <br /><br /><i>[html_entity_decode({my/xpath})]</i><br /><br /> or <br /><br /><i>[htmlentities({my/xpath})]</i><br /><br /> or <br /><br /><i>[htmlspecialchars_decode({my/xpath})]</i><br /><br /> to decode or encode HTML in your file.">?</a>
|
91 |
</div>
|
92 |
</div>
|
93 |
</div>
|
139 |
|
140 |
<p style="margin: 11px; float: left;">
|
141 |
<input type="checkbox" id="save_template_as" name="save_template_as" class="switcher-horizontal fix_checkbox" value="1" <?php echo ( ! empty($post['save_template_as'])) ? 'checked="checked"' : '' ?> />
|
142 |
+
<label for="save_template_as"><?php _e('Save settings as a template','wp_all_import_plugin');?></label>
|
143 |
</p>
|
144 |
<div class="switcher-target-save_template_as" style="float: left;">
|
145 |
+
<input type="text" name="name" placeholder="<?php _e('Template name...', 'wp_all_import_plugin') ?>" style="vertical-align:middle; line-height: 26px;" value="<?php echo esc_attr($post['name']) ?>" />
|
146 |
</div>
|
147 |
<?php $templates = new PMXI_Template_List(); ?>
|
148 |
<div class="load-template">
|
149 |
<select name="load_template" id="load_template" style="padding:2px; width: auto; height: 40px;">
|
150 |
+
<option value=""><?php _e('Load Template...', 'wp_all_import_plugin') ?></option>
|
151 |
<?php foreach ($templates->getBy()->convertRecords() as $t): ?>
|
152 |
<option value="<?php echo $t->id ?>"><?php echo $t->name ?></option>
|
153 |
<?php endforeach ?>
|
162 |
|
163 |
<div style="text-align:center; width:100%;">
|
164 |
<?php wp_nonce_field('template', '_wpnonce_template'); ?>
|
165 |
+
|
166 |
<input type="hidden" name="is_submitted" value="1" />
|
167 |
+
<input type="hidden" name="security" value="<?php echo wp_create_nonce( "wp_all_import_preview" ); ?>" />
|
168 |
|
169 |
<?php if ($this->isWizard):?>
|
170 |
+
<a href="<?php echo add_query_arg('action', 'element', $this->baseUrl) ?>" class="back rad3" style="float:none;"><?php _e('Back to Step 2', 'wp_all_import_plugin') ?></a>
|
171 |
<?php else: ?>
|
172 |
+
<a href="<?php echo remove_query_arg('id', remove_query_arg('action', $this->baseUrl)); ?>" class="back rad3" style="float:none;"><?php _e('Back to Manage Imports', 'wp_all_import_plugin') ?></a>
|
173 |
<?php endif; ?>
|
174 |
+
<input type="submit" class="button button-primary button-hero wpallimport-large-button" value="<?php _e( ($this->isWizard) ? 'Continue to Step 4' : 'Update Template', 'wp_all_import_plugin') ?>" />
|
175 |
</div>
|
176 |
|
177 |
</div>
|
178 |
|
179 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
180 |
|
181 |
</td>
|
182 |
<?php if ($this->isWizard or $this->isTemplateEdit): ?>
|
views/admin/import/template/_custom_fields_template.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<div class="wpallimport-collapsed closed wpallimport-section wpallimport-custom-fields">
|
3 |
<div class="wpallimport-content-section">
|
4 |
<div class="wpallimport-collapsed-header">
|
5 |
-
<h3><?php _e('Custom Fields','
|
6 |
</div>
|
7 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
8 |
<div class="wpallimport-collapsed-content-inner">
|
@@ -15,21 +15,21 @@
|
|
15 |
<?php if (empty($post['custom_name'])): ?>
|
16 |
<div class="input cf_welcome">
|
17 |
<?php if ( ! empty($meta_keys) ):?>
|
18 |
-
<h1 style="font-size:23px; color:#40acad;"><?php printf(__('Your website is using Custom Fields to store data for %s.', '
|
19 |
-
<a class="autodetect_cf auto_detect_cf" href="javascript:void(0);" rel="auto_detect_cf"><?php _e('See Detected Fields', '
|
20 |
<?php else: ?>
|
21 |
-
<h1 style="font-size:23px; color:#40acad;"><?php printf(__('No Custom Fields are present in your database for %s.', '
|
22 |
-
<p class="wpallimport-note"><?php printf(__('Manually create a %s, and fill out each field you want to import data to. WP All Import will then display these fields as available for import below.', '
|
23 |
<?php endif;?>
|
24 |
-
<a href="javascript:void(0);" class="wpallimport-dismiss-cf-welcome"><?php _e('Hide Notice', '
|
25 |
</div>
|
26 |
<div class="input cf_detect_result" style="display:none;">
|
27 |
<h1 style="font-size:23px; color:#40acad;">
|
28 |
<span class="cf_detected"></span>
|
29 |
-
<a class="autodetect_cf clear_detected_cf" href="javascript:void(0);" rel="clear_detected_cf"><?php _e('Clear All Fields', '
|
30 |
</h1>
|
31 |
-
<p class="wpallimport-note"><?php printf(__('If not all fields were detected, manually create a %s, and fill out each field you want to import data to. Then create a new import, and WP All Import will display these fields as available for import below.', '
|
32 |
-
<a href="javascript:void(0);" class="wpallimport-dismiss-cf-welcome"><?php _e('Hide Notice', '
|
33 |
</div>
|
34 |
<?php endif; ?>
|
35 |
<table class="form-table wpallimport-custom-fields-list" style="max-width:none;">
|
@@ -39,8 +39,8 @@
|
|
39 |
<table class="form-table custom-params" style="max-width:none; border:none;">
|
40 |
<thead>
|
41 |
<tr>
|
42 |
-
<td style="padding-bottom:10px;"><?php _e('Name', '
|
43 |
-
<td style="padding-bottom:10px;"><?php _e('Value', '
|
44 |
</tr>
|
45 |
</thead>
|
46 |
<tbody>
|
@@ -55,15 +55,15 @@
|
|
55 |
<td class="action">
|
56 |
<div class="custom_type" rel="default">
|
57 |
<textarea name="custom_value[]" class="widefat" <?php echo ( ! empty($post['custom_format'][$i]) ) ? 'style="display:none;"' : ''; ?>><?php echo esc_html($post['custom_value'][$i]) ?></textarea>
|
58 |
-
<a class="specify_cf pmxi_cf_pointer" rel="serialized_<?php echo $i; ?>" href="javascript:void(0);" <?php echo ( empty($post['custom_format'][$i]) ) ? 'style="display:none;"' : ''; ?>><?php _e('Click to specify', '
|
59 |
<div class="input wpallimport-custom-fields-actions">
|
60 |
-
<a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', '
|
61 |
<ul id="wpallimport-cf-menu-<?php echo $i;?>" class="wpallimport-cf-menu">
|
62 |
<li class="<?php echo ( ! empty($post['custom_format'][$i]) ) ? 'active' : ''; ?>">
|
63 |
-
<a href="javascript:void(0);" class="set_serialize"><?php _e('Serialized', '
|
64 |
</li>
|
65 |
<li class="<?php echo ( ! empty($custom_mapping_rules) ) ? 'active' : ''; ?>">
|
66 |
-
<a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping" rel="cf_mapping_<?php echo $i; ?>"><?php _e('Mapping', '
|
67 |
</li>
|
68 |
</ul>
|
69 |
</div>
|
@@ -73,8 +73,8 @@
|
|
73 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="serialized_<?php echo $i; ?>">
|
74 |
<thead>
|
75 |
<tr>
|
76 |
-
<td><?php _e('Key', '
|
77 |
-
<td><?php _e('Value', '
|
78 |
<td> </td>
|
79 |
</tr>
|
80 |
</thead>
|
@@ -144,18 +144,18 @@
|
|
144 |
</tr>
|
145 |
<tr>
|
146 |
<td colspan="3">
|
147 |
-
<a href="javascript:void(0);" title="<?php _e('Add Custom Field', '
|
148 |
</td>
|
149 |
</tr>
|
150 |
<tr>
|
151 |
<td>
|
152 |
<div class="wrap" style="position:relative;">
|
153 |
-
<a class="save_popup auto_detect_sf" href="javascript:void(0);"><?php _e('Auto-Detect', '
|
154 |
</div>
|
155 |
</td>
|
156 |
<td colspan="2">
|
157 |
<div class="wrap" style="position:relative;">
|
158 |
-
<a class="save_popup save_sf" href="javascript:void(0);"><?php _e('Save', '
|
159 |
</div>
|
160 |
</td>
|
161 |
</tr>
|
@@ -170,8 +170,8 @@
|
|
170 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="cf_mapping_<?php echo $i; ?>">
|
171 |
<thead>
|
172 |
<tr>
|
173 |
-
<td><?php _e('In Your File', '
|
174 |
-
<td><?php _e('Translated To', '
|
175 |
<td> </td>
|
176 |
</tr>
|
177 |
</thead>
|
@@ -233,13 +233,13 @@
|
|
233 |
</tr>
|
234 |
<tr>
|
235 |
<td colspan="3">
|
236 |
-
<a href="javascript:void(0);" title="<?php _e('Add Another', '
|
237 |
</td>
|
238 |
</tr>
|
239 |
<tr>
|
240 |
<td colspan="3">
|
241 |
<div class="wrap" style="position:relative;">
|
242 |
-
<a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', '
|
243 |
</div>
|
244 |
</td>
|
245 |
</tr>
|
@@ -264,15 +264,15 @@
|
|
264 |
<td class="action">
|
265 |
<div class="custom_type" rel="default">
|
266 |
<textarea name="custom_value[]" class="widefat"></textarea>
|
267 |
-
<a class="specify_cf pmxi_cf_pointer" rel="serialized_0" href="javascript:void(0);" style="display:none;"><?php _e('Click to specify', '
|
268 |
<div class="input wpallimport-custom-fields-actions">
|
269 |
-
<a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', '
|
270 |
<ul id="wpallimport-cf-menu-0" class="wpallimport-cf-menu">
|
271 |
<li>
|
272 |
-
<a href="javascript:void(0);" class="set_serialize"><?php _e('Serialized', '
|
273 |
</li>
|
274 |
<li>
|
275 |
-
<a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping" rel="cf_mapping_0"><?php _e('Mapping', '
|
276 |
</li>
|
277 |
</ul>
|
278 |
</div>
|
@@ -282,8 +282,8 @@
|
|
282 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="serialized_0">
|
283 |
<thead>
|
284 |
<tr>
|
285 |
-
<td><?php _e('Key', '
|
286 |
-
<td><?php _e('Value', '
|
287 |
<td> </td>
|
288 |
</tr>
|
289 |
</thead>
|
@@ -304,7 +304,7 @@
|
|
304 |
<input type="text" class="serialized_key widefat" value="">
|
305 |
</td>
|
306 |
<td>
|
307 |
-
<input type="text" class="serialized_value widefat"
|
308 |
</td>
|
309 |
<td class="action remove">
|
310 |
<a href="#remove" style="right:-10px;"></a>
|
@@ -312,18 +312,18 @@
|
|
312 |
</tr>
|
313 |
<tr>
|
314 |
<td colspan="3">
|
315 |
-
<a href="javascript:void(0);" title="<?php _e('Add Another', '
|
316 |
</td>
|
317 |
</tr>
|
318 |
<tr>
|
319 |
<td>
|
320 |
<div class="wrap" style="position:relative;">
|
321 |
-
<a class="save_popup auto_detect_sf" href="javascript:void(0);"><?php _e('Auto-Detect', '
|
322 |
</div>
|
323 |
</td>
|
324 |
<td colspan="2">
|
325 |
<div class="wrap" style="position:relative;">
|
326 |
-
<a class="save_popup save_sf" href="javascript:void(0);"><?php _e('Save', '
|
327 |
</div>
|
328 |
</td>
|
329 |
</tr>
|
@@ -338,8 +338,8 @@
|
|
338 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="cf_mapping_0">
|
339 |
<thead>
|
340 |
<tr>
|
341 |
-
<td><?php _e('In Your File', '
|
342 |
-
<td><?php _e('Translated To', '
|
343 |
<td> </td>
|
344 |
</tr>
|
345 |
</thead>
|
@@ -360,7 +360,7 @@
|
|
360 |
<input type="text" class="mapping_from widefat" value="">
|
361 |
</td>
|
362 |
<td>
|
363 |
-
<input type="text" class="mapping_to widefat"
|
364 |
</td>
|
365 |
<td class="action remove">
|
366 |
<a href="#remove" style="right:-10px;"></a>
|
@@ -368,13 +368,13 @@
|
|
368 |
</tr>
|
369 |
<tr>
|
370 |
<td colspan="3">
|
371 |
-
<a href="javascript:void(0);" title="<?php _e('Add Another', '
|
372 |
</td>
|
373 |
</tr>
|
374 |
<tr>
|
375 |
<td colspan="3">
|
376 |
<div class="wrap" style="position:relative;">
|
377 |
-
<a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', '
|
378 |
</div>
|
379 |
</td>
|
380 |
</tr>
|
@@ -398,15 +398,15 @@
|
|
398 |
<td class="action">
|
399 |
<div class="custom_type" rel="default">
|
400 |
<textarea name="custom_value[]" class="widefat"></textarea>
|
401 |
-
<a class="specify_cf pmxi_cf_pointer" href="javascript:void(0);" style="display:none;"><?php _e('Click to specify', '
|
402 |
<div class="input wpallimport-custom-fields-actions">
|
403 |
-
<a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', '
|
404 |
<ul class="wpallimport-cf-menu">
|
405 |
<li>
|
406 |
-
<a href="javascript:void(0);" class="set_serialize"><?php _e('Serialized', '
|
407 |
</li>
|
408 |
<li>
|
409 |
-
<a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping"><?php _e('Mapping', '
|
410 |
</li>
|
411 |
</ul>
|
412 |
</div>
|
@@ -416,8 +416,8 @@
|
|
416 |
<table cellpadding="0" cellspacing="5" class="cf-form-table">
|
417 |
<thead>
|
418 |
<tr>
|
419 |
-
<td><?php _e('Key', '
|
420 |
-
<td><?php _e('Value', '
|
421 |
<td> </td>
|
422 |
</tr>
|
423 |
</thead>
|
@@ -446,18 +446,18 @@
|
|
446 |
</tr>
|
447 |
<tr>
|
448 |
<td colspan="3">
|
449 |
-
<a href="javascript:void(0);" title="<?php _e('Add Another', '
|
450 |
</td>
|
451 |
</tr>
|
452 |
<tr>
|
453 |
<td>
|
454 |
<div class="wrap" style="position:relative;">
|
455 |
-
<a class="save_popup auto_detect_sf" href="javascript:void(0);"><?php _e('Auto-Detect', '
|
456 |
</div>
|
457 |
</td>
|
458 |
<td colspan="2">
|
459 |
<div class="wrap" style="position:relative;">
|
460 |
-
<a class="save_popup save_sf" href="javascript:void(0);"><?php _e('Save', '
|
461 |
</div>
|
462 |
</td>
|
463 |
</tr>
|
@@ -472,8 +472,8 @@
|
|
472 |
<table cellpadding="0" cellspacing="5" class="cf-form-table">
|
473 |
<thead>
|
474 |
<tr>
|
475 |
-
<td><?php _e('In Your File', '
|
476 |
-
<td><?php _e('Translated To', '
|
477 |
<td> </td>
|
478 |
</tr>
|
479 |
</thead>
|
@@ -502,13 +502,13 @@
|
|
502 |
</tr>
|
503 |
<tr>
|
504 |
<td colspan="3">
|
505 |
-
<a href="javascript:void(0);" title="<?php _e('Add Another', '
|
506 |
</td>
|
507 |
</tr>
|
508 |
<tr>
|
509 |
<td colspan="3">
|
510 |
<div class="wrap" style="position:relative;">
|
511 |
-
<a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', '
|
512 |
</div>
|
513 |
</td>
|
514 |
</tr>
|
@@ -524,7 +524,7 @@
|
|
524 |
</td>
|
525 |
</tr>
|
526 |
<tr>
|
527 |
-
<td colspan="2"><a href="javascript:void(0);" title="<?php _e('Add Custom Field', '
|
528 |
</tr>
|
529 |
</tbody>
|
530 |
</table>
|
2 |
<div class="wpallimport-collapsed closed wpallimport-section wpallimport-custom-fields">
|
3 |
<div class="wpallimport-content-section">
|
4 |
<div class="wpallimport-collapsed-header">
|
5 |
+
<h3><?php _e('Custom Fields','wp_all_import_plugin');?></h3>
|
6 |
</div>
|
7 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
8 |
<div class="wpallimport-collapsed-content-inner">
|
15 |
<?php if (empty($post['custom_name'])): ?>
|
16 |
<div class="input cf_welcome">
|
17 |
<?php if ( ! empty($meta_keys) ):?>
|
18 |
+
<h1 style="font-size:23px; color:#40acad;"><?php printf(__('Your website is using Custom Fields to store data for %s.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></h1>
|
19 |
+
<a class="autodetect_cf auto_detect_cf" href="javascript:void(0);" rel="auto_detect_cf"><?php _e('See Detected Fields', 'wp_all_import_plugin'); ?></a>
|
20 |
<?php else: ?>
|
21 |
+
<h1 style="font-size:23px; color:#40acad;"><?php printf(__('No Custom Fields are present in your database for %s.', 'wp_all_import_plugin'), $custom_type->labels->name); ?></h1>
|
22 |
+
<p class="wpallimport-note"><?php printf(__('Manually create a %s, and fill out each field you want to import data to. WP All Import will then display these fields as available for import below.', 'wp_all_import_plugin'), $custom_type->labels->singular_name); ?></p>
|
23 |
<?php endif;?>
|
24 |
+
<a href="javascript:void(0);" class="wpallimport-dismiss-cf-welcome"><?php _e('Hide Notice', 'wp_all_import_plugin'); ?></a>
|
25 |
</div>
|
26 |
<div class="input cf_detect_result" style="display:none;">
|
27 |
<h1 style="font-size:23px; color:#40acad;">
|
28 |
<span class="cf_detected"></span>
|
29 |
+
<a class="autodetect_cf clear_detected_cf" href="javascript:void(0);" rel="clear_detected_cf"><?php _e('Clear All Fields', 'wp_all_import_plugin'); ?></a>
|
30 |
</h1>
|
31 |
+
<p class="wpallimport-note"><?php printf(__('If not all fields were detected, manually create a %s, and fill out each field you want to import data to. Then create a new import, and WP All Import will display these fields as available for import below.', 'wp_all_import_plugin'), $custom_type->labels->singular_name); ?></p>
|
32 |
+
<a href="javascript:void(0);" class="wpallimport-dismiss-cf-welcome"><?php _e('Hide Notice', 'wp_all_import_plugin'); ?></a>
|
33 |
</div>
|
34 |
<?php endif; ?>
|
35 |
<table class="form-table wpallimport-custom-fields-list" style="max-width:none;">
|
39 |
<table class="form-table custom-params" style="max-width:none; border:none;">
|
40 |
<thead>
|
41 |
<tr>
|
42 |
+
<td style="padding-bottom:10px;"><?php _e('Name', 'wp_all_import_plugin') ?></td>
|
43 |
+
<td style="padding-bottom:10px;"><?php _e('Value', 'wp_all_import_plugin') ?></td>
|
44 |
</tr>
|
45 |
</thead>
|
46 |
<tbody>
|
55 |
<td class="action">
|
56 |
<div class="custom_type" rel="default">
|
57 |
<textarea name="custom_value[]" class="widefat" <?php echo ( ! empty($post['custom_format'][$i]) ) ? 'style="display:none;"' : ''; ?>><?php echo esc_html($post['custom_value'][$i]) ?></textarea>
|
58 |
+
<a class="specify_cf pmxi_cf_pointer" rel="serialized_<?php echo $i; ?>" href="javascript:void(0);" <?php echo ( empty($post['custom_format'][$i]) ) ? 'style="display:none;"' : ''; ?>><?php _e('Click to specify', 'wp_all_import_plugin'); ?></a>
|
59 |
<div class="input wpallimport-custom-fields-actions">
|
60 |
+
<a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', 'wp_all_import_plugin'); ?></a>
|
61 |
<ul id="wpallimport-cf-menu-<?php echo $i;?>" class="wpallimport-cf-menu">
|
62 |
<li class="<?php echo ( ! empty($post['custom_format'][$i]) ) ? 'active' : ''; ?>">
|
63 |
+
<a href="javascript:void(0);" class="set_serialize"><?php _e('Serialized', 'wp_all_import_plugin'); ?></a>
|
64 |
</li>
|
65 |
<li class="<?php echo ( ! empty($custom_mapping_rules) ) ? 'active' : ''; ?>">
|
66 |
+
<a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping" rel="cf_mapping_<?php echo $i; ?>"><?php _e('Mapping', 'wp_all_import_plugin'); ?></a>
|
67 |
</li>
|
68 |
</ul>
|
69 |
</div>
|
73 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="serialized_<?php echo $i; ?>">
|
74 |
<thead>
|
75 |
<tr>
|
76 |
+
<td><?php _e('Key', 'wp_all_import_plugin') ?></td>
|
77 |
+
<td><?php _e('Value', 'wp_all_import_plugin') ?></td>
|
78 |
<td> </td>
|
79 |
</tr>
|
80 |
</thead>
|
144 |
</tr>
|
145 |
<tr>
|
146 |
<td colspan="3">
|
147 |
+
<a href="javascript:void(0);" title="<?php _e('Add Custom Field', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
148 |
</td>
|
149 |
</tr>
|
150 |
<tr>
|
151 |
<td>
|
152 |
<div class="wrap" style="position:relative;">
|
153 |
+
<a class="save_popup auto_detect_sf" href="javascript:void(0);"><?php _e('Auto-Detect', 'wp_all_import_plugin'); ?></a>
|
154 |
</div>
|
155 |
</td>
|
156 |
<td colspan="2">
|
157 |
<div class="wrap" style="position:relative;">
|
158 |
+
<a class="save_popup save_sf" href="javascript:void(0);"><?php _e('Save', 'wp_all_import_plugin'); ?></a>
|
159 |
</div>
|
160 |
</td>
|
161 |
</tr>
|
170 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="cf_mapping_<?php echo $i; ?>">
|
171 |
<thead>
|
172 |
<tr>
|
173 |
+
<td><?php _e('In Your File', 'wp_all_import_plugin') ?></td>
|
174 |
+
<td><?php _e('Translated To', 'wp_all_import_plugin') ?></td>
|
175 |
<td> </td>
|
176 |
</tr>
|
177 |
</thead>
|
233 |
</tr>
|
234 |
<tr>
|
235 |
<td colspan="3">
|
236 |
+
<a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
237 |
</td>
|
238 |
</tr>
|
239 |
<tr>
|
240 |
<td colspan="3">
|
241 |
<div class="wrap" style="position:relative;">
|
242 |
+
<a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', 'wp_all_import_plugin'); ?></a>
|
243 |
</div>
|
244 |
</td>
|
245 |
</tr>
|
264 |
<td class="action">
|
265 |
<div class="custom_type" rel="default">
|
266 |
<textarea name="custom_value[]" class="widefat"></textarea>
|
267 |
+
<a class="specify_cf pmxi_cf_pointer" rel="serialized_0" href="javascript:void(0);" style="display:none;"><?php _e('Click to specify', 'wp_all_import_plugin'); ?></a>
|
268 |
<div class="input wpallimport-custom-fields-actions">
|
269 |
+
<a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', 'wp_all_import_plugin'); ?></a>
|
270 |
<ul id="wpallimport-cf-menu-0" class="wpallimport-cf-menu">
|
271 |
<li>
|
272 |
+
<a href="javascript:void(0);" class="set_serialize"><?php _e('Serialized', 'wp_all_import_plugin'); ?></a>
|
273 |
</li>
|
274 |
<li>
|
275 |
+
<a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping" rel="cf_mapping_0"><?php _e('Mapping', 'wp_all_import_plugin'); ?></a>
|
276 |
</li>
|
277 |
</ul>
|
278 |
</div>
|
282 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="serialized_0">
|
283 |
<thead>
|
284 |
<tr>
|
285 |
+
<td><?php _e('Key', 'wp_all_import_plugin') ?></td>
|
286 |
+
<td><?php _e('Value', 'wp_all_import_plugin') ?></td>
|
287 |
<td> </td>
|
288 |
</tr>
|
289 |
</thead>
|
304 |
<input type="text" class="serialized_key widefat" value="">
|
305 |
</td>
|
306 |
<td>
|
307 |
+
<input type="text" class="serialized_value widefat"value="">
|
308 |
</td>
|
309 |
<td class="action remove">
|
310 |
<a href="#remove" style="right:-10px;"></a>
|
312 |
</tr>
|
313 |
<tr>
|
314 |
<td colspan="3">
|
315 |
+
<a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
316 |
</td>
|
317 |
</tr>
|
318 |
<tr>
|
319 |
<td>
|
320 |
<div class="wrap" style="position:relative;">
|
321 |
+
<a class="save_popup auto_detect_sf" href="javascript:void(0);"><?php _e('Auto-Detect', 'wp_all_import_plugin'); ?></a>
|
322 |
</div>
|
323 |
</td>
|
324 |
<td colspan="2">
|
325 |
<div class="wrap" style="position:relative;">
|
326 |
+
<a class="save_popup save_sf" href="javascript:void(0);"><?php _e('Save', 'wp_all_import_plugin'); ?></a>
|
327 |
</div>
|
328 |
</td>
|
329 |
</tr>
|
338 |
<table cellpadding="0" cellspacing="5" class="cf-form-table" rel="cf_mapping_0">
|
339 |
<thead>
|
340 |
<tr>
|
341 |
+
<td><?php _e('In Your File', 'wp_all_import_plugin') ?></td>
|
342 |
+
<td><?php _e('Translated To', 'wp_all_import_plugin') ?></td>
|
343 |
<td> </td>
|
344 |
</tr>
|
345 |
</thead>
|
360 |
<input type="text" class="mapping_from widefat" value="">
|
361 |
</td>
|
362 |
<td>
|
363 |
+
<input type="text" class="mapping_to widefat"value="">
|
364 |
</td>
|
365 |
<td class="action remove">
|
366 |
<a href="#remove" style="right:-10px;"></a>
|
368 |
</tr>
|
369 |
<tr>
|
370 |
<td colspan="3">
|
371 |
+
<a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
372 |
</td>
|
373 |
</tr>
|
374 |
<tr>
|
375 |
<td colspan="3">
|
376 |
<div class="wrap" style="position:relative;">
|
377 |
+
<a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', 'wp_all_import_plugin'); ?></a>
|
378 |
</div>
|
379 |
</td>
|
380 |
</tr>
|
398 |
<td class="action">
|
399 |
<div class="custom_type" rel="default">
|
400 |
<textarea name="custom_value[]" class="widefat"></textarea>
|
401 |
+
<a class="specify_cf pmxi_cf_pointer" href="javascript:void(0);" style="display:none;"><?php _e('Click to specify', 'wp_all_import_plugin'); ?></a>
|
402 |
<div class="input wpallimport-custom-fields-actions">
|
403 |
+
<a href="javascript:void(0);" class="wpallimport-cf-options"><?php _e('Field Options...', 'wp_all_import_plugin'); ?></a>
|
404 |
<ul class="wpallimport-cf-menu">
|
405 |
<li>
|
406 |
+
<a href="javascript:void(0);" class="set_serialize"><?php _e('Serialized', 'wp_all_import_plugin'); ?></a>
|
407 |
</li>
|
408 |
<li>
|
409 |
+
<a href="javascript:void(0);" class="set_mapping pmxi_cf_mapping"><?php _e('Mapping', 'wp_all_import_plugin'); ?></a>
|
410 |
</li>
|
411 |
</ul>
|
412 |
</div>
|
416 |
<table cellpadding="0" cellspacing="5" class="cf-form-table">
|
417 |
<thead>
|
418 |
<tr>
|
419 |
+
<td><?php _e('Key', 'wp_all_import_plugin') ?></td>
|
420 |
+
<td><?php _e('Value', 'wp_all_import_plugin') ?></td>
|
421 |
<td> </td>
|
422 |
</tr>
|
423 |
</thead>
|
446 |
</tr>
|
447 |
<tr>
|
448 |
<td colspan="3">
|
449 |
+
<a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin'); ?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
450 |
</td>
|
451 |
</tr>
|
452 |
<tr>
|
453 |
<td>
|
454 |
<div class="wrap" style="position:relative;">
|
455 |
+
<a class="save_popup auto_detect_sf" href="javascript:void(0);"><?php _e('Auto-Detect', 'wp_all_import_plugin'); ?></a>
|
456 |
</div>
|
457 |
</td>
|
458 |
<td colspan="2">
|
459 |
<div class="wrap" style="position:relative;">
|
460 |
+
<a class="save_popup save_sf" href="javascript:void(0);"><?php _e('Save', 'wp_all_import_plugin'); ?></a>
|
461 |
</div>
|
462 |
</td>
|
463 |
</tr>
|
472 |
<table cellpadding="0" cellspacing="5" class="cf-form-table">
|
473 |
<thead>
|
474 |
<tr>
|
475 |
+
<td><?php _e('In Your File', 'wp_all_import_plugin') ?></td>
|
476 |
+
<td><?php _e('Translated To', 'wp_all_import_plugin') ?></td>
|
477 |
<td> </td>
|
478 |
</tr>
|
479 |
</thead>
|
502 |
</tr>
|
503 |
<tr>
|
504 |
<td colspan="3">
|
505 |
+
<a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
506 |
</td>
|
507 |
</tr>
|
508 |
<tr>
|
509 |
<td colspan="3">
|
510 |
<div class="wrap" style="position:relative;">
|
511 |
+
<a class="save_popup save_mr" href="javascript:void(0);"><?php _e('Save Rules', 'wp_all_import_plugin'); ?></a>
|
512 |
</div>
|
513 |
</td>
|
514 |
</tr>
|
524 |
</td>
|
525 |
</tr>
|
526 |
<tr>
|
527 |
+
<td colspan="2"><a href="javascript:void(0);" title="<?php _e('Add Custom Field', 'wp_all_import_plugin')?>" class="action add-new-custom add-new-entry"><?php _e('Add Custom Field', 'wp_all_import_plugin') ?></a></td>
|
528 |
</tr>
|
529 |
</tbody>
|
530 |
</table>
|
views/admin/import/template/_featured_template.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<div class="wpallimport-collapsed closed wpallimport-section wpallimport-featured-images">
|
2 |
<div class="wpallimport-content-section" style="padding-bottom: 0;">
|
3 |
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
4 |
-
<h3><?php _e('Images','
|
5 |
</div>
|
6 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
7 |
<div class="wpallimport-collapsed-content-inner">
|
@@ -12,7 +12,6 @@
|
|
12 |
</div>
|
13 |
|
14 |
<?php endif; ?>
|
15 |
-
|
16 |
<table class="form-table" style="max-width:none;">
|
17 |
<tr>
|
18 |
<td colspan="3">
|
@@ -20,36 +19,41 @@
|
|
20 |
<div class="input">
|
21 |
<input type="radio" name="download_images" value="yes" class="switcher" id="download_images_yes" <?php echo ("yes" == $post['download_images']) ? 'checked="checked"' : '';?>/>
|
22 |
<label for="download_images_yes"><?php _e('Download image(s) hosted elsewhere'); ?></label>
|
23 |
-
<a href="#help" class="wpallimport-help" title="<?php _e('http:// or https://', '
|
24 |
</div>
|
25 |
<div class="switcher-target-download_images_yes" style="padding-left:27px;">
|
26 |
-
<label for="download_featured_delim"><?php _e('Enter image URL one per line, or separate them with a ', '
|
27 |
-
<input type="text" class="small" id="download_featured_delim" name="download_featured_delim" value="<?php echo esc_attr($post['download_featured_delim']) ?>" style="width:5%; text-align:center;"
|
28 |
<textarea name="download_featured_image" class="newline rad4" style="clear: both; display:block;" placeholder=""><?php echo esc_attr($post['download_featured_image']) ?></textarea>
|
29 |
</div>
|
30 |
<div class="input">
|
31 |
<?php $wp_uploads = wp_upload_dir(); ?>
|
32 |
<input type="radio" name="download_images" value="no" class="switcher" id="download_images_no" <?php echo ("yes" != $post['download_images']) ? 'checked="checked"' : '';?>/>
|
33 |
-
<label for="download_images_no"><?php printf(__('Use image(s) currently uploaded in %s
|
34 |
</div>
|
35 |
<div class="switcher-target-download_images_no" style="padding-left:27px;">
|
36 |
-
<label for="featured_delim"><?php _e('Enter image filenames one per line, or separate them with a ', '
|
37 |
<input type="text" class="small" id="featured_delim" name="featured_delim" value="<?php echo esc_attr($post['featured_delim']) ?>" style="width:5%; text-align:center;"/>
|
38 |
<textarea name="featured_image" class="newline rad4" style="clear: both; display:block; "><?php echo esc_attr($post['featured_image']) ?></textarea>
|
39 |
</div>
|
40 |
-
<a class="preview_images" href="javascript:void(0);" rel="preview_images"><?php _e('Preview & Test', '
|
|
|
|
|
|
|
|
|
|
|
41 |
</div>
|
42 |
-
<h4><?php _e('Featured Image', '
|
43 |
<div class="input" style="margin:3px 0px;">
|
44 |
<input type="hidden" name="is_featured" value="0" />
|
45 |
-
<input type="checkbox" id="is_featured" name="is_featured" value="1" <?php echo $post['is_featured'] ? 'checked="checked"' : '' ?> class="fix_checkbox"
|
46 |
-
<label for="is_featured"><?php _e('Set the first image to the Featured Image (_thumbnail_id)','
|
47 |
</div>
|
48 |
-
<h4><?php _e('Other', '
|
49 |
<div class="input">
|
50 |
<input type="hidden" name="create_draft" value="no" />
|
51 |
<input type="checkbox" id="create_draft" name="create_draft" value="yes" <?php echo 'yes' == $post['create_draft'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
52 |
-
<label for="create_draft"><?php _e('If no images are downloaded successfully, create entry as Draft.', '
|
53 |
</div>
|
54 |
</td>
|
55 |
</tr>
|
@@ -59,7 +63,7 @@
|
|
59 |
<div class="wpallimport-collapsed closed wpallimport-section">
|
60 |
<div class="wpallimport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2;">
|
61 |
<div class="wpallimport-collapsed-header">
|
62 |
-
<h3 style="color:#40acad;"><?php _e('SEO & Advanced Options','
|
63 |
</div>
|
64 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
65 |
<div class="wpallimport-collapsed-content-inner">
|
@@ -67,59 +71,59 @@
|
|
67 |
<table class="form-table" style="max-width:none;">
|
68 |
<tr>
|
69 |
<td colspan="3">
|
70 |
-
<h4><?php _e('Meta Data', '
|
71 |
<div class="input">
|
72 |
<input type="hidden" name="set_image_meta_title" value="0" />
|
73 |
<input type="checkbox" id="set_image_meta_title" name="set_image_meta_title" value="1" <?php echo $post['set_image_meta_title'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
74 |
-
<label for="set_image_meta_title"><?php _e('Set Title(s)','
|
75 |
<div class="switcher-target-set_image_meta_title" style="padding-left:23px;">
|
76 |
-
<label for="image_meta_title_delim"><?php _e('Enter one per line, or separate them with a ', '
|
77 |
-
<input type="text" class="small" id="image_meta_title_delim" name="image_meta_title_delim" value="<?php echo esc_attr($post['image_meta_title_delim']) ?>" style="width:5%; text-align:center;"
|
78 |
-
<p style="margin-bottom:5px;"><?php _e('The first title will be linked to the first image, the second title will be linked to the second image, ...', '
|
79 |
<textarea name="image_meta_title" class="newline rad4"><?php echo esc_attr($post['image_meta_title']) ?></textarea>
|
80 |
</div>
|
81 |
</div>
|
82 |
<div class="input">
|
83 |
<input type="hidden" name="set_image_meta_caption" value="0" />
|
84 |
<input type="checkbox" id="set_image_meta_caption" name="set_image_meta_caption" value="1" <?php echo $post['set_image_meta_caption'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
85 |
-
<label for="set_image_meta_caption"><?php _e('Set Caption(s)','
|
86 |
<div class="switcher-target-set_image_meta_caption" style="padding-left:23px;">
|
87 |
-
<label for="image_meta_caption_delim"><?php _e('Enter one per line, or separate them with a ', '
|
88 |
<input type="text" class="small" id="image_meta_caption_delim" name="image_meta_caption_delim" value="<?php echo esc_attr($post['image_meta_caption_delim']) ?>" style="width:5%; text-align:center;"/>
|
89 |
-
<p style="margin-bottom:5px;"><?php _e('The first caption will be linked to the first image, the second caption will be linked to the second image, ...', '
|
90 |
<textarea name="image_meta_caption" class="newline rad4"><?php echo esc_attr($post['image_meta_caption']) ?></textarea>
|
91 |
</div>
|
92 |
</div>
|
93 |
<div class="input">
|
94 |
<input type="hidden" name="set_image_meta_alt" value="0" />
|
95 |
<input type="checkbox" id="set_image_meta_alt" name="set_image_meta_alt" value="1" <?php echo $post['set_image_meta_alt'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
96 |
-
<label for="set_image_meta_alt"><?php _e('Set Alt Text(s)','
|
97 |
<div class="switcher-target-set_image_meta_alt" style="padding-left:23px;">
|
98 |
-
<label for="image_meta_alt_delim"><?php _e('Enter one per line, or separate them with a ', '
|
99 |
<input type="text" class="small" id="image_meta_alt_delim" name="image_meta_alt_delim" value="<?php echo esc_attr($post['image_meta_alt_delim']) ?>" style="width:5%; text-align:center;"/>
|
100 |
-
<p style="margin-bottom:5px;"><?php _e('The first alt text will be linked to the first image, the second alt text will be linked to the second image, ...', '
|
101 |
<textarea name="image_meta_alt" class="newline rad4"><?php echo esc_attr($post['image_meta_alt']) ?></textarea>
|
102 |
</div>
|
103 |
</div>
|
104 |
<div class="input">
|
105 |
<input type="hidden" name="set_image_meta_description" value="0" />
|
106 |
<input type="checkbox" id="set_image_meta_description" name="set_image_meta_description" value="1" <?php echo $post['set_image_meta_description'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
107 |
-
<label for="set_image_meta_description"><?php _e('Set Description(s)','
|
108 |
<div class="switcher-target-set_image_meta_description" style="padding-left:23px;">
|
109 |
-
<label for="image_meta_description_delim"><?php _e('Enter one per line, or separate them with a ', '
|
110 |
<input type="text" class="small" id="image_meta_description_delim" name="image_meta_description_delim" value="<?php echo esc_attr($post['image_meta_description_delim']) ?>" style="width:5%; text-align:center;"/>
|
111 |
-
<p style="margin-bottom:5px;"><?php _e('The first description will be linked to the first image, the second description will be linked to the second image, ...', '
|
112 |
<textarea name="image_meta_description" class="newline rad4"><?php echo esc_attr($post['image_meta_description']) ?></textarea>
|
113 |
</div>
|
114 |
</div>
|
115 |
|
116 |
-
<h4><?php _e('Files', '
|
117 |
<div id="advanced_options_files">
|
118 |
-
<p style="font-style:italic; display:none;"><?php _e('These options only available if Download image(s) hosted elsewhere is selected above.', '
|
119 |
<div class="input" style="margin:3px 0px;">
|
120 |
<input type="hidden" name="auto_rename_images" value="0" />
|
121 |
<input type="checkbox" id="auto_rename_images" name="auto_rename_images" value="1" <?php echo $post['auto_rename_images'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
122 |
-
<label for="auto_rename_images"><?php _e('Change image file names to','
|
123 |
<div class="input switcher-target-auto_rename_images" style="padding-left:23px;">
|
124 |
<input type="text" id="auto_rename_images_suffix" name="auto_rename_images_suffix" value="<?php echo esc_attr($post['auto_rename_images_suffix']) ?>" style="width:480px;"/>
|
125 |
<p class="note"><?php _e('Multiple image will have numbers appended, i.e. image-name-1.jpg, image-name-2.jpg '); ?></p>
|
@@ -128,7 +132,7 @@
|
|
128 |
<div class="input" style="margin:3px 0px;">
|
129 |
<input type="hidden" name="auto_set_extension" value="0" />
|
130 |
<input type="checkbox" id="auto_set_extension" name="auto_set_extension" value="1" <?php echo $post['auto_set_extension'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
131 |
-
<label for="auto_set_extension"><?php _e('Change image file extensions','
|
132 |
<div class="input switcher-target-auto_set_extension" style="padding-left:23px;">
|
133 |
<input type="text" id="new_extension" name="new_extension" value="<?php echo esc_attr($post['new_extension']) ?>" placeholder="jpg" style="width:480px;"/>
|
134 |
</div>
|
@@ -146,9 +150,9 @@
|
|
146 |
</div>
|
147 |
<div id="images_hints" style="display:none;">
|
148 |
<ul>
|
149 |
-
<li><?php _e('WP All Import will automatically ignore elements with blank image URLs/filenames.', '
|
150 |
-
<li><?php _e('WP All Import must download the images to your server. You can\'t have images in a Gallery that are referenced by external URL. That\'s just how WordPress works.', '
|
151 |
-
<li><?php printf(__('Importing a variable number of images can be done using a <a href="%s" target="_blank">FOREACH LOOP</a>', '
|
152 |
-
<li><?php printf(__('For more information check out our <a href="%s" target="_blank">comprehensive documentation</a>', '
|
153 |
</ul>
|
154 |
</div>
|
1 |
<div class="wpallimport-collapsed closed wpallimport-section wpallimport-featured-images">
|
2 |
<div class="wpallimport-content-section" style="padding-bottom: 0;">
|
3 |
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
4 |
+
<h3><?php _e('Images','wp_all_import_plugin');?></h3>
|
5 |
</div>
|
6 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
7 |
<div class="wpallimport-collapsed-content-inner">
|
12 |
</div>
|
13 |
|
14 |
<?php endif; ?>
|
|
|
15 |
<table class="form-table" style="max-width:none;">
|
16 |
<tr>
|
17 |
<td colspan="3">
|
19 |
<div class="input">
|
20 |
<input type="radio" name="download_images" value="yes" class="switcher" id="download_images_yes" <?php echo ("yes" == $post['download_images']) ? 'checked="checked"' : '';?>/>
|
21 |
<label for="download_images_yes"><?php _e('Download image(s) hosted elsewhere'); ?></label>
|
22 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('http:// or https://', 'wp_all_import_plugin') ?>" style="position: relative; top: -2px;">?</a>
|
23 |
</div>
|
24 |
<div class="switcher-target-download_images_yes" style="padding-left:27px;">
|
25 |
+
<label for="download_featured_delim"><?php _e('Enter image URL one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
26 |
+
<input type="text" class="small" id="download_featured_delim" name="download_featured_delim" value="<?php echo esc_attr($post['download_featured_delim']) ?>" style="width:5%; text-align:center;"/>
|
27 |
<textarea name="download_featured_image" class="newline rad4" style="clear: both; display:block;" placeholder=""><?php echo esc_attr($post['download_featured_image']) ?></textarea>
|
28 |
</div>
|
29 |
<div class="input">
|
30 |
<?php $wp_uploads = wp_upload_dir(); ?>
|
31 |
<input type="radio" name="download_images" value="no" class="switcher" id="download_images_no" <?php echo ("yes" != $post['download_images']) ? 'checked="checked"' : '';?>/>
|
32 |
+
<label for="download_images_no"><?php printf(__('Use image(s) currently uploaded in %s', 'wp_all_import_plugin'), $wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::FILES_DIRECTORY . DIRECTORY_SEPARATOR); ?></label>
|
33 |
</div>
|
34 |
<div class="switcher-target-download_images_no" style="padding-left:27px;">
|
35 |
+
<label for="featured_delim"><?php _e('Enter image filenames one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
36 |
<input type="text" class="small" id="featured_delim" name="featured_delim" value="<?php echo esc_attr($post['featured_delim']) ?>" style="width:5%; text-align:center;"/>
|
37 |
<textarea name="featured_image" class="newline rad4" style="clear: both; display:block; "><?php echo esc_attr($post['featured_image']) ?></textarea>
|
38 |
</div>
|
39 |
+
<a class="preview_images" href="javascript:void(0);" rel="preview_images"><?php _e('Preview & Test', 'wp_all_import_plugin'); ?></a>
|
40 |
+
</div>
|
41 |
+
<div class="input" style="margin:3px;">
|
42 |
+
<input type="hidden" name="search_existing_images" value="0" />
|
43 |
+
<input type="checkbox" id="search_existing_images" name="search_existing_images" value="1" <?php echo $post['search_existing_images'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
44 |
+
<label for="search_existing_images"><?php _e('Search for existing images through attachments','wp_all_import_plugin');?> </label>
|
45 |
</div>
|
46 |
+
<h4><?php _e('Featured Image', 'wp_all_import_plugin'); ?></h4>
|
47 |
<div class="input" style="margin:3px 0px;">
|
48 |
<input type="hidden" name="is_featured" value="0" />
|
49 |
+
<input type="checkbox" id="is_featured" name="is_featured" value="1" <?php echo $post['is_featured'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
50 |
+
<label for="is_featured"><?php _e('Set the first image to the Featured Image (_thumbnail_id)','wp_all_import_plugin');?> </label>
|
51 |
</div>
|
52 |
+
<h4><?php _e('Other', 'wp_all_import_plugin'); ?></h4>
|
53 |
<div class="input">
|
54 |
<input type="hidden" name="create_draft" value="no" />
|
55 |
<input type="checkbox" id="create_draft" name="create_draft" value="yes" <?php echo 'yes' == $post['create_draft'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
56 |
+
<label for="create_draft"><?php _e('If no images are downloaded successfully, create entry as Draft.', 'wp_all_import_plugin') ?></label>
|
57 |
</div>
|
58 |
</td>
|
59 |
</tr>
|
63 |
<div class="wpallimport-collapsed closed wpallimport-section">
|
64 |
<div class="wpallimport-content-section rad0" style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2;">
|
65 |
<div class="wpallimport-collapsed-header">
|
66 |
+
<h3 style="color:#40acad;"><?php _e('SEO & Advanced Options','wp_all_import_plugin');?></h3>
|
67 |
</div>
|
68 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
69 |
<div class="wpallimport-collapsed-content-inner">
|
71 |
<table class="form-table" style="max-width:none;">
|
72 |
<tr>
|
73 |
<td colspan="3">
|
74 |
+
<h4><?php _e('Meta Data', 'wp_all_import_plugin'); ?></h4>
|
75 |
<div class="input">
|
76 |
<input type="hidden" name="set_image_meta_title" value="0" />
|
77 |
<input type="checkbox" id="set_image_meta_title" name="set_image_meta_title" value="1" <?php echo $post['set_image_meta_title'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
78 |
+
<label for="set_image_meta_title"><?php _e('Set Title(s)','wp_all_import_plugin');?></label>
|
79 |
<div class="switcher-target-set_image_meta_title" style="padding-left:23px;">
|
80 |
+
<label for="image_meta_title_delim"><?php _e('Enter one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
81 |
+
<input type="text" class="small" id="image_meta_title_delim" name="image_meta_title_delim" value="<?php echo esc_attr($post['image_meta_title_delim']) ?>" style="width:5%; text-align:center;"/>
|
82 |
+
<p style="margin-bottom:5px;"><?php _e('The first title will be linked to the first image, the second title will be linked to the second image, ...', 'wp_all_import_plugin');?></p>
|
83 |
<textarea name="image_meta_title" class="newline rad4"><?php echo esc_attr($post['image_meta_title']) ?></textarea>
|
84 |
</div>
|
85 |
</div>
|
86 |
<div class="input">
|
87 |
<input type="hidden" name="set_image_meta_caption" value="0" />
|
88 |
<input type="checkbox" id="set_image_meta_caption" name="set_image_meta_caption" value="1" <?php echo $post['set_image_meta_caption'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
89 |
+
<label for="set_image_meta_caption"><?php _e('Set Caption(s)','wp_all_import_plugin');?></label>
|
90 |
<div class="switcher-target-set_image_meta_caption" style="padding-left:23px;">
|
91 |
+
<label for="image_meta_caption_delim"><?php _e('Enter one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
92 |
<input type="text" class="small" id="image_meta_caption_delim" name="image_meta_caption_delim" value="<?php echo esc_attr($post['image_meta_caption_delim']) ?>" style="width:5%; text-align:center;"/>
|
93 |
+
<p style="margin-bottom:5px;"><?php _e('The first caption will be linked to the first image, the second caption will be linked to the second image, ...', 'wp_all_import_plugin');?></p>
|
94 |
<textarea name="image_meta_caption" class="newline rad4"><?php echo esc_attr($post['image_meta_caption']) ?></textarea>
|
95 |
</div>
|
96 |
</div>
|
97 |
<div class="input">
|
98 |
<input type="hidden" name="set_image_meta_alt" value="0" />
|
99 |
<input type="checkbox" id="set_image_meta_alt" name="set_image_meta_alt" value="1" <?php echo $post['set_image_meta_alt'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
100 |
+
<label for="set_image_meta_alt"><?php _e('Set Alt Text(s)','wp_all_import_plugin');?></label>
|
101 |
<div class="switcher-target-set_image_meta_alt" style="padding-left:23px;">
|
102 |
+
<label for="image_meta_alt_delim"><?php _e('Enter one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
103 |
<input type="text" class="small" id="image_meta_alt_delim" name="image_meta_alt_delim" value="<?php echo esc_attr($post['image_meta_alt_delim']) ?>" style="width:5%; text-align:center;"/>
|
104 |
+
<p style="margin-bottom:5px;"><?php _e('The first alt text will be linked to the first image, the second alt text will be linked to the second image, ...', 'wp_all_import_plugin');?></p>
|
105 |
<textarea name="image_meta_alt" class="newline rad4"><?php echo esc_attr($post['image_meta_alt']) ?></textarea>
|
106 |
</div>
|
107 |
</div>
|
108 |
<div class="input">
|
109 |
<input type="hidden" name="set_image_meta_description" value="0" />
|
110 |
<input type="checkbox" id="set_image_meta_description" name="set_image_meta_description" value="1" <?php echo $post['set_image_meta_description'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
111 |
+
<label for="set_image_meta_description"><?php _e('Set Description(s)','wp_all_import_plugin');?></label>
|
112 |
<div class="switcher-target-set_image_meta_description" style="padding-left:23px;">
|
113 |
+
<label for="image_meta_description_delim"><?php _e('Enter one per line, or separate them with a ', 'wp_all_import_plugin');?></label>
|
114 |
<input type="text" class="small" id="image_meta_description_delim" name="image_meta_description_delim" value="<?php echo esc_attr($post['image_meta_description_delim']) ?>" style="width:5%; text-align:center;"/>
|
115 |
+
<p style="margin-bottom:5px;"><?php _e('The first description will be linked to the first image, the second description will be linked to the second image, ...', 'wp_all_import_plugin');?></p>
|
116 |
<textarea name="image_meta_description" class="newline rad4"><?php echo esc_attr($post['image_meta_description']) ?></textarea>
|
117 |
</div>
|
118 |
</div>
|
119 |
|
120 |
+
<h4><?php _e('Files', 'wp_all_import_plugin'); ?></h4>
|
121 |
<div id="advanced_options_files">
|
122 |
+
<p style="font-style:italic; display:none;"><?php _e('These options only available if Download image(s) hosted elsewhere is selected above.', 'wp_all_import_plugin'); ?></p>
|
123 |
<div class="input" style="margin:3px 0px;">
|
124 |
<input type="hidden" name="auto_rename_images" value="0" />
|
125 |
<input type="checkbox" id="auto_rename_images" name="auto_rename_images" value="1" <?php echo $post['auto_rename_images'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
126 |
+
<label for="auto_rename_images"><?php _e('Change image file names to','wp_all_import_plugin');?> </label>
|
127 |
<div class="input switcher-target-auto_rename_images" style="padding-left:23px;">
|
128 |
<input type="text" id="auto_rename_images_suffix" name="auto_rename_images_suffix" value="<?php echo esc_attr($post['auto_rename_images_suffix']) ?>" style="width:480px;"/>
|
129 |
<p class="note"><?php _e('Multiple image will have numbers appended, i.e. image-name-1.jpg, image-name-2.jpg '); ?></p>
|
132 |
<div class="input" style="margin:3px 0px;">
|
133 |
<input type="hidden" name="auto_set_extension" value="0" />
|
134 |
<input type="checkbox" id="auto_set_extension" name="auto_set_extension" value="1" <?php echo $post['auto_set_extension'] ? 'checked="checked"' : '' ?> class="switcher fix_checkbox"/>
|
135 |
+
<label for="auto_set_extension"><?php _e('Change image file extensions','wp_all_import_plugin');?> </label>
|
136 |
<div class="input switcher-target-auto_set_extension" style="padding-left:23px;">
|
137 |
<input type="text" id="new_extension" name="new_extension" value="<?php echo esc_attr($post['new_extension']) ?>" placeholder="jpg" style="width:480px;"/>
|
138 |
</div>
|
150 |
</div>
|
151 |
<div id="images_hints" style="display:none;">
|
152 |
<ul>
|
153 |
+
<li><?php _e('WP All Import will automatically ignore elements with blank image URLs/filenames.', 'wp_all_import_plugin'); ?></li>
|
154 |
+
<li><?php _e('WP All Import must download the images to your server. You can\'t have images in a Gallery that are referenced by external URL. That\'s just how WordPress works.', 'wp_all_import_plugin'); ?></li>
|
155 |
+
<li><?php printf(__('Importing a variable number of images can be done using a <a href="%s" target="_blank">FOREACH LOOP</a>', 'wp_all_import_plugin'), 'http://www.wpallimport.com/documentation/step-3/template-syntax/'); ?></li>
|
156 |
+
<li><?php printf(__('For more information check out our <a href="%s" target="_blank">comprehensive documentation</a>', 'wp_all_import_plugin'), 'http://www.wpallimport.com/documentation/'); ?></li>
|
157 |
</ul>
|
158 |
</div>
|
views/admin/import/template/_nested_template.php
CHANGED
@@ -25,14 +25,14 @@ $l10n = array(
|
|
25 |
|
26 |
?>
|
27 |
<script type="text/javascript">
|
28 |
-
var plugin_url = '<?php echo
|
29 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
30 |
</script>
|
31 |
|
32 |
<div class="wpallimport-collapsed closed nested_options wpallimport-section">
|
33 |
<div class="wpallimport-content-section">
|
34 |
<div class="wpallimport-collapsed-header">
|
35 |
-
<h3><?php _e('Nested XML/CSV files','
|
36 |
</div>
|
37 |
<div class="wpallimport-collapsed-content">
|
38 |
<table class="form-table" style="max-width:none;">
|
@@ -45,7 +45,7 @@ $l10n = array(
|
|
45 |
$nested_files = json_decode($post['nested_files'], true);
|
46 |
foreach ($nested_files as $key => $file) {
|
47 |
?>
|
48 |
-
<li rel="<?php echo $key;?>"><?php echo $file;?> <a href="javascript:void(0);" class="unmerge"><?php _e('remove', '
|
49 |
<?php
|
50 |
}?>
|
51 |
<?php endif; ?>
|
@@ -66,11 +66,11 @@ $l10n = array(
|
|
66 |
<div class="msgs"></div>
|
67 |
|
68 |
<div class="file-type-options">
|
69 |
-
<label><?php _e('Specify the URL of the nested file to use.', '
|
70 |
<input type="text" class="regular-text" name="nested_url" value="" style="width:100%; line-height:20px;" placeholder="http(s)://"/>
|
71 |
</div>
|
72 |
|
73 |
-
<a rel="parse" href="javascript:void(0);" class="parse"><?php _e('Add', '
|
74 |
</div>
|
75 |
</td>
|
76 |
</tr>
|
25 |
|
26 |
?>
|
27 |
<script type="text/javascript">
|
28 |
+
var plugin_url = '<?php echo WP_ALL_IMPORT_ROOT_URL; ?>';
|
29 |
var swfuploadL10n = <?php echo json_encode($l10n); ?>;
|
30 |
</script>
|
31 |
|
32 |
<div class="wpallimport-collapsed closed nested_options wpallimport-section">
|
33 |
<div class="wpallimport-content-section">
|
34 |
<div class="wpallimport-collapsed-header">
|
35 |
+
<h3><?php _e('Nested XML/CSV files','wp_all_import_plugin');?></h3>
|
36 |
</div>
|
37 |
<div class="wpallimport-collapsed-content">
|
38 |
<table class="form-table" style="max-width:none;">
|
45 |
$nested_files = json_decode($post['nested_files'], true);
|
46 |
foreach ($nested_files as $key => $file) {
|
47 |
?>
|
48 |
+
<li rel="<?php echo $key;?>"><?php echo $file;?> <a href="javascript:void(0);" class="unmerge"><?php _e('remove', 'wp_all_import_plugin'); ?></a></li>
|
49 |
<?php
|
50 |
}?>
|
51 |
<?php endif; ?>
|
66 |
<div class="msgs"></div>
|
67 |
|
68 |
<div class="file-type-options">
|
69 |
+
<label><?php _e('Specify the URL of the nested file to use.', 'wp_all_import_plugin'); ?></label>
|
70 |
<input type="text" class="regular-text" name="nested_url" value="" style="width:100%; line-height:20px;" placeholder="http(s)://"/>
|
71 |
</div>
|
72 |
|
73 |
+
<a rel="parse" href="javascript:void(0);" class="parse"><?php _e('Add', 'wp_all_import_plugin'); ?></a>
|
74 |
</div>
|
75 |
</td>
|
76 |
</tr>
|
views/admin/import/template/_other_template.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<div class="wpallimport-collapsed closed wpallimport-section ">
|
3 |
<div class="wpallimport-content-section ">
|
4 |
<div class="wpallimport-collapsed-header">
|
5 |
-
<h3><?php printf(__('Other %s Options','
|
6 |
</div>
|
7 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
8 |
<div class="wpallimport-collapsed-content-inner">
|
@@ -14,22 +14,22 @@
|
|
14 |
|
15 |
<?php $is_support_post_format = ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) ? true : false; ?>
|
16 |
|
17 |
-
<h4><?php _e('Post Status', '
|
18 |
<div class="input">
|
19 |
<input type="radio" id="status_publish" name="status" value="publish" <?php echo 'publish' == $post['status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
20 |
-
<label for="status_publish"><?php _e('Published', '
|
21 |
</div>
|
22 |
<div class="input">
|
23 |
<input type="radio" id="status_draft" name="status" value="draft" <?php echo 'draft' == $post['status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
24 |
-
<label for="status_draft"><?php _e('Draft', '
|
25 |
</div>
|
26 |
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px;">
|
27 |
<input type="radio" id="status_xpath" class="switcher" name="status" value="xpath" <?php echo 'xpath' == $post['status'] ? 'checked="checked"': '' ?>/>
|
28 |
-
<label for="status_xpath"><?php _e('Set with XPath', '
|
29 |
<div class="switcher-target-status_xpath">
|
30 |
<div class="input">
|
31 |
<input type="text" class="smaller-text" name="status_xpath" style="width:190px;" value="<?php echo esc_attr($post['status_xpath']) ?>"/>
|
32 |
-
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'publish\', \'draft\', \'trash\').', '
|
33 |
</div>
|
34 |
</div>
|
35 |
</div>
|
@@ -38,11 +38,11 @@
|
|
38 |
</tr>
|
39 |
<tr>
|
40 |
<td>
|
41 |
-
<h4><?php _e('Post Dates', '
|
42 |
<div class="input">
|
43 |
<input type="radio" id="date_type_specific" class="switcher" name="date_type" value="specific" <?php echo 'random' != $post['date_type'] ? 'checked="checked"' : '' ?> />
|
44 |
<label for="date_type_specific">
|
45 |
-
<?php _e('As specified', '
|
46 |
</label>
|
47 |
<div class="switcher-target-date_type_specific" style="vertical-align:middle; margin-top: 5px; margin-bottom: 10px;">
|
48 |
<input type="text" class="datepicker" name="date" value="<?php echo esc_attr($post['date']) ?>"/>
|
@@ -51,11 +51,11 @@
|
|
51 |
<div class="input">
|
52 |
<input type="radio" id="date_type_random" class="switcher" name="date_type" value="random" <?php echo 'random' == $post['date_type'] ? 'checked="checked"' : '' ?> />
|
53 |
<label for="date_type_random">
|
54 |
-
<?php _e('Random dates', '
|
55 |
</label>
|
56 |
<div class="switcher-target-date_type_random" style="vertical-align:middle; margin-top:5px;">
|
57 |
<input type="text" class="datepicker" name="date_start" value="<?php echo esc_attr($post['date_start']) ?>" />
|
58 |
-
<?php _e('and', '
|
59 |
<input type="text" class="datepicker" name="date_end" value="<?php echo esc_attr($post['date_end']) ?>" />
|
60 |
</div>
|
61 |
</div>
|
@@ -63,22 +63,53 @@
|
|
63 |
</tr>
|
64 |
<tr>
|
65 |
<td>
|
66 |
-
<h4><?php _e('
|
67 |
<div class="input">
|
68 |
-
<input type="
|
69 |
-
<
|
70 |
-
<label for="comment_status"><?php _e('Allow Comments', 'pmxi_plugin') ?></label>
|
71 |
</div>
|
72 |
<div class="input">
|
73 |
-
<input type="
|
74 |
-
<
|
75 |
-
<label for="ping_status"><?php _e('Allow Trackbacks and Pingbacks', 'pmxi_plugin') ?></label>
|
76 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
</td>
|
78 |
</tr>
|
79 |
<tr>
|
80 |
<td>
|
81 |
-
<h4><?php _e('Post Slug', '
|
82 |
<div>
|
83 |
<input type="text" name="post_slug" style="width:100%;" value="<?php echo esc_attr($post['post_slug']); ?>" />
|
84 |
</div>
|
@@ -86,32 +117,37 @@
|
|
86 |
</tr>
|
87 |
<tr>
|
88 |
<td>
|
89 |
-
<h4><?php _e('Post Author', '
|
90 |
<div>
|
91 |
-
<input type="text" name="author" value="<?php echo esc_attr($post['author']) ?>"/> <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('Assign the post to an existing user account by specifying the user ID, username, or e-mail address.', '
|
92 |
</div>
|
93 |
</td>
|
94 |
</tr>
|
95 |
<tr>
|
96 |
<td>
|
97 |
-
<h4 style="float:left;"><?php _e('Download & Import Attachments', '
|
98 |
-
<span class="separated_by" style="position:relative; top:15px; margin-right:0px;"><?php _e('Separated by','
|
99 |
<div>
|
100 |
<input type="text" name="attachments" style="width:93%;" value="<?php echo esc_attr($post['attachments']) ?>" />
|
101 |
<input type="text" class="small" name="atch_delim" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center; float:right;"/>
|
102 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
103 |
</td>
|
104 |
</tr>
|
105 |
<?php if ($is_support_post_format):?>
|
106 |
<tr>
|
107 |
<td>
|
108 |
-
<h4><?php _e('Post Format', '
|
109 |
<div>
|
110 |
<?php $post_formats = get_theme_support( 'post-formats' ); ?>
|
111 |
|
112 |
<div class="input">
|
113 |
<input type="radio" id="post_format_<?php echo "standart_" . $post_type; ?>" name="post_format" value="0" <?php echo (empty($post['post_format']) or ( empty($post_formats) )) ? 'checked="checked"' : '' ?> />
|
114 |
-
<label for="post_format_<?php echo "standart_" . $post_type; ?>"><?php _e( "Standard", '
|
115 |
</div>
|
116 |
|
117 |
<?php
|
@@ -120,7 +156,7 @@
|
|
120 |
?>
|
121 |
<div class="input">
|
122 |
<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"' : '' ?> />
|
123 |
-
<label for="post_format_<?php echo $post_format . "_" . $entry; ?>"><?php _e( ucfirst($post_format), '
|
124 |
</div>
|
125 |
<?php
|
126 |
}
|
@@ -134,32 +170,63 @@
|
|
134 |
<?php if ( 'page' == $post_type ):?>
|
135 |
<tr>
|
136 |
<td>
|
137 |
-
<h4><?php _e('Page Template', '
|
138 |
<div class="input">
|
139 |
-
<
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
</td>
|
145 |
</tr>
|
146 |
<tr>
|
147 |
<td>
|
148 |
-
<h4><?php _e('Page Parent', '
|
|
|
149 |
<div class="input">
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
</td>
|
153 |
</tr>
|
|
|
154 |
<tr>
|
155 |
<td>
|
156 |
-
<h4><?php _e('
|
157 |
<div class="input">
|
158 |
<input type="text" class="" name="order" value="<?php echo esc_attr($post['order']) ?>" />
|
159 |
</div>
|
160 |
</td>
|
161 |
-
</tr>
|
162 |
-
<?php endif; ?>
|
163 |
</table>
|
164 |
</div>
|
165 |
</div>
|
2 |
<div class="wpallimport-collapsed closed wpallimport-section ">
|
3 |
<div class="wpallimport-content-section ">
|
4 |
<div class="wpallimport-collapsed-header">
|
5 |
+
<h3><?php printf(__('Other %s Options','wp_all_import_plugin'), $custom_type->labels->singular_name);?></h3>
|
6 |
</div>
|
7 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
8 |
<div class="wpallimport-collapsed-content-inner">
|
14 |
|
15 |
<?php $is_support_post_format = ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) ? true : false; ?>
|
16 |
|
17 |
+
<h4><?php _e('Post Status', 'wp_all_import_plugin') ?></h4>
|
18 |
<div class="input">
|
19 |
<input type="radio" id="status_publish" name="status" value="publish" <?php echo 'publish' == $post['status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
20 |
+
<label for="status_publish"><?php _e('Published', 'wp_all_import_plugin') ?></label>
|
21 |
</div>
|
22 |
<div class="input">
|
23 |
<input type="radio" id="status_draft" name="status" value="draft" <?php echo 'draft' == $post['status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
24 |
+
<label for="status_draft"><?php _e('Draft', 'wp_all_import_plugin') ?></label>
|
25 |
</div>
|
26 |
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px;">
|
27 |
<input type="radio" id="status_xpath" class="switcher" name="status" value="xpath" <?php echo 'xpath' == $post['status'] ? 'checked="checked"': '' ?>/>
|
28 |
+
<label for="status_xpath"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
29 |
<div class="switcher-target-status_xpath">
|
30 |
<div class="input">
|
31 |
<input type="text" class="smaller-text" name="status_xpath" style="width:190px;" value="<?php echo esc_attr($post['status_xpath']) ?>"/>
|
32 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'publish\', \'draft\', \'trash\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
|
33 |
</div>
|
34 |
</div>
|
35 |
</div>
|
38 |
</tr>
|
39 |
<tr>
|
40 |
<td>
|
41 |
+
<h4><?php _e('Post Dates', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" style="position:relative; top: 1px;" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', 'wp_all_import_plugin') ?>">?</a></h4>
|
42 |
<div class="input">
|
43 |
<input type="radio" id="date_type_specific" class="switcher" name="date_type" value="specific" <?php echo 'random' != $post['date_type'] ? 'checked="checked"' : '' ?> />
|
44 |
<label for="date_type_specific">
|
45 |
+
<?php _e('As specified', 'wp_all_import_plugin') ?>
|
46 |
</label>
|
47 |
<div class="switcher-target-date_type_specific" style="vertical-align:middle; margin-top: 5px; margin-bottom: 10px;">
|
48 |
<input type="text" class="datepicker" name="date" value="<?php echo esc_attr($post['date']) ?>"/>
|
51 |
<div class="input">
|
52 |
<input type="radio" id="date_type_random" class="switcher" name="date_type" value="random" <?php echo 'random' == $post['date_type'] ? 'checked="checked"' : '' ?> />
|
53 |
<label for="date_type_random">
|
54 |
+
<?php _e('Random dates', 'wp_all_import_plugin') ?><a href="#help" class="wpallimport-help" style="position:relative; top:0;" 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.', 'wp_all_import_plugin') ?>">?</a>
|
55 |
</label>
|
56 |
<div class="switcher-target-date_type_random" style="vertical-align:middle; margin-top:5px;">
|
57 |
<input type="text" class="datepicker" name="date_start" value="<?php echo esc_attr($post['date_start']) ?>" />
|
58 |
+
<?php _e('and', 'wp_all_import_plugin') ?>
|
59 |
<input type="text" class="datepicker" name="date_end" value="<?php echo esc_attr($post['date_end']) ?>" />
|
60 |
</div>
|
61 |
</div>
|
63 |
</tr>
|
64 |
<tr>
|
65 |
<td>
|
66 |
+
<h4><?php _e('Comments', 'wp_all_import_plugin'); ?></h4>
|
67 |
<div class="input">
|
68 |
+
<input type="radio" id="comment_status_open" name="comment_status" value="open" <?php echo 'open' == $post['comment_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
69 |
+
<label for="comment_status_open"><?php _e('Open', 'wp_all_import_plugin') ?></label>
|
|
|
70 |
</div>
|
71 |
<div class="input">
|
72 |
+
<input type="radio" id="comment_status_closed" name="comment_status" value="closed" <?php echo 'closed' == $post['comment_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
73 |
+
<label for="comment_status_closed"><?php _e('Closed', 'wp_all_import_plugin') ?></label>
|
|
|
74 |
</div>
|
75 |
+
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px;">
|
76 |
+
<input type="radio" id="comment_status_xpath" class="switcher" name="comment_status" value="xpath" <?php echo 'xpath' == $post['comment_status'] ? 'checked="checked"': '' ?>/>
|
77 |
+
<label for="comment_status_xpath"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
78 |
+
<div class="switcher-target-comment_status_xpath">
|
79 |
+
<div class="input">
|
80 |
+
<input type="text" class="smaller-text" name="comment_status_xpath" style="width:190px;" value="<?php echo esc_attr($post['comment_status_xpath']) ?>"/>
|
81 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'open\', \'closed\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
</td>
|
86 |
+
</tr>
|
87 |
+
<tr>
|
88 |
+
<td>
|
89 |
+
<h4><?php _e('Trackbacks and Pingbacks', 'wp_all_import_plugin'); ?></h4>
|
90 |
+
<div class="input">
|
91 |
+
<input type="radio" id="ping_status_open" name="ping_status" value="open" <?php echo 'open' == $post['ping_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
92 |
+
<label for="ping_status_open"><?php _e('Open', 'wp_all_import_plugin') ?></label>
|
93 |
+
</div>
|
94 |
+
<div class="input">
|
95 |
+
<input type="radio" id="ping_status_closed" name="ping_status" value="closed" <?php echo 'closed' == $post['ping_status'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
96 |
+
<label for="ping_status_closed"><?php _e('Closed', 'wp_all_import_plugin') ?></label>
|
97 |
+
</div>
|
98 |
+
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px;">
|
99 |
+
<input type="radio" id="ping_status_xpath" class="switcher" name="ping_status" value="xpath" <?php echo 'xpath' == $post['ping_status'] ? 'checked="checked"': '' ?>/>
|
100 |
+
<label for="ping_status_xpath"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
101 |
+
<div class="switcher-target-ping_status_xpath">
|
102 |
+
<div class="input">
|
103 |
+
<input type="text" class="smaller-text" name="ping_status_xpath" style="width:190px;" value="<?php echo esc_attr($post['ping_status_xpath']) ?>"/>
|
104 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'open\', \'closed\').', 'wp_all_import_plugin') ?>" style="position:relative; top:13px; float: right;">?</a>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
</div>
|
108 |
</td>
|
109 |
</tr>
|
110 |
<tr>
|
111 |
<td>
|
112 |
+
<h4><?php _e('Post Slug', 'wp_all_import_plugin') ?></h4>
|
113 |
<div>
|
114 |
<input type="text" name="post_slug" style="width:100%;" value="<?php echo esc_attr($post['post_slug']); ?>" />
|
115 |
</div>
|
117 |
</tr>
|
118 |
<tr>
|
119 |
<td>
|
120 |
+
<h4><?php _e('Post Author', 'wp_all_import_plugin') ?></h4>
|
121 |
<div>
|
122 |
+
<input type="text" name="author" value="<?php echo esc_attr($post['author']) ?>"/> <a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('Assign the post to an existing user account by specifying the user ID, username, or e-mail address.', 'wp_all_import_plugin') ?>">?</a>
|
123 |
</div>
|
124 |
</td>
|
125 |
</tr>
|
126 |
<tr>
|
127 |
<td>
|
128 |
+
<h4 style="float:left;"><?php _e('Download & Import Attachments', 'wp_all_import_plugin') ?></h4>
|
129 |
+
<span class="separated_by" style="position:relative; top:15px; margin-right:0px;"><?php _e('Separated by','wp_all_import_plugin');?></span>
|
130 |
<div>
|
131 |
<input type="text" name="attachments" style="width:93%;" value="<?php echo esc_attr($post['attachments']) ?>" />
|
132 |
<input type="text" class="small" name="atch_delim" value="<?php echo esc_attr($post['atch_delim']) ?>" style="width:5%; text-align:center; float:right;"/>
|
133 |
+
</div>
|
134 |
+
<div class="input" style="margin:3px;">
|
135 |
+
<input type="hidden" name="is_search_existing_attach" value="0" />
|
136 |
+
<input type="checkbox" id="is_search_existing_attach" name="is_search_existing_attach" value="1" <?php echo $post['is_search_existing_attach'] ? 'checked="checked"' : '' ?> class="fix_checkbox"/>
|
137 |
+
<label for="is_search_existing_attach"><?php _e('Search for existing attachments to prevent duplicates in media library','wp_all_import_plugin');?> </label>
|
138 |
+
</div>
|
139 |
</td>
|
140 |
</tr>
|
141 |
<?php if ($is_support_post_format):?>
|
142 |
<tr>
|
143 |
<td>
|
144 |
+
<h4><?php _e('Post Format', 'wp_all_import_plugin') ?></h4>
|
145 |
<div>
|
146 |
<?php $post_formats = get_theme_support( 'post-formats' ); ?>
|
147 |
|
148 |
<div class="input">
|
149 |
<input type="radio" id="post_format_<?php echo "standart_" . $post_type; ?>" name="post_format" value="0" <?php echo (empty($post['post_format']) or ( empty($post_formats) )) ? 'checked="checked"' : '' ?> />
|
150 |
+
<label for="post_format_<?php echo "standart_" . $post_type; ?>"><?php _e( "Standard", 'wp_all_import_plugin') ?></label>
|
151 |
</div>
|
152 |
|
153 |
<?php
|
156 |
?>
|
157 |
<div class="input">
|
158 |
<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"' : '' ?> />
|
159 |
+
<label for="post_format_<?php echo $post_format . "_" . $entry; ?>"><?php _e( ucfirst($post_format), 'wp_all_import_plugin') ?></label>
|
160 |
</div>
|
161 |
<?php
|
162 |
}
|
170 |
<?php if ( 'page' == $post_type ):?>
|
171 |
<tr>
|
172 |
<td>
|
173 |
+
<h4><?php _e('Page Template', 'wp_all_import_plugin') ?></h4>
|
174 |
<div class="input">
|
175 |
+
<input type="radio" id="is_multiple_page_template_yes" name="is_multiple_page_template" value="yes" <?php echo 'yes' == $post['is_multiple_page_template'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
|
176 |
+
<label for="is_multiple_page_template_yes"><?php _e('Select a template', 'wp_all_import_plugin') ?></label>
|
177 |
+
<div class="switcher-target-is_multiple_page_template_yes">
|
178 |
+
<div class="input">
|
179 |
+
<select name="page_template" id="page_template">
|
180 |
+
<option value='default'><?php _e('Default', 'wp_all_import_plugin') ?></option>
|
181 |
+
<?php page_template_dropdown($post['page_template']); ?>
|
182 |
+
</select>
|
183 |
+
</div>
|
184 |
+
</div>
|
185 |
</div>
|
186 |
+
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px; margin-top: 5px;">
|
187 |
+
<input type="radio" id="is_multiple_page_template_no" class="switcher" name="is_multiple_page_template" value="no" <?php echo 'no' == $post['is_multiple_page_template'] ? 'checked="checked"': '' ?> style="margin-left:0;"/>
|
188 |
+
<label for="is_multiple_page_template_no"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
189 |
+
<div class="switcher-target-is_multiple_page_template_no">
|
190 |
+
<div class="input">
|
191 |
+
<input type="text" class="smaller-text" name="single_page_template" style="width:190px;" value="<?php echo esc_attr($post['single_page_template']) ?>"/>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
</div>
|
195 |
</td>
|
196 |
</tr>
|
197 |
<tr>
|
198 |
<td>
|
199 |
+
<h4><?php _e('Page Parent', 'wp_all_import_plugin') ?></h4>
|
200 |
+
|
201 |
<div class="input">
|
202 |
+
<input type="radio" id="is_multiple_page_parent_yes" name="is_multiple_page_parent" value="yes" <?php echo 'yes' == $post['is_multiple_page_parent'] ? 'checked="checked"' : '' ?> class="switcher" style="margin-left:0;"/>
|
203 |
+
<label for="is_multiple_page_parent_yes"><?php _e('Select page parent', 'wp_all_import_plugin') ?></label>
|
204 |
+
<div class="switcher-target-is_multiple_page_parent_yes">
|
205 |
+
<div class="input">
|
206 |
+
<?php wp_dropdown_pages(array('post_type' => 'page', 'selected' => $post['parent'], 'name' => 'parent', 'show_option_none' => __('(no parent)', 'wp_all_import_plugin'), 'sort_column'=> 'menu_order, post_title',)) ?>
|
207 |
+
</div>
|
208 |
+
</div>
|
209 |
</div>
|
210 |
+
<div class="input fleft" style="position:relative;width:220px; margin-bottom:15px; margin-top: 5px;">
|
211 |
+
<input type="radio" id="is_multiple_page_parent_no" class="switcher" name="is_multiple_page_parent" value="no" <?php echo 'no' == $post['is_multiple_page_parent'] ? 'checked="checked"': '' ?> style="margin-left:0;"/>
|
212 |
+
<label for="is_multiple_page_parent_no"><?php _e('Set with XPath', 'wp_all_import_plugin' )?></label> <br>
|
213 |
+
<div class="switcher-target-is_multiple_page_parent_no">
|
214 |
+
<div class="input">
|
215 |
+
<input type="text" class="smaller-text" name="single_page_parent" style="width:190px;" value="<?php echo esc_attr($post['single_page_parent']) ?>"/>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
</div>
|
219 |
</td>
|
220 |
</tr>
|
221 |
+
<?php endif; ?>
|
222 |
<tr>
|
223 |
<td>
|
224 |
+
<h4><?php _e('Menu Order', 'wp_all_import_plugin') ?></h4>
|
225 |
<div class="input">
|
226 |
<input type="text" class="" name="order" value="<?php echo esc_attr($post['order']) ?>" />
|
227 |
</div>
|
228 |
</td>
|
229 |
+
</tr>
|
|
|
230 |
</table>
|
231 |
</div>
|
232 |
</div>
|
views/admin/import/template/_taxonomies_template.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
$custom_type = get_post_type_object( $post_type );
|
4 |
|
5 |
-
$exclude_taxonomies = (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class') : array('post_format');
|
6 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($exclude_taxonomies));
|
7 |
|
8 |
if ( ! empty($post_taxonomies)):
|
@@ -10,11 +10,11 @@ if ( ! empty($post_taxonomies)):
|
|
10 |
<div class="wpallimport-collapsed closed wpallimport-section">
|
11 |
<div class="wpallimport-content-section">
|
12 |
<div class="wpallimport-collapsed-header">
|
13 |
-
<h3><?php _e('Taxonomies, Categories, Tags','
|
14 |
</div>
|
15 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
16 |
<div class="wpallimport-collapsed-content-inner">
|
17 |
-
<input type="button" rel="taxonomies_hints" value="<?php _e('Show Hints', '
|
18 |
<table class="form-table" style="max-width:none;">
|
19 |
|
20 |
<?php $private_ctx = 0; ?>
|
@@ -28,48 +28,100 @@ if ( ! empty($post_taxonomies)):
|
|
28 |
<div class="post_taxonomy">
|
29 |
<div class="input">
|
30 |
<input type="hidden" name="tax_assing[<?php echo $ctx->name;?>]" value="0"/>
|
31 |
-
<input type="checkbox" class="assign_post switcher" name="tax_assing[<?php echo $ctx->name;?>]" id="tax_assing_<?php echo $ctx->name;?>" <?php echo ( ! empty($post['tax_assing'][$ctx->name]) ) ? 'checked="checked"' : ''; ?>
|
32 |
<label for="tax_assing_<?php echo $ctx->name;?>"><?php echo $ctx->labels->name; ?></label>
|
33 |
</div>
|
34 |
<div class="switcher-target-tax_assing_<?php echo $ctx->name;?>">
|
35 |
<div class="input sub_input">
|
36 |
<div class="input">
|
37 |
<input type="radio" name="tax_logic[<?php echo $ctx->name;?>]" value="single" id="tax_logic_single_<?php echo $ctx->name;?>" class="switcher" <?php echo (empty($post['tax_logic'][$ctx->name]) or $post['tax_logic'][$ctx->name] == 'single') ? 'checked="checked"' : ''; ?>/>
|
38 |
-
<label for="tax_logic_single_<?php echo $ctx->name;?>"><?php printf(__('Each %s has just one %s', '
|
39 |
<div class="switcher-target-tax_logic_single_<?php echo $ctx->name;?> sub_input">
|
|
|
|
|
40 |
<input type="text" class="widefat single_xpath_field" name="tax_single_xpath[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_single_xpath'][$ctx->name])) ? esc_attr($post['tax_single_xpath'][$ctx->name]) : ''; ?>" style="width:50%;"/>
|
41 |
</div>
|
42 |
</div>
|
43 |
<div class="input">
|
44 |
<input type="radio" name="tax_logic[<?php echo $ctx->name;?>]" value="multiple" id="tax_logic_multiple_<?php echo $ctx->name;?>" class="switcher" <?php echo (!empty($post['tax_logic'][$ctx->name]) and $post['tax_logic'][$ctx->name] == 'multiple') ? 'checked="checked"' : ''; ?>/>
|
45 |
-
<label for="tax_logic_multiple_<?php echo $ctx->name;?>"><?php printf(__('Each %s has multiple %s', '
|
46 |
<div class="switcher-target-tax_logic_multiple_<?php echo $ctx->name;?> sub_input">
|
|
|
|
|
47 |
<input type="text" class="widefat multiple_xpath_field" name="tax_multiple_xpath[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_multiple_xpath'][$ctx->name])) ? esc_attr($post['tax_multiple_xpath'][$ctx->name]) : ''; ?>" style="width:50%;"/>
|
48 |
-
<label><?php _e('Separated by', '
|
49 |
<input type="text" class="small tax_delim" name="tax_multiple_delim[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_multiple_delim'][$ctx->name]) ) ? str_replace("&","&", htmlentities(htmlentities($post['tax_multiple_delim'][$ctx->name]))) : ',' ?>" />
|
50 |
</div>
|
51 |
</div>
|
52 |
<?php if ($ctx->hierarchical): ?>
|
53 |
<div class="input">
|
54 |
<input type="radio" name="tax_logic[<?php echo $ctx->name;?>]" value="hierarchical" id="tax_logic_hierarchical_<?php echo $ctx->name;?>" class="switcher" <?php echo (!empty($post['tax_logic'][$ctx->name]) and $post['tax_logic'][$ctx->name] == 'hierarchical') ? 'checked="checked"' : ''; ?>/>
|
55 |
-
<label for="tax_logic_hierarchical_<?php echo $ctx->name;?>"><?php printf(__('%ss have hierarchical (parent/child) %s (i.e. Sports > Golf > Clubs > Putters)', '
|
56 |
<div class="switcher-target-tax_logic_hierarchical_<?php echo $ctx->name;?> sub_input">
|
57 |
<div class="input">
|
58 |
-
<input type="
|
59 |
-
<
|
60 |
-
<
|
61 |
-
|
62 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
<input type="text" class="small tax_delim" name="tax_hierarchical_delim[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_hierarchical_delim'][$ctx->name]) ) ? str_replace("&","&", htmlentities(htmlentities($post['tax_hierarchical_delim'][$ctx->name]))) : '>' ?>" />
|
64 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
</div>
|
66 |
</div>
|
67 |
<div class="input">
|
68 |
-
<input type="
|
69 |
-
<
|
|
|
70 |
<div class="switcher-target-hierarchical_logic_manual_<?php echo $ctx->name;?> sub_input">
|
71 |
-
<p style="margin-bottom: 10px;"><?php printf(__('Drag the <img src="%s" class="wpallimport-drag-icon"/> to the right to create a child, drag up and down to re-order.'),
|
72 |
-
<ol class="sortable no-margin">
|
73 |
<?php
|
74 |
if ( ! empty($post['post_taxonomies'][$ctx->name]) ):
|
75 |
|
@@ -82,7 +134,8 @@ if ( ! empty($post_taxonomies)):
|
|
82 |
{
|
83 |
?>
|
84 |
<li id="item_<?php echo $i; ?>" class="dragging">
|
85 |
-
<div class="drag-element">
|
|
|
86 |
<input type="text" class="widefat xpath_field" value="<?php echo esc_attr($cat->xpath); ?>"/>
|
87 |
|
88 |
<?php do_action('pmxi_category_view', $cat, $i, $ctx->name, $post_type); ?>
|
@@ -100,18 +153,23 @@ if ( ! empty($post_taxonomies)):
|
|
100 |
endif;?>
|
101 |
|
102 |
<li id="item" class="template">
|
103 |
-
<div class="drag-element">
|
|
|
104 |
<input type="text" class="widefat xpath_field" value=""/>
|
105 |
<?php do_action('pmxi_category_view', false, false, $ctx->name, $post_type); ?>
|
106 |
</div>
|
107 |
<a href="javascript:void(0);" class="icon-item remove-ico"></a>
|
108 |
</li>
|
109 |
|
110 |
-
</ol>
|
111 |
-
<a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add Another','pmxi_plugin');?></a>
|
112 |
<input type="hidden" class="hierarhy-output" name="post_taxonomies[<?php echo $ctx->name; ?>]" value="<?php echo esc_attr($post['post_taxonomies'][$ctx->name]) ?>"/>
|
113 |
<?php do_action('pmxi_category_options_view', ((!empty($post['post_taxonomies'][$ctx->name])) ? $post['post_taxonomies'][$ctx->name] : false), $ctx->name, $post_type, $ctx->labels->name); ?>
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
115 |
</div>
|
116 |
</div>
|
117 |
</div>
|
@@ -122,14 +180,14 @@ if ( ! empty($post_taxonomies)):
|
|
122 |
?>
|
123 |
<input type="hidden" name="tax_enable_mapping[<?php echo $ctx->name; ?>]" value="0"/>
|
124 |
<input type="checkbox" id="tax_mapping_<?php echo $ctx->name; ?>" class="pmxi_tax_mapping switcher" <?php if ( ! empty($post['tax_enable_mapping'][$ctx->name]) ) echo "checked='checked'"; ?> name="tax_enable_mapping[<?php echo $ctx->name; ?>]" value="1"/>
|
125 |
-
<label for="tax_mapping_<?php echo $ctx->name;?>"><?php printf(__('Enable Mapping for %s', '
|
126 |
<div class="switcher-target-tax_mapping_<?php echo $ctx->name;?> sub_input custom_type" rel="tax_mapping">
|
127 |
<fieldset style="padding: 0;">
|
128 |
<table cellpadding="0" cellspacing="5" class="tax-form-table" rel="tax_mapping_<?php echo $ctx->name; ?>" style="width: 100%;">
|
129 |
<thead>
|
130 |
<tr>
|
131 |
-
<td><?php _e('In Your File', '
|
132 |
-
<td><?php _e('Translated To', '
|
133 |
<td> </td>
|
134 |
</tr>
|
135 |
</thead>
|
@@ -149,10 +207,10 @@ if ( ! empty($post_taxonomies)):
|
|
149 |
?>
|
150 |
<tr class="form-field">
|
151 |
<td>
|
152 |
-
<input type="text" class="mapping_from widefat" value="<?php echo $k; ?>">
|
153 |
</td>
|
154 |
<td>
|
155 |
-
<input type="text" class="mapping_to widefat" value="<?php echo (is_array($value)) ? $value[$k] : $value; ?>">
|
156 |
</td>
|
157 |
<td class="action remove">
|
158 |
<a href="#remove" style="right:-10px; top: 7px;"></a>
|
@@ -191,15 +249,20 @@ if ( ! empty($post_taxonomies)):
|
|
191 |
</tr>
|
192 |
<tr>
|
193 |
<td colspan="3">
|
194 |
-
<a href="javascript:void(0);" title="<?php _e('Add Another', '
|
195 |
</td>
|
196 |
</tr>
|
197 |
</tbody>
|
198 |
</table>
|
199 |
<input type="hidden" name="tax_mapping[<?php echo $ctx->name; ?>]" value="<?php if (!empty($post['tax_mapping'][$ctx->name])) echo esc_html($post['tax_mapping'][$ctx->name]); ?>"/>
|
200 |
-
</fieldset>
|
|
|
|
|
|
|
|
|
|
|
201 |
</div>
|
202 |
-
</div>
|
203 |
</div>
|
204 |
</div>
|
205 |
</div>
|
@@ -211,7 +274,7 @@ if ( ! empty($post_taxonomies)):
|
|
211 |
<hr/>
|
212 |
<div class="input">
|
213 |
<input type="checkbox" id="show_hidden_ctx"/>
|
214 |
-
<label for="show_hidden_ctx"><?php _e('Show "private" taxonomies', '
|
215 |
</div>
|
216 |
<?php endif;?>
|
217 |
</td>
|
@@ -222,9 +285,9 @@ if ( ! empty($post_taxonomies)):
|
|
222 |
</div>
|
223 |
<div id="taxonomies_hints" style="display:none;">
|
224 |
<ul>
|
225 |
-
<li><?php _e('Taxonomies that don\'t already exist on your site will be created.', '
|
226 |
-
<li><?php _e('To import to existing parent taxonomies, use the existing taxonomy name or slug.', '
|
227 |
-
<li><?php _e('To import to existing hierarchical taxonomies, create the entire hierarchy using the taxonomy names or slugs.', '
|
228 |
</ul>
|
229 |
</div>
|
230 |
</div>
|
2 |
|
3 |
$custom_type = get_post_type_object( $post_type );
|
4 |
|
5 |
+
$exclude_taxonomies = apply_filters('pmxi_exclude_taxonomies', (class_exists('PMWI_Plugin')) ? array('post_format', 'product_type', 'product_shipping_class') : array('post_format'));
|
6 |
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($exclude_taxonomies));
|
7 |
|
8 |
if ( ! empty($post_taxonomies)):
|
10 |
<div class="wpallimport-collapsed closed wpallimport-section">
|
11 |
<div class="wpallimport-content-section">
|
12 |
<div class="wpallimport-collapsed-header">
|
13 |
+
<h3><?php _e('Taxonomies, Categories, Tags','wp_all_import_plugin');?></h3>
|
14 |
</div>
|
15 |
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
16 |
<div class="wpallimport-collapsed-content-inner">
|
17 |
+
<input type="button" rel="taxonomies_hints" value="<?php _e('Show Hints', 'wp_all_import_plugin');?>" class="show_hints">
|
18 |
<table class="form-table" style="max-width:none;">
|
19 |
|
20 |
<?php $private_ctx = 0; ?>
|
28 |
<div class="post_taxonomy">
|
29 |
<div class="input">
|
30 |
<input type="hidden" name="tax_assing[<?php echo $ctx->name;?>]" value="0"/>
|
31 |
+
<input type="checkbox" class="assign_post switcher" name="tax_assing[<?php echo $ctx->name;?>]" id="tax_assing_<?php echo $ctx->name;?>" <?php echo ( ! empty($post['tax_assing'][$ctx->name]) ) ? 'checked="checked"' : ''; ?> value="1"/>
|
32 |
<label for="tax_assing_<?php echo $ctx->name;?>"><?php echo $ctx->labels->name; ?></label>
|
33 |
</div>
|
34 |
<div class="switcher-target-tax_assing_<?php echo $ctx->name;?>">
|
35 |
<div class="input sub_input">
|
36 |
<div class="input">
|
37 |
<input type="radio" name="tax_logic[<?php echo $ctx->name;?>]" value="single" id="tax_logic_single_<?php echo $ctx->name;?>" class="switcher" <?php echo (empty($post['tax_logic'][$ctx->name]) or $post['tax_logic'][$ctx->name] == 'single') ? 'checked="checked"' : ''; ?>/>
|
38 |
+
<label for="tax_logic_single_<?php echo $ctx->name;?>"><?php printf(__('Each %s has just one %s', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $ctx->labels->singular_name); ?></label>
|
39 |
<div class="switcher-target-tax_logic_single_<?php echo $ctx->name;?> sub_input">
|
40 |
+
<input type="hidden" name="term_assing[<?php echo $ctx->name;?>]" value="0"/>
|
41 |
+
<input type="checkbox" name="term_assing[<?php echo $ctx->name;?>]" <?php echo (isset($post['term_assing'][$ctx->name])) ? (( ! empty($post['term_assing'][$ctx->name]) ) ? 'checked="checked"' : '') : 'checked="checked"'; ?> title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>" value="1"/>
|
42 |
<input type="text" class="widefat single_xpath_field" name="tax_single_xpath[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_single_xpath'][$ctx->name])) ? esc_attr($post['tax_single_xpath'][$ctx->name]) : ''; ?>" style="width:50%;"/>
|
43 |
</div>
|
44 |
</div>
|
45 |
<div class="input">
|
46 |
<input type="radio" name="tax_logic[<?php echo $ctx->name;?>]" value="multiple" id="tax_logic_multiple_<?php echo $ctx->name;?>" class="switcher" <?php echo (!empty($post['tax_logic'][$ctx->name]) and $post['tax_logic'][$ctx->name] == 'multiple') ? 'checked="checked"' : ''; ?>/>
|
47 |
+
<label for="tax_logic_multiple_<?php echo $ctx->name;?>"><?php printf(__('Each %s has multiple %s', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $ctx->labels->name); ?></label>
|
48 |
<div class="switcher-target-tax_logic_multiple_<?php echo $ctx->name;?> sub_input">
|
49 |
+
<input type="hidden" name="multiple_term_assing[<?php echo $ctx->name;?>]" value="0"/>
|
50 |
+
<input type="checkbox" name="multiple_term_assing[<?php echo $ctx->name;?>]" <?php echo (isset($post['multiple_term_assing'][$ctx->name])) ? (( ! empty($post['multiple_term_assing'][$ctx->name]) ) ? 'checked="checked"' : '') : 'checked="checked"'; ?> title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>" value="1"/>
|
51 |
<input type="text" class="widefat multiple_xpath_field" name="tax_multiple_xpath[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_multiple_xpath'][$ctx->name])) ? esc_attr($post['tax_multiple_xpath'][$ctx->name]) : ''; ?>" style="width:50%;"/>
|
52 |
+
<label><?php _e('Separated by', 'wp_all_import_plugin'); ?></label>
|
53 |
<input type="text" class="small tax_delim" name="tax_multiple_delim[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_multiple_delim'][$ctx->name]) ) ? str_replace("&","&", htmlentities(htmlentities($post['tax_multiple_delim'][$ctx->name]))) : ',' ?>" />
|
54 |
</div>
|
55 |
</div>
|
56 |
<?php if ($ctx->hierarchical): ?>
|
57 |
<div class="input">
|
58 |
<input type="radio" name="tax_logic[<?php echo $ctx->name;?>]" value="hierarchical" id="tax_logic_hierarchical_<?php echo $ctx->name;?>" class="switcher" <?php echo (!empty($post['tax_logic'][$ctx->name]) and $post['tax_logic'][$ctx->name] == 'hierarchical') ? 'checked="checked"' : ''; ?>/>
|
59 |
+
<label for="tax_logic_hierarchical_<?php echo $ctx->name;?>"><?php printf(__('%ss have hierarchical (parent/child) %s (i.e. Sports > Golf > Clubs > Putters)', 'wp_all_import_plugin'), $custom_type->labels->singular_name, $ctx->labels->name); ?></label>
|
60 |
<div class="switcher-target-tax_logic_hierarchical_<?php echo $ctx->name;?> sub_input">
|
61 |
<div class="input">
|
62 |
+
<input type="hidden" name="tax_hierarchical_logic_entire[<?php echo $ctx->name;?>]" value="0" />
|
63 |
+
<input type="checkbox" name="tax_hierarchical_logic_entire[<?php echo $ctx->name;?>]" value="1" id="hierarchical_logic_entire_<?php echo $ctx->name;?>" class="switcher" <?php echo (!empty($post['tax_hierarchical_logic_entire'][$ctx->name])) ? 'checked="checked"' : ''; ?>/>
|
64 |
+
<label for="hierarchical_logic_entire_<?php echo $ctx->name;?>"><?php _e('An element in my file contains the entire hierarchy (i.e. you have an element with a value = Sports > Golf > Clubs > Putters)', 'wp_all_import_plugin'); ?></label>
|
65 |
+
<div class="switcher-target-hierarchical_logic_entire_<?php echo $ctx->name;?> sub_input" style="margin-left: 20px; padding-left: 20px;">
|
66 |
+
<ul class="tax_hierarchical_logic no-margin">
|
67 |
+
<?php $txes_count = 0; if ( ! empty($post['tax_hierarchical_xpath'][$ctx->name])): foreach ($post['tax_hierarchical_xpath'][$ctx->name] as $k => $path) : if (empty($path)) continue; ?>
|
68 |
+
<li class="dragging">
|
69 |
+
<div style="position:relative;">
|
70 |
+
<input type="hidden" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][<?php echo $k;?>]" value="0"/>
|
71 |
+
<input type="checkbox" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][<?php echo $k; ?>]" <?php echo (isset($post['tax_hierarchical_assing'][$ctx->name][$k])) ? (( ! empty($post['tax_hierarchical_assing'][$ctx->name][$k]) ) ? 'checked="checked"' : '') : 'checked="checked"'; ?> title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>" value="1"/>
|
72 |
+
<input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value="<?php echo esc_attr($path); ?>"/>
|
73 |
+
<a href="javascript:void(0);" class="icon-item remove-ico" style="top:8px;"></a>
|
74 |
+
</div>
|
75 |
+
</li>
|
76 |
+
<?php $txes_count++; endforeach; endif; ?>
|
77 |
+
<?php if ( ! $txes_count): ?>
|
78 |
+
<li class="dragging">
|
79 |
+
<div style="position:relative;">
|
80 |
+
<input type="hidden" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][0]" value="0"/>
|
81 |
+
<input type="checkbox" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][0]" checked="checked" title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>" value="1"/>
|
82 |
+
<input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value=""/>
|
83 |
+
<a href="javascript:void(0);" class="icon-item remove-ico" style="top:8px;"></a>
|
84 |
+
</div>
|
85 |
+
</li>
|
86 |
+
<?php endif; ?>
|
87 |
+
<li class="dragging template">
|
88 |
+
<div style="position:relative;">
|
89 |
+
<input type="hidden" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][NUMBER]" value="0"/>
|
90 |
+
<input type="checkbox" class="assign_term" name="tax_hierarchical_assing[<?php echo $ctx->name;?>][NUMBER]" checked="checked" title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>" value="1"/>
|
91 |
+
<input type="text" class="widefat hierarchical_xpath_field" name="tax_hierarchical_xpath[<?php echo $ctx->name; ?>][]" value=""/>
|
92 |
+
<a href="javascript:void(0);" class="icon-item remove-ico" style="top:8px;"></a>
|
93 |
+
</div>
|
94 |
+
</li>
|
95 |
+
</ul>
|
96 |
+
<label><?php _e('Separated by', 'wp_all_import_plugin'); ?></label>
|
97 |
<input type="text" class="small tax_delim" name="tax_hierarchical_delim[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_hierarchical_delim'][$ctx->name]) ) ? str_replace("&","&", htmlentities(htmlentities($post['tax_hierarchical_delim'][$ctx->name]))) : '>' ?>" />
|
98 |
+
<div class="input">
|
99 |
+
<input type="hidden" name="tax_hierarchical_last_level_assign[<?php echo $ctx->name; ?>]" value="0" />
|
100 |
+
<input type="checkbox" id="tax_hierarchical_last_level_assign_<?php echo $ctx->name; ?>" name="tax_hierarchical_last_level_assign[<?php echo $ctx->name; ?>]" value="1" <?php echo ( ! empty($post['tax_hierarchical_last_level_assign'][$ctx->name])) ? 'checked="checked"': '' ?> />
|
101 |
+
<label for="tax_hierarchical_last_level_assign_<?php echo $ctx->name; ?>"><?php printf(__('Only assign %s to the bottom level term in the hierarchy', 'wp_all_import_plugin'), $custom_type->label) ?></label>
|
102 |
+
</div>
|
103 |
+
<div class="input">
|
104 |
+
<input type="hidden" name="is_tax_hierarchical_group_delim[<?php echo $ctx->name; ?>]" value="0" />
|
105 |
+
<input type="checkbox" id="is_tax_hierarchical_group_delim_<?php echo $ctx->name; ?>" name="is_tax_hierarchical_group_delim[<?php echo $ctx->name; ?>]" value="1" class="switcher" <?php echo ( ! empty($post['is_tax_hierarchical_group_delim'][$ctx->name])) ? 'checked="checked"': '' ?> />
|
106 |
+
<label for="is_tax_hierarchical_group_delim_<?php echo $ctx->name; ?>"><?php printf(__('Separate hierarchy groups via symbol', 'wp_all_import_plugin'), $custom_type->label) ?></label>
|
107 |
+
<div class="switcher-target-is_tax_hierarchical_group_delim_<?php echo $ctx->name;?> sub_input">
|
108 |
+
<label><?php _e('Separated by', 'wp_all_import_plugin'); ?></label>
|
109 |
+
<input type="text" class="small tax_delim" name="tax_hierarchical_group_delim[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_hierarchical_group_delim'][$ctx->name]) ) ? str_replace("&","&", htmlentities(htmlentities($post['tax_hierarchical_group_delim'][$ctx->name]))) : '|' ?>" />
|
110 |
+
</div>
|
111 |
+
</div>
|
112 |
+
<a class="preview_taxonomies" href="javascript:void(0);" style="top:-35px; float: right; position: relative;" rel="preview_taxonomies"><?php _e('Preview', 'wp_all_import_plugin'); ?></a>
|
113 |
+
<div class="input">
|
114 |
+
<a href="javascript:void(0);" class="icon-item add-new-cat" style="width: 200px;"><?php _e('Add Another Hierarchy Group','wp_all_import_plugin');?></a>
|
115 |
+
</div>
|
116 |
</div>
|
117 |
</div>
|
118 |
<div class="input">
|
119 |
+
<input type="hidden" name="tax_hierarchical_logic_manual[<?php echo $ctx->name;?>]" value="0" />
|
120 |
+
<input type="checkbox" name="tax_hierarchical_logic_manual[<?php echo $ctx->name;?>]" value="1" id="hierarchical_logic_manual_<?php echo $ctx->name;?>" class="switcher" <?php echo (!empty($post['tax_hierarchical_logic_manual'][$ctx->name])) ? 'checked="checked"' : ''; ?>/>
|
121 |
+
<label for="hierarchical_logic_manual_<?php echo $ctx->name;?>"><?php _e('Manually design the hierarchy with drag & drop', 'wp_all_import_plugin'); ?></label>
|
122 |
<div class="switcher-target-hierarchical_logic_manual_<?php echo $ctx->name;?> sub_input">
|
123 |
+
<p style="margin-bottom: 10px;"><?php printf(__('Drag the <img src="%s" class="wpallimport-drag-icon"/> to the right to create a child, drag up and down to re-order.'), WP_ALL_IMPORT_ROOT_URL . '/static/img/drag.png'); ?></p>
|
124 |
+
<ol class="sortable no-margin" style="margin-left: 20px;">
|
125 |
<?php
|
126 |
if ( ! empty($post['post_taxonomies'][$ctx->name]) ):
|
127 |
|
134 |
{
|
135 |
?>
|
136 |
<li id="item_<?php echo $i; ?>" class="dragging">
|
137 |
+
<div class="drag-element">
|
138 |
+
<input type="checkbox" class="assign_term" <?php if (!empty($cat->assign)): ?>checked="checked"<?php endif; ?> title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>"/>
|
139 |
<input type="text" class="widefat xpath_field" value="<?php echo esc_attr($cat->xpath); ?>"/>
|
140 |
|
141 |
<?php do_action('pmxi_category_view', $cat, $i, $ctx->name, $post_type); ?>
|
153 |
endif;?>
|
154 |
|
155 |
<li id="item" class="template">
|
156 |
+
<div class="drag-element">
|
157 |
+
<input type="checkbox" class="assign_term" checked="checked" title="<?php _e('Assign post to the taxonomy.','wp_all_import_plugin');?>"/>
|
158 |
<input type="text" class="widefat xpath_field" value=""/>
|
159 |
<?php do_action('pmxi_category_view', false, false, $ctx->name, $post_type); ?>
|
160 |
</div>
|
161 |
<a href="javascript:void(0);" class="icon-item remove-ico"></a>
|
162 |
</li>
|
163 |
|
164 |
+
</ol>
|
|
|
165 |
<input type="hidden" class="hierarhy-output" name="post_taxonomies[<?php echo $ctx->name; ?>]" value="<?php echo esc_attr($post['post_taxonomies'][$ctx->name]) ?>"/>
|
166 |
<?php do_action('pmxi_category_options_view', ((!empty($post['post_taxonomies'][$ctx->name])) ? $post['post_taxonomies'][$ctx->name] : false), $ctx->name, $post_type, $ctx->labels->name); ?>
|
167 |
+
<div class="input" style="margin-left:17px;">
|
168 |
+
<label><?php _e('Separated by', 'wp_all_import_plugin'); ?></label>
|
169 |
+
<input type="text" class="small tax_delim" name="tax_manualhierarchy_delim[<?php echo $ctx->name; ?>]" value="<?php echo ( ! empty($post['tax_manualhierarchy_delim'][$ctx->name]) ) ? str_replace("&","&", htmlentities(htmlentities($post['tax_manualhierarchy_delim'][$ctx->name]))) : ',' ?>" />
|
170 |
+
</div>
|
171 |
+
<a href="javascript:void(0);" class="icon-item add-new-ico"><?php _e('Add Another','wp_all_import_plugin');?></a>
|
172 |
+
</div>
|
173 |
</div>
|
174 |
</div>
|
175 |
</div>
|
180 |
?>
|
181 |
<input type="hidden" name="tax_enable_mapping[<?php echo $ctx->name; ?>]" value="0"/>
|
182 |
<input type="checkbox" id="tax_mapping_<?php echo $ctx->name; ?>" class="pmxi_tax_mapping switcher" <?php if ( ! empty($post['tax_enable_mapping'][$ctx->name]) ) echo "checked='checked'"; ?> name="tax_enable_mapping[<?php echo $ctx->name; ?>]" value="1"/>
|
183 |
+
<label for="tax_mapping_<?php echo $ctx->name;?>"><?php printf(__('Enable Mapping for %s', 'wp_all_import_plugin'), $ctx->labels->name); ?></label>
|
184 |
<div class="switcher-target-tax_mapping_<?php echo $ctx->name;?> sub_input custom_type" rel="tax_mapping">
|
185 |
<fieldset style="padding: 0;">
|
186 |
<table cellpadding="0" cellspacing="5" class="tax-form-table" rel="tax_mapping_<?php echo $ctx->name; ?>" style="width: 100%;">
|
187 |
<thead>
|
188 |
<tr>
|
189 |
+
<td><?php _e('In Your File', 'wp_all_import_plugin') ?></td>
|
190 |
+
<td><?php _e('Translated To', 'wp_all_import_plugin') ?></td>
|
191 |
<td> </td>
|
192 |
</tr>
|
193 |
</thead>
|
207 |
?>
|
208 |
<tr class="form-field">
|
209 |
<td>
|
210 |
+
<input type="text" class="mapping_from widefat" value="<?php echo esc_textarea($k); ?>">
|
211 |
</td>
|
212 |
<td>
|
213 |
+
<input type="text" class="mapping_to widefat" value="<?php echo esc_textarea((is_array($value)) ? $value[$k] : $value); ?>">
|
214 |
</td>
|
215 |
<td class="action remove">
|
216 |
<a href="#remove" style="right:-10px; top: 7px;"></a>
|
249 |
</tr>
|
250 |
<tr>
|
251 |
<td colspan="3">
|
252 |
+
<a href="javascript:void(0);" title="<?php _e('Add Another', 'wp_all_import_plugin')?>" class="action add-new-key add-new-entry"><?php _e('Add Another', 'wp_all_import_plugin') ?></a>
|
253 |
</td>
|
254 |
</tr>
|
255 |
</tbody>
|
256 |
</table>
|
257 |
<input type="hidden" name="tax_mapping[<?php echo $ctx->name; ?>]" value="<?php if (!empty($post['tax_mapping'][$ctx->name])) echo esc_html($post['tax_mapping'][$ctx->name]); ?>"/>
|
258 |
+
</fieldset>
|
259 |
+
<div class="input">
|
260 |
+
<input type="hidden" name="tax_logic_mapping[<?php echo $ctx->name; ?>]" value="0"/>
|
261 |
+
<input type="checkbox" id="tax_logic_mapping_<?php echo $ctx->name; ?>" name="tax_logic_mapping[<?php echo $ctx->name; ?>]" <?php echo ( ! empty($post['tax_logic_mapping'][$ctx->name]) ) ? 'checked="checked"' : ''; ?> value="1"/>
|
262 |
+
<label for="tax_logic_mapping_<?php echo $ctx->name; ?>"><?php _e('Apply mapping rules before splitting via separator symbol','wp_all_import_plugin'); ?></label>
|
263 |
+
</div>
|
264 |
</div>
|
265 |
+
</div>
|
266 |
</div>
|
267 |
</div>
|
268 |
</div>
|
274 |
<hr/>
|
275 |
<div class="input">
|
276 |
<input type="checkbox" id="show_hidden_ctx"/>
|
277 |
+
<label for="show_hidden_ctx"><?php _e('Show "private" taxonomies', 'wp_all_import_plugin'); ?></label>
|
278 |
</div>
|
279 |
<?php endif;?>
|
280 |
</td>
|
285 |
</div>
|
286 |
<div id="taxonomies_hints" style="display:none;">
|
287 |
<ul>
|
288 |
+
<li><?php _e('Taxonomies that don\'t already exist on your site will be created.', 'wp_all_import_plugin'); ?></li>
|
289 |
+
<li><?php _e('To import to existing parent taxonomies, use the existing taxonomy name or slug.', 'wp_all_import_plugin'); ?></li>
|
290 |
+
<li><?php _e('To import to existing hierarchical taxonomies, create the entire hierarchy using the taxonomy names or slugs.', 'wp_all_import_plugin'); ?></li>
|
291 |
</ul>
|
292 |
</div>
|
293 |
</div>
|
views/admin/license/index.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<form class="licenses" method="post" action="<?php echo $this->baseUrl ?>" enctype="multipart/form-data">
|
2 |
-
|
3 |
-
<h2><?php _e('WP All Import Licenses', 'pmxi_plugin') ?></h2>
|
4 |
-
<hr />
|
5 |
-
<?php if ($this->errors->get_error_codes()): ?>
|
6 |
-
<?php $this->error() ?>
|
7 |
-
<?php endif ?>
|
8 |
-
|
9 |
-
<table class="form-table">
|
10 |
-
<tbody>
|
11 |
-
<?php foreach ($addons as $class => $addon) : if ( ! $addon['active'] ) continue; ?>
|
12 |
-
<tr valign="top">
|
13 |
-
<th scope="row" valign="middle" style="width:200px; vertical-align: middle;">
|
14 |
-
<?php echo $addon['title']; ?>
|
15 |
-
</th>
|
16 |
-
<td style="vertical-align: middle; width: 360px;">
|
17 |
-
<input id="<?php echo $class; ?>_license_key" name="licenses[<?php echo $class; ?>]" type="text" class="regular-text" value="<?php if (!empty($post['licenses'][$class])) esc_attr_e( $post['licenses'][$class] ); ?>" />
|
18 |
-
</td>
|
19 |
-
<td style="vertical-align: middle;">
|
20 |
-
<?php if( ! empty($post['licenses'][$class]) ) { ?>
|
21 |
-
|
22 |
-
<?php if( ! empty($post['statuses'][$class]) && $post['statuses'][$class] == 'valid' ) { ?>
|
23 |
-
<p style="color:green;"><?php _e('Active', 'pmxi_plugin'); ?></p>
|
24 |
-
<!--input type="submit" class="button-secondary" name="pmxi_license_deactivate[<?php echo $class; ?>]" value="<?php _e('Deactivate License', 'pmxi_plugin'); ?>"/-->
|
25 |
-
<?php } else { ?>
|
26 |
-
<input type="submit" class="button-secondary" name="pmxi_license_activate[<?php echo $class; ?>]" value="<?php _e('Activate License', 'pmxi_plugin'); ?>"/>
|
27 |
-
<?php } ?>
|
28 |
-
|
29 |
-
<?php } ?>
|
30 |
-
</td>
|
31 |
-
</tr>
|
32 |
-
<?php endforeach; ?>
|
33 |
-
</tbody>
|
34 |
-
</table>
|
35 |
-
|
36 |
-
<p>
|
37 |
-
<?php wp_nonce_field('edit-licenses', '_wpnonce_edit-licenses') ?>
|
38 |
-
<input type="hidden" name="is_licenses_submitted" value="1" />
|
39 |
-
<input type="submit" class="button-primary" value="<?php _e('Save', 'pmxi_plugin') ?>" />
|
40 |
-
</p>
|
41 |
-
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
views/admin/manage/bulk.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
<input type="hidden" name="items[]" value="<?php echo esc_attr($id) ?>" />
|
8 |
<?php endforeach ?>
|
9 |
|
10 |
-
<p><?php printf(__('Are you sure you want to delete <strong>%s</strong> selected %s?', '
|
11 |
<p><input type="checkbox" id="is_delete_posts" name="is_delete_posts" /> <label for="is_delete_posts">Delete associated posts as well</label></p>
|
12 |
|
13 |
<p class="submit">
|
7 |
<input type="hidden" name="items[]" value="<?php echo esc_attr($id) ?>" />
|
8 |
<?php endforeach ?>
|
9 |
|
10 |
+
<p><?php printf(__('Are you sure you want to delete <strong>%s</strong> selected %s?', 'wp_all_import_plugin'), $items->count(), _n('import', 'imports', $items->count(), 'wp_all_import_plugin')) ?></p>
|
11 |
<p><input type="checkbox" id="is_delete_posts" name="is_delete_posts" /> <label for="is_delete_posts">Delete associated posts as well</label></p>
|
12 |
|
13 |
<p class="submit">
|
views/admin/manage/delete.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<h2><?php _e('Delete Import', '
|
2 |
|
3 |
<form method="post">
|
4 |
-
<p><?php printf(__('Are you sure you want to delete <strong>%s</strong> import?', '
|
5 |
<div class="input">
|
6 |
<input type="checkbox" id="is_delete_posts" name="is_delete_posts" /> <label for="is_delete_posts">Delete associated posts as well</label>
|
7 |
</div>
|
1 |
+
<h2><?php _e('Delete Import', 'wp_all_import_plugin') ?></h2>
|
2 |
|
3 |
<form method="post">
|
4 |
+
<p><?php printf(__('Are you sure you want to delete <strong>%s</strong> import?', 'wp_all_import_plugin'), $item->name) ?></p>
|
5 |
<div class="input">
|
6 |
<input type="checkbox" id="is_delete_posts" name="is_delete_posts" /> <label for="is_delete_posts">Delete associated posts as well</label>
|
7 |
</div>
|
views/admin/manage/index.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<div class="wpallimport-header" style="overflow:hidden; height: 60px; padding-top: 10px; margin-bottom: -20px;">
|
2 |
<div class="wpallimport-logo"></div>
|
3 |
<div class="wpallimport-title">
|
4 |
-
<p><?php _e('WP All Import', '
|
5 |
-
<h3><?php _e('Manage Imports', '
|
6 |
</div>
|
7 |
</div>
|
8 |
|
@@ -15,20 +15,20 @@
|
|
15 |
<form method="get">
|
16 |
<input type="hidden" name="page" value="<?php echo esc_attr($this->input->get('page')) ?>" />
|
17 |
<p class="search-box">
|
18 |
-
<label for="search-input" class="screen-reader-text"><?php _e('Search Imports', '
|
19 |
<input id="search-input" type="text" name="s" value="<?php echo esc_attr($s) ?>" />
|
20 |
-
<input type="submit" class="button" value="<?php _e('Search Imports', '
|
21 |
</p>
|
22 |
</form>
|
23 |
|
24 |
<?php
|
25 |
// define the columns to display, the syntax is 'internal name' => 'display name'
|
26 |
$columns = array(
|
27 |
-
'id' => __('ID', '
|
28 |
-
'name' => __('File', '
|
29 |
'actions' => '',
|
30 |
-
'summary' => __('Summary', '
|
31 |
-
'info' => __('Info & Options', '
|
32 |
);
|
33 |
|
34 |
$columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
@@ -41,16 +41,16 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
41 |
<div class="tablenav">
|
42 |
<div class="alignleft actions">
|
43 |
<select name="bulk-action">
|
44 |
-
<option value="" selected="selected"><?php _e('Bulk Actions', '
|
45 |
-
<option value="delete"><?php _e('Delete', '
|
46 |
</select>
|
47 |
-
<input type="submit" value="<?php esc_attr_e('Apply', '
|
48 |
</div>
|
49 |
|
50 |
<?php if ($page_links): ?>
|
51 |
<div class="tablenav-pages">
|
52 |
<?php echo $page_links_html = sprintf(
|
53 |
-
'<span class="displaying-num">' . __('Displaying %s–%s of %s', '
|
54 |
number_format_i18n(($pagenum - 1) * $perPage + 1),
|
55 |
number_format_i18n(min($pagenum * $perPage, $list->total())),
|
56 |
number_format_i18n($list->total()),
|
@@ -97,7 +97,7 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
97 |
<tbody id="the-pmxi-admin-import-list" class="list:pmxi-admin-imports">
|
98 |
<?php if ($list->isEmpty()): ?>
|
99 |
<tr>
|
100 |
-
<td colspan="<?php echo count($columns) + 1 ?>"><?php printf(__('No previous imports found. <a href="%s">Start a new import...</a>', '
|
101 |
</tr>
|
102 |
<?php else: ?>
|
103 |
<?php
|
@@ -154,7 +154,7 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
154 |
if ( ! empty($path_parts['dirname'])){
|
155 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
156 |
$dirname = array_pop($path_all_parts);
|
157 |
-
if (
|
158 |
|
159 |
$path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $item['path']));
|
160 |
|
@@ -175,17 +175,17 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
175 |
$import_actions = array(
|
176 |
'import_template' => array(
|
177 |
'url' => ( ! $item['processing'] and ! $item['executing'] ) ? add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl) : '',
|
178 |
-
'title' => __('Edit Import', '
|
179 |
'class' => 'edit'
|
180 |
),
|
181 |
'import_settings' => array(
|
182 |
'url' => ( ! $item['processing'] and ! $item['executing'] ) ? add_query_arg(array('id' => $item['id'], 'action' => 'options'), $this->baseUrl) : '',
|
183 |
-
'title' => __('Import Settings', '
|
184 |
'class' => 'edit'
|
185 |
),
|
186 |
'delete' => array(
|
187 |
'url' => add_query_arg(array('id' => $item['id'], 'action' => 'delete'), $this->baseUrl),
|
188 |
-
'title' => __('Delete', '
|
189 |
'class' => 'delete'
|
190 |
),
|
191 |
);
|
@@ -221,21 +221,21 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
221 |
<td>
|
222 |
<?php
|
223 |
if ($item['triggered'] and ! $item['processing']){
|
224 |
-
_e('triggered with cron', '
|
225 |
if ($item['last_activity'] != '0000-00-00 00:00:00'){
|
226 |
$diff = ceil((time() - strtotime($item['last_activity']))/60);
|
227 |
?>
|
228 |
<br>
|
229 |
<span <?php if ($diff >= 10) echo 'style="color:red;"';?>>
|
230 |
<?php
|
231 |
-
printf(__('last activity %s ago', '
|
232 |
?>
|
233 |
</span>
|
234 |
<?php
|
235 |
}
|
236 |
}
|
237 |
elseif ($item['processing']){
|
238 |
-
_e('currently processing with cron', '
|
239 |
printf('Records Processed %s', $item['imported']);
|
240 |
if ($item['last_activity'] != '0000-00-00 00:00:00'){
|
241 |
$diff = ceil((time() - strtotime($item['last_activity']))/60);
|
@@ -243,47 +243,47 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
243 |
<br>
|
244 |
<span <?php if ($diff >= 10) echo 'style="color:red;"';?>>
|
245 |
<?php
|
246 |
-
printf(__('last activity %s ago', '
|
247 |
?>
|
248 |
</span>
|
249 |
<?php
|
250 |
}
|
251 |
}
|
252 |
elseif($item['executing']){
|
253 |
-
_e('Import currently in progress', '
|
254 |
if ($item['last_activity'] != '0000-00-00 00:00:00'){
|
255 |
$diff = ceil((time() - strtotime($item['last_activity']))/60);
|
256 |
?>
|
257 |
<br>
|
258 |
<span <?php if ($diff >= 10) echo 'style="color:red;"';?>>
|
259 |
<?php
|
260 |
-
printf(__('last activity %s ago', '
|
261 |
?>
|
262 |
</span>
|
263 |
<?php
|
264 |
}
|
265 |
}
|
266 |
elseif($item['canceled'] and $item['canceled_on'] != '0000-00-00 00:00:00'){
|
267 |
-
printf(__('Import Attempt at %s', '
|
268 |
-
_e('Import canceled', '
|
269 |
}
|
270 |
elseif($item['failed'] and $item['failed_on'] != '0000-00-00 00:00:00'){
|
271 |
-
printf(__('Import Attempt at %s', '
|
272 |
-
_e('Import failed, please check logs', '
|
273 |
}
|
274 |
else{
|
275 |
$custom_type = get_post_type_object( $item['options']['custom_type'] );
|
276 |
$cpt_name = ( ! empty($custom_type)) ? $custom_type->labels->singular_name : '';
|
277 |
-
printf(__('Last run: %s', '
|
278 |
-
printf(__('%d %ss created', '
|
279 |
printf(__('%d updated, %d skipped, %d deleted'), $item['updated'], $item['skipped'], $item['deleted']);
|
280 |
-
//printf(__('%d records', '
|
281 |
}
|
282 |
|
283 |
if ($item['settings_update_on'] != '0000-00-00 00:00:00' and $item['last_activity'] != '0000-00-00 00:00:00' and strtotime($item['settings_update_on']) > strtotime($item['last_activity'])){
|
284 |
echo '<br/>';
|
285 |
?>
|
286 |
-
<strong><?php _e('settings edited since last run', '
|
287 |
<?php
|
288 |
}
|
289 |
|
@@ -295,9 +295,9 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
295 |
?>
|
296 |
<td>
|
297 |
|
298 |
-
<a href="
|
299 |
|
300 |
-
<a href="<?php echo add_query_arg(array('page' => 'pmxi-admin-history', 'id' => $item['id']), $this->baseUrl)?>"><?php _e('History Logs', '
|
301 |
|
302 |
</td>
|
303 |
<?php
|
@@ -306,12 +306,12 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
306 |
?>
|
307 |
<td style="width: 130px;">
|
308 |
<?php if ( ! $item['processing'] and ! $item['executing'] ): ?>
|
309 |
-
<!--h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl); ?>"><?php _e('Edit', '
|
310 |
-
<h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'update'), $this->baseUrl); ?>"><?php _e('Run Import', '
|
311 |
<?php elseif ($item['processing']) : ?>
|
312 |
-
<h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel'), $this->baseUrl); ?>"><?php _e('Cancel Cron', '
|
313 |
<?php elseif ($item['executing']) : ?>
|
314 |
-
<h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel'), $this->baseUrl); ?>"><?php _e('Cancel', '
|
315 |
<?php endif; ?>
|
316 |
</td>
|
317 |
<?php
|
@@ -338,33 +338,34 @@ $columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
|
338 |
|
339 |
<div class="alignleft actions">
|
340 |
<select name="bulk-action2">
|
341 |
-
<option value="" selected="selected"><?php _e('Bulk Actions', '
|
342 |
<?php if ( empty($type) or 'trash' != $type): ?>
|
343 |
-
<option value="delete"><?php _e('Delete', '
|
344 |
<?php else: ?>
|
345 |
-
<option value="restore"><?php _e('Restore', '
|
346 |
-
<option value="delete"><?php _e('Delete Permanently', '
|
347 |
<?php endif ?>
|
348 |
</select>
|
349 |
-
<input type="submit" value="<?php esc_attr_e('Apply', '
|
350 |
</div>
|
351 |
</div>
|
352 |
<div class="clear"></div>
|
|
|
353 |
<?php
|
354 |
// notify user
|
355 |
if (!PMXI_Plugin::getInstance()->getOption('dismiss_manage_bottom')) {
|
356 |
?>
|
357 |
<div class="updated_bottom"><p>
|
358 |
<?php printf(
|
359 |
-
__('<a href="https://wordpress.org/support/view/plugin-reviews/wp-all-import#postform" target="_blank">If our plugin helped you, please rate us on WordPress.org. It would really help us!</a> <a href="https://wordpress.org/support/view/plugin-reviews/wp-all-import#postform" class="pmxi_stars" target="_blank"></a> <br/><br/><a href="javascript:void(0);" id="dismiss_manage_bottom">dismiss</a>', '
|
360 |
) ?>
|
361 |
</p></div>
|
362 |
<?php
|
363 |
}
|
364 |
?>
|
365 |
|
366 |
-
<p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=manage" target="_blank" class="upgrade_link"><?php _e('Find out more about the professional edition of WP All Import.', '
|
367 |
|
368 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
369 |
|
370 |
</form>
|
1 |
<div class="wpallimport-header" style="overflow:hidden; height: 60px; padding-top: 10px; margin-bottom: -20px;">
|
2 |
<div class="wpallimport-logo"></div>
|
3 |
<div class="wpallimport-title">
|
4 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
5 |
+
<h3><?php _e('Manage Imports', 'wp_all_import_plugin'); ?></h3>
|
6 |
</div>
|
7 |
</div>
|
8 |
|
15 |
<form method="get">
|
16 |
<input type="hidden" name="page" value="<?php echo esc_attr($this->input->get('page')) ?>" />
|
17 |
<p class="search-box">
|
18 |
+
<label for="search-input" class="screen-reader-text"><?php _e('Search Imports', 'wp_all_import_plugin') ?>:</label>
|
19 |
<input id="search-input" type="text" name="s" value="<?php echo esc_attr($s) ?>" />
|
20 |
+
<input type="submit" class="button" value="<?php _e('Search Imports', 'wp_all_import_plugin') ?>">
|
21 |
</p>
|
22 |
</form>
|
23 |
|
24 |
<?php
|
25 |
// define the columns to display, the syntax is 'internal name' => 'display name'
|
26 |
$columns = array(
|
27 |
+
'id' => __('ID', 'wp_all_import_plugin'),
|
28 |
+
'name' => __('File', 'wp_all_import_plugin'),
|
29 |
'actions' => '',
|
30 |
+
'summary' => __('Summary', 'wp_all_import_plugin'),
|
31 |
+
'info' => __('Info & Options', 'wp_all_import_plugin'),
|
32 |
);
|
33 |
|
34 |
$columns = apply_filters('pmxi_manage_imports_columns', $columns);
|
41 |
<div class="tablenav">
|
42 |
<div class="alignleft actions">
|
43 |
<select name="bulk-action">
|
44 |
+
<option value="" selected="selected"><?php _e('Bulk Actions', 'wp_all_import_plugin') ?></option>
|
45 |
+
<option value="delete"><?php _e('Delete', 'wp_all_import_plugin') ?></option>
|
46 |
</select>
|
47 |
+
<input type="submit" value="<?php esc_attr_e('Apply', 'wp_all_import_plugin') ?>" name="doaction" id="doaction" class="button-secondary action" />
|
48 |
</div>
|
49 |
|
50 |
<?php if ($page_links): ?>
|
51 |
<div class="tablenav-pages">
|
52 |
<?php echo $page_links_html = sprintf(
|
53 |
+
'<span class="displaying-num">' . __('Displaying %s–%s of %s', 'wp_all_import_plugin') . '</span>%s',
|
54 |
number_format_i18n(($pagenum - 1) * $perPage + 1),
|
55 |
number_format_i18n(min($pagenum * $perPage, $list->total())),
|
56 |
number_format_i18n($list->total()),
|
97 |
<tbody id="the-pmxi-admin-import-list" class="list:pmxi-admin-imports">
|
98 |
<?php if ($list->isEmpty()): ?>
|
99 |
<tr>
|
100 |
+
<td colspan="<?php echo count($columns) + 1 ?>"><?php printf(__('No previous imports found. <a href="%s">Start a new import...</a>', 'wp_all_import_plugin'), esc_url(add_query_arg(array('page' => 'pmxi-admin-import'), admin_url('admin.php')))); ?></td>
|
101 |
</tr>
|
102 |
<?php else: ?>
|
103 |
<?php
|
154 |
if ( ! empty($path_parts['dirname'])){
|
155 |
$path_all_parts = explode('/', $path_parts['dirname']);
|
156 |
$dirname = array_pop($path_all_parts);
|
157 |
+
if ( wp_all_import_isValidMd5($dirname)){
|
158 |
|
159 |
$path = str_replace($dirname, preg_replace('%^(.{3}).*(.{3})$%', '$1***$2', $dirname), str_replace('temp/', '', $item['path']));
|
160 |
|
175 |
$import_actions = array(
|
176 |
'import_template' => array(
|
177 |
'url' => ( ! $item['processing'] and ! $item['executing'] ) ? add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl) : '',
|
178 |
+
'title' => __('Edit Import', 'wp_all_import_plugin'),
|
179 |
'class' => 'edit'
|
180 |
),
|
181 |
'import_settings' => array(
|
182 |
'url' => ( ! $item['processing'] and ! $item['executing'] ) ? add_query_arg(array('id' => $item['id'], 'action' => 'options'), $this->baseUrl) : '',
|
183 |
+
'title' => __('Import Settings', 'wp_all_import_plugin'),
|
184 |
'class' => 'edit'
|
185 |
),
|
186 |
'delete' => array(
|
187 |
'url' => add_query_arg(array('id' => $item['id'], 'action' => 'delete'), $this->baseUrl),
|
188 |
+
'title' => __('Delete', 'wp_all_import_plugin'),
|
189 |
'class' => 'delete'
|
190 |
),
|
191 |
);
|
221 |
<td>
|
222 |
<?php
|
223 |
if ($item['triggered'] and ! $item['processing']){
|
224 |
+
_e('triggered with cron', 'wp_all_import_plugin');
|
225 |
if ($item['last_activity'] != '0000-00-00 00:00:00'){
|
226 |
$diff = ceil((time() - strtotime($item['last_activity']))/60);
|
227 |
?>
|
228 |
<br>
|
229 |
<span <?php if ($diff >= 10) echo 'style="color:red;"';?>>
|
230 |
<?php
|
231 |
+
printf(__('last activity %s ago', 'wp_all_import_plugin'), human_time_diff(strtotime($item['last_activity']), time()));
|
232 |
?>
|
233 |
</span>
|
234 |
<?php
|
235 |
}
|
236 |
}
|
237 |
elseif ($item['processing']){
|
238 |
+
_e('currently processing with cron', 'wp_all_import_plugin'); echo '<br/>';
|
239 |
printf('Records Processed %s', $item['imported']);
|
240 |
if ($item['last_activity'] != '0000-00-00 00:00:00'){
|
241 |
$diff = ceil((time() - strtotime($item['last_activity']))/60);
|
243 |
<br>
|
244 |
<span <?php if ($diff >= 10) echo 'style="color:red;"';?>>
|
245 |
<?php
|
246 |
+
printf(__('last activity %s ago', 'wp_all_import_plugin'), human_time_diff(strtotime($item['last_activity']), time()));
|
247 |
?>
|
248 |
</span>
|
249 |
<?php
|
250 |
}
|
251 |
}
|
252 |
elseif($item['executing']){
|
253 |
+
_e('Import currently in progress', 'wp_all_import_plugin');
|
254 |
if ($item['last_activity'] != '0000-00-00 00:00:00'){
|
255 |
$diff = ceil((time() - strtotime($item['last_activity']))/60);
|
256 |
?>
|
257 |
<br>
|
258 |
<span <?php if ($diff >= 10) echo 'style="color:red;"';?>>
|
259 |
<?php
|
260 |
+
printf(__('last activity %s ago', 'wp_all_import_plugin'), human_time_diff(strtotime($item['last_activity']), time()));
|
261 |
?>
|
262 |
</span>
|
263 |
<?php
|
264 |
}
|
265 |
}
|
266 |
elseif($item['canceled'] and $item['canceled_on'] != '0000-00-00 00:00:00'){
|
267 |
+
printf(__('Import Attempt at %s', 'wp_all_import_plugin'), get_date_from_gmt($item['canceled_on'], "m/d/Y g:i a")); echo '<br/>';
|
268 |
+
_e('Import canceled', 'wp_all_import_plugin');
|
269 |
}
|
270 |
elseif($item['failed'] and $item['failed_on'] != '0000-00-00 00:00:00'){
|
271 |
+
printf(__('Import Attempt at %s', 'wp_all_import_plugin'), get_date_from_gmt($item['failed_on'], "m/d/Y g:i a")); echo '<br/>';
|
272 |
+
_e('Import failed, please check logs', 'wp_all_import_plugin');
|
273 |
}
|
274 |
else{
|
275 |
$custom_type = get_post_type_object( $item['options']['custom_type'] );
|
276 |
$cpt_name = ( ! empty($custom_type)) ? $custom_type->labels->singular_name : '';
|
277 |
+
printf(__('Last run: %s', 'wp_all_import_plugin'), ($item['registered_on'] == '0000-00-00 00:00:00') ? __('never', 'wp_all_import_plugin') : get_date_from_gmt($item['registered_on'], "m/d/Y g:i a")); echo '<br/>';
|
278 |
+
printf(__('%d %ss created', 'wp_all_import_plugin'), $item['created'], $cpt_name); echo '<br/>';
|
279 |
printf(__('%d updated, %d skipped, %d deleted'), $item['updated'], $item['skipped'], $item['deleted']);
|
280 |
+
//printf(__('%d records', 'wp_all_import_plugin'), $item['post_count']);
|
281 |
}
|
282 |
|
283 |
if ($item['settings_update_on'] != '0000-00-00 00:00:00' and $item['last_activity'] != '0000-00-00 00:00:00' and strtotime($item['settings_update_on']) > strtotime($item['last_activity'])){
|
284 |
echo '<br/>';
|
285 |
?>
|
286 |
+
<strong><?php _e('settings edited since last run', 'wp_all_import_plugin'); ?></strong>
|
287 |
<?php
|
288 |
}
|
289 |
|
295 |
?>
|
296 |
<td>
|
297 |
|
298 |
+
<a href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'scheduling'), $this->baseUrl)?>"><?php _e('Cron Scheduling', 'wp_all_import_plugin'); ?></a> <br>
|
299 |
|
300 |
+
<a href="<?php echo add_query_arg(array('page' => 'pmxi-admin-history', 'id' => $item['id']), $this->baseUrl)?>"><?php _e('History Logs', 'wp_all_import_plugin'); ?></a>
|
301 |
|
302 |
</td>
|
303 |
<?php
|
306 |
?>
|
307 |
<td style="width: 130px;">
|
308 |
<?php if ( ! $item['processing'] and ! $item['executing'] ): ?>
|
309 |
+
<!--h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'edit'), $this->baseUrl); ?>"><?php _e('Edit', 'wp_all_import_plugin'); ?></a></h2-->
|
310 |
+
<h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'update'), $this->baseUrl); ?>"><?php _e('Run Import', 'wp_all_import_plugin'); ?></a></h2>
|
311 |
<?php elseif ($item['processing']) : ?>
|
312 |
+
<h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), $this->baseUrl); ?>"><?php _e('Cancel Cron', 'wp_all_import_plugin'); ?></a></h2>
|
313 |
<?php elseif ($item['executing']) : ?>
|
314 |
+
<h2 style="float:left;"><a class="add-new-h2" href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'cancel', '_wpnonce' => wp_create_nonce( '_wpnonce-cancel_import' )), $this->baseUrl); ?>"><?php _e('Cancel', 'wp_all_import_plugin'); ?></a></h2>
|
315 |
<?php endif; ?>
|
316 |
</td>
|
317 |
<?php
|
338 |
|
339 |
<div class="alignleft actions">
|
340 |
<select name="bulk-action2">
|
341 |
+
<option value="" selected="selected"><?php _e('Bulk Actions', 'wp_all_import_plugin') ?></option>
|
342 |
<?php if ( empty($type) or 'trash' != $type): ?>
|
343 |
+
<option value="delete"><?php _e('Delete', 'wp_all_import_plugin') ?></option>
|
344 |
<?php else: ?>
|
345 |
+
<option value="restore"><?php _e('Restore', 'wp_all_import_plugin')?></option>
|
346 |
+
<option value="delete"><?php _e('Delete Permanently', 'wp_all_import_plugin')?></option>
|
347 |
<?php endif ?>
|
348 |
</select>
|
349 |
+
<input type="submit" value="<?php esc_attr_e('Apply', 'wp_all_import_plugin') ?>" name="doaction2" id="doaction2" class="button-secondary action" />
|
350 |
</div>
|
351 |
</div>
|
352 |
<div class="clear"></div>
|
353 |
+
|
354 |
<?php
|
355 |
// notify user
|
356 |
if (!PMXI_Plugin::getInstance()->getOption('dismiss_manage_bottom')) {
|
357 |
?>
|
358 |
<div class="updated_bottom"><p>
|
359 |
<?php printf(
|
360 |
+
__('<a href="https://wordpress.org/support/view/plugin-reviews/wp-all-import#postform" target="_blank">If our plugin helped you, please rate us on WordPress.org. It would really help us!</a> <a href="https://wordpress.org/support/view/plugin-reviews/wp-all-import#postform" class="pmxi_stars" target="_blank"></a> <br/><br/><a href="javascript:void(0);" id="dismiss_manage_bottom">dismiss</a>', 'wp_all_import_plugin')
|
361 |
) ?>
|
362 |
</p></div>
|
363 |
<?php
|
364 |
}
|
365 |
?>
|
366 |
|
367 |
+
<p style='font-size: 1.3em; font-weight: bold;'><a href="http://www.wpallimport.com/upgrade-to-pro/?utm_source=free-plugin&utm_medium=in-plugin&utm_campaign=manage" target="_blank" class="upgrade_link"><?php _e('Find out more about the professional edition of WP All Import.', 'wp_all_import_plugin'); ?></a></p>
|
368 |
|
369 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
370 |
|
371 |
</form>
|
views/admin/manage/scheduling.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<h2>
|
2 |
-
<?php _e('Cron Scheduling', '
|
3 |
</h2>
|
4 |
|
5 |
<?php if ( in_array($item['type'], array('url', 'ftp', 'file'))):?>
|
6 |
|
7 |
<p>
|
8 |
-
<?php _e('To schedule an import, you must create two cron jobs in your web hosting control panel. One cron job will be used to run the Trigger script, the other to run the Execution script.', '
|
9 |
</p>
|
10 |
|
11 |
<p>
|
@@ -16,44 +16,47 @@
|
|
16 |
</p>
|
17 |
|
18 |
|
19 |
-
<p><strong><?php _e('Trigger Script', '
|
20 |
|
21 |
-
<p><?php _e('Every time you want to schedule the import, run the trigger script.', '
|
22 |
|
23 |
-
<p><?php _e('To schedule the import to run once every 24 hours, run the trigger script every 24 hours. Most hosts require you to use “wget” to access a URL. Ask your host for details.', '
|
24 |
|
25 |
-
<p><i><?php _e('Example:', '
|
26 |
|
27 |
<p>wget -q -O /dev/null "<?php echo home_url() . '/wp-cron.php?import_key=' . $cron_job_key . '&import_id=' . $id . '&action=trigger'; ?>"</p>
|
28 |
|
29 |
-
<p><strong><?php _e('Execution Script', '
|
30 |
|
31 |
-
<p><?php _e('The Execution script actually executes the import, once it has been triggered with the Trigger script.', '
|
32 |
|
33 |
-
<p><?php _e('It processes in iteration (only importing a few records each time it runs) to optimize server load. It is recommended you run the execution script every 2 minutes.', '
|
34 |
|
35 |
-
<p><?php _e('It also operates this way in case of unexpected crashes by your web host. If it crashes before the import is finished, the next run of the cron job two minutes later will continue it where it left off, ensuring reliability.', '
|
36 |
|
37 |
-
<p><i><?php _e('Example:', '
|
38 |
|
39 |
<p>wget -q -O /dev/null "<?php echo home_url() . '/wp-cron.php?import_key=' . $cron_job_key . '&import_id=' . $id . '&action=processing'; ?>"</p>
|
40 |
|
41 |
-
<p><strong><?php _e('Notes', '
|
42 |
|
43 |
<p>
|
44 |
-
<?php _e('Your web host may require you to use a command other than wget, although wget is most common. In this case, you must asking your web hosting provider for help.', '
|
45 |
</p>
|
46 |
|
47 |
<p>
|
48 |
-
See the <a href='http://www.wpallimport.com/documentation/
|
49 |
</p>
|
50 |
|
51 |
<?php else: ?>
|
52 |
-
|
53 |
-
<p
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
56 |
|
57 |
<?php endif; ?>
|
58 |
|
59 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
1 |
<h2>
|
2 |
+
<?php _e('Cron Scheduling', 'wp_all_import_plugin') ?>
|
3 |
</h2>
|
4 |
|
5 |
<?php if ( in_array($item['type'], array('url', 'ftp', 'file'))):?>
|
6 |
|
7 |
<p>
|
8 |
+
<?php _e('To schedule an import, you must create two cron jobs in your web hosting control panel. One cron job will be used to run the Trigger script, the other to run the Execution script.', 'wp_all_import_plugin'); ?>
|
9 |
</p>
|
10 |
|
11 |
<p>
|
16 |
</p>
|
17 |
|
18 |
|
19 |
+
<p><strong><?php _e('Trigger Script', 'wp_all_import_plugin'); ?></strong></p>
|
20 |
|
21 |
+
<p><?php _e('Every time you want to schedule the import, run the trigger script.', 'wp_all_import_plugin'); ?></p>
|
22 |
|
23 |
+
<p><?php _e('To schedule the import to run once every 24 hours, run the trigger script every 24 hours. Most hosts require you to use “wget” to access a URL. Ask your host for details.', 'wp_all_import_plugin'); ?></p>
|
24 |
|
25 |
+
<p><i><?php _e('Example:', 'wp_all_import_plugin'); ?></i></p>
|
26 |
|
27 |
<p>wget -q -O /dev/null "<?php echo home_url() . '/wp-cron.php?import_key=' . $cron_job_key . '&import_id=' . $id . '&action=trigger'; ?>"</p>
|
28 |
|
29 |
+
<p><strong><?php _e('Execution Script', 'wp_all_import_plugin'); ?></strong></p>
|
30 |
|
31 |
+
<p><?php _e('The Execution script actually executes the import, once it has been triggered with the Trigger script.', 'wp_all_import_plugin'); ?></p>
|
32 |
|
33 |
+
<p><?php _e('It processes in iteration (only importing a few records each time it runs) to optimize server load. It is recommended you run the execution script every 2 minutes.', 'wp_all_import_plugin'); ?></p>
|
34 |
|
35 |
+
<p><?php _e('It also operates this way in case of unexpected crashes by your web host. If it crashes before the import is finished, the next run of the cron job two minutes later will continue it where it left off, ensuring reliability.', 'wp_all_import_plugin'); ?></p>
|
36 |
|
37 |
+
<p><i><?php _e('Example:', 'wp_all_import_plugin'); ?></i></p>
|
38 |
|
39 |
<p>wget -q -O /dev/null "<?php echo home_url() . '/wp-cron.php?import_key=' . $cron_job_key . '&import_id=' . $id . '&action=processing'; ?>"</p>
|
40 |
|
41 |
+
<p><strong><?php _e('Notes', 'wp_all_import_plugin'); ?></strong></p>
|
42 |
|
43 |
<p>
|
44 |
+
<?php _e('Your web host may require you to use a command other than wget, although wget is most common. In this case, you must asking your web hosting provider for help.', 'wp_all_import_plugin'); ?>
|
45 |
</p>
|
46 |
|
47 |
<p>
|
48 |
+
See the <a href='http://www.wpallimport.com/documentation/recurring/cron/'>documentation</a> for more details.
|
49 |
</p>
|
50 |
|
51 |
<?php else: ?>
|
52 |
+
|
53 |
+
<p>
|
54 |
+
<?php _e('To schedule this import with a cron job, you must use the "Download from URL" option on the Import Settings screen of WP All Import.', 'wp_all_import_plugin'); ?>
|
55 |
+
</p>
|
56 |
+
<p>
|
57 |
+
<a href="<?php echo add_query_arg(array('id' => $item['id'], 'action' => 'options'), $this->baseUrl); ?>"><?php _e('Go to Import Settings now...', 'wp_all_import_plugin'); ?></a>
|
58 |
+
</p>
|
59 |
|
60 |
<?php endif; ?>
|
61 |
|
62 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
views/admin/manage/update.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<h2><?php _e('Update Import', '
|
2 |
|
3 |
<?php if ($this->errors->get_error_codes()): ?>
|
4 |
<?php $this->error() ?>
|
@@ -6,8 +6,8 @@
|
|
6 |
|
7 |
<?php if ($item->path): ?>
|
8 |
<form method="post">
|
9 |
-
<p><?php printf(__('Are you sure you want to update <strong>%s</strong> import?', '
|
10 |
-
<p><?php printf(__('Source path is <strong>%s</strong>', '
|
11 |
|
12 |
<p class="submit">
|
13 |
<?php wp_nonce_field('update-import', '_wpnonce_update-import') ?>
|
1 |
+
<h2><?php _e('Update Import', 'wp_all_import_plugin') ?></h2>
|
2 |
|
3 |
<?php if ($this->errors->get_error_codes()): ?>
|
4 |
<?php $this->error() ?>
|
6 |
|
7 |
<?php if ($item->path): ?>
|
8 |
<form method="post">
|
9 |
+
<p><?php printf(__('Are you sure you want to update <strong>%s</strong> import?', 'wp_all_import_plugin'), $item->name) ?></p>
|
10 |
+
<p><?php printf(__('Source path is <strong>%s</strong>', 'wp_all_import_plugin'), $item->path) ?></p>
|
11 |
|
12 |
<p class="submit">
|
13 |
<?php wp_nonce_field('update-import', '_wpnonce_update-import') ?>
|
views/admin/settings/index.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<form class="settings" method="post" action="
|
2 |
|
3 |
<div class="wpallimport-header">
|
4 |
<div class="wpallimport-logo"></div>
|
5 |
<div class="wpallimport-title">
|
6 |
-
<p><?php _e('WP All Import', '
|
7 |
-
<h3><?php _e('Settings', '
|
8 |
</div>
|
9 |
</div>
|
10 |
|
@@ -15,8 +15,9 @@
|
|
15 |
<?php $this->error() ?>
|
16 |
<?php endif ?>
|
17 |
|
18 |
-
<h3><?php _e('Import/Export Templates', '
|
19 |
<?php $templates = new PMXI_Template_List(); $templates->getBy()->convertRecords() ?>
|
|
|
20 |
<?php if ($templates->total()): ?>
|
21 |
<table>
|
22 |
<?php foreach ($templates as $t): ?>
|
@@ -27,57 +28,56 @@
|
|
27 |
</tr>
|
28 |
<?php endforeach ?>
|
29 |
</table>
|
30 |
-
<p class="submit-buttons">
|
31 |
-
<?php
|
32 |
-
<input type="submit" class="button-primary" name="
|
33 |
-
<input type="submit" class="button-primary" name="export_templates" value="<?php _e('Export Selected', 'pmxi_plugin') ?>" />
|
34 |
</p>
|
35 |
<?php else: ?>
|
36 |
-
<em><?php _e('There are no templates saved', '
|
37 |
<?php endif ?>
|
38 |
<p>
|
39 |
<input type="hidden" name="is_templates_submitted" value="1" />
|
40 |
<input type="file" name="template_file"/>
|
41 |
-
<input type="submit" class="button-primary" name="import_templates" value="<?php _e('Import Templates', '
|
42 |
</p>
|
43 |
</div>
|
44 |
|
45 |
</form>
|
46 |
|
47 |
-
<form name="settings" method="post" action="
|
48 |
|
49 |
-
<h3><?php _e('Files', '
|
50 |
|
51 |
<table class="form-table">
|
52 |
<tbody>
|
53 |
<tr>
|
54 |
-
<th scope="row"><label><?php _e('Secure Mode', '
|
55 |
<td>
|
56 |
<fieldset style="padding:0;">
|
57 |
-
<legend class="screen-reader-text"><span><?php _e('Secure Mode', '
|
58 |
<input type="hidden" name="secure" value="0"/>
|
59 |
-
<label for="secure"><input type="checkbox" value="1" id="secure" name="secure" <?php echo (($post['secure']) ? 'checked="checked"' : ''); ?>><?php _e('Randomize folder names', '
|
60 |
</fieldset>
|
61 |
<p class="description">
|
62 |
<?php
|
63 |
$wp_uploads = wp_upload_dir();
|
64 |
?>
|
65 |
-
<?php printf(__('Imported files, chunks, logs and temporary files will be placed in a folder with a randomized name inside of %s.', '
|
66 |
</p>
|
67 |
</td>
|
68 |
</tr>
|
69 |
<tr>
|
70 |
-
<th scope="row"><label><?php _e('Log Storage', '
|
71 |
<td>
|
72 |
<input type="text" class="regular-text" name="log_storage" value="<?php echo esc_attr($post['log_storage']); ?>"/>
|
73 |
-
<p class="description"><?php _e('Number of logs to store for each import. Enter 0 to never store logs.', '
|
74 |
</td>
|
75 |
</tr>
|
76 |
<tr>
|
77 |
-
<th scope="row"><label><?php _e('Clean Up Temp Files', '
|
78 |
<td>
|
79 |
-
<a class="button-primary wpallimport-clean-up-tmp-files" href="<?php echo add_query_arg(array('action' => 'cleanup'), $this->baseUrl); ?>"><?php _e('Clean Up', '
|
80 |
-
<p class="description"><?php _e('Attempt to remove temp files left over by imports that were improperly terminated.', '
|
81 |
</td>
|
82 |
</tr>
|
83 |
</tbody>
|
@@ -85,28 +85,35 @@
|
|
85 |
|
86 |
<div class="clear"></div>
|
87 |
|
88 |
-
<h3><?php _e('Advanced Settings', '
|
89 |
|
90 |
<table class="form-table">
|
91 |
<tbody>
|
92 |
<tr>
|
93 |
-
<th scope="row"><label><?php _e('Chunk Size', '
|
94 |
<td>
|
95 |
<input type="text" class="regular-text" name="large_feed_limit" value="<?php echo esc_attr($post['large_feed_limit']); ?>"/>
|
96 |
-
<p class="description"><?php _e('Split file into chunks containing the specified number of records.', '
|
97 |
</td>
|
98 |
</tr>
|
99 |
<tr>
|
100 |
-
<th scope="row"><label><?php _e('WP_IMPORTING', '
|
101 |
<td>
|
102 |
<fieldset style="padding:0;">
|
103 |
<legend class="screen-reader-text"><span>Membership</span></legend>
|
104 |
<input type="hidden" name="pingbacks" value="0"/>
|
105 |
-
<label for="pingbacks"><input type="checkbox" value="1" id="pingbacks" name="pingbacks" <?php echo (($post['pingbacks']) ? 'checked="checked"' : ''); ?>><?php _e('Enable WP_IMPORTING', '
|
106 |
</fieldset>
|
107 |
-
<p class="description"><?php _e('Setting this constant avoids triggering pingback.', '
|
108 |
</td>
|
109 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
</tbody>
|
111 |
</table>
|
112 |
|
@@ -118,6 +125,6 @@
|
|
118 |
<input type="submit" class="button-primary" value="Save Settings" />
|
119 |
</p>
|
120 |
|
121 |
-
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', '
|
122 |
|
123 |
</form>
|
1 |
+
<form class="settings" method="post" action="" enctype="multipart/form-data">
|
2 |
|
3 |
<div class="wpallimport-header">
|
4 |
<div class="wpallimport-logo"></div>
|
5 |
<div class="wpallimport-title">
|
6 |
+
<p><?php _e('WP All Import', 'wp_all_import_plugin'); ?></p>
|
7 |
+
<h3><?php _e('Settings', 'wp_all_import_plugin'); ?></h3>
|
8 |
</div>
|
9 |
</div>
|
10 |
|
15 |
<?php $this->error() ?>
|
16 |
<?php endif ?>
|
17 |
|
18 |
+
<h3><?php _e('Import/Export Templates', 'wp_all_import_plugin') ?></h3>
|
19 |
<?php $templates = new PMXI_Template_List(); $templates->getBy()->convertRecords() ?>
|
20 |
+
<?php wp_nonce_field('delete-templates', '_wpnonce_delete-templates') ?>
|
21 |
<?php if ($templates->total()): ?>
|
22 |
<table>
|
23 |
<?php foreach ($templates as $t): ?>
|
28 |
</tr>
|
29 |
<?php endforeach ?>
|
30 |
</table>
|
31 |
+
<p class="submit-buttons">
|
32 |
+
<input type="submit" class="button-primary" name="delete_templates" value="<?php _e('Delete Selected', 'wp_all_import_plugin') ?>" />
|
33 |
+
<input type="submit" class="button-primary" name="export_templates" value="<?php _e('Export Selected', 'wp_all_import_plugin') ?>" />
|
|
|
34 |
</p>
|
35 |
<?php else: ?>
|
36 |
+
<em><?php _e('There are no templates saved', 'wp_all_import_plugin') ?></em>
|
37 |
<?php endif ?>
|
38 |
<p>
|
39 |
<input type="hidden" name="is_templates_submitted" value="1" />
|
40 |
<input type="file" name="template_file"/>
|
41 |
+
<input type="submit" class="button-primary" name="import_templates" value="<?php _e('Import Templates', 'wp_all_import_plugin') ?>" />
|
42 |
</p>
|
43 |
</div>
|
44 |
|
45 |
</form>
|
46 |
|
47 |
+
<form name="settings" method="post" action="" class="settings">
|
48 |
|
49 |
+
<h3><?php _e('Files', 'wp_all_import_plugin') ?></h3>
|
50 |
|
51 |
<table class="form-table">
|
52 |
<tbody>
|
53 |
<tr>
|
54 |
+
<th scope="row"><label><?php _e('Secure Mode', 'wp_all_import_plugin'); ?></label></th>
|
55 |
<td>
|
56 |
<fieldset style="padding:0;">
|
57 |
+
<legend class="screen-reader-text"><span><?php _e('Secure Mode', 'wp_all_import_plugin'); ?></span></legend>
|
58 |
<input type="hidden" name="secure" value="0"/>
|
59 |
+
<label for="secure"><input type="checkbox" value="1" id="secure" name="secure" <?php echo (($post['secure']) ? 'checked="checked"' : ''); ?>><?php _e('Randomize folder names', 'wp_all_import_plugin'); ?></label>
|
60 |
</fieldset>
|
61 |
<p class="description">
|
62 |
<?php
|
63 |
$wp_uploads = wp_upload_dir();
|
64 |
?>
|
65 |
+
<?php printf(__('Imported files, chunks, logs and temporary files will be placed in a folder with a randomized name inside of %s.', 'wp_all_import_plugin'), $wp_uploads['basedir'] . '/wpallimport' ); ?>
|
66 |
</p>
|
67 |
</td>
|
68 |
</tr>
|
69 |
<tr>
|
70 |
+
<th scope="row"><label><?php _e('Log Storage', 'wp_all_import_plugin'); ?></label></th>
|
71 |
<td>
|
72 |
<input type="text" class="regular-text" name="log_storage" value="<?php echo esc_attr($post['log_storage']); ?>"/>
|
73 |
+
<p class="description"><?php _e('Number of logs to store for each import. Enter 0 to never store logs.', 'wp_all_import_plugin'); ?></p>
|
74 |
</td>
|
75 |
</tr>
|
76 |
<tr>
|
77 |
+
<th scope="row"><label><?php _e('Clean Up Temp Files', 'wp_all_import_plugin'); ?></label></th>
|
78 |
<td>
|
79 |
+
<a class="button-primary wpallimport-clean-up-tmp-files" href="<?php echo add_query_arg(array('action' => 'cleanup'), $this->baseUrl); ?>"><?php _e('Clean Up', 'wp_all_import_plugin'); ?></a>
|
80 |
+
<p class="description"><?php _e('Attempt to remove temp files left over by imports that were improperly terminated.', 'wp_all_import_plugin'); ?></p>
|
81 |
</td>
|
82 |
</tr>
|
83 |
</tbody>
|
85 |
|
86 |
<div class="clear"></div>
|
87 |
|
88 |
+
<h3><?php _e('Advanced Settings', 'wp_all_import_plugin') ?></h3>
|
89 |
|
90 |
<table class="form-table">
|
91 |
<tbody>
|
92 |
<tr>
|
93 |
+
<th scope="row"><label><?php _e('Chunk Size', 'wp_all_import_plugin'); ?></label></th>
|
94 |
<td>
|
95 |
<input type="text" class="regular-text" name="large_feed_limit" value="<?php echo esc_attr($post['large_feed_limit']); ?>"/>
|
96 |
+
<p class="description"><?php _e('Split file into chunks containing the specified number of records.', 'wp_all_import_plugin'); ?></p>
|
97 |
</td>
|
98 |
</tr>
|
99 |
<tr>
|
100 |
+
<th scope="row"><label><?php _e('WP_IMPORTING', 'wp_all_import_plugin'); ?></label></th>
|
101 |
<td>
|
102 |
<fieldset style="padding:0;">
|
103 |
<legend class="screen-reader-text"><span>Membership</span></legend>
|
104 |
<input type="hidden" name="pingbacks" value="0"/>
|
105 |
+
<label for="pingbacks"><input type="checkbox" value="1" id="pingbacks" name="pingbacks" <?php echo (($post['pingbacks']) ? 'checked="checked"' : ''); ?>><?php _e('Enable WP_IMPORTING', 'wp_all_import_plugin'); ?></label>
|
106 |
</fieldset>
|
107 |
+
<p class="description"><?php _e('Setting this constant avoids triggering pingback.', 'wp_all_import_plugin'); ?></p>
|
108 |
</td>
|
109 |
+
</tr>
|
110 |
+
<tr>
|
111 |
+
<th scope="row"><label><?php _e('Add Port To URL', 'wp_all_import_plugin'); ?></label></th>
|
112 |
+
<td>
|
113 |
+
<input type="text" class="regular-text" name="port" value="<?php echo esc_attr($post['port']); ?>"/>
|
114 |
+
<p class="description"><?php _e('Specify the port number to add if you\'re having problems continuing to Step 2 and are running things on a custom port. Default is blank.', 'wp_all_import_plugin'); ?></p>
|
115 |
+
</td>
|
116 |
+
</tr>
|
117 |
</tbody>
|
118 |
</table>
|
119 |
|
125 |
<input type="submit" class="button-primary" value="Save Settings" />
|
126 |
</p>
|
127 |
|
128 |
+
<a href="http://soflyy.com/" target="_blank" class="wpallimport-created-by"><?php _e('Created by', 'wp_all_import_plugin'); ?> <span></span></a>
|
129 |
|
130 |
</form>
|