PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.2.10
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.2.10
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 / src / App / Service / Addons / AddonService.php
wp-all-export / src / App / Service / Addons Last commit date
AddonNotFoundException.php 4 years ago AddonService.php 4 years ago
AddonService.php
124 lines
1 <?php
2
3 namespace Wpae\App\Service\Addons;
4
5
6 class AddonService
7 {
8 public function isUserAddonActive() {
9 return defined('PMUE_EDITION');
10 }
11
12
13 public function isWooCommerceAddonActive() {
14 return defined('PMWE_EDITION');
15 }
16
17 public function isAcfAddonActive() {
18 return defined('PMAE_EDITION');
19 }
20
21 public function isWoocommerceAddonActiveAndIsWooCommerceExport()
22 {
23 return $this->isWooCommerceAddonActive() && \XmlExportWooCommerce::$is_active;
24 }
25
26 public function isUserAddonActiveAndIsUserExport()
27 {
28 return $this->isUserAddonActive() && \XmlExportUser::$is_active;
29 }
30
31 public function userExportsExistAndAddonNotInstalled()
32 {
33 $exports = new \PMXE_Export_List();
34 $exports->getBy('parent_id', 0)->convertRecords();
35
36 foreach ($exports as $item) {
37
38 if (
39 ((in_array('users', $item['options']['cpt']) || in_array('shop_customer', $item['options']['cpt'])) && !$this->isUserAddonActive()) ||
40 ($item['options']['export_type'] == 'advanced' && $item['options']['wp_query_selector'] == 'wp_user_query' && !$this->isUserAddonActive())
41 ) {
42 return true;
43 }
44
45 }
46
47 return false;
48 }
49
50 public function hasExportAtOlderVersionThan($version)
51 {
52 $exports = new \PMXE_Export_List();
53 $exports->getBy('parent_id', 0)->convertRecords();
54
55 foreach ($exports as $item) {
56
57 if (!isset($item['options']['created_at_version'])) {
58 continue;
59 }
60
61 if(version_compare($item['options']['created_at_version'], $version) < 0) {
62 return true;
63 }
64 }
65
66 return false;
67 }
68
69 public function wooCommerceExportsExistAndAddonNotInstalled()
70 {
71 $exports = new \PMXE_Export_List();
72 $exports->getBy('parent_id', 0)->convertRecords();
73
74 foreach ($exports as $item) {
75
76 if(!isset($item['options']['cpt'])) {
77 continue;
78 }
79
80 if(!is_array($item['options']['cpt'])) {
81 $item['options']['cpt'] = array($item['options']['cpt']);
82 }
83
84 if (
85 (
86 (
87 in_array('product', $item['options']['cpt']) ||
88 in_array('product_variation', $item['options']['cpt']) ||
89 in_array('shop_order', $item['options']['cpt']) ||
90 in_array('shop_review', $item['options']['cpt']) ||
91 in_array('shop_coupon', $item['options']['cpt'])
92 )
93 && !$this->isWooCommerceAddonActive())
94 ) {
95 return true;
96 }
97
98 }
99
100 return false;
101 }
102
103 public function acfExportsExistAndNotInstalled()
104 {
105 if($this->isAcfAddonActive()) {
106 return false;
107 }
108
109 $exports = new \PMXE_Export_List();
110 $exports->getBy('parent_id', 0)->convertRecords();
111
112 foreach ($exports as $item) {
113
114 if(!empty($item['tpl_data']['options']['acf'])) {
115 return true;
116 }
117
118
119 }
120
121 return false;
122 }
123
124 }