Export WordPress data to XML/CSV - Version 1.2.6

Version Description

  • improvement: disable scheduled exports via Automatic Scheduling UI
  • API: add new filter wp_all_export_no_cache to avoid server cache for export files
  • bug fix: saving scheduling license not working
Download this release

Release Info

Developer soflyy
Plugin Icon 128x128 Export WordPress data to XML/CSV
Version 1.2.6
Comparing to
See all releases

Code changes from version 1.2.5 to 1.2.6

Files changed (133) hide show
  1. actions/admin_init.php +0 -0
  2. actions/admin_menu.php +0 -0
  3. actions/admin_notices.php +0 -0
  4. actions/wp_loaded.php +16 -0
  5. classes/config.php +0 -0
  6. classes/download.php +3 -0
  7. classes/helper.php +0 -0
  8. classes/input.php +0 -0
  9. classes/session.php +0 -0
  10. config/options.php +1 -1
  11. controllers/admin/export.php +0 -0
  12. controllers/admin/help.php +0 -0
  13. controllers/admin/settings.php +0 -0
  14. controllers/controller.php +0 -0
  15. controllers/controller/admin.php +0 -0
  16. helpers/backward.php +0 -0
  17. helpers/pmxe_functions.php +0 -0
  18. helpers/str_getcsv.php +0 -0
  19. helpers/wp_redirect_or_javascript.php +0 -0
  20. models/export/list.php +0 -0
  21. models/export/record.php +0 -0
  22. models/model.php +0 -0
  23. models/model/list.php +0 -0
  24. models/model/record.php +0 -0
  25. readme.txt +9 -2
  26. schema.php +0 -0
  27. src/Scheduling/Scheduling.php +21 -8
  28. src/Scheduling/SchedulingApi.php +37 -12
  29. src/Scheduling/views/SchedulingOptions.php +40 -40
  30. static/css/admin-ie.css +0 -0
  31. static/css/admin-wp-3.8.css +0 -0
  32. static/css/admin.css +0 -0
  33. static/img/date-picker.gif +0 -0
  34. static/img/down.gif +0 -0
  35. static/img/drag.png +0 -0
  36. static/img/ico-add-new.png +0 -0
  37. static/img/ico-remove.png +0 -0
  38. static/img/loading.png +0 -0
  39. static/img/progress_animated.gif +0 -0
  40. static/img/screen-options-right-up.gif +0 -0
  41. static/img/screen-options-right.gif +0 -0
  42. static/img/stars.png +0 -0
  43. static/js/admin.js +0 -0
  44. static/js/jquery/css/redmond/images/animated-overlay.gif +0 -0
  45. static/js/jquery/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  46. static/js/jquery/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100_1.png +0 -0
  47. static/js/jquery/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  48. static/js/jquery/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  49. static/js/jquery/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  50. static/js/jquery/css/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  51. static/js/jquery/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  52. static/js/jquery/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  53. static/js/jquery/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  54. static/js/jquery/css/redmond/images/ui-icons_217bc0_256x240.png +0 -0
  55. static/js/jquery/css/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
  56. static/js/jquery/css/redmond/images/ui-icons_469bdd_256x240.png +0 -0
  57. static/js/jquery/css/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
  58. static/js/jquery/css/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
  59. static/js/jquery/css/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
  60. static/js/jquery/css/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
  61. static/js/jquery/css/redmond/jquery-ui.css +0 -0
  62. static/js/jquery/css/select2/select2-bootstrap.css +0 -0
  63. static/js/jquery/css/select2/select2-spinner.gif +0 -0
  64. static/js/jquery/css/select2/select2.css +0 -0
  65. static/js/jquery/css/select2/select2.png +0 -0
  66. static/js/jquery/css/smoothness/images/tipsy.gif +0 -0
  67. static/js/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  68. static/js/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  69. static/js/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  70. static/js/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  71. static/js/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  72. static/js/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  73. static/js/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  74. static/js/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  75. static/js/jquery/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  76. static/js/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  77. static/js/jquery/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  78. static/js/jquery/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  79. static/js/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  80. static/js/jquery/css/smoothness/jquery-ui.css +0 -0
  81. static/js/jquery/css/smoothness/jquery.tipsy.css +0 -0
  82. static/js/jquery/jquery.tipsy.js +0 -0
  83. static/js/jquery/select2.min.js +0 -0
  84. static/js/jquery/ui.autocomplete.js +0 -0
  85. static/js/jquery/ui.datepicker.js +0 -0
  86. static/js/pmxe.js +0 -0
  87. trunk/actions/admin_head.php +26 -0
  88. trunk/actions/admin_init.php +5 -0
  89. trunk/actions/admin_menu.php +22 -0
  90. trunk/actions/admin_notices.php +19 -0
  91. trunk/actions/init.php +8 -0
  92. trunk/actions/pmxe_after_export.php +417 -0
  93. trunk/actions/pmxe_before_export.php +42 -0
  94. trunk/actions/pmxe_exported_post.php +26 -0
  95. trunk/actions/wp_ajax_dismiss_export_warnings.php +23 -0
  96. trunk/actions/wp_ajax_generate_zapier_api_key.php +18 -0
  97. trunk/actions/wp_ajax_redirect_after_addon_installed.php +24 -0
  98. trunk/actions/wp_ajax_save_scheduling.php +56 -0
  99. trunk/actions/wp_ajax_scheduling_dialog_content.php +853 -0
  100. trunk/actions/wp_ajax_wpae_available_rules.php +106 -0
  101. trunk/actions/wp_ajax_wpae_filtering.php +91 -0
  102. trunk/actions/wp_ajax_wpae_filtering_count.php +372 -0
  103. trunk/actions/wp_ajax_wpae_preview.php +436 -0
  104. trunk/actions/wp_ajax_wpallexport.php +327 -0
  105. trunk/actions/wp_loaded.php +251 -0
  106. trunk/actions/wpmu_new_blog.php +21 -0
  107. trunk/banner-772x250.png +0 -0
  108. trunk/classes/CdataStrategy.php +7 -0
  109. trunk/classes/CdataStrategyAlways.php +12 -0
  110. trunk/classes/CdataStrategyFactory.php +22 -0
  111. trunk/classes/CdataStrategyIllegalCharacters.php +24 -0
  112. trunk/classes/CdataStrategyIllegalCharactersHtmlEntities.php +12 -0
  113. trunk/classes/CdataStrategyNever.php +12 -0
  114. trunk/classes/XMLWriter.php +420 -0
  115. trunk/classes/chunk.php +274 -0
  116. trunk/classes/config.php +99 -0
  117. trunk/classes/download.php +58 -0
  118. trunk/classes/handler.php +134 -0
  119. trunk/classes/helper.php +139 -0
  120. trunk/classes/input.php +81 -0
  121. trunk/classes/installer.php +40 -0
  122. trunk/classes/session.php +96 -0
  123. trunk/classes/wpallimport.php +582 -0
  124. trunk/classes/zip.php +54 -0
  125. trunk/config/options.php +22 -0
  126. trunk/controllers/admin/export.php +563 -0
  127. trunk/controllers/admin/feedback.php +12 -0
  128. trunk/controllers/admin/help.php +12 -0
  129. trunk/controllers/admin/manage.php +526 -0
  130. trunk/controllers/admin/settings.php +178 -0
  131. trunk/controllers/controller.php +182 -0
  132. trunk/controllers/controller/admin.php +129 -0
  133. trunk/dist/app.js +19938 -0
actions/admin_init.php CHANGED
File without changes
actions/admin_menu.php CHANGED
File without changes
actions/admin_notices.php CHANGED
File without changes
actions/wp_loaded.php CHANGED
@@ -206,7 +206,23 @@ function pmxe_wp_loaded() {
206
 
207
  die;
208
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  $fileurl = str_replace( "\\", "/", $fileurl );
 
210
  wp_redirect($fileurl);
211
  }
212
  else
206
 
207
  die;
208
  }
209
+
210
+ if(apply_filters('wp_all_export_no_cache', false)) {
211
+
212
+ // If we are doing a google merchants export, send the file as a download.
213
+ header("Content-type: " . mime_content_type($filepath));
214
+ header("Content-Disposition: attachment; filename=" . basename($filepath));
215
+ header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
216
+ header("Cache-Control: post-check=0, pre-check=0", false);
217
+ header("Pragma: no-cache");
218
+
219
+ readfile($filepath);
220
+
221
+ die;
222
+ }
223
+
224
  $fileurl = str_replace( "\\", "/", $fileurl );
225
+
226
  wp_redirect($fileurl);
227
  }
228
  else
classes/config.php CHANGED
File without changes
classes/download.php CHANGED
@@ -43,6 +43,9 @@ class PMXE_Download
43
  if (php_sapi_name() != 'cli-server') {
44
  header($header);
45
  header("Content-Disposition: attachment; filename=\"" . basename($file_name) . "\"");
 
 
 
46
  }
47
  while (ob_get_level()) {
48
  ob_end_clean();
43
  if (php_sapi_name() != 'cli-server') {
44
  header($header);
45
  header("Content-Disposition: attachment; filename=\"" . basename($file_name) . "\"");
46
+ header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
47
+ header("Cache-Control: post-check=0, pre-check=0", false);
48
+ header("Pragma: no-cache");
49
  }
50
  while (ob_get_level()) {
51
  ob_end_clean();
classes/helper.php CHANGED
File without changes
classes/input.php CHANGED
File without changes
classes/session.php CHANGED
File without changes
config/options.php CHANGED
@@ -4,7 +4,7 @@
4
  * and can be changed by corresponding WordPress function calls
5
  */
6
  $config = array(
7
- "info_api_url" => "http://www.wpallimport.com/export/?utm_source=export-plugin-free&utm_medium=info-api-url",
8
  "dismiss" => 0,
9
  "dismiss_manage_top" => 0,
10
  "dismiss_manage_bottom" => 0,
4
  * and can be changed by corresponding WordPress function calls
5
  */
6
  $config = array(
7
+ "info_api_url" => "http://www.wpallimport.com",
8
  "dismiss" => 0,
9
  "dismiss_manage_top" => 0,
10
  "dismiss_manage_bottom" => 0,
controllers/admin/export.php CHANGED
File without changes
controllers/admin/help.php CHANGED
File without changes
controllers/admin/settings.php CHANGED
File without changes
controllers/controller.php CHANGED
File without changes
controllers/controller/admin.php CHANGED
File without changes
helpers/backward.php CHANGED
File without changes
helpers/pmxe_functions.php CHANGED
File without changes
helpers/str_getcsv.php CHANGED
File without changes
helpers/wp_redirect_or_javascript.php CHANGED
File without changes
models/export/list.php CHANGED
File without changes
models/export/record.php CHANGED
File without changes
models/model.php CHANGED
File without changes
models/model/list.php CHANGED
File without changes
models/model/record.php CHANGED
File without changes
readme.txt CHANGED
@@ -1,8 +1,9 @@
1
  === Export any WordPress data to XML/CSV ===
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
- Tested up to: 5.2.3
5
- Stable tag: 1.2.5
 
6
  Tags: export, wordpress csv export, wordpress xml export, export woocommerce, migrate, export csv from wordpress, export xml from wordpress, advanced xml export, advanced csv export, export data, bulk csv export, export custom post type, export woocommerce products, export woocommerce orders, migrate woocommerce, csv export, export csv, xml export, export xml, csv exporter, datafeed
7
 
8
  Easily export any data from WordPress. Drag & drop to create a completely custom spreadsheet, CSV, or XML file.
@@ -90,6 +91,12 @@ Either: -
90
  * Unzip wp-all-export.zip and upload the contents to /wp-content/plugins/, and then activate the plugin from the Plugins page in WordPress
91
 
92
  == Changelog ==
 
 
 
 
 
 
93
  = 1.2.5 =
94
  * bug fix: preserve existing admin body classes
95
 
1
  === Export any WordPress data to XML/CSV ===
2
  Contributors: soflyy, wpallimport
3
  Requires at least: 4.1
4
+ Tested up to: 5.4.1
5
+ Stable tag: 1.2.6
6
+
7
  Tags: export, wordpress csv export, wordpress xml export, export woocommerce, migrate, export csv from wordpress, export xml from wordpress, advanced xml export, advanced csv export, export data, bulk csv export, export custom post type, export woocommerce products, export woocommerce orders, migrate woocommerce, csv export, export csv, xml export, export xml, csv exporter, datafeed
8
 
9
  Easily export any data from WordPress. Drag & drop to create a completely custom spreadsheet, CSV, or XML file.
91
  * Unzip wp-all-export.zip and upload the contents to /wp-content/plugins/, and then activate the plugin from the Plugins page in WordPress
92
 
93
  == Changelog ==
94
+
95
+ = 1.2.6 =
96
+ * improvement: disable scheduled exports via Automatic Scheduling UI
97
+ * API: add new filter wp_all_export_no_cache to avoid server cache for export files
98
+ * bug fix: saving scheduling license not working
99
+
100
  = 1.2.5 =
101
  * bug fix: preserve existing admin body classes
102
 
schema.php CHANGED
File without changes
src/Scheduling/Scheduling.php CHANGED
@@ -22,15 +22,12 @@ class Scheduling
22
  $this->licensingManager = $licensingManager;
23
  }
24
 
25
- public function schedule($elementId, ScheduleTime $scheduleTime, $schedulingEnabled)
26
  {
27
  $elementId = intval($elementId);
28
 
29
- if ($schedulingEnabled == 1) {
30
- $this->enableSchedule($elementId, $scheduleTime);
31
- } else {
32
- $this->disableSchedule($elementId);
33
- }
34
  }
35
 
36
  public function scheduleExists($elementId)
@@ -90,6 +87,7 @@ class Scheduling
90
 
91
  if ($schedulingEnabled == 1) {
92
 
 
93
 
94
  if ($post['scheduling_run_on'] == 'weekly') {
95
  $monthly = false;
@@ -107,6 +105,8 @@ class Scheduling
107
  new \Wpae\Scheduling\Interval\ScheduleTime($timesArray, $monthly, $post['scheduling_timezone']),
108
  $schedulingEnabled
109
  );
 
 
110
  }
111
  }
112
 
@@ -157,9 +157,22 @@ class Scheduling
157
  $this->schedulingApi->updateSchedule($scheduleId, $scheduleTime);
158
  }
159
 
160
- private function disableSchedule($elementId)
 
 
 
 
 
 
 
 
 
161
  {
162
- $this->deleteSchedule($elementId);
 
 
 
 
163
  }
164
 
165
  public static function buildTimesArray($schedulingWeeklyDays, $schedulingTimes)
22
  $this->licensingManager = $licensingManager;
23
  }
24
 
25
+ private function schedule($elementId, ScheduleTime $scheduleTime)
26
  {
27
  $elementId = intval($elementId);
28
 
29
+ $this->enableSchedule($elementId, $scheduleTime);
30
+
 
 
 
31
  }
32
 
33
  public function scheduleExists($elementId)
87
 
88
  if ($schedulingEnabled == 1) {
89
 
90
+ $this->userEnableSchedule($id);
91
 
92
  if ($post['scheduling_run_on'] == 'weekly') {
93
  $monthly = false;
105
  new \Wpae\Scheduling\Interval\ScheduleTime($timesArray, $monthly, $post['scheduling_timezone']),
106
  $schedulingEnabled
107
  );
108
+ } else {
109
+ $this->userDisableSchedule($id);
110
  }
111
  }
112
 
157
  $this->schedulingApi->updateSchedule($scheduleId, $scheduleTime);
158
  }
159
 
160
+ public function userDisableSchedule($elementId)
161
+ {
162
+ $remoteSchedule = $this->getSchedule($elementId);
163
+
164
+ if ($remoteSchedule) {
165
+ $this->schedulingApi->disableSchedule($remoteSchedule->id);
166
+ }
167
+ }
168
+
169
+ public function userEnableSchedule($elementId)
170
  {
171
+ $remoteSchedule = $this->getSchedule($elementId);
172
+
173
+ if ($remoteSchedule) {
174
+ $this->schedulingApi->enableSchedule($remoteSchedule->id);
175
+ }
176
  }
177
 
178
  public static function buildTimesArray($schedulingWeeklyDays, $schedulingTimes)
src/Scheduling/SchedulingApi.php CHANGED
@@ -16,13 +16,13 @@ class SchedulingApi
16
 
17
  public function checkConnection()
18
  {
19
- if ( is_multisite() ) {
20
- $siteUrl = get_site_url( get_current_blog_id() );
21
  } else {
22
  $siteUrl = get_site_url();
23
  }
24
 
25
- $pingBackUrl = $this->getApiUrl('connection').'?url='.urlencode($siteUrl);
26
 
27
  $response = wp_remote_request(
28
  $pingBackUrl,
@@ -31,7 +31,7 @@ class SchedulingApi
31
  )
32
  );
33
 
34
- if($response instanceof \WP_Error) {
35
  return false;
36
  }
37
 
@@ -46,16 +46,16 @@ class SchedulingApi
46
  {
47
  $response = wp_remote_request(
48
 
49
- $this->getApiUrl('schedules?forElement='.$elementId.
50
- '&type=' . $elementType.
51
- '&endpoint='.urlencode(get_site_url())),
52
  array(
53
  'method' => 'GET',
54
  'headers' => $this->getHeaders()
55
  )
56
  );
57
 
58
- if($response instanceof \WP_Error) {
59
  return false;
60
  }
61
 
@@ -86,17 +86,29 @@ class SchedulingApi
86
  )
87
  );
88
 
89
- if($response instanceof \WP_Error) {
90
  throw new SchedulingHttpException('There was a problem saving the schedule');
91
  }
92
 
93
  return $response;
94
  }
95
 
96
- public function deleteSchedule($scheduleId)
97
  {
 
98
  wp_remote_request(
99
- $this->getApiUrl('schedules/' . $scheduleId),
 
 
 
 
 
 
 
 
 
 
 
100
  array(
101
  'method' => 'DELETE',
102
  'headers' => $this->getHeaders()
@@ -104,6 +116,19 @@ class SchedulingApi
104
  );
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  public function updateSchedule($scheduleId, $scheduleTime)
108
  {
109
 
@@ -115,7 +140,7 @@ class SchedulingApi
115
  'body' => json_encode($scheduleTime)
116
  ));
117
 
118
- if($response instanceof \WP_Error) {
119
  throw new SchedulingHttpException('There was a problem saving the schedule');
120
  }
121
 
16
 
17
  public function checkConnection()
18
  {
19
+ if (is_multisite()) {
20
+ $siteUrl = get_site_url(get_current_blog_id());
21
  } else {
22
  $siteUrl = get_site_url();
23
  }
24
 
25
+ $pingBackUrl = $this->getApiUrl('connection') . '?url=' . urlencode($siteUrl);
26
 
27
  $response = wp_remote_request(
28
  $pingBackUrl,
31
  )
32
  );
33
 
34
+ if ($response instanceof \WP_Error) {
35
  return false;
36
  }
37
 
46
  {
47
  $response = wp_remote_request(
48
 
49
+ $this->getApiUrl('schedules?forElement=' . $elementId .
50
+ '&type=' . $elementType .
51
+ '&endpoint=' . urlencode(get_site_url())),
52
  array(
53
  'method' => 'GET',
54
  'headers' => $this->getHeaders()
55
  )
56
  );
57
 
58
+ if ($response instanceof \WP_Error) {
59
  return false;
60
  }
61
 
86
  )
87
  );
88
 
89
+ if ($response instanceof \WP_Error) {
90
  throw new SchedulingHttpException('There was a problem saving the schedule');
91
  }
92
 
93
  return $response;
94
  }
95
 
96
+ public function deleteSchedule($remoteScheduleId)
97
  {
98
+
99
  wp_remote_request(
100
+ $this->getApiUrl('schedules/' . $remoteScheduleId),
101
+ array(
102
+ 'method' => 'DELETE',
103
+ 'headers' => $this->getHeaders()
104
+ )
105
+ );
106
+ }
107
+
108
+ public function disableSchedule($remoteScheduleId)
109
+ {
110
+ wp_remote_request(
111
+ $this->getApiUrl('schedules/' . $remoteScheduleId . '/disable'),
112
  array(
113
  'method' => 'DELETE',
114
  'headers' => $this->getHeaders()
116
  );
117
  }
118
 
119
+
120
+ public function enableSchedule($scheduleId)
121
+ {
122
+ wp_remote_request(
123
+ $this->getApiUrl('schedules/' . $scheduleId . '/enable'),
124
+ array(
125
+ 'method' => 'POST',
126
+ 'headers' => $this->getHeaders()
127
+ )
128
+ );
129
+ }
130
+
131
+
132
  public function updateSchedule($scheduleId, $scheduleTime)
133
  {
134
 
140
  'body' => json_encode($scheduleTime)
141
  ));
142
 
143
+ if ($response instanceof \WP_Error) {
144
  throw new SchedulingHttpException('There was a problem saving the schedule');
145
  }
146
 
src/Scheduling/views/SchedulingOptions.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  $scheduling = \Wpae\Scheduling\Scheduling::create();
3
- $post = $export->options;
4
  $hasActiveLicense = $scheduling->checkLicense();
5
  $cron_job_key = PMXE_Plugin::getInstance()->getOption('cron_job_key');
6
  $options = \PMXE_Plugin::getInstance()->getOption();
@@ -153,7 +153,7 @@ $options = \PMXE_Plugin::getInstance()->getOption();
153
 
154
  #add-subscription-field {
155
  position: absolute;
156
- left: -155px;
157
  top: -2px;
158
  height: 46px;
159
  border-radius: 5px;
@@ -392,7 +392,7 @@ $options = \PMXE_Plugin::getInstance()->getOption();
392
  }
393
 
394
  // Don't process scheduling
395
- if (!schedulingEnable) {
396
  var submitEvent = $.Event('wpae-scheduling-options-form:submit');
397
  $(document).trigger(submitEvent);
398
 
@@ -409,7 +409,7 @@ $options = \PMXE_Plugin::getInstance()->getOption();
409
  e.preventDefault();
410
  return false;
411
  }
412
-
413
  var $button = $(this);
414
 
415
  var formData = $('#scheduling-form :input').serializeArray();
@@ -524,22 +524,22 @@ $options = \PMXE_Plugin::getInstance()->getOption();
524
  return false;
525
  });
526
 
527
- <?php if($post['scheduling_timezone'] == 'UTC') {
528
  ?>
529
- var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
530
-
531
- if($('#timezone').find("option:contains('"+ timeZone +"')").length != 0){
532
- $('#timezone').trigger("chosen:updated");
533
- $('#timezone').val(timeZone);
534
- $('#timezone').trigger("chosen:updated");
535
- }else{
536
- var parts = timeZone.split('/');
537
- var lastPart = parts[parts.length-1];
538
- var opt = $('#timezone').find("option:contains('"+ lastPart +"')");
539
-
540
- $('#timezone').val(opt.val());
541
- $('#timezone').trigger("chosen:updated");
542
- }
543
 
544
  <?php
545
  }
@@ -609,7 +609,7 @@ $options = \PMXE_Plugin::getInstance()->getOption();
609
 
610
  setTimeout(function () {
611
  $('#add-subscription-field').animate({width:'140px'}, 225);
612
- $('#add-subscription-field').animate({left:'-155px'}, 225);
613
  }, 300);
614
 
615
  $('#add-subscription-field').val('');
@@ -668,20 +668,20 @@ $options = \PMXE_Plugin::getInstance()->getOption();
668
  <div class="wpallexport-collapsed-content-inner" style="padding-bottom: 0; overflow: auto;">
669
  <div style="margin-bottom: 20px;">
670
  <label>
671
- <input type="radio" name="scheduling_enable" value="0" <?php if(!$post['scheduling_enable']) { ?> checked="checked" <?php } ?>/>
672
  <h4 style="display: inline-block; margin-top:3px; margin-bottom:-2px;"><?php _e('Do Not Schedule'); ?></h4>
673
  </label>
674
  </div>
675
  <div>
676
  <label>
677
- <input type="radio" name="scheduling_enable" value="1" <?php if($post['scheduling_enable'] == 1) {?> checked="checked" <?php }?>/>
678
 
679
  <h4 style="margin: 0; position: relative; display: inline-block;"><?php _e('Automatic Scheduling', PMXE_Plugin::LANGUAGE_DOMAIN); ?>
680
- <span class="connection-icon">
681
  <?php include_once('ConnectionIcon.php'); ?>
682
  </span>
683
  <?php if (!$scheduling->checkConnection()) { ?>
684
- <span class="wpai-license wpai-license-text" style="display: inline-block; font-weight: normal; <?php if(!$hasActiveLicense) { ?> display: none; <?php }?> color: #f2b03d; ">Unable to connect - <a target="_blank" style="text-decoration: underline;" href="http://wpallimport.com/support">please contact support</a>.</span>
685
  <?php } ?>
686
  </h4>
687
  </label>
@@ -692,26 +692,26 @@ $options = \PMXE_Plugin::getInstance()->getOption();
692
  </label>
693
  </div>
694
  <div id="automatic-scheduling"
695
- style="margin-left: 21px; <?php if ($post['scheduling_enable'] != 1) { ?> display: none; <?php } ?>">
696
  <div>
697
  <div class="input">
698
  <label style="color: rgb(68,68,68);">
699
  <input
700
- type="radio" <?php if ($post['scheduling_run_on'] != 'monthly') { ?> checked="checked" <?php } ?>
701
  name="scheduling_run_on" value="weekly"
702
  checked="checked"/> <?php _e('Every week on...', PMXE_Plugin::LANGUAGE_DOMAIN); ?>
703
  </label>
704
  </div>
705
  <input type="hidden" style="width: 500px;" name="scheduling_weekly_days"
706
- value="<?php echo $post['scheduling_weekly_days']; ?>" id="weekly_days"/>
707
  <?php
708
- if (isset($post['scheduling_weekly_days'])) {
709
- $weeklyArray = explode(',', $post['scheduling_weekly_days']);
710
  } else {
711
  $weeklyArray = array();
712
  }
713
  ?>
714
- <ul class="days-of-week" id="weekly" style="<?php if ($post['scheduling_run_on'] == 'monthly') { ?> display: none; <?php } ?>">
715
  <li data-day="0" <?php if (in_array('0', $weeklyArray)) { ?> class="selected" <?php } ?>>
716
  Mon
717
  </li>
@@ -740,21 +740,21 @@ $options = \PMXE_Plugin::getInstance()->getOption();
740
  <div class="input">
741
  <label style="color: rgb(68,68,68);">
742
  <input
743
- type="radio" <?php if ($post['scheduling_run_on'] == 'monthly') { ?> checked="checked" <?php } ?>
744
  name="scheduling_run_on"
745
  value="monthly"/> <?php _e('Every month on the first...', PMXE_Plugin::LANGUAGE_DOMAIN); ?>
746
  </label>
747
  </div>
748
- <input type="hidden" name="scheduling_monthly_days" value="<?php if (isset($post['scheduling_monthly_days'])) echo $post['scheduling_monthly_days']; ?>" id="monthly_days"/>
749
  <?php
750
- if (isset($post['scheduling_monthly_days'])) {
751
- $monthlyArray = explode(',', $post['scheduling_monthly_days']);
752
  } else {
753
  $monthlyArray = array();
754
  }
755
  ?>
756
  <ul class="days-of-week" id="monthly"
757
- style="<?php if ($post['scheduling_run_on'] != 'monthly') { ?> display: none; <?php } ?>">
758
  <li data-day="0" <?php if (in_array('0', $monthlyArray)) { ?> class="selected" <?php } ?>>
759
  Mon
760
  </li>
@@ -786,8 +786,8 @@ $options = \PMXE_Plugin::getInstance()->getOption();
786
  </div>
787
 
788
  <div id="times" style="margin-bottom: 10px;">
789
- <?php if (is_array($post['scheduling_times'])) {
790
- foreach ($post['scheduling_times'] as $time) { ?>
791
 
792
  <?php if ($time) { ?>
793
  <input class="timepicker" type="text" name="scheduling_times[]"
@@ -802,8 +802,8 @@ $options = \PMXE_Plugin::getInstance()->getOption();
802
  <?php
803
 
804
  $timezoneValue = false;
805
- if ($post['scheduling_timezone']) {
806
- $timezoneValue = $post['scheduling_timezone'];
807
  }
808
 
809
  $timezoneSelect = new \Wpae\Scheduling\Timezone\TimezoneSelect();
@@ -818,7 +818,7 @@ $options = \PMXE_Plugin::getInstance()->getOption();
818
  <div class="subscribe" style="margin-left: 5px; margin-top: 65px; margin-bottom: 130px; position: relative;">
819
  <div class="button-container">
820
 
821
- <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=515704&utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=automatic-scheduling" target="_blank" id="subscribe-button">
822
  <div class="button button-primary button-hero wpallexport-large-button button-subscribe"
823
  style="background-image: none; width: 140px; text-align: center; position: absolute; z-index: 4;">
824
  <svg class="success" width="30" height="30" viewBox="0 0 1792 1792"
1
  <?php
2
  $scheduling = \Wpae\Scheduling\Scheduling::create();
3
+ $schedulingExportOptions = $export->options;
4
  $hasActiveLicense = $scheduling->checkLicense();
5
  $cron_job_key = PMXE_Plugin::getInstance()->getOption('cron_job_key');
6
  $options = \PMXE_Plugin::getInstance()->getOption();
153
 
154
  #add-subscription-field {
155
  position: absolute;
156
+ left: -152px;
157
  top: -2px;
158
  height: 46px;
159
  border-radius: 5px;
392
  }
393
 
394
  // Don't process scheduling
395
+ if (!hasActiveLicense) {
396
  var submitEvent = $.Event('wpae-scheduling-options-form:submit');
397
  $(document).trigger(submitEvent);
398
 
409
  e.preventDefault();
410
  return false;
411
  }
412
+
413
  var $button = $(this);
414
 
415
  var formData = $('#scheduling-form :input').serializeArray();
524
  return false;
525
  });
526
 
527
+ <?php if($schedulingExportOptions['scheduling_timezone'] == 'UTC') {
528
  ?>
529
+ var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
530
+
531
+ if($('#timezone').find("option:contains('"+ timeZone +"')").length != 0){
532
+ $('#timezone').trigger("chosen:updated");
533
+ $('#timezone').val(timeZone);
534
+ $('#timezone').trigger("chosen:updated");
535
+ }else{
536
+ var parts = timeZone.split('/');
537
+ var lastPart = parts[parts.length-1];
538
+ var opt = $('#timezone').find("option:contains('"+ lastPart +"')");
539
+
540
+ $('#timezone').val(opt.val());
541
+ $('#timezone').trigger("chosen:updated");
542
+ }
543
 
544
  <?php
545
  }
609
 
610
  setTimeout(function () {
611
  $('#add-subscription-field').animate({width:'140px'}, 225);
612
+ $('#add-subscription-field').animate({left:'-152px'}, 225);
613
  }, 300);
614
 
615
  $('#add-subscription-field').val('');
668
  <div class="wpallexport-collapsed-content-inner" style="padding-bottom: 0; overflow: auto;">
669
  <div style="margin-bottom: 20px;">
670
  <label>
671
+ <input type="radio" name="scheduling_enable" value="0" <?php if(!$schedulingExportOptions['scheduling_enable']) { ?> checked="checked" <?php } ?>/>
672
  <h4 style="display: inline-block; margin-top:3px; margin-bottom:-2px;"><?php _e('Do Not Schedule'); ?></h4>
673
  </label>
674
  </div>
675
  <div>
676
  <label>
677
+ <input type="radio" name="scheduling_enable" value="1" <?php if($schedulingExportOptions['scheduling_enable'] == 1) {?> checked="checked" <?php }?>/>
678
 
679
  <h4 style="margin: 0; position: relative; display: inline-block;"><?php _e('Automatic Scheduling', PMXE_Plugin::LANGUAGE_DOMAIN); ?>
680
+ <span class="connection-icon" style="position: absolute; top:-1px; left: 152px;">
681
  <?php include_once('ConnectionIcon.php'); ?>
682
  </span>
683
  <?php if (!$scheduling->checkConnection()) { ?>
684
+ <span class="wpai-license" style="margin-left: 25px; display: inline-block; font-weight: normal; <?php if(!$hasActiveLicense) { ?> display: none; <?php }?> color: #f2b03d; ">Unable to connect - <a target="_blank" style="text-decoration: underline;" href="http://wpallimport.com/support">please contact support</a>.</span>
685
  <?php } ?>
686
  </h4>
687
  </label>
692
  </label>
693
  </div>
694
  <div id="automatic-scheduling"
695
+ style="margin-left: 21px; <?php if ($schedulingExportOptions['scheduling_enable'] != 1) { ?> display: none; <?php } ?>">
696
  <div>
697
  <div class="input">
698
  <label style="color: rgb(68,68,68);">
699
  <input
700
+ type="radio" <?php if ($schedulingExportOptions['scheduling_run_on'] != 'monthly') { ?> checked="checked" <?php } ?>
701
  name="scheduling_run_on" value="weekly"
702
  checked="checked"/> <?php _e('Every week on...', PMXE_Plugin::LANGUAGE_DOMAIN); ?>
703
  </label>
704
  </div>
705
  <input type="hidden" style="width: 500px;" name="scheduling_weekly_days"
706
+ value="<?php echo $schedulingExportOptions['scheduling_weekly_days']; ?>" id="weekly_days"/>
707
  <?php
708
+ if (isset($schedulingExportOptions['scheduling_weekly_days'])) {
709
+ $weeklyArray = explode(',', $schedulingExportOptions['scheduling_weekly_days']);
710
  } else {
711
  $weeklyArray = array();
712
  }
713
  ?>
714
+ <ul class="days-of-week" id="weekly" style="<?php if ($schedulingExportOptions['scheduling_run_on'] == 'monthly') { ?> display: none; <?php } ?>">
715
  <li data-day="0" <?php if (in_array('0', $weeklyArray)) { ?> class="selected" <?php } ?>>
716
  Mon
717
  </li>
740
  <div class="input">
741
  <label style="color: rgb(68,68,68);">
742
  <input
743
+ type="radio" <?php if ($schedulingExportOptions['scheduling_run_on'] == 'monthly') { ?> checked="checked" <?php } ?>
744
  name="scheduling_run_on"
745
  value="monthly"/> <?php _e('Every month on the first...', PMXE_Plugin::LANGUAGE_DOMAIN); ?>
746
  </label>
747
  </div>
748
+ <input type="hidden" name="scheduling_monthly_days" value="<?php if (isset($schedulingExportOptions['scheduling_monthly_days'])) echo $schedulingExportOptions['scheduling_monthly_days']; ?>" id="monthly_days"/>
749
  <?php
750
+ if (isset($schedulingExportOptions['scheduling_monthly_days'])) {
751
+ $monthlyArray = explode(',', $schedulingExportOptions['scheduling_monthly_days']);
752
  } else {
753
  $monthlyArray = array();
754
  }
755
  ?>
756
  <ul class="days-of-week" id="monthly"
757
+ style="<?php if ($schedulingExportOptions['scheduling_run_on'] != 'monthly') { ?> display: none; <?php } ?>">
758
  <li data-day="0" <?php if (in_array('0', $monthlyArray)) { ?> class="selected" <?php } ?>>
759
  Mon
760
  </li>
786
  </div>
787
 
788
  <div id="times" style="margin-bottom: 10px;">
789
+ <?php if (is_array($schedulingExportOptions['scheduling_times'])) {
790
+ foreach ($schedulingExportOptions['scheduling_times'] as $time) { ?>
791
 
792
  <?php if ($time) { ?>
793
  <input class="timepicker" type="text" name="scheduling_times[]"
802
  <?php
803
 
804
  $timezoneValue = false;
805
+ if ($schedulingExportOptions['scheduling_timezone']) {
806
+ $timezoneValue = $schedulingExportOptions['scheduling_timezone'];
807
  }
808
 
809
  $timezoneSelect = new \Wpae\Scheduling\Timezone\TimezoneSelect();
818
  <div class="subscribe" style="margin-left: 5px; margin-top: 65px; margin-bottom: 130px; position: relative;">
819
  <div class="button-container">
820
 
821
+ <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=515704" target="_blank" id="subscribe-button">
822
  <div class="button button-primary button-hero wpallexport-large-button button-subscribe"
823
  style="background-image: none; width: 140px; text-align: center; position: absolute; z-index: 4;">
824
  <svg class="success" width="30" height="30" viewBox="0 0 1792 1792"
static/css/admin-ie.css CHANGED
File without changes
static/css/admin-wp-3.8.css CHANGED
File without changes
static/css/admin.css CHANGED
File without changes
static/img/date-picker.gif CHANGED
File without changes
static/img/down.gif CHANGED
File without changes
static/img/drag.png CHANGED
File without changes
static/img/ico-add-new.png CHANGED
File without changes
static/img/ico-remove.png CHANGED
File without changes
static/img/loading.png CHANGED
File without changes
static/img/progress_animated.gif CHANGED
File without changes
static/img/screen-options-right-up.gif CHANGED
File without changes
static/img/screen-options-right.gif CHANGED
File without changes
static/img/stars.png CHANGED
File without changes
static/js/admin.js CHANGED
File without changes
static/js/jquery/css/redmond/images/animated-overlay.gif CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100_1.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_glass_95_fef1ec_1x400.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_217bc0_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_2e83ff_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_469bdd_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_6da8d5_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_cd0a0a_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_d8e7f3_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/images/ui-icons_f9bd01_256x240.png CHANGED
File without changes
static/js/jquery/css/redmond/jquery-ui.css CHANGED
File without changes
static/js/jquery/css/select2/select2-bootstrap.css CHANGED
File without changes
static/js/jquery/css/select2/select2-spinner.gif CHANGED
File without changes
static/js/jquery/css/select2/select2.css CHANGED
File without changes
static/js/jquery/css/select2/select2.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/tipsy.gif CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-icons_222222_256x240.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-icons_454545_256x240.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-icons_888888_256x240.png CHANGED
File without changes
static/js/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png CHANGED
File without changes
static/js/jquery/css/smoothness/jquery-ui.css CHANGED
File without changes
static/js/jquery/css/smoothness/jquery.tipsy.css CHANGED
File without changes
static/js/jquery/jquery.tipsy.js CHANGED
File without changes
static/js/jquery/select2.min.js CHANGED
File without changes
static/js/jquery/ui.autocomplete.js CHANGED
File without changes
static/js/jquery/ui.datepicker.js CHANGED
File without changes
static/js/pmxe.js CHANGED
File without changes
trunk/actions/admin_head.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function pmxe_admin_head(){
3
+ $input = new PMXE_Input();
4
+ $export_id = $input->get('id', false);
5
+ $export_action = $input->get('action', false);
6
+ if ($export_id){
7
+ ?>
8
+ <script type="text/javascript">
9
+ var export_id = '<?php echo $export_id; ?>';
10
+ </script>
11
+ <?php
12
+ }
13
+
14
+ $wp_all_export_ajax_nonce = wp_create_nonce("wp_all_export_secure");
15
+
16
+ ?>
17
+ <script type="text/javascript" id="googleMerchantsInit">
18
+ if(typeof GoogleMerchants != 'undefined') {
19
+ GoogleMerchants.constant('NONCE', '<?php echo $wp_all_export_ajax_nonce; ?>');
20
+ }
21
+ var ajaxurl = '<?php echo admin_url( "admin-ajax.php" ); ?>';
22
+ var export_action = '<?php echo $export_action; ?>';
23
+ var wp_all_export_security = '<?php echo $wp_all_export_ajax_nonce; ?>';
24
+ </script>
25
+ <?php
26
+ }
trunk/actions/admin_init.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_admin_init(){
4
+ wp_enqueue_script('pmxe-script', PMXE_ROOT_URL . '/static/js/pmxe.js', array('jquery'), PMXE_VERSION);
5
+ }
trunk/actions/admin_menu.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Register plugin specific admin menu
4
+ */
5
+
6
+ function pmxe_admin_menu() {
7
+ global $menu, $submenu;
8
+
9
+ if (current_user_can( PMXE_Plugin::$capabilities )) { // admin management options
10
+
11
+ add_menu_page(__('WP All Export', 'wp_all_export_plugin'), __('All Export', 'wp_all_export_plugin'), PMXE_Plugin::$capabilities, 'pmxe-admin-home', array(PMXE_Plugin::getInstance(), 'adminDispatcher'), PMXE_Plugin::ROOT_URL . '/static/img/xmlicon.png', 111);
12
+ // workaround to rename 1st option to `Home`
13
+ $submenu['pmxe-admin-home'] = array();
14
+ add_submenu_page('pmxe-admin-home', __('Export to XML', 'wp_all_export_plugin') . ' &lsaquo; ' . __('WP All Export', 'wp_all_export_plugin'), __('New Export', 'wp_all_export_plugin'), PMXE_Plugin::$capabilities, 'pmxe-admin-export', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
15
+ add_submenu_page('pmxe-admin-home', __('Manage Exports', 'wp_all_export_plugin') . ' &lsaquo; ' . __('WP All Export', 'wp_all_export_plugin'), __('Manage Exports', 'wp_all_export_plugin'), PMXE_Plugin::$capabilities, 'pmxe-admin-manage', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
16
+ add_submenu_page('pmxe-admin-home', __('Settings', 'wp_all_export_plugin') . ' &lsaquo; ' . __('WP All Export', 'wp_all_export_plugin'), __('Settings', 'wp_all_export_plugin'), PMXE_Plugin::$capabilities, 'pmxe-admin-settings', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
17
+ // add_submenu_page('pmxe-admin-home', __('Feedback', 'wp_all_export_plugin') . ' &lsaquo; ' . __('WP All Export', 'wp_all_export_plugin'), __('Feedback', 'wp_all_export_plugin'), PMXE_Plugin::$capabilities, 'pmxe-admin-feedback', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
18
+ //add_submenu_page('pmxe-admin-home', __('Support', 'wp_all_export_plugin') . ' &lsaquo; ' . __('WP All Export', 'wp_all_export_plugin'), __('Support', 'wp_all_export_plugin'), 'manage_options', 'pmxe-admin-help', array(PMXE_Plugin::getInstance(), 'adminDispatcher'));
19
+
20
+ }
21
+ }
22
+
trunk/actions/admin_notices.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_admin_notices() {
4
+
5
+ // notify user if history folder is not writable
6
+ $uploads = wp_upload_dir();
7
+
8
+ $input = new PMXE_Input();
9
+ $messages = $input->get('pmxe_nt', array());
10
+ if ($messages) {
11
+ is_array($messages) or $messages = array($messages);
12
+ foreach ($messages as $type => $m) {
13
+ in_array((string)$type, array('updated', 'error')) or $type = 'updated';
14
+ ?>
15
+ <div class="<?php echo $type ?>"><p><?php echo $m ?></p></div>
16
+ <?php
17
+ }
18
+ }
19
+ }
trunk/actions/init.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_init()
4
+ {
5
+ if(!empty($_GET['check_connection'])) {
6
+ exit(json_encode(array('success' => true)));
7
+ }
8
+ }
trunk/actions/pmxe_after_export.php ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_prepend($string, $orig_filename) {
4
+ $context = stream_context_create();
5
+ $orig_file = fopen($orig_filename, 'r', 1, $context);
6
+
7
+ $temp_filename = tempnam(sys_get_temp_dir(), 'php_prepend_');
8
+ file_put_contents($temp_filename, $string);
9
+ file_put_contents($temp_filename, $orig_file, FILE_APPEND);
10
+
11
+ fclose($orig_file);
12
+ unlink($orig_filename);
13
+ rename($temp_filename, $orig_filename);
14
+ }
15
+
16
+ function pmxe_pmxe_after_export($export_id, $export)
17
+ {
18
+ if ( ! empty(PMXE_Plugin::$session) and PMXE_Plugin::$session->has_session() )
19
+ {
20
+ PMXE_Plugin::$session->set('file', '');
21
+ PMXE_Plugin::$session->save_data();
22
+ }
23
+
24
+ if ( ! $export->isEmpty())
25
+ {
26
+
27
+ $export->set(
28
+ array(
29
+ 'registered_on' => current_time( 'mysql', 1 ),
30
+ )
31
+ )->save();
32
+
33
+ $splitSize = $export->options['split_large_exports_count'];
34
+
35
+ $exportOptions = $export->options;
36
+ // remove previously genereted chunks
37
+ if ( ! empty($exportOptions['split_files_list']) and ! $export->options['creata_a_new_export_file'] )
38
+ {
39
+ foreach ($exportOptions['split_files_list'] as $file) {
40
+ @unlink($file);
41
+ }
42
+ }
43
+
44
+ $is_secure_import = PMXE_Plugin::getInstance()->getOption('secure');
45
+
46
+ if ( ! $is_secure_import)
47
+ {
48
+ $filepath = get_attached_file($export->attch_id);
49
+ }
50
+ else
51
+ {
52
+ $filepath = wp_all_export_get_absolute_path($export->options['filepath']);
53
+ }
54
+
55
+ //TODO: Look into what is happening with this variable and what it is used for
56
+ $is_export_csv_headers = apply_filters('wp_all_export_is_csv_headers_enabled', true, $export->id);
57
+
58
+ if ( isset($export->options['include_header_row']) ) {
59
+ $is_export_csv_headers = $export->options['include_header_row'];
60
+ }
61
+
62
+ $removeHeaders = false;
63
+
64
+ $removeHeaders = apply_filters('wp_all_export_remove_csv_headers', $removeHeaders, $export->id);
65
+
66
+ // Remove headers row from CSV file
67
+ if ( (empty($is_export_csv_headers) && @file_exists($filepath) && $export->options['export_to'] == 'csv' && $export->options['export_to_sheet'] == 'csv') || $removeHeaders){
68
+
69
+ $tmp_file = str_replace(basename($filepath), 'iteration_' . basename($filepath), $filepath);
70
+ copy($filepath, $tmp_file);
71
+ $in = fopen($tmp_file, 'r');
72
+ $out = fopen($filepath, 'w');
73
+
74
+ $headers = fgetcsv($in, 0, XmlExportEngine::$exportOptions['delimiter']);
75
+
76
+ if (is_resource($in)) {
77
+ $lineNumber = 0;
78
+ while ( ! feof($in) ) {
79
+ $data = fgetcsv($in, 0, XmlExportEngine::$exportOptions['delimiter']);
80
+ if ( empty($data) ) continue;
81
+ $data_assoc = array_combine($headers, array_values($data));
82
+ $line = array();
83
+ foreach ($headers as $header) {
84
+ $line[$header] = ( isset($data_assoc[$header]) ) ? $data_assoc[$header] : '';
85
+ }
86
+ if ( ! $lineNumber && XmlExportEngine::$exportOptions['include_bom']){
87
+ fwrite($out, chr(0xEF).chr(0xBB).chr(0xBF));
88
+ fputcsv($out, $line, XmlExportEngine::$exportOptions['delimiter']);
89
+ }
90
+ else{
91
+ fputcsv($out, $line, XmlExportEngine::$exportOptions['delimiter']);
92
+ }
93
+ apply_filters('wp_all_export_after_csv_line', $out, XmlExportEngine::$exportID);
94
+ $lineNumber++;
95
+ }
96
+ fclose($in);
97
+ }
98
+ fclose($out);
99
+ @unlink($tmp_file);
100
+ }
101
+
102
+ $preCsvHeaders = false;
103
+ $preCsvHeaders = apply_filters('wp_all_export_pre_csv_headers', $preCsvHeaders, $export->id);
104
+
105
+ if($preCsvHeaders) {
106
+ pmxe_prepend($preCsvHeaders."\n", $filepath);
107
+ }
108
+
109
+ // Split large exports into chunks
110
+ if ( $export->options['split_large_exports'] and $splitSize < $export->exported )
111
+ {
112
+
113
+ $exportOptions['split_files_list'] = array();
114
+
115
+ if ( @file_exists($filepath) )
116
+ {
117
+
118
+ switch ($export->options['export_to'])
119
+ {
120
+ case 'xml':
121
+
122
+ require_once PMXE_ROOT_DIR . '/classes/XMLWriter.php';
123
+
124
+ switch ( $export->options['xml_template_type'])
125
+ {
126
+ case 'XmlGoogleMerchants':
127
+ case 'custom':
128
+ // Determine XML root element
129
+ $main_xml_tag = false;
130
+ preg_match_all("%<[\w]+[\s|>]{1}%", $export->options['custom_xml_template_header'], $matches);
131
+ if ( ! empty($matches[0]) ){
132
+ $main_xml_tag = preg_replace("%[\s|<|>]%","",array_shift($matches[0]));
133
+ }
134
+ // Determine XML recond element
135
+ $record_xml_tag = false;
136
+ preg_match_all("%<[\w]+[\s|>]{1}%", $export->options['custom_xml_template_loop'], $matches);
137
+ if ( ! empty($matches[0]) ){
138
+ $record_xml_tag = preg_replace("%[\s|<|>]%","",array_shift($matches[0]));
139
+ }
140
+
141
+ $xml_header = PMXE_XMLWriter::preprocess_xml($export->options['custom_xml_template_header']);
142
+ $xml_footer = PMXE_XMLWriter::preprocess_xml($export->options['custom_xml_template_footer']);
143
+
144
+ break;
145
+
146
+ default:
147
+ $main_xml_tag = apply_filters('wp_all_export_main_xml_tag', $export->options['main_xml_tag'], $export->id);
148
+ $record_xml_tag = apply_filters('wp_all_export_record_xml_tag', $export->options['record_xml_tag'], $export->id);
149
+ $xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n" . "<".$main_xml_tag.">";
150
+ $xml_footer = "</".$main_xml_tag.">";
151
+ break;
152
+
153
+ }
154
+
155
+
156
+ $records_count = 0;
157
+ $chunk_records_count = 0;
158
+ $fileCount = 1;
159
+
160
+ $feed = $xml_header;
161
+
162
+ if($export->options['xml_template_type'] == 'custom'){
163
+ $outputFileTemplate = str_replace(basename($filepath), str_replace('.xml', '', basename($filepath)) . '-{FILE_COUNT_PLACEHOLDER}.xml', $filepath);
164
+ $exportOptions['split_files_list'] = wp_all_export_break_into_files($record_xml_tag, -1, $splitSize, file_get_contents($filepath), null, $outputFileTemplate);
165
+
166
+ // Remove first file which just contains the empty data tag
167
+ @unlink($exportOptions['split_files_list'][0]);
168
+ array_shift($exportOptions['split_files_list']);
169
+ }
170
+ else {
171
+ $file = new PMXE_Chunk($filepath, array('element' => $record_xml_tag, 'encoding' => 'UTF-8'));
172
+ // loop through the file until all lines are read
173
+ while ($xml = $file->read()) {
174
+
175
+ if ( ! empty($xml) )
176
+ {
177
+ $records_count++;
178
+ $chunk_records_count++;
179
+ $feed .= $xml;
180
+ }
181
+
182
+ if ( $chunk_records_count == $splitSize or $records_count == $export->exported ){
183
+ $feed .= "\n".$xml_footer;
184
+ $outputFile = str_replace(basename($filepath), str_replace('.xml', '', basename($filepath)) . '-' . $fileCount++ . '.xml', $filepath);
185
+ file_put_contents($outputFile, $feed);
186
+ if ( ! in_array($outputFile, $exportOptions['split_files_list']))
187
+ $exportOptions['split_files_list'][] = $outputFile;
188
+ $chunk_records_count = 0;
189
+ $feed = $xml_header;
190
+ }
191
+ }
192
+ }
193
+
194
+ break;
195
+ case 'csv':
196
+ $in = fopen($filepath, 'r');
197
+
198
+ $rowCount = 0;
199
+ $fileCount = 1;
200
+ $headers = fgetcsv($in);
201
+ while (!feof($in)) {
202
+ $data = fgetcsv($in);
203
+ if (empty($data)) continue;
204
+ if (($rowCount % $splitSize) == 0) {
205
+ if ($rowCount > 0) {
206
+ fclose($out);
207
+ }
208
+ $outputFile = str_replace(basename($filepath), str_replace('.csv', '', basename($filepath)) . '-' . $fileCount++ . '.csv', $filepath);
209
+ if ( ! in_array($outputFile, $exportOptions['split_files_list']))
210
+ $exportOptions['split_files_list'][] = $outputFile;
211
+
212
+ $out = fopen($outputFile, 'w');
213
+ }
214
+ if ($data){
215
+ if (($rowCount % $splitSize) == 0) {
216
+ fputcsv($out, $headers);
217
+ }
218
+ fputcsv($out, $data);
219
+ }
220
+ $rowCount++;
221
+ }
222
+ fclose($in);
223
+ fclose($out);
224
+
225
+ // convert splitted files into XLS format
226
+ if ( ! empty($exportOptions['split_files_list']) && ! empty($export->options['export_to_sheet']) and $export->options['export_to_sheet'] != 'csv' )
227
+ {
228
+ require_once PMXE_Plugin::ROOT_DIR . '/classes/PHPExcel/IOFactory.php';
229
+
230
+ foreach ($exportOptions['split_files_list'] as $key => $file)
231
+ {
232
+ $objReader = PHPExcel_IOFactory::createReader('CSV');
233
+ // If the files uses a delimiter other than a comma (e.g. a tab), then tell the reader
234
+ $objReader->setDelimiter($export->options['delimiter']);
235
+ // If the files uses an encoding other than UTF-8 or ASCII, then tell the reader
236
+ $objPHPExcel = $objReader->load($file);
237
+ switch ($export->options['export_to_sheet']){
238
+ case 'xls':
239
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
240
+ $objWriter->save(str_replace(".csv", ".xls", $file));
241
+ $exportOptions['split_files_list'][$key] = str_replace(".csv", ".xls", $file);
242
+ break;
243
+ case 'xlsx':
244
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
245
+ $objWriter->save(str_replace(".csv", ".xlsx", $file));
246
+ $exportOptions['split_files_list'][$key] = str_replace(".csv", ".xlsx", $file);
247
+ break;
248
+ }
249
+ @unlink($file);
250
+ }
251
+ }
252
+
253
+ break;
254
+
255
+ default:
256
+
257
+ break;
258
+ }
259
+
260
+ $export->set(array('options' => $exportOptions))->save();
261
+ }
262
+ }
263
+
264
+ // convert CSV to XLS
265
+ if ( @file_exists($filepath) and $export->options['export_to'] == 'csv' && ! empty($export->options['export_to_sheet']) and $export->options['export_to_sheet'] != 'csv')
266
+ {
267
+
268
+ require_once PMXE_Plugin::ROOT_DIR . '/classes/PHPExcel/IOFactory.php';
269
+
270
+ $objReader = PHPExcel_IOFactory::createReader('CSV');
271
+ // If the files uses a delimiter other than a comma (e.g. a tab), then tell the reader
272
+ $objReader->setDelimiter($export->options['delimiter']);
273
+ // If the files uses an encoding other than UTF-8 or ASCII, then tell the reader
274
+
275
+ $objPHPExcel = $objReader->load($filepath);
276
+
277
+ switch ($export->options['export_to_sheet']) {
278
+ case 'xls':
279
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
280
+ $objWriter->save(str_replace(".csv", ".xls", $filepath));
281
+ @unlink($filepath);
282
+ $filepath = str_replace(".csv", ".xls", $filepath);
283
+ break;
284
+ case 'xlsx':
285
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
286
+ $objWriter->save(str_replace(".csv", ".xlsx", $filepath));
287
+ @unlink($filepath);
288
+ $filepath = str_replace(".csv", ".xlsx", $filepath);
289
+ break;
290
+ }
291
+
292
+ $exportOptions = $export->options;
293
+ $exportOptions['filepath'] = wp_all_export_get_relative_path($filepath);
294
+ $export->set(array('options' => $exportOptions))->save();
295
+
296
+ $is_secure_import = PMXE_Plugin::getInstance()->getOption('secure');
297
+
298
+ if ( ! $is_secure_import ){
299
+ $wp_uploads = wp_upload_dir();
300
+ $wp_filetype = wp_check_filetype(basename($filepath), null );
301
+ $attachment_data = array(
302
+ 'guid' => $wp_uploads['baseurl'] . '/' . _wp_relative_upload_path( $filepath ),
303
+ 'post_mime_type' => $wp_filetype['type'],
304
+ 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filepath)),
305
+ 'post_content' => '',
306
+ 'post_status' => 'inherit'
307
+ );
308
+ if ( ! empty($export->attch_id) )
309
+ {
310
+ $attach_id = $export->attch_id;
311
+ $attachment = get_post($attach_id);
312
+ if ($attachment)
313
+ {
314
+ update_attached_file( $attach_id, $filepath );
315
+ wp_update_attachment_metadata( $attach_id, $attachment_data );
316
+ }
317
+ else
318
+ {
319
+ $attach_id = wp_insert_attachment( $attachment_data, PMXE_Plugin::$session->file );
320
+ }
321
+ }
322
+ }
323
+
324
+ }
325
+
326
+ // make a temporary copy of current file
327
+ if ( empty($export->parent_id) and @file_exists($filepath) and @copy($filepath, str_replace(basename($filepath), '', $filepath) . 'current-' . basename($filepath)))
328
+ {
329
+ $exportOptions = $export->options;
330
+ $exportOptions['current_filepath'] = str_replace(basename($filepath), '', $filepath) . 'current-' . basename($filepath);
331
+ $export->set(array('options' => $exportOptions))->save();
332
+ }
333
+
334
+ $generateBundle = apply_filters('wp_all_export_generate_bundle', true);
335
+
336
+ if($generateBundle) {
337
+
338
+ // genereta export bundle
339
+ $export->generate_bundle();
340
+
341
+ if ( ! empty($export->parent_id) )
342
+ {
343
+ $parent_export = new PMXE_Export_Record();
344
+ $parent_export->getById($export->parent_id);
345
+ if ( ! $parent_export->isEmpty() )
346
+ {
347
+ $parent_export->generate_bundle(true);
348
+ }
349
+ }
350
+ }
351
+
352
+
353
+ // send exported data to zapier.com
354
+ $subscriptions = get_option('zapier_subscribe', array());
355
+ if ( ! empty($subscriptions) and empty($export->parent_id))
356
+ {
357
+
358
+ $wp_uploads = wp_upload_dir();
359
+
360
+ $fileurl = str_replace($wp_uploads['basedir'], $wp_uploads['baseurl'], $filepath);
361
+
362
+ $response = array(
363
+ 'website_url' => home_url(),
364
+ 'export_id' => $export->id,
365
+ 'export_name' => $export->friendly_name,
366
+ 'file_name' => basename($filepath),
367
+ 'file_type' => wp_all_export_get_export_format($export->options),
368
+ 'post_types_exported' => empty($export->options['cpt']) ? $export->options['wp_query'] : implode($export->options['cpt'], ','),
369
+ 'export_created_date' => $export->registered_on,
370
+ 'export_last_run_date' => date('Y-m-d H:i:s'),
371
+ 'export_trigger_type' => empty($_GET['export_key']) ? 'manual' : 'cron',
372
+ 'records_exported' => $export->exported,
373
+ 'export_file' => ''
374
+ );
375
+
376
+ if (file_exists($filepath))
377
+ {
378
+ $response['export_file_url'] = $fileurl;
379
+ $response['status'] = 200;
380
+ $response['message'] = 'OK';
381
+ }
382
+ else
383
+ {
384
+ $response['export_file_url'] = '';
385
+ $response['status'] = 300;
386
+ $response['message'] = 'File doesn\'t exist';
387
+ }
388
+
389
+ $response = apply_filters('wp_all_export_zapier_response', $response);
390
+
391
+ foreach ($subscriptions as $zapier)
392
+ {
393
+ if (empty($zapier['target_url'])) continue;
394
+
395
+ wp_remote_post( $zapier['target_url'], array(
396
+ 'method' => 'POST',
397
+ 'timeout' => 45,
398
+ 'redirection' => 5,
399
+ 'httpversion' => '1.0',
400
+ 'blocking' => true,
401
+ 'headers' => array(
402
+ 'Content-Type' => 'application/json'
403
+ ),
404
+ 'body' => "[".json_encode($response)."]",
405
+ 'cookies' => array()
406
+ )
407
+ );
408
+ }
409
+ }
410
+
411
+ // clean session
412
+ if ( ! empty(PMXE_Plugin::$session) and PMXE_Plugin::$session->has_session() )
413
+ {
414
+ PMXE_Plugin::$session->clean_session( $export->id );
415
+ }
416
+ }
417
+ }
trunk/actions/pmxe_before_export.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_pmxe_before_export($export_id)
4
+ {
5
+ $export = new PMXE_Export_Record();
6
+ $export->getById($export_id);
7
+
8
+ if ( ! $export->isEmpty() )
9
+ {
10
+ if ( ! $export->options['export_only_new_stuff'] )
11
+ {
12
+ $postList = new PMXE_Post_List();
13
+ $missingPosts = $postList->getBy(array('export_id' => $export_id, 'iteration !=' => --$export->iteration));
14
+ $missing_ids = array();
15
+ if ( ! $missingPosts->isEmpty() ):
16
+
17
+ foreach ($missingPosts as $missingPost)
18
+ {
19
+ $missing_ids[] = $missingPost['post_id'];
20
+ }
21
+
22
+ endif;
23
+
24
+ if ( ! empty($missing_ids))
25
+ {
26
+ global $wpdb;
27
+ // Delete records form pmxe_posts
28
+ $sql = "DELETE FROM " . PMXE_Plugin::getInstance()->getTablePrefix() . "posts WHERE post_id IN (" . implode(',', $missing_ids) . ") AND export_id = %d";
29
+ $wpdb->query(
30
+ $wpdb->prepare($sql, $export->id)
31
+ );
32
+ }
33
+ }
34
+
35
+ if ( empty($export->parent_id) )
36
+ {
37
+ delete_option( 'wp_all_export_queue_' . $export->id );
38
+ }
39
+
40
+ delete_option( 'wp_all_export_acf_flexible_' . $export->id );
41
+ }
42
+ }
trunk/actions/pmxe_exported_post.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_pmxe_exported_post( $pid, $exportRecord )
4
+ {
5
+ // do not associate exported record with child export
6
+ if ( ! empty($exportRecord->parent_id) ) return;
7
+
8
+ $postRecord = new PMXE_Post_Record();
9
+ $postRecord->getBy(array(
10
+ 'post_id' => $pid,
11
+ 'export_id' => XmlExportEngine::$exportID
12
+ ));
13
+
14
+ if ($postRecord->isEmpty())
15
+ {
16
+ $postRecord->set(array(
17
+ 'post_id' => $pid,
18
+ 'export_id' => XmlExportEngine::$exportID,
19
+ 'iteration' => $exportRecord->iteration
20
+ ))->insert();
21
+ }
22
+ else
23
+ {
24
+ $postRecord->set(array('iteration' => $exportRecord->iteration))->update();
25
+ }
26
+ }
trunk/actions/wp_ajax_dismiss_export_warnings.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_wp_ajax_dismiss_export_warnings(){
4
+
5
+ if ( ! check_ajax_referer( 'wp_all_export_secure', 'security', false )){
6
+ exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
7
+ }
8
+
9
+ if ( ! current_user_can( PMXE_Plugin::$capabilities ) ){
10
+ exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
11
+ }
12
+
13
+ $input = new PMXE_Input();
14
+
15
+ $post = $input->post('data', false);
16
+
17
+ if ( ! empty($post) && ! empty($post['export_id'])){
18
+ $option_name = 'wpae_dismiss_warnings_' . $post['export_id'];
19
+ update_option($option_name, 1);
20
+ }
21
+
22
+ exit(json_encode(array('result' => true)));
23
+ }
trunk/actions/wp_ajax_generate_zapier_api_key.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_wp_ajax_generate_zapier_api_key(){
4
+
5
+ if ( ! check_ajax_referer( 'wp_all_export_secure', 'security', false )){
6
+ exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
7
+ }
8
+
9
+ if ( ! current_user_can( PMXE_Plugin::$capabilities ) ){
10
+ exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
11
+ }
12
+
13
+ $api_key = wp_all_export_rand_char(32);
14
+
15
+ PMXE_Plugin::getInstance()->updateOption('zapier_api_key', $api_key);
16
+
17
+ exit(json_encode(array('api_key' => $api_key)));
18
+ }
trunk/actions/wp_ajax_redirect_after_addon_installed.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pmxe_wp_ajax_redirect_after_addon_installed(){
4
+
5
+ if ( ! check_ajax_referer( 'wp_all_export_secure', 'security', false )){
6
+ exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
7
+ }
8
+
9
+ if ( ! current_user_can( PMXE_Plugin::$capabilities ) ){
10
+ exit( json_encode(array('html' => __('Security check', 'wp_all_export_plugin'))) );
11
+ }
12
+
13
+ $input = new PMXE_Input();
14
+
15
+ $addon = $input->post('addon', false);
16
+
17
+ $result = false;
18
+
19
+ if ($addon && defined( 'WP_PLUGIN_DIR' )) {
20
+ $result = file_exists(trailingslashit(WP_PLUGIN_DIR) . $addon);
21
+ }
22
+
23
+ exit(json_encode(array('result' => $result)));
24
+ }
trunk/actions/wp_ajax_save_scheduling.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ use Wpae\Scheduling\Interval\ScheduleTime;
4
+ use Wpae\Scheduling\Scheduling;
5
+
6
+ /**
7
+ * @throws Exception
8
+ */
9
+ function pmxe_wp_ajax_save_scheduling()
10
+ {
11
+
12
+ if (!check_ajax_referer('wp_all_export_secure', 'security', false)) {
13
+ exit(__('Security check', 'wp_all_export_plugin'));
14
+ }
15
+
16
+ if (!current_user_can(PMXE_Plugin::$capabilities)) {
17
+ exit(__('Security check', 'wp_all_export_plugin'));
18
+ }
19
+
20
+ $elementId = $_POST['element_id'];
21
+
22
+ $post = $_POST;
23
+
24
+ foreach($post['scheduling_times'] as $schedulingTime) {
25
+ if(!preg_match('/^(0?[1-9]|1[012])(:[0-5]\d)[APap][mM]$/', $schedulingTime) && $schedulingTime != '') {
26
+ header('HTTP/1.1 400 Bad request', true, 400);
27
+ die('Invalid times provided');
28
+ }
29
+ }
30
+
31
+ try{
32
+ $scheduling = Scheduling::create();
33
+ $scheduling->handleScheduling($elementId, $post);
34
+ } catch (\Wpae\Scheduling\Exception\SchedulingHttpException $e) {
35
+ header('HTTP/1.1 503 Service unavailable', true, 503);
36
+ echo json_encode(array('success' => false));
37
+
38
+ die;
39
+ }
40
+
41
+ $export = new PMXE_Export_Record();
42
+ $export->getById($elementId);
43
+ $export->set(array('options' => array_merge($export->options, $post)));
44
+ $export->save();
45
+
46
+ echo json_encode(array('success' => true));
47
+ die;
48
+ }
49
+
50
+ /**
51
+ * @return bool
52
+ */
53
+ function convertStringToBoolean($string)
54
+ {
55
+ return ($string == 'true' || $string == 1 || $string === true) ? true : false;
56
+ }
trunk/actions/wp_ajax_scheduling_dialog_content.php ADDED
@@ -0,0 +1,853 @@