process.php
10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php
if(!defined('ABSPATH')) {
die();
}
?>
<h2 class="wpallexport-wp-notices"></h2>
<div class="inner-content wpallexport-step-6 wpallexport-wrapper">
<div class="wpallexport-header">
<div class="wpallexport-logo"></div>
<div class="wpallexport-title">
<h2><?php esc_html_e('Confirm & Run', 'wp_all_export_plugin'); ?></h2>
</div>
<div class="wpallexport-links">
<a href="http://www.wpallimport.com/support/?utm_source=export-plugin-free&utm_medium=help&utm_campaign=premium-support"
target="_blank"><?php esc_html_e('Support', 'wp_all_export_plugin'); ?></a> | <a
href="http://www.wpallimport.com/documentation/?utm_source=export-plugin-free&utm_medium=help&utm_campaign=docs"
target="_blank"><?php esc_html_e('Documentation', 'wp_all_export_plugin'); ?></a>
</div>
<div class="clear"></div>
<div class="processing_step_1">
<div class="clear"></div>
<div class="step_description">
<h2><?php echo wp_kses_post('Export <span id="status">in Progress...</span>', 'wp_all_export_plugin') ?></h2>
<h3 id="process_notice"><?php esc_html_e('Exporting may take some time. Please do not close your browser or refresh the page until the process is complete.', 'wp_all_export_plugin'); ?></h3>
</div>
<div
class="wpallexport_process_wrapper_<?php echo intval($update_previous->id); ?> wpallexport_process_parent_wrapper">
<div class="wpallexport_processbar rad14">
<div class="rad14"></div>
</div>
<div class="export_progress">
<span class="left_progress"><?php esc_html_e('Time Elapsed', 'wp_all_export_plugin'); ?> <span id="then">00:00:00</span></span>
<span class="center_progress"><span class="percents_count">0</span>%</span>
<span class="right_progress"><?php esc_html_e('Exported', 'wp_all_export_plugin'); ?> <span
class="created_count"><?php echo intval($update_previous->exported); ?></span></span>
</div>
</div>
<?php
if ((XmlExportEngine::get_addons_service()->isWooCommerceAddonActive() || XmlExportEngine::get_addons_service()->isWooCommerceOrderAddonActive() ) && XmlExportWooCommerceOrder::$is_active && $update_previous->options['export_type'] == 'specific') {
$exportList = new PMXE_Export_List();
foreach ($exportList->getBy('parent_id', $update_previous->id)->convertRecords() as $child_export) {
$is_render_child_progress = true;
switch ($child_export->export_post_type) {
case 'product':
if (!$update_previous->options['order_include_poducts']) $is_render_child_progress = false;
break;
case 'shop_coupon':
if (!$update_previous->options['order_include_coupons']) $is_render_child_progress = false;
break;
case 'shop_customer':if (!$update_previous->options['order_include_customers']) $is_render_child_progress = false;
break;
}
if (!$is_render_child_progress) continue;
?>
<div class="clear"></div>
<div
class="wpallexport_process_wrapper_<?php echo intval($child_export->id); ?> wpallexport_process_child_wrapper">
<div class="wpallexport_processbar rad14">
<div class="rad14"></div>
</div>
<div class="export_progress">
<span class="left_progress">
<span class="center_progress">
<span
class="percents_count">0</span>%</span> <?php printf(esc_html__("Export %ss", "wp_all_export_plugin"), ucwords(str_replace("_", " ", str_replace("shop", "", esc_html($child_export->export_post_type))))); ?></span>
<span class="right_progress"><?php esc_html_e('Exported', 'wp_all_export_plugin'); ?> <span
class="created_count">0</span></span>
</div>
</div>
<?php
}
} ?>
</div>
<span id="wpallexport-error-terminated" style="display: none;">
<div class="wpallexport-content-section" style="display:block; position: relative;">
<div class="wpallexport-notify-wrapper">
<div class="found_records terminated" style="background-position: 0 50% !important;">
<h3><?php esc_html_e('Your server terminated the export process', 'wp_all_export_plugin'); ?></h3>
<h4 style="width: 78%; line-height: 25px;"><?php esc_html_e("Ask your host to check your server's error log. They will be able to determine why your server is terminating the export process.", "wp_all_export_plugin"); ?></h4>
</div>
</div>
</div>
</span>
<?php include ('success_page.php'); ?>
</div>
<div class="wpallexport-display-columns wpallexport-margin-top-forty">
<?php echo apply_filters('wpallexport_footer', ''); ?>
</div>
</div>
<script type="text/javascript">
(function ($) {
function toHHMMSS(string)
{
var sec_num = parseInt(string, 10); // don't forget the second param
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60);
if (hours < 10) {hours = "0"+hours;}
if (minutes < 10) {minutes = "0"+minutes;}
if (seconds < 10) {seconds = "0"+seconds;}
return hours+':'+minutes+':'+seconds;
}
$(function () {
$('#status').each(function () {
var $this = $(this);
if ($this.html().match(/\.{3}$/)) {
var dots = 0;
var status = $this.html().replace(/\.{3}$/, '');
var interval;
interval = setInterval(function () {
if ($this.html().match(new RegExp(status + '\\.{1,3}$', ''))) {
$this.html(status + '...'.substr(0, dots++ % 3 + 1));
} else {
$('#process_notice').hide();
clearInterval(interval);
}
}, 1000);
}
var then = $('#then');
var start_date = new Date();
var current_date = new Date();
update = function () {
current_date = Date.now();
var duration = Math.floor((current_date - start_date)/1000);
duration = toHHMMSS(duration);
if ($('#process_notice').is(':visible')) then.html(duration);
};
update();
setInterval(update, 1000);
interval = setInterval(function () {
$('div[class^=wpallexport_process_wrapper]').each(function () {
var percents = $(this).find('.percents_count').html();
$(this).find('.wpallexport_processbar div').css({'width': ((parseInt(percents) > 100 || percents == undefined) ? 100 : percents) + '%'});
});
}, 1000);
$('.wpallexport_processbar').css({'visibility': 'visible'});
});
var request = {
action: 'wpallexport',
security: wp_all_export_security
};
function wp_all_export_process(queue_export) {
var $URL = ajaxurl;
if (queue_export !== false) {
$URL += '?id=' + queue_export;
}
else {
if (typeof export_id != "undefined") {
if ($URL.indexOf("?") == -1) {
$URL += '?id=' + export_id;
}
else {
$URL += '&id=' + export_id;
}
}
}
$.ajax({
type: 'POST',
url: $URL,
data: request,
success: function (response) {
if (response === null) {
$('#status').html('Error');
window.onbeforeunload = false;
$('#process_notice').after(request.responseText);
return;
}
var $process_wrapper = $('.wpallexport_process_wrapper_' + response.export_id);
$process_wrapper.find('.created_count').html(response.exported);
$process_wrapper.find('.percents_count').html(response.percentage);
$process_wrapper.find('.wpallexport_processbar div').css({'width': response.percentage + '%'});
if (response.done) {
if (response.queue_export) {
wp_all_export_process(response.queue_export);
}
else {
$('#status').html('Complete');
window.onbeforeunload = false;
setTimeout(function () {
$('#export_finished').fadeIn();
}, 1000);
}
}
else {
wp_all_export_process(response.export_id);
}
},
error: function (request, status, error) {
$('#status').html('Error');
window.onbeforeunload = false;
$('#process_notice').after(request.responseText);
$('#wpallexport-error-terminated').show();
},
dataType: "json"
});
};
wp_all_export_process(<?php echo intval($update_previous->id); ?>);
window.onbeforeunload = function () {
return 'WARNING:\nExport process in under way, leaving the page will interrupt\nthe operation and most likely to cause leftovers in posts.';
};
});
})(jQuery);
</script>