PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
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 2 years ago
AddonService.php
147 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(!isset($item['options']['cpt'])) {
50 continue;
51 }
52
53 if(!is_array($item['options']['cpt'])) {
54 $item['options']['cpt'] = array($item['options']['cpt']);
55 }
56
57 if (
58 ((in_array('users', $item['options']['cpt']) || in_array('shop_customer', $item['options']['cpt']))) ||
59 ($item['options']['export_type'] == 'advanced' && $item['options']['wp_query_selector'] == 'wp_user_query')
60 ) {
61 return true;
62 }
63
64 }
65
66 return false;
67 }
68
69 public function wooCommerceExportsExistAndAddonNotInstalled()
70 {
71
72 if($this->isWooCommerceAddonActive()) {
73 return false;
74 }
75
76 $exports = new \PMXE_Export_List();
77 $exports->getBy('parent_id', 0)->convertRecords();
78
79 foreach ($exports as $item) {
80
81 if(!isset($item['options']['cpt'])) {
82 continue;
83 }
84
85 if(!is_array($item['options']['cpt'])) {
86 $item['options']['cpt'] = array($item['options']['cpt']);
87 }
88
89 if (
90 (
91 (
92 (in_array('product', $item['options']['cpt']) && \class_exists('WooCommerce') && !$this->isWooCommerceProductAddonActive()) ||
93 in_array('product_variation', $item['options']['cpt']) ||
94 in_array('shop_order', $item['options']['cpt']) ||
95 in_array('shop_review', $item['options']['cpt']) ||
96 in_array('shop_coupon', $item['options']['cpt'])
97 ))
98 ) {
99 return true;
100 }
101
102 }
103
104 return false;
105 }
106
107 public function acfExportsExistAndNotInstalled()
108 {
109 if($this->isAcfAddonActive()) {
110 return false;
111 }
112
113 $exports = new \PMXE_Export_List();
114 $exports->getBy('parent_id', 0)->convertRecords();
115
116 foreach ($exports as $item) {
117
118 if(is_array($item->options['cc_type']) && in_array('acf', $item->options['cc_type'])) {
119 return true;
120 }
121
122 }
123
124 return false;
125 }
126
127 public function hasExportAtOlderVersionThan($version)
128 {
129 $exports = new \PMXE_Export_List();
130 $exports->getBy('parent_id', 0)->convertRecords();
131
132 foreach ($exports as $item) {
133
134 if (!isset($item['options']['created_at_version'])) {
135 continue;
136 }
137
138 if(version_compare($item['options']['created_at_version'], $version) < 0) {
139 return true;
140 }
141 }
142
143 return false;
144 }
145
146
147 }