PluginProbe
The WP Remote WordPress Plugin / 5.56
The WP Remote WordPress Plugin v5.56
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.56, at info.php

245 lines 7.0 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.56';
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 getConnectionKey() {
61 require_once dirname( __FILE__ ) . '/recover.php';
62 $bvsiteinfo = new WPRWPSiteInfo();
63 return base64_encode(WPRRecover::defaultSecret($this->settings).":".$bvsiteinfo->siteurl());
64 }
65
66 public function getDefaultSecret() {
67 require_once dirname( __FILE__ ) . '/recover.php';
68 $bvsiteinfo = new WPRWPSiteInfo();
69 return WPRRecover::defaultSecret($this->settings);
70 }
71
72 public function getLatestElementorDBVersion($file) {
73 $managerClass = $file === "elementor/elementor.php" ? '\Elementor\Core\Upgrade\Manager' : '\ElementorPro\Core\Upgrade\Manager';
74
75 if (!class_exists($managerClass)) {
76 return false;
77 }
78
79 $manager = new $managerClass();
80 return $manager->get_new_version();
81 }
82
83 public static function getRequestID() {
84 if (!defined("BV_REQUEST_ID")) {
85 define("BV_REQUEST_ID", uniqid(mt_rand()));
86 }
87 return BV_REQUEST_ID;
88 }
89
90 public function canSetCWBranding() {
91 if (WPRWPSiteInfo::isCWServer()) {
92
93 $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect');
94 if (sizeof($bot_protect_accounts) >= 1)
95 return true;
96
97 $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/');
98 if (sizeof($bot_protect_accounts) >= 1)
99 return true;
100 }
101
102 return false;
103 }
104
105 public function canWhiteLabel($slug = NULL) {
106 if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) {
107 return false;
108 }
109 if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) &&
110 $_REQUEST["bv_override_plugin_whitelabel"] === $slug) {
111 return false;
112 }
113 return true;
114 }
115
116 public function getPluginWhitelabelInfo($slug = null) {
117 if ($slug === null) {
118 $slug = $this->slug;
119 }
120 $whitelabel_infos = $this->getPluginsWhitelabelInfos();
121 if (!array_key_exists($slug, $whitelabel_infos) || !is_array($whitelabel_infos[$slug])) {
122 return array();
123 }
124 return $whitelabel_infos[$slug];
125 }
126
127 public function getBrandInfo() {
128 return $this->settings->getOption($this->brand_option);
129 }
130
131 public function getPluginsWhitelabelInfos() {
132 $whitelabel_infos = $this->settings->getOption($this->brand_option);
133 return is_array($whitelabel_infos) ? $whitelabel_infos : array();
134 }
135
136 public function getPluginsWhitelabelInfoByTitle() {
137 $whitelabel_infos = $this->getPluginsWhitelabelInfos();
138 $whitelabel_infos_by_title = array();
139 foreach ($whitelabel_infos as $slug => $whitelabel_info) {
140 if (is_array($whitelabel_info) && array_key_exists('default_title', $whitelabel_info) && isset($whitelabel_info['default_title'])) {
141 $whitelabel_info['slug'] = $slug;
142 $whitelabel_infos_by_title[$whitelabel_info['default_title']] = $whitelabel_info;
143 }
144 }
145 return $whitelabel_infos_by_title;
146 }
147
148 public function getBrandName() {
149 $brand = $this->getPluginWhitelabelInfo();
150 if (is_array($brand) && array_key_exists('menuname', $brand)) {
151 return $brand['menuname'];
152 }
153
154 return $this->brandname;
155 }
156
157 public function getBrandIcon() {
158 $brand = $this->getPluginWhitelabelInfo();
159 if (is_array($brand) && array_key_exists('brand_icon', $brand)) {
160 return $brand['brand_icon'];
161 }
162 return $this->brand_icon;
163 }
164
165 public function getWatchTime() {
166 $time = $this->settings->getOption('bvwatchtime');
167 return ($time ? $time : 0);
168 }
169
170 public function appUrl() {
171 if (defined('BV_APP_URL')) {
172 return BV_APP_URL;
173 } else {
174 $brand = $this->getPluginWhitelabelInfo();
175 if (is_array($brand) && array_key_exists('appurl', $brand)) {
176 return $brand['appurl'];
177 }
178 return $this->appurl;
179 }
180 }
181
182 public function isActivePlugin() {
183 $expiry_time = time() - (3 * 24 * 3600);
184 return ($this->getWatchTime() > $expiry_time);
185 }
186
187 public function isValidEnvironment(){
188 $bvsiteinfo = new WPRWPSiteInfo();
189 $bvconfig = $this->config;
190
191 if (is_multisite()) {
192 return true;
193 } elseif ($bvconfig && array_key_exists("siteurl_scheme", $bvconfig)) {
194 $siteurl = $bvsiteinfo->siteurl('', $bvconfig["siteurl_scheme"]);
195 if (array_key_exists("abspath", $bvconfig) &&
196 array_key_exists("siteurl", $bvconfig) && !empty($siteurl)) {
197 return ($bvconfig["abspath"] == ABSPATH && $bvconfig["siteurl"] == $siteurl);
198 }
199 }
200 return true;
201 }
202
203 public function isProtectModuleEnabled() {
204 return $this->isServiceActive("protect") && $this->isValidEnvironment();
205 }
206
207 public function isDynSyncModuleEnabled() {
208 if ($this->isServiceActive("dynsync")) {
209 $dynconfig = $this->config['dynsync'];
210 if (array_key_exists('dynplug', $dynconfig) && ($dynconfig['dynplug'] === $this->plugname)) {
211 return true;
212 }
213 }
214 return false;
215 }
216
217 public function isServiceActive($service) {
218 $bvconfig = $this->config;
219 if ($bvconfig && array_key_exists('services', $bvconfig)) {
220 return in_array($service, $bvconfig['services']) && $this->isActivePlugin();
221 }
222 return false;
223 }
224
225 public function isActivateRedirectSet() {
226 return ($this->settings->getOption($this->plug_redirect) === 'yes') ? true : false;
227 }
228
229 public function isMalcare() {
230 return $this->getBrandName() === 'MalCare';
231 }
232
233 public function isBlogvault() {
234 return $this->getBrandName() === 'BlogVault';
235 }
236
237 public function info() {
238 return array(
239 "bvversion" => $this->version,
240 "sha1" => "true",
241 "plugname" => $this->plugname
242 );
243 }
244 }
245 endif;