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

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