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

183 lines 4.8 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 = 'wprbrand';
13 public $version = '5.41';
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 static function getRequestID() {
61 if (!defined("BV_REQUEST_ID")) {
62 define("BV_REQUEST_ID", uniqid(mt_rand()));
63 }
64 return BV_REQUEST_ID;
65 }
66
67 public function canSetCWBranding() {
68 if (WPRWPSiteInfo::isCWServer()) {
69
70 $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect');
71 if (sizeof($bot_protect_accounts) >= 1)
72 return true;
73
74 $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/');
75 if (sizeof($bot_protect_accounts) >= 1)
76 return true;
77 }
78
79 return false;
80 }
81
82 public function getBrandInfo() {
83 return $this->settings->getOption($this->brand_option);
84 }
85
86 public function getBrandName() {
87 $brand = $this->getBrandInfo();
88 if (is_array($brand) && array_key_exists('menuname', $brand)) {
89 return $brand['menuname'];
90 }
91
92 return $this->brandname;
93 }
94
95 public function getBrandIcon() {
96 $brand = $this->getBrandInfo();
97 if (is_array($brand) && array_key_exists('brand_icon', $brand)) {
98 return $brand['brand_icon'];
99 }
100 return $this->brand_icon;
101 }
102
103 public function getWatchTime() {
104 $time = $this->settings->getOption('bvwatchtime');
105 return ($time ? $time : 0);
106 }
107
108 public function appUrl() {
109 if (defined('BV_APP_URL')) {
110 return BV_APP_URL;
111 } else {
112 $brand = $this->getBrandInfo();
113 if (is_array($brand) && array_key_exists('appurl', $brand)) {
114 return $brand['appurl'];
115 }
116 return $this->appurl;
117 }
118 }
119
120 public function isActivePlugin() {
121 $expiry_time = time() - (3 * 24 * 3600);
122 return ($this->getWatchTime() > $expiry_time);
123 }
124
125 public function isValidEnvironment(){
126 $bvsiteinfo = new WPRWPSiteInfo();
127 $bvconfig = $this->config;
128
129 if (is_multisite()) {
130 return true;
131 } elseif ($bvconfig && array_key_exists("siteurl_scheme", $bvconfig)) {
132 $siteurl = $bvsiteinfo->siteurl('', $bvconfig["siteurl_scheme"]);
133 if (array_key_exists("abspath", $bvconfig) &&
134 array_key_exists("siteurl", $bvconfig) && !empty($siteurl)) {
135 return ($bvconfig["abspath"] == ABSPATH && $bvconfig["siteurl"] == $siteurl);
136 }
137 }
138 return true;
139 }
140
141 public function isProtectModuleEnabled() {
142 return $this->isServiceActive("protect") && $this->isValidEnvironment();
143 }
144
145 public function isDynSyncModuleEnabled() {
146 if ($this->isServiceActive("dynsync")) {
147 $dynconfig = $this->config['dynsync'];
148 if (array_key_exists('dynplug', $dynconfig) && ($dynconfig['dynplug'] === $this->plugname)) {
149 return true;
150 }
151 }
152 return false;
153 }
154
155 public function isServiceActive($service) {
156 $bvconfig = $this->config;
157 if ($bvconfig && array_key_exists('services', $bvconfig)) {
158 return in_array($service, $bvconfig['services']) && $this->isActivePlugin();
159 }
160 return false;
161 }
162
163 public function isActivateRedirectSet() {
164 return ($this->settings->getOption($this->plug_redirect) === 'yes') ? true : false;
165 }
166
167 public function isMalcare() {
168 return $this->getBrandName() === 'MalCare';
169 }
170
171 public function isBlogvault() {
172 return $this->getBrandName() === 'BlogVault';
173 }
174
175 public function info() {
176 return array(
177 "bvversion" => $this->version,
178 "sha1" => "true",
179 "plugname" => $this->plugname
180 );
181 }
182 }
183 endif;