PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.4.11
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.4.11
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / libraries / XmlExportEngine.php
wp-all-export / libraries Last commit date
VariableProductTitle 9 years ago .gitkeep 11 years ago WpaeInvalidPhpException.php 9 years ago WpaeInvalidStringException.php 9 years ago WpaeMethodNotFoundException.php 9 years ago WpaePhpInterpreterErrorHandler.php 2 years ago WpaeString.php 9 years ago WpaeTooMuchRecursionException.php 9 years ago XmlCsvExport.php 2 years ago XmlExportCpt.php 1 year ago XmlExportCustomRecord.php 1 year ago XmlExportEngine.php 2 years ago XmlExportFiltering.php 4 years ago XmlExportMediaGallery.php 3 years ago XmlExportTaxonomy.php 4 years ago
XmlExportEngine.php
1353 lines
1 <?php
2
3 if ( ! class_exists('XmlExportEngine') ){
4
5 require_once dirname(__FILE__) . '/XmlExportTaxonomy.php';
6
7 final class XmlExportEngine
8 {
9
10 const VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION = 1;
11 const VARIABLE_PRODUCTS_EXPORT_VARIATION = 2;
12 const VARIABLE_PRODUCTS_EXPORT_PARENT = 3;
13
14 const VARIATION_USE_PARENT_TITLE = 1;
15 const VARIATION_USE_DEFAULT_TITLE = 2;
16
17 /**
18 * Custom XML Loop begin statement
19 * @var string
20 */
21 const XML_LOOP_START = '<!-- BEGIN LOOP -->';
22
23 /**
24 * Custom XML Loop end statement
25 * @var string
26 */
27 const XML_LOOP_END = '<!-- END LOOP -->';
28
29 const EXPORT_TYPE_GOOLE_MERCHANTS = 'XmlGoogleMerchants';
30 const EXPORT_TYPE_XML = 'xml';
31 const EXPORT_TYPE_CSV = 'csv';
32
33 public static $acf_export;
34 public static $woo_export = false;
35 public static $woo_order_export;
36 public static $woo_coupon_export;
37 public static $woo_refund_export;
38 public static $woo_review_export;
39 public static $user_export = false;
40 public static $taxonomy_export;
41 public static $custom_record_export;
42
43 public static $is_woo_order_export = false;
44
45 public static $is_preview = false;
46
47 public static $implode = ',';
48
49 private $post;
50 private $_existing_meta_keys = array();
51 private $_existing_taxonomies = array();
52
53 private static $addons_service = false;
54
55 private $init_fields = array(
56 array(
57 'label' => 'id',
58 'name' => 'ID',
59 'type' => 'id'
60 ),
61 array(
62 'label' => 'title',
63 'name' => 'Title',
64 'type' => 'title'
65 ),
66 array(
67 'label' => 'content',
68 'name' => 'Content',
69 'type' => 'content'
70 )
71 );
72
73 public static $default_fields = array(
74 array(
75 'label' => 'id',
76 'name' => 'ID',
77 'type' => 'id'
78 ),
79 array(
80 'label' => 'title',
81 'name' => 'Title',
82 'type' => 'title'
83 ),
84 array(
85 'label' => 'content',
86 'name' => 'Content',
87 'type' => 'content'
88 ),
89 array(
90 'label' => 'excerpt',
91 'name' => 'Excerpt',
92 'type' => 'excerpt'
93 ),
94 array(
95 'label' => 'date',
96 'name' => 'Date',
97 'type' => 'date'
98 ),
99 array(
100 'label' => 'post_type',
101 'name' => 'Post Type',
102 'type' => 'post_type'
103 ),
104 array(
105 'label' => 'permalink',
106 'name' => 'Permalink',
107 'type' => 'permalink'
108 )
109 );
110
111 private $other_fields = array(
112 array(
113 'label' => 'status',
114 'name' => 'Status',
115 'type' => 'status'
116 ),
117
118 array(
119 'label' => 'author',
120 'name' => 'Author ID',
121 'type' => 'author'
122 ),
123
124 array(
125 'label' => 'author_username',
126 'name' => 'Author Username',
127 'type' => 'author_username'
128 ),
129
130 array(
131 'label' => 'author_email',
132 'name' => 'Author Email',
133 'type' => 'author_email'
134 ),
135
136 array(
137 'label' => 'author_first_name',
138 'name' => 'Author First Name',
139 'type' => 'author_first_name'
140 ),
141
142 array(
143 'label' => 'author_last_name',
144 'name' => 'Author Last Name',
145 'type' => 'author_last_name'
146 ),
147
148 array(
149 'label' => 'slug',
150 'name' => 'Slug',
151 'type' => 'slug'
152 ),
153 array(
154 'label' => 'format',
155 'name' => 'Format',
156 'type' => 'format'
157 ),
158 array(
159 'label' => 'template',
160 'name' => 'Template',
161 'type' => 'template'
162 ),
163 array(
164 'label' => 'parent',
165 'name' => 'Parent',
166 'type' => 'parent'
167 ),
168 array(
169 'label' => 'parent_slug',
170 'name' => 'Parent Slug',
171 'type' => 'parent_slug'
172 ),
173 array(
174 'label' => 'order',
175 'name' => 'Order',
176 'type' => 'order'
177 ),
178 array(
179 'label' => 'comment_status',
180 'name' => 'Comment Status',
181 'type' => 'comment_status'
182 ),
183 array(
184 'label' => 'ping_status',
185 'name' => 'Ping Status',
186 'type' => 'ping_status'
187 ),
188 array(
189 'label' => 'post_modified',
190 'name' => 'Post Modified Date',
191 'type' => 'post_modified'
192 )
193 );
194
195 private $available_sections = array();
196 private $filter_sections = array();
197
198 private $errors;
199
200 private $available_data = array(
201 'acf_groups' => array(),
202 'existing_acf_meta_keys' => array(),
203 'existing_meta_keys' => array(),
204 'init_fields' => array(),
205 'default_fields' => array(),
206 'other_fields' => array(),
207 'woo_data' => array(),
208 'existing_attributes' => array(),
209 'existing_taxonomies' => array()
210 );
211
212 private $filters;
213
214 public static $is_user_export = false;
215 public static $is_comment_export = false;
216 public static $is_taxonomy_export = false;
217 public static $is_custom_addon_export = false;
218 public static $post_types = array();
219 public static $exportOptions = array();
220 public static $exportQuery;
221 public static $exportID = false;
222 public static $exportRecord = false;
223 public static $globalAvailableSections;
224
225 public static $is_auto_generate_enabled = true;
226
227 public function __construct( $post, & $errors = false ){
228
229 $this->post = $post;
230 $this->errors = $errors;
231
232 $this->available_sections = array(
233 'default' => array(
234 'title' => __("Standard", "wp_all_export_plugin"),
235 'content' => 'default_fields'
236 ),
237 'media' => array(
238 'title' => __("Media", "wp_all_export_plugin"),
239 'content' => '',
240 'additional' => array(
241 'images' => array(
242 'title' => __("Images", "wp_all_export_plugin"),
243 'meta' => array(
244 array(
245 'name' => 'URL',
246 'label' => 'url',
247 'type' => 'image_url',
248 'auto' => 1
249 ),
250 array(
251 'name' => 'Filename',
252 'label' => 'filename',
253 'type' => 'image_filename'
254 ),
255 array(
256 'name' => 'Path',
257 'label' => 'path',
258 'type' => 'image_path'
259 ),
260 array(
261 'name' => 'ID',
262 'label' => 'image_id',
263 'type' => 'image_id'
264 ),
265 array(
266 'name' => 'Title',
267 'label' => 'title',
268 'type' => 'image_title',
269 'auto' => 1
270 ),
271 array(
272 'name' => 'Caption',
273 'label' => 'caption',
274 'type' => 'image_caption',
275 'auto' => 1
276 ),
277 array(
278 'name' => 'Description',
279 'label' => 'description',
280 'type' => 'image_description',
281 'auto' => 1
282 ),
283 array(
284 'name' => 'Alt Text',
285 'label' => 'alt',
286 'type' => 'image_alt',
287 'auto' => 1
288 ),
289 array(
290 'name' => 'Featured',
291 'label' => 'featured',
292 'type' => 'image_featured',
293 'auto' => 1
294 ),
295 )
296 ),
297 'attachments' => array(
298 'title' => __("Attachments", "wp_all_export_plugin"),
299 'meta' => array(
300 array(
301 'name' => 'URL',
302 'label' => 'url',
303 'type' => 'attachment_url',
304 'auto' => 1
305 ),
306 array(
307 'name' => 'Filename',
308 'label' => 'filename',
309 'type' => 'attachment_filename'
310 ),
311 array(
312 'name' => 'Path',
313 'label' => 'path',
314 'type' => 'attachment_path'
315 ),
316 array(
317 'name' => 'ID',
318 'label' => 'attachment_id',
319 'type' => 'attachment_id'
320 ),
321 array(
322 'name' => 'Title',
323 'label' => 'title',
324 'type' => 'attachment_title'
325 ),
326 array(
327 'name' => 'Caption',
328 'label' => 'caption',
329 'type' => 'attachment_caption'
330 ),
331 array(
332 'name' => 'Description',
333 'label' => 'description',
334 'type' => 'attachment_description'
335 ),
336 array(
337 'name' => 'Alt Text',
338 'label' => 'alt',
339 'type' => 'attachment_alt'
340 ),
341 )
342 )
343 )
344 ),
345 'cats' => array(
346 'title' => __("Taxonomies", "wp_all_export_plugin"),
347 'content' => 'existing_taxonomies'
348 ),
349 'cf' => array(
350 'title' => __("Custom Fields", "wp_all_export_plugin"),
351 'content' => 'existing_meta_keys'
352 ),
353 'other' => array(
354 'title' => __("Other", "wp_all_export_plugin"),
355 'content' => 'other_fields'
356 )
357 );
358
359 $this->available_sections = apply_filters('pmxe_available_sections', $this->available_sections);
360
361 $this->filter_sections = array(
362 'author' => array(
363 'title' => __("Author", "wp_all_export_plugin"),
364 'fields' => array(
365 'user_ID' => 'User ID',
366 'user_login' => 'User Login',
367 'user_nicename' => 'Nicename',
368 'user_email' => 'Email',
369 'user_registered' => 'Date Registered (Y-m-d H:i:s)',
370 'display_name' => 'Display Name',
371 'cf_first_name' => 'First Name',
372 'cf_last_name' => 'Last Name',
373 'nickname' => 'Nickname',
374 'description' => 'User Description',
375 'wp_capabilities' => 'User Role'
376 )
377 )
378 );
379
380 if ( 'specific' == $this->post['export_type'] || 'wp_query' == $this->post['wp_query_selector']) {
381
382 $postTypes = [];
383 $exportqueryPostType = [];
384
385 if (!empty($this->post['cpt'])) {
386 $postTypes = is_array( $this->post['cpt'] )
387 ? $this->post['cpt']
388 : array( $this->post['cpt'] );
389 }
390
391 if (isset($this->post['exportquery']) && !empty($this->post['exportquery']->query['post_type'])) {
392 $exportqueryPostType = [$this->post['exportquery']->query['post_type']];
393 }
394
395 if (empty($postTypes)) {
396 $postTypes = $exportqueryPostType;
397 }
398
399 self::$post_types = $postTypes;
400
401 if( \class_exists('WooCommerce') && XmlExportEngine::get_addons_service()->isWooCommerceAddonActive()) {
402 if (in_array('product', self::$post_types) and !in_array('product_variation', self::$post_types)) self::$post_types[] = 'product_variation';
403 } else if(\class_exists('WooCommerce') && in_array('product', self::$post_types) && XmlExportEngine::get_addons_service()->isWooCommerceProductAddonActive()) {
404 self::$post_types = ['product'];
405 }
406
407 self::$is_user_export = ( in_array('users', self::$post_types) or in_array('shop_customer', self::$post_types) ) ? true : false;
408
409 self::$is_comment_export = ( in_array('comments', self::$post_types) ) ? true : false;
410
411 self::$is_taxonomy_export = ( in_array('taxonomies', self::$post_types) ) ? true : false;
412
413 if(count(self::$post_types) === 1) {
414 if(strpos(self::$post_types[0], 'custom_') === 0 ) {
415 self::$is_custom_addon_export = true;
416 }
417 }
418 }
419 else
420 {
421 self::$is_user_export = ( 'wp_user_query' == $this->post['wp_query_selector'] );
422 self::$is_comment_export = ( 'wp_comment_query' == $this->post['wp_query_selector'] );
423 }
424
425 if ( ! self::$is_user_export && ! self::$is_comment_export && ! self::$is_taxonomy_export)
426 {
427 add_filter("wp_all_export_filters", array( &$this, "filter_export_filters"), 10, 1);
428
429 // When WPML is active and at least one post in the export has a trid
430 if (class_exists('SitePress'))
431 {
432 self::$default_fields[] = array(
433 'label' => 'wpml_trid',
434 'name' => 'WPML Translation ID',
435 'type' => 'wpml_trid'
436 );
437
438 self::$default_fields[] = array(
439 'label' => 'wpml_lang',
440 'name' => 'WPML Language Code',
441 'type' => 'wpml_lang'
442 );
443 }
444 }
445
446 self::$exportOptions = $post;
447
448 if ( ! empty(PMXE_Plugin::$session) and PMXE_Plugin::$session->has_session() )
449 {
450 $filter_args = array(
451 'filter_rules_hierarhy' => $this->post['filter_rules_hierarhy'],
452 'product_matching_mode' => $this->post['product_matching_mode'],
453 'taxonomy_to_export' => empty($this->post['taxonomy_to_export']) ? '' : $this->post['taxonomy_to_export']
454 );
455
456 $this->filters = \Wpae\Pro\Filtering\FilteringFactory::getFilterEngine();
457 $this->filters->init($filter_args);
458
459 $this->init();
460 }
461
462 if (empty(self::$exportOptions['delimiter'])) self::$exportOptions['delimiter'] = ',';
463
464 self::$implode = (self::$exportOptions['delimiter'] == ',') ? '|' : ',';
465
466 self::$implode = apply_filters('wp_all_export_implode_delimiter', self::$implode, self::$exportID);
467
468 if ( !empty(self::$exportOptions['xml_template_type']) && in_array(self::$exportOptions['xml_template_type'], array('custom', 'XmlGoogleMerchants')) ) self::$implode = '#delimiter#';
469
470 self::$taxonomy_export = new XmlExportTaxonomy();
471 self::$custom_record_export = new XmlExportCustomRecord();
472 self::$is_woo_order_export = in_array('shop_order', self::$post_types);
473
474 do_action('pmxe_init_addons');
475 }
476
477 // [FILTERS]
478
479 /**
480 *
481 * Filter data for advanced filtering
482 *
483 */
484 public function filter_export_filters($filters){
485 return array_merge($filters, $this->filter_sections);
486 }
487
488 // [\FILTERS]
489
490 protected function init(){
491
492 PMXE_Plugin::$session->set('is_user_export', self::$is_user_export);
493 PMXE_Plugin::$session->set('is_comment_export', self::$is_comment_export);
494 PMXE_Plugin::$session->set('is_taxonomy_export', self::$is_taxonomy_export);
495 PMXE_Plugin::$session->save_data();
496
497 if ('advanced' == $this->post['export_type']) {
498
499 if( "" == $this->post['wp_query'] ){
500 $this->errors->add('form-validation', __('WP Query field is required', 'pmxe_plugin'));
501 }
502 else if(!XmlExportEngine::get_addons_service()->isWooCommerceAddonActive() && strpos($this->post['wp_query'], 'product') !== false && \class_exists('WooCommerce')) {
503 $this->errors->add('form-validation', __('The WooCommerce Export Add-On Pro is required to Export WooCommerce Products', 'pmxe_plugin'));
504 }
505 else if(!XmlExportEngine::get_addons_service()->isWooCommerceAddonActive() && !XmlExportEngine::get_addons_service()->isWooCommerceOrderAddonActive() && strpos($this->post['wp_query'], 'shop_order') !== false) {
506 $this->errors->add('form-validation', __('The WooCommerce Export Add-On Pro is required to Export WooCommerce Orders', 'pmxe_plugin'));
507 }
508 else if(!XmlExportEngine::get_addons_service()->isWooCommerceAddonActive() && strpos($this->post['wp_query'], 'shop_coupon') !== false) {
509 $this->errors->add('form-validation', __('The WooCommerce Export Add-On Pro is required to Export WooCommerce Coupons', 'pmxe_plugin'));
510 }
511 else
512 {
513 $this->filters->parse();
514
515 PMXE_Plugin::$session->set('whereclause', $this->filters->get('queryWhere'));
516 PMXE_Plugin::$session->set('joinclause', $this->filters->get('queryJoin'));
517 PMXE_Plugin::$session->set('wp_query', $this->post['wp_query']);
518 PMXE_Plugin::$session->save_data();
519 }
520 }
521 else
522 {
523 $this->filters->parse();
524
525 PMXE_Plugin::$session->set('cpt', self::$post_types);
526 PMXE_Plugin::$session->set('whereclause', $this->filters->get('queryWhere'));
527 PMXE_Plugin::$session->set('joinclause', $this->filters->get('queryJoin'));
528 PMXE_Plugin::$session->save_data();
529 }
530
531 PMXE_Plugin::$session->save_data();
532
533 }
534
535 public function init_additional_data(){
536
537 if(self::$woo_export) {
538 self::$woo_export->init_additional_data();
539 }
540
541 if(self::$woo_order_export) {
542 self::$woo_order_export->init_additional_data();
543 }
544 }
545
546 public function init_available_data(){
547
548 global $wpdb;
549 $table_prefix = $wpdb->prefix;
550
551 // Prepare existing taxonomies
552 if ( 'specific' == $this->post['export_type'] and ! self::$is_user_export and ! self::$is_comment_export and ! self::$is_taxonomy_export )
553 {
554 $this->_existing_taxonomies = wp_all_export_get_existing_taxonomies_by_cpt( self::$post_types[0] );
555
556 $this->_existing_meta_keys = wp_all_export_get_existing_meta_by_cpt( self::$post_types[0] );
557 }
558 if ( 'advanced' == $this->post['export_type'] and ! self::$is_user_export and ! self::$is_comment_export and ! self::$is_taxonomy_export )
559 {
560 $meta_keys = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$table_prefix}postmeta WHERE {$table_prefix}postmeta.meta_key NOT LIKE '_edit%' AND {$table_prefix}postmeta.meta_key NOT LIKE '_oembed_%' LIMIT 1000");
561 if ( ! empty($meta_keys)){
562 $exclude_keys = array('_first_variation_attributes', '_is_first_variation_created');
563 foreach ($meta_keys as $meta_key) {
564 if ( strpos($meta_key->meta_key, "_tmp") === false && strpos($meta_key->meta_key, "_v_") === false && ! in_array($meta_key->meta_key, $exclude_keys))
565 $this->_existing_meta_keys[] = $meta_key->meta_key;
566 }
567 }
568
569 global $wp_taxonomies;
570
571 foreach ($wp_taxonomies as $key => $obj) { if (in_array($obj->name, array('nav_menu'))) continue;
572
573 if (strpos($obj->name, "pa_") !== 0 and strlen($obj->name) > 3)
574 $this->_existing_taxonomies[] = array(
575 'name' => empty($obj->label) ? $obj->name : $obj->label,
576 'label' => $obj->name,
577 'type' => 'cats'
578 );
579 }
580 }
581
582 if(self::$acf_export) {
583 // Prepare existing ACF groups & fields
584 self::$acf_export->init($this->_existing_meta_keys);
585 }
586
587 if(XmlExportEngine::$woo_export) {
588 // Prepare existing WooCommerce data
589 self::$woo_export->init($this->_existing_meta_keys);
590
591 if(self::get_addons_service()->isWooCommerceAddonActive()) {
592 // Prepare existing WooCommerce Coupon data
593 self::$woo_coupon_export->init($this->_existing_meta_keys);
594 }
595 }
596 if(XmlExportEngine::$woo_order_export) {
597 // Prepare existing WooCommerce Order data
598 self::$woo_order_export->init($this->_existing_meta_keys);
599
600
601 }
602
603 if(XmlExportEngine::$user_export) {
604 // Prepare existing Users data
605 self::$user_export->init($this->_existing_meta_keys);
606 }
607
608 // Prepare existing Taxonomy data
609 self::$taxonomy_export->init($this->_existing_meta_keys);
610
611 return $this->get_available_data();
612 }
613
614 public function get_available_data(){
615
616 if(self::$acf_export) {
617 $this->available_data['acf_groups'] = self::$acf_export->get('_acf_groups');
618 $this->available_data['existing_acf_meta_keys'] = self::$acf_export->get('_existing_acf_meta_keys');
619 }
620
621 $this->available_data['existing_meta_keys'] = $this->_existing_meta_keys;
622 $this->available_data['existing_taxonomies'] = $this->_existing_taxonomies;
623
624 $this->available_data['init_fields'] = apply_filters('wp_all_export_init_fields', $this->init_fields);
625 $this->available_data['default_fields'] = apply_filters('wp_all_export_default_fields', self::$default_fields);
626 $this->available_data['other_fields'] = apply_filters('wp_all_export_other_fields', $this->other_fields);
627
628 $this->available_data = apply_filters("wp_all_export_available_data", $this->available_data);
629
630 return $this->available_data;
631
632 }
633
634 public function get_fields_options( $field_keys = array() ){
635
636 $fields = array(
637 'ids' => array(),
638 'cc_label' => array(),
639 'cc_php' => array(),
640 'cc_code' => array(),
641 'cc_sql' => array(),
642 'cc_options' => array(),
643 'cc_type' => array(),
644 'cc_value' => array(),
645 'cc_name' => array(),
646 'cc_settings' => array()
647 );
648
649 self::$woo_order_export->get_fields_options( $fields, $field_keys );
650
651 $available_sections = apply_filters("wp_all_export_available_sections", $this->available_sections);
652
653 foreach ($available_sections as $slug => $section)
654 {
655 if ( ! empty($this->available_data[$section['content']]) ):
656
657 foreach ($this->available_data[$section['content']] as $field)
658 {
659
660 $field_key = (is_array($field)) ? $field['name'] : $field;
661
662 if ( ! in_array($field_key, $field_keys) ) continue;
663
664 $fields['ids'][] = 1;
665 $fields['cc_label'][] = (is_array($field)) ? $field['label'] : $field;
666 $fields['cc_php'][] = '';
667 $fields['cc_code'][] = '';
668 $fields['cc_sql'][] = '';
669 $fields['cc_options'][] = '';
670 $fields['cc_type'][] = (is_array($field)) ? $field['type'] : $slug;
671 $fields['cc_value'][] = (is_array($field)) ? $field['label'] : $field;
672 $fields['cc_name'][] = $field_key;
673 $fields['cc_settings'][] = '';
674 }
675 endif;
676
677 if ( ! empty($section['additional']) )
678 {
679 foreach ($section['additional'] as $sub_slug => $sub_section)
680 {
681
682 foreach ($sub_section['meta'] as $field) {
683 $key_to_check = (is_array($field)) ? $field['name'] : $field;
684
685 if ( in_array($sub_slug, array('images', 'attachments')) ){
686 $key_to_check = preg_replace("%s$%","",ucfirst($sub_slug)) . ' ' . $key_to_check;
687 }
688
689 if ( ! in_array($key_to_check, $field_keys) ) continue;
690
691 $field_options = ( in_array($sub_slug, array('images', 'attachments')) ) ? esc_attr('{"is_export_featured":true,"is_export_attached":true,"image_separator":"|"}') : '0';
692
693 $fields['ids'][] = 1;
694 $fields['cc_label'][] = (is_array($field)) ? $field['label'] : $field;
695 $fields['cc_php'][] = '';
696 $fields['cc_code'][] = '';
697 $fields['cc_sql'][] = '';
698 $fields['cc_options'][] = $field_options;
699 $fields['cc_type'][] = (is_array($field)) ? $field['type'] : $sub_slug;
700 $fields['cc_value'][] = (is_array($field)) ? $field['label'] : $field;
701 $fields['cc_name'][] = $key_to_check;
702 $fields['cc_settings'][] = '';
703 }
704 }
705 }
706 }
707
708 if ( ! self::$is_comment_export )
709 {
710 if(self::$acf_export) {
711 self::$acf_export->get_fields_options( $fields, $field_keys );
712 }
713 }
714
715 $sort_fields = array();
716 foreach ($field_keys as $i => $field_key){
717 foreach ($fields['cc_name'] as $j => $cc_name){
718 if (!empty($cc_name) && $cc_name == $field_key){
719 $sort_fields['ids'][] = 1;
720 $sort_fields['cc_label'][] = $fields['cc_label'][$j];
721 $sort_fields['cc_php'][] = $fields['cc_php'][$j];
722 $sort_fields['cc_code'][] = $fields['cc_code'][$j];
723 $sort_fields['cc_sql'][] = $fields['cc_sql'][$j];
724 $sort_fields['cc_options'][] = $fields['cc_options'][$j];
725 $sort_fields['cc_type'][] = $fields['cc_type'][$j];
726 $sort_fields['cc_value'][] = $fields['cc_value'][$j];
727 $sort_fields['cc_name'][] = $fields['cc_name'][$j];
728 $sort_fields['cc_settings'][] = $fields['cc_settings'][$j];
729 break;
730 }
731 }
732 }
733
734 return $sort_fields;
735
736 }
737
738 public function render(){
739
740 $i = 0;
741
742 ob_start();
743
744 $available_sections = apply_filters("wp_all_export_available_sections", $this->available_sections);
745 self::$globalAvailableSections = $available_sections;
746
747 if(self::$woo_order_export) {
748 // Render Available WooCommerce Orders Data
749 self::$woo_order_export->render($i);
750 }
751
752 foreach ($available_sections as $slug => $section)
753 {
754
755 if ( ! empty($this->available_data[$section['content']]) or ! empty($section['additional']) ):
756 ?>
757 <p class="wpae-available-fields-group"><?php echo esc_html($section['title']); ?><span class="wpae-expander">+</span></p>
758 <div class="wpae-custom-field">
759 <?php
760 if($slug == 'cf' && XmlExportEngine::$is_user_export) {
761 ?>
762 <div class="wpallexport-free-edition-notice">
763 <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=5839967&edd_options%5Bprice_id%5D=1&utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=export-user-meta">Upgrade to the Pro edition of WP All Export to Export User Meta</a>
764 </div>
765 <?php
766 }
767 ?>
768 <?php
769 if($slug == 'other' && XmlExportEngine::$is_user_export) {
770 ?>
771 <div class="wpallexport-free-edition-notice">
772 <a class="upgrade_link" target="_blank" href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=5839967&edd_options%5Bprice_id%5D=1&utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=export-advanced-user-data">Upgrade to the Pro edition of WP All Export to Export Advanced Fields</a>
773 </div>
774 <?php
775 }
776 $elementClass = "";
777 if(($slug == 'cf' || $slug == 'other') && XmlExportEngine::$is_user_export){
778 $elementClass = 'wpallexport_disabled';
779 }
780 ?>
781 <ul>
782 <?php if ( ! empty($this->available_data[$section['content']]) ): ?>
783 <li class="<?php echo esc_attr($elementClass); ?>">
784 <div class="default_column" rel="">
785 <label class="wpallexport-element-label"><?php esc_html_e("All", "wp_all_export_plugin") . ' ' . esc_html($section['title']); ?></label>
786 <input type="hidden" name="rules[]" value="<?php echo esc_attr("pmxe_" . $slug); ?>"/>
787 </div>
788 </li>
789 <?php
790 foreach ($this->available_data[$section['content']] as $field)
791 {
792 $field_type = is_array($field) ? $field['type'] : $slug;
793 $field_name = is_array($field) ? $field['name'] : $field;
794
795 if ( $field_type == 'cf' && $field_name == '_thumbnail_id' ) continue;
796
797 $is_auto_field = ( ! empty($field['auto']) or self::$is_auto_generate_enabled and ('specific' != $this->post['export_type'] or 'specific' == $this->post['export_type'] and (! in_array(self::$post_types[0], array('product')) || !\class_exists('WooCommerce'))));
798
799 ?>
800 <li class="pmxe_<?php echo $slug; ?> <?php if ( $is_auto_field ) echo 'wp_all_export_auto_generate';?> <?php echo esc_attr($elementClass);?>">
801 <div class="custom_column" rel="<?php echo ($i + 1);?>">
802 <label class="wpallexport-xml-element"><?php echo esc_html(is_array($field) ? $field['name'] : $field); ?></label>
803 <input type="hidden" name="ids[]" value="1"/>
804 <input type="hidden" name="cc_label[]" value="<?php echo esc_html(is_array($field) ? $field['label'] : $field); ?>"/>
805 <input type="hidden" name="cc_php[]" value="0"/>
806 <input type="hidden" name="cc_code[]" value=""/>
807 <input type="hidden" name="cc_sql[]" value="0"/>
808 <input type="hidden" name="cc_options[]" value="0"/>
809 <input type="hidden" name="cc_type[]" value="<?php echo esc_html(is_array($field) ? $field['type'] : $slug); ?>"/>
810 <input type="hidden" name="cc_value[]" value="<?php echo esc_html(is_array($field) ? $field['label'] : $field); ?>"/>
811 <input type="hidden" name="cc_name[]" value="<?php echo esc_html(is_array($field) ? $field['name'] : $field); ?>"/>
812 <input type="hidden" name="cc_settings[]" value="0"/>
813 </div>
814 </li>
815 <?php
816 $i++;
817 }
818 endif;
819
820 if ( ! empty($section['additional']) )
821 {
822 foreach ($section['additional'] as $sub_slug => $sub_section)
823 {
824
825 ?>
826 <li class="available_sub_section">
827 <p class="wpae-available-fields-group"><?php echo esc_html($sub_section['title']); ?><span
828 class="wpae-expander">+</span></p>
829 <div class="wpae-custom-field">
830 <?php
831 $show_additional_subsection = apply_filters("wp_all_export_show_additional_subsection", true, $sub_slug, $sub_section);
832 do_action("wp_all_export_before_available_subsection", $sub_slug, $sub_section);
833
834
835 if($show_additional_subsection) { ?>
836
837 <ul>
838 <li>
839 <div class="default_column" rel="">
840 <label class="wpallexport-element-label"><?php echo __("All", "wp_all_export_plugin") . ' ' . esc_html($sub_section['title']); ?></label>
841 <input type="hidden" name="rules[]"
842 value="<?php echo esc_attr("pmxe_" . $slug . "_" . $sub_slug); ?>"/>
843 </div>
844 </li>
845 <?php
846 foreach ($sub_section['meta'] as $field) {
847 $is_auto_field = empty($field['auto']) ? false : true;
848 $field_options = (in_array($sub_slug, array('images', 'attachments'))) ? esc_attr('{"is_export_featured":true,"is_export_attached":true,"image_separator":"|"}') : '0';
849 ?>
850 <li class="<?php echo esc_attr("pmxe_" . $slug . "_" . $sub_slug); ?> <?php if ($is_auto_field) echo 'wp_all_export_auto_generate'; ?>">
851 <div class="custom_column" rel="<?php echo($i + 1); ?>">
852 <label class="wpallexport-xml-element"><?php echo (is_array($field)) ? esc_html(XmlExportEngine::sanitizeFieldName($field['name'])) : esc_html($field); ?></label>
853 <input type="hidden" name="ids[]" value="1"/>
854 <input type="hidden" name="cc_label[]"
855 value="<?php echo (is_array($field)) ? esc_attr($field['label']) : esc_attr($field); ?>"/>
856 <input type="hidden" name="cc_php[]" value="0"/>
857 <input type="hidden" name="cc_code[]" value="0"/>
858 <input type="hidden" name="cc_sql[]" value="0"/>
859 <input type="hidden" name="cc_options[]"
860 value="<?php echo esc_attr($field_options); ?>"/>
861 <input type="hidden" name="cc_type[]"
862 value="<?php echo (is_array($field)) ? esc_attr($field['type']) : esc_attr($sub_slug); ?>"/>
863 <input type="hidden" name="cc_value[]"
864 value="<?php echo (is_array($field)) ? esc_attr($field['label']) : esc_attr($field); ?>"/>
865 <input type="hidden" name="cc_name[]"
866 value="<?php echo (is_array($field)) ? esc_attr(XmlExportEngine::sanitizeFieldName($field['name'])) : esc_attr($field); ?>"/>
867 <input type="hidden" name="cc_settings[]" value=""/>
868 </div>
869 </li>
870 <?php
871 $i++;
872
873 }
874 ?>
875 </ul>
876 <?php
877 }
878 ?>
879 </div>
880 </li>
881 <?php
882
883 }
884 }
885 ?>
886 </ul>
887 </div>
888 <?php
889 endif;
890 }
891
892 if ( ! self::$is_comment_export )
893 {
894 if(self::$acf_export) {
895 // Render Available ACF
896 self::$acf_export->render($i);
897 } else {
898 if(!self::get_addons_service()->isAcfAddonActive()) {
899 ?>
900 <p class="wpae-available-fields-group">ACF<span class="wpae-expander">+</span></p>
901 <div class="wpae-custom-field">
902
903 <div class="wpallexport-free-edition-notice">
904 <a class="upgrade_link" target="_blank"
905 href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=5839953&edd_options%5Bprice_id%5D=1&utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=export-advanced-custom-fields">Upgrade to the ACF Export Package to Export Advanced Custom Fields</a>
906 </div>
907 </div>
908 <?php
909 }
910
911 }
912 }
913
914 return ob_get_clean();
915
916 }
917
918 public function render_filters(){
919
920 $available_sections = apply_filters("wp_all_export_available_sections", apply_filters('wp_all_export_filters', $this->available_sections) );
921
922 if(self::$woo_order_export) {
923 // Render Filters for WooCommerce Orders
924 self::$woo_order_export->render_filters();
925 }
926
927 if(self::$is_custom_addon_export) {
928 if(class_exists('GF_Export_Add_On')) {
929 $addon = GF_Export_Add_On::get_instance();
930 $addon->render_filters();
931 unset($available_sections);
932 }
933
934 }
935
936 if ( ! empty($available_sections) )
937 {
938 $exclude = array('wpml_lang', 'wpml_trid');
939
940 foreach ($available_sections as $slug => $section)
941 {
942 if ( ! empty($section['content']) and ! empty($this->available_data[$section['content']]) or ! empty($section['fields'])):
943 ?>
944
945 <optgroup label="<?php echo esc_attr($section['title']); ?>">
946
947 <?php if ( ! empty($section['content']) && ! empty($this->available_data[$section['content']]) ): ?>
948
949 <?php foreach ($this->available_data[$section['content']] as $field) : ?>
950
951 <?php
952
953 $field_label = is_array($field) ? $field['label'] : $field;
954 $field_type = is_array($field) ? $field['type'] : $slug;
955 $field_name = is_array($field) ? $field['name'] : $field;
956
957 if ( in_array($field_label, $exclude) ) continue;
958
959 switch ($field_type)
960 {
961 case 'woo':
962 $exclude_fields = array('attributes');
963 if ( ! in_array($field_label, $exclude_fields)):
964 ?>
965 <option value="<?php echo esc_attr('cf_' . $field_label); ?>"><?php echo esc_html($field_name); ?></option>
966 <?php
967 endif;
968 break;
969 case 'cf':
970 ?>
971 <option value="<?php echo esc_attr('cf_' . $field_label); ?>"><?php echo esc_html($field_name); ?></option>
972 <?php
973 break;
974 case 'cats':
975 case 'attr':
976 ?>
977 <option value="<?php echo esc_attr('tx_' . $field_label); ?>"><?php echo esc_html($field_name); ?></option>
978 <?php
979 break;
980 default:
981
982 if (self::$is_user_export)
983 {
984 switch ($field_label)
985 {
986 case 'id':
987 $field_label = strtoupper($field_label);
988 break;
989 case 'user_nicename':
990 ?>
991 <option value="user_role"><?php esc_html_e('User Role', 'wp_all_export_plugin'); ?></option>
992 <?php
993 break;
994 }
995 }
996 else
997 {
998 switch ($field_label) {
999 case 'id':
1000 $field_label = strtoupper($field_label);
1001 break;
1002 case 'parent':
1003 case 'author':
1004 case 'author_username':
1005 case 'author_email':
1006 case 'author_first_name':
1007 case 'author_last_name':
1008 case 'status':
1009 case 'title':
1010 case 'content':
1011 case 'date':
1012 case 'excerpt':
1013 $field_label = 'post_' . $field_label;
1014 break;
1015 case 'permalink':
1016 $field_label = 'guid';
1017 break;
1018 case 'slug':
1019 $field_label = 'post_name';
1020 break;
1021 case 'order':
1022 $field_label = 'menu_order';
1023 break;
1024 case 'template':
1025 $field_label = 'cf__wp_page_template';
1026 break;
1027 case 'format':
1028 $field_label = 'tx_post_format';
1029 break;
1030 default:
1031 # code...
1032 break;
1033 }
1034 }
1035 ?>
1036 <option value="<?php echo esc_attr($field_label); ?>"><?php echo esc_html($field_name); ?></option>
1037 <?php
1038 break;
1039 }
1040 ?>
1041
1042 <?php endforeach; ?>
1043
1044 <?php endif; ?>
1045
1046 <?php if ( ! empty($section['fields'])): ?>
1047
1048 <?php foreach ($section['fields'] as $key => $title) : ?>
1049
1050 <option value="<?php echo esc_attr($key); ?>"><?php echo esc_html($title); ?></option>
1051
1052 <?php endforeach; ?>
1053
1054 <?php endif; ?>
1055
1056 </optgroup>
1057
1058 <?php
1059
1060 endif;
1061
1062 if ( ! empty($section['additional']) )
1063 {
1064 foreach ($section['additional'] as $sub_slug => $sub_section)
1065 {
1066 if ( $sub_slug == 'attributes' ) {
1067 ?>
1068 <optgroup label="<?php echo esc_attr($sub_section['title']); ?>">
1069 <?php
1070 foreach ($sub_section['meta'] as $field) :
1071 if ( isset( $field['type'] ) ) {
1072 switch ( $field['type'] ) {
1073 case 'attr':
1074 ?>
1075 <option value="<?php echo esc_attr('tx_' . $field['label']); ?>"><?php echo esc_html($field['name']); ?></option>
1076 <?php
1077 break;
1078 case 'cf':
1079 ?>
1080 <option value="<?php echo esc_attr('cf_' . $field['label']); ?>"><?php echo esc_html($field['name']); ?></option>
1081 <?php
1082 break;
1083 default:
1084 # code...
1085 break;
1086 }
1087 }
1088
1089 endforeach;
1090 ?>
1091 </optgroup>
1092 <?php
1093 }
1094 }
1095 }
1096 }
1097 }
1098
1099 if ( ! self::$is_comment_export )
1100 {
1101 if(self::$acf_export) {
1102 // Render Available ACF
1103 self::$acf_export->render_filters();
1104 }
1105 }
1106
1107 }
1108
1109 public function render_new_field(){
1110
1111 ob_start();
1112
1113 $available_sections = apply_filters("wp_all_export_available_sections", $this->available_sections);
1114
1115 if(self::$woo_order_export) {
1116 // Render Available WooCommerce Orders Data
1117 self::$woo_order_export->render_new_field();
1118 }
1119
1120 if ( ! empty($available_sections) ):?>
1121
1122 <select class="wp-all-export-chosen-select" name="column_value_type" style="width:350px;">
1123
1124 <?php
1125 foreach ($available_sections as $slug => $section)
1126 {
1127 if($slug === 'product_data' && !self::get_addons_service()->isWooCommerceAddonActive()) {
1128 unset($section['additional']);
1129 }
1130
1131 if ( ! empty($this->available_data[$section['content']]) or ! empty($section['additional']) ):
1132 ?>
1133 <optgroup label="<?php echo esc_attr($section['title']); ?>">
1134
1135 <?php
1136 if ( ! empty($this->available_data[$section['content']]) )
1137 {
1138 foreach ($this->available_data[$section['content']] as $field)
1139 {
1140 $field_label = is_array($field) ? $field['label'] : $field;
1141 $field_type = is_array($field) ? $field['type'] : $slug;
1142 $field_name = is_array($field) ? $field['name'] : $field;
1143 $field_options = empty ($field['options']) ? '' : $field['options'];
1144
1145 if ( $field_type == 'cf' && $field_name == '_thumbnail_id' || ($field_type=='other')) continue;
1146 $elementDisabled = "";
1147 if(($section['title'] == 'Custom Fields' || $section['title'] == 'Other') && XmlExportEngine::$is_user_export) {
1148 $elementDisabled = "disabled='disabled'";
1149 }
1150 ?>
1151 <option
1152 value="<?php echo esc_attr($field_type);?>"
1153 label="<?php echo esc_attr($field_label);?>"
1154 <?php echo esc_html($elementDisabled); ?>
1155 options="<?php echo esc_attr($field_options); ?>"><?php echo esc_html($field_name);?></option>
1156 <?php
1157 }
1158 }
1159 ?>
1160
1161 </optgroup>
1162
1163 <?php
1164
1165 if ( ! empty($section['additional']) )
1166 {
1167 foreach ($section['additional'] as $sub_slug => $sub_section)
1168 {
1169 ?>
1170 <optgroup label="<?php echo esc_attr($sub_section['title']); ?>">
1171
1172 <?php
1173 foreach ($sub_section['meta'] as $field)
1174 {
1175 $field_label = is_array($field) ? $field['label'] : $field;
1176 $field_type = is_array($field) ? $field['type'] : $slug;
1177 $field_name = is_array($field) ? $field['name'] : $field;
1178 $field_options = empty($field['options']) ? '{"is_export_featured":true,"is_export_attached":true,"image_separator":"|"}' : $field['options'];
1179 ?>
1180 <option
1181 value="<?php echo esc_attr($field_type);?>"
1182 label="<?php echo esc_attr($field_label);?>"
1183 options="<?php echo esc_attr($field_options); ?>"><?php echo esc_html($field_name);?></option>
1184 <?php
1185 }
1186 ?>
1187 </optgroup>
1188 <?php
1189 }
1190 }
1191 endif;
1192 }
1193
1194 if ( ! self::$is_comment_export )
1195 {
1196 if(self::$acf_export) {
1197 // Render Available ACF
1198 self::$acf_export->render_new_field();
1199 }
1200 }
1201
1202 ?>
1203 <optgroup label="Advanced">
1204 <option value="sql" label="sql"><?php esc_html_e("SQL Query", "wp_all_export_plugin"); ?></option>
1205 </optgroup>
1206 </select>
1207 <?php
1208 endif;
1209
1210 return ob_get_clean();
1211
1212 }
1213
1214 public function parse_custom_xml_template(){
1215
1216 preg_match("%". self::XML_LOOP_START ."(.*)". self::XML_LOOP_END ."%", $this->post['custom_xml_template'], $matches);
1217 $parts = explode(self::XML_LOOP_START, $this->post['custom_xml_template']);
1218 $loopContent = $parts[1];
1219 $parts = explode(self::XML_LOOP_END, $loopContent);
1220 $loopContent = $parts[0];
1221 $line_numbers = substr_count($loopContent, "\n") +1;
1222
1223 $result['original_post_loop'] = $loopContent;
1224 $result['line_numbers'] = $line_numbers;
1225
1226 $custom_xml_template = str_replace("\n", "", $this->post['custom_xml_template']);
1227 // retrieve XML header
1228 preg_match("%(.*)". self::XML_LOOP_START ."%", $custom_xml_template, $matches);
1229 $result['custom_xml_template_header'] = empty($matches[1]) ? '' : rtrim($matches[1]);
1230 // retrieve XML POST LOOP
1231 preg_match("%". self::XML_LOOP_START ."(.*)". self::XML_LOOP_END ."%", $custom_xml_template, $matches);
1232 $result['custom_xml_template_loop'] = empty($matches[1]) ? '' : rtrim($matches[1]);
1233 // retrieve XML footer
1234 preg_match("%". self::XML_LOOP_END ."(.*)%", $custom_xml_template, $matches);
1235 $result['custom_xml_template_footer'] = empty($matches[1]) ? '' : $matches[1];
1236
1237 // Validate Custom XML Template header
1238 if ( empty($result['custom_xml_template_header']) )
1239 {
1240 $this->errors->add('form-validation', __('Missing custom XML template header.', 'wp_all_export_plugin'));
1241 }
1242 // Validate Custom XML Template post LOOP
1243 if ( empty($result['custom_xml_template_loop']) )
1244 {
1245 $this->errors->add('form-validation', __('Missing custom XML template post loop.', 'wp_all_export_plugin'));
1246 }
1247 // Validate Custom XML Template footer
1248 if ( empty($result['custom_xml_template_footer']) )
1249 {
1250 $this->errors->add('form-validation', __('Missing custom XML template footer.', 'wp_all_export_plugin'));
1251 }
1252
1253 if ( ! $this->errors->get_error_codes()) {
1254
1255 // retrieve all placeholders in the XML loop
1256 preg_match_all("%(\[[^\]\[]*\])%", $result['custom_xml_template_loop'], $matches);
1257 $loop_placeholders = empty($matches) ? array() : $matches[0];
1258
1259 $field_keys = array();
1260 // looking for placeholders e.q. {Post Type}, {Title}
1261 if ( ! empty($loop_placeholders) ){
1262
1263 foreach ($loop_placeholders as $snippet) {
1264 preg_match("%\{(.*)\}%", $snippet, $matches);
1265 if ( ! empty($matches[1]) ) $field_keys[] = $matches[1];
1266 }
1267 }
1268
1269 preg_match_all("%(\{[^\}\{]*\})%", $result['custom_xml_template_loop'], $matches);
1270 $loop_placeholders = empty($matches) ? array() : $matches[0];
1271
1272 $field_keys = array();
1273 // looking for placeholders e.q. {Post Type}, {Title}
1274 if ( ! empty($loop_placeholders) ){
1275
1276 foreach ($loop_placeholders as $snippet) {
1277 preg_match("%\{(.*)\}%", $snippet, $matches);
1278 if ( ! empty($matches[1]) and ! in_array($matches[1], $field_keys)) $field_keys[] = $matches[1];
1279 }
1280 }
1281
1282 if (!empty($field_keys)){
1283 $result['custom_xml_template_options'] = $this->get_fields_options( $field_keys );
1284 }
1285 }
1286 return $result;
1287 }
1288
1289 /**
1290 * __get function.
1291 *
1292 * @access public
1293 * @param mixed $key
1294 * @return mixed
1295 */
1296 public function __get( $key ) {
1297 return $this->get( $key );
1298 }
1299
1300 /**
1301 * Get a session variable
1302 *
1303 * @param string $key
1304 * @param mixed $default used if the session variable isn't set
1305 * @return mixed value of session variable
1306 */
1307 public function get( $key, $default = null ) {
1308 return isset( $this->{$key} ) ? $this->{$key} : $default;
1309 }
1310
1311 public static function getProductVariationMode()
1312 {
1313 if(!isset(self::$exportOptions['export_variations'])) {
1314 self::$exportOptions['export_variations'] = self::VARIABLE_PRODUCTS_EXPORT_PARENT_AND_VARIATION;
1315 }
1316
1317 return apply_filters('wp_all_export_product_variation_mode', self::$exportOptions['export_variations'], self::$exportID);
1318 }
1319
1320 public static function getProductVariationTitleMode()
1321 {
1322 if(!isset(self::$exportOptions['export_variations_title'])) {
1323 self::$exportOptions['export_variations_title'] = self::VARIATION_USE_PARENT_TITLE;
1324 }
1325
1326 return self::$exportOptions['export_variations_title'];
1327 }
1328
1329 public static function sanitizeFieldName($fieldName)
1330 {
1331 if (class_exists('XmlExportWooCommerce') && XmlExportWooCommerce::$is_active) {
1332 return urldecode($fieldName);
1333 }
1334
1335 return $fieldName;
1336 }
1337
1338 public static function get_addons() {
1339 return apply_filters('pmxe_addons', []);
1340 }
1341
1342 public static function get_addons_service()
1343 {
1344 if(!self::$addons_service) {
1345 self::$addons_service = new Wpae\App\Service\Addons\AddonService();
1346 }
1347
1348 return self::$addons_service;
1349 }
1350 }
1351
1352 }
1353