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

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