PluginProbe
The WP Remote WordPress Plugin / 5.45
The WP Remote WordPress Plugin v5.45
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / info.php

info.php in The WP Remote WordPress Plugin 5.45, at info.php

240 lines 6.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('WPRInfo')) :
5 class WPRInfo {
6 public $settings;
7 public $config;
8 public $plugname = 'wpremote';
9 public $brandname = 'WP Remote';
10 public $badgeinfo = 'wprbadge';
11 public $ip_header_option = 'wpripheader';
12 public $brand_option = 'bv_whitelabel_infos';
13 public $version = '5.45';
14 public $webpage = 'https://wpremote.com';
15 public $appurl = 'https://app.wpremote.com';
16 public $slug = 'wpremote/plugin.php';
17 public $plug_redirect = 'wprredirect';
18 public $logo = '../img/wprlogo.png';
19 public $brand_icon = '/img/icon.png';
20 public $services_option_name = 'wprconfig';
21 public $author = 'WP Remote';
22 public $title = 'WP Remote';
23
24 const DB_VERSION = '4';
25
26 public function __construct($settings) {
27 $this->settings = $settings;
28 $this->config = $this->settings->getOption($this->services_option_name);
29 }
30
31 public function getCurrentDBVersion() {
32 $bvconfig = $this->config;
33 if ($bvconfig && array_key_exists('db_version', $bvconfig)) {
34 return $bvconfig['db_version'];
35 }
36 return false;
37 }
38
39 public function hasValidDBVersion() {
40 return WPRInfo::DB_VERSION === $this->getCurrentDBVersion();
41 }
42
43 public function getLatestWooCommerceDBVersion() {
44 if (defined('WC_ABSPATH') && file_exists(WC_ABSPATH . 'includes/class-wc-install.php')) {
45 include_once WC_ABSPATH . 'includes/class-wc-install.php';
46
47 if (class_exists('WC_Install')) {
48 $update_versions = array_keys(WC_Install::get_db_update_callbacks());
49
50 if (!empty($update_versions)) {
51 asort($update_versions);
52 return end($update_versions);
53 }
54 }
55 }
56
57 return false;
58 }
59
60 public function getLatestElementorDBVersion($file) {
61 if (defined('ELEMENTOR_PATH') && file_exists(ELEMENTOR_PATH . 'core/upgrade/manager.php')) {
62 include_once ELEMENTOR_PATH . 'core/upgrade/manager.php';
63
64 if ($file === 'elementor-pro/elementor-pro.php') {
65 $managerClass = '\ElementorPro\Core\Upgrade\Manager';
66 } else {
67 $managerClass = '\Elementor\Core\Upgrade\Manager';
68 }
69
70 $manager = new $managerClass();
71
72 return $manager->get_new_version();
73 }
74
75 return false;
76 }
77
78 public static function getRequestID() {
79 if (!defined("BV_REQUEST_ID")) {
80 define("BV_REQUEST_ID", uniqid(mt_rand()));
81 }
82 return BV_REQUEST_ID;
83 }
84
85 public function canSetCWBranding() {
86 if (WPRWPSiteInfo::isCWServer()) {
87
88 $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect');
89 if (sizeof($bot_protect_accounts) >= 1)
90 return true;
91
92 $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/');
93 if (sizeof($bot_protect_accounts) >= 1)
94 return true;
95 }
96
97 return false;
98 }
99
100 public function canWhiteLabel($slug = NULL) {
101 if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) {
102 return false;
103 }
104 if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) &&
105 $_REQUEST["bv_override_plugin_whitelabel"] === $slug) {
106 return false;
107 }
108 return true;
109 }
110
111 public function getPluginWhitelabelInfo($slug = null) {
112 if ($slug === null) {
113 $slug = $this->slug;
114 }
115 $whitelabel_infos = $this->getPluginsWhitelabelInfos();
116 if (!array_key_exists($slug, $whitelabel_infos) || !is_array($whitelabel_infos[$slug])) {
117 return array();
118 }
119 return $whitelabel_infos[$slug];
120 }
121
122 public function getBrandInfo() {
123 return $this->settings->getOption($this->brand_option);
124 }
125
126 public function getPluginsWhitelabelInfos() {
127 $whitelabel_infos = $this->settings->getOption($this->brand_option);
128 return is_array($whitelabel_infos) ? $whitelabel_infos : array();
129 }
130
131 public function getPluginsWhitelabelInfoByTitle() {
132 $whitelabel_infos = $this->getPluginsWhitelabelInfos();
133 $whitelabel_infos_by_title = array();
134 foreach ($whitelabel_infos as $slug => $whitelabel_info) {
135 if (is_array($whitelabel_info) && array_key_exists('default_title', $whitelabel_info) && isset($whitelabel_info['default_title'])) {
136 $whitelabel_info['slug'] = $slug;
137 $whitelabel_infos_by_title[$whitelabel_info['default_title']] = $whitelabel_info;
138 }
139 }
140 return $whitelabel_infos_by_title;
141 }
142
143 public function getBrandName() {
144 $brand = $this->getPluginWhitelabelInfo();
145 if (is_array($brand) && array_key_exists('menuname', $brand)) {
146 return $brand['menuname'];
147 }
148
149 return $this->brandname;
150 }
151
152 public function getBrandIcon() {
153 $brand = $this->getPluginWhitelabelInfo();
154 if (is_array($brand) && array_key_exists('brand_icon', $brand)) {
155 return $brand['brand_icon'];
156 }
157 return $this->brand_icon;
158 }
159
160 public function getWatchTime() {
161 $time = $this->settings->getOption('bvwatchtime');
162 return ($time ? $time : 0);
163 }
164
165 public function appUrl() {
166 if (defined('BV_APP_URL')) {
167 return BV_APP_URL;
168 } else {
169 $brand = $this->getPluginWhitelabelInfo();
170 if (is_array($brand) && array_key_exists('appurl', $brand)) {
171 return $brand['appurl'];
172 }
173 return $this->appurl;
174 }
175 }
176
177 public function isActivePlugin() {
178 $expiry_time = time() - (3 * 24 * 3600);
179 return ($this->getWatchTime() > $expiry_time);
180 }
181
182 public function isValidEnvironment(){
183 $bvsiteinfo = new WPRWPSiteInfo();
184 $bvconfig = $this->config;
185
186 if (is_multisite()) {
187 return true;
188 } elseif ($bvconfig && array_key_exists("siteurl_scheme", $bvconfig)) {
189 $siteurl = $bvsiteinfo->siteurl('', $bvconfig["siteurl_scheme"]);
190 if (array_key_exists("abspath", $bvconfig) &&
191 array_key_exists("siteurl", $bvconfig) && !empty($siteurl)) {
192 return ($bvconfig["abspath"] == ABSPATH && $bvconfig["siteurl"] == $siteurl);
193 }
194 }
195 return true;
196 }
197
198 public function isProtectModuleEnabled() {
199 return $this->isServiceActive("protect") && $this->isValidEnvironment();
200 }
201
202 public function isDynSyncModuleEnabled() {
203 if ($this->isServiceActive("dynsync")) {
204 $dynconfig = $this->config['dynsync'];
205 if (array_key_exists('dynplug', $dynconfig) && ($dynconfig['dynplug'] === $this->plugname)) {
206 return true;
207 }
208 }
209 return false;
210 }
211
212 public function isServiceActive($service) {
213 $bvconfig = $this->config;
214 if ($bvconfig && array_key_exists('services', $bvconfig)) {
215 return in_array($service, $bvconfig['services']) && $this->isActivePlugin();
216 }
217 return false;
218 }
219
220 public function isActivateRedirectSet() {
221 return ($this->settings->getOption($this->plug_redirect) === 'yes') ? true : false;
222 }
223
224 public function isMalcare() {
225 return $this->getBrandName() === 'MalCare';
226 }
227
228 public function isBlogvault() {
229 return $this->getBrandName() === 'BlogVault';
230 }
231
232 public function info() {
233 return array(
234 "bvversion" => $this->version,
235 "sha1" => "true",
236 "plugname" => $this->plugname
237 );
238 }
239 }
240 endif;