PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / 1.3.6
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel v1.3.6
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 6 years ago AddonService.php 4 years ago
AddonService.php
139 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 public function isWooCommerceAddonActive() {
13 return defined('PMWE_EDITION');
14 }
15
16 public function isAcfAddonActive() {
17 return defined('PMAE_EDITION');
18 }
19
20 public function isWooCommerceOrderAddonActive() {
21 return defined('PMWOE_EDITION');
22 }
23
24 public function isWooCommerceProductAddonActive() {
25 return defined('PMWPE_EDITION');
26 }
27
28 public function isWoocommerceAddonActiveAndIsWooCommerceExport()
29 {
30 return $this->isWooCommerceAddonActive() && \XmlExportWooCommerce::$is_active;
31 }
32
33 public function isUserAddonActiveAndIsUserExport()
34 {
35 return $this->isUserAddonActive() && \XmlExportUser::$is_active;
36 }
37
38 public function userExportsExistAndAddonNotInstalled()
39 {
40 if($this->isUserAddonActive()) {
41 return false;
42 }
43
44 $exports = new \PMXE_Export_List();
45 $exports->getBy('parent_id', 0)->convertRecords();
46
47 foreach ($exports as $item) {
48
49 if (
50 ((in_array('users', $item['options']['cpt']) || in_array('shop_customer', $item['options']['cpt']))) ||
51 ($item['options']['export_type'] == 'advanced' && $item['options']['wp_query_selector'] == 'wp_user_query')
52 ) {
53 return true;
54 }
55
56 }
57
58 return false;
59 }
60
61 public function wooCommerceExportsExistAndAddonNotInstalled()
62 {
63
64 if($this->isWooCommerceAddonActive()) {
65 return false;
66 }
67
68 $exports = new \PMXE_Export_List();
69 $exports->getBy('parent_id', 0)->convertRecords();
70
71 foreach ($exports as $item) {
72
73 if(!isset($item['options']['cpt'])) {
74 continue;
75 }
76
77 if(!is_array($item['options']['cpt'])) {
78 $item['options']['cpt'] = array($item['options']['cpt']);
79 }
80
81 if (
82 (
83 (
84 (in_array('product', $item['options']['cpt']) && \class_exists('WooCommerce')) ||
85 in_array('product_variation', $item['options']['cpt']) ||
86 in_array('shop_order', $item['options']['cpt']) ||
87 in_array('shop_review', $item['options']['cpt']) ||
88 in_array('shop_coupon', $item['options']['cpt'])
89 ))
90 ) {
91 return true;
92 }
93
94 }
95
96 return false;
97 }
98
99 public function acfExportsExistAndNotInstalled()
100 {
101 if($this->isAcfAddonActive()) {
102 return false;
103 }
104
105 $exports = new \PMXE_Export_List();
106 $exports->getBy('parent_id', 0)->convertRecords();
107
108 foreach ($exports as $item) {
109
110 if(is_array($item->options['cc_type']) && in_array('acf', $item->options['cc_type'])) {
111 return true;
112 }
113
114 }
115
116 return false;
117 }
118
119 public function hasExportAtOlderVersionThan($version)
120 {
121 $exports = new \PMXE_Export_List();
122 $exports->getBy('parent_id', 0)->convertRecords();
123
124 foreach ($exports as $item) {
125
126 if (!isset($item['options']['created_at_version'])) {
127 continue;
128 }
129
130 if(version_compare($item['options']['created_at_version'], $version) < 0) {
131 return true;
132 }
133 }
134
135 return false;
136 }
137
138
139 }