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