| @@ -8,11 +8,10 @@ | ||
| 8 | 8 | public $plugname = 'wpremote'; |
| 9 | 9 | public $brandname = 'WP Remote'; |
| 10 | 10 | public $badgeinfo = 'wprbadge'; |
| 11 | 11 | public $ip_header_option = 'wpripheader'; |
| 12 | - public $brand_option = 'bv_whitelabel_infos'; | |
| 13 | - public $wp_lp_whitelabel_option = 'wprLpWhitelabelConf'; | |
| 14 | - public $version = '6.69'; | |
| 12 | + public $brand_option = 'wprbrand'; | |
| 13 | + public $version = '4.84'; | |
| 15 | 14 | public $webpage = 'https://wpremote.com'; |
| 16 | 15 | public $appurl = 'https://app.wpremote.com'; |
| 17 | 16 | public $slug = 'wpremote/plugin.php'; |
| 18 | 17 | public $plug_redirect = 'wprredirect'; |
| @@ -18,13 +17,10 @@ | ||
| 18 | 17 | public $plug_redirect = 'wprredirect'; |
| 19 | 18 | public $logo = '../img/wprlogo.png'; |
| 20 | 19 | public $brand_icon = '/img/icon.png'; |
| 21 | 20 | public $services_option_name = 'wprconfig'; |
| 22 | - public $author = 'WP Remote'; | |
| 23 | - public $title = 'WP Remote'; | |
| 24 | 21 | |
| 25 | - const DB_VERSION = '5'; | |
| 26 | - const AL_CONF_VERSION = '1.1'; | |
| 22 | + const DB_VERSION = '3'; | |
| 27 | 23 | |
| 28 | 24 | public function __construct($settings) { |
| 29 | 25 | $this->settings = $settings; |
| 30 | 26 | $this->config = $this->settings->getOption($this->services_option_name); |
| @@ -41,119 +37,45 @@ | ||
| 41 | 37 | public function hasValidDBVersion() { |
| 42 | 38 | return WPRInfo::DB_VERSION === $this->getCurrentDBVersion(); |
| 43 | 39 | } |
| 44 | 40 | |
| 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 | - } | |
| 41 | + public static function getRequestID() { | |
| 42 | + if (!defined("BV_REQUEST_ID")) { | |
| 43 | + define("BV_REQUEST_ID", uniqid(mt_rand())); | |
| 57 | 44 | } |
| 58 | - | |
| 59 | - return false; | |
| 45 | + return BV_REQUEST_ID; | |
| 60 | 46 | } |
| 61 | 47 | |
| 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 | - $tag = WPRRecover::connectionTag($this->settings); | |
| 48 | + public function canSetCWBranding() { | |
| 49 | + if (WPRWPSiteInfo::isCWServer()) { | |
| 68 | 50 | |
| 69 | - #No tag means this site has no salt material in wp-config.php, and there | |
| 70 | - #is no connection key that would be safe to hand out. | |
| 71 | - if (empty($secret) || empty($tag)) { | |
| 72 | - return null; | |
| 73 | - } | |
| 51 | + $bot_protect_accounts = WPRAccount::accountsByType($this->settings, 'botprotect'); | |
| 52 | + if (sizeof($bot_protect_accounts) >= 1) | |
| 53 | + return true; | |
| 74 | 54 | |
| 75 | - return base64_encode("v3:".$secret.":".$encoded_url.":".$this->plugname.":".$tag); | |
| 76 | - } | |
| 77 | - | |
| 78 | - public function getLatestElementorDBVersion($file) { | |
| 79 | - $managerClass = $file === "elementor/elementor.php" ? '\Elementor\Core\Upgrade\Manager' : '\ElementorPro\Core\Upgrade\Manager'; | |
| 80 | - | |
| 81 | - if (!class_exists($managerClass)) { | |
| 82 | - return false; | |
| 55 | + $bot_protect_accounts = WPRAccount::accountsByPattern($this->settings, 'email', '/@cw_user\.com$/'); | |
| 56 | + if (sizeof($bot_protect_accounts) >= 1) | |
| 57 | + return true; | |
| 83 | 58 | } |
| 84 | 59 | |
| 85 | - $manager = new $managerClass(); | |
| 86 | - return $manager->get_new_version(); | |
| 60 | + return false; | |
| 87 | 61 | } |
| 88 | 62 | |
| 89 | - public static function getRequestID() { | |
| 90 | - if (!defined("WPR_REQUEST_ID")) { | |
| 91 | - define("WPR_REQUEST_ID", uniqid(mt_rand())); // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_mt_rand | |
| 92 | - } | |
| 93 | - return WPR_REQUEST_ID; | |
| 94 | - } | |
| 95 | - | |
| 96 | - public function canWhiteLabel($slug = NULL) { | |
| 97 | - // phpcs:disable WordPress.Security.NonceVerification.Recommended | |
| 98 | - if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) { | |
| 99 | - return false; | |
| 100 | - } | |
| 101 | - if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && | |
| 102 | - $_REQUEST["bv_override_plugin_whitelabel"] === $slug) { | |
| 103 | - return false; | |
| 104 | - } | |
| 105 | - // phpcs:enable WordPress.Security.NonceVerification.Recommended | |
| 106 | - return true; | |
| 107 | - } | |
| 108 | - | |
| 109 | - public function getPluginWhitelabelInfo($slug = null) { | |
| 110 | - if ($slug === null) { | |
| 111 | - $slug = $this->slug; | |
| 112 | - } | |
| 113 | - $whitelabel_infos = $this->getPluginsWhitelabelInfos(); | |
| 114 | - if (!array_key_exists($slug, $whitelabel_infos) || !is_array($whitelabel_infos[$slug])) { | |
| 115 | - return array(); | |
| 116 | - } | |
| 117 | - return $whitelabel_infos[$slug]; | |
| 118 | - } | |
| 119 | - | |
| 120 | 63 | public function getBrandInfo() { |
| 121 | 64 | return $this->settings->getOption($this->brand_option); |
| 122 | 65 | } |
| 123 | 66 | |
| 124 | - public function getPluginsWhitelabelInfos() { | |
| 125 | - $whitelabel_infos = $this->settings->getOption($this->brand_option); | |
| 126 | - return is_array($whitelabel_infos) ? $whitelabel_infos : array(); | |
| 127 | - } | |
| 128 | - | |
| 129 | - public function getLPWhitelabelInfo() { | |
| 130 | - $infos = $this->settings->getOption($this->wp_lp_whitelabel_option); | |
| 131 | - return is_array($infos) ? $infos : array(); | |
| 132 | - } | |
| 133 | - | |
| 134 | - public function getPluginsWhitelabelInfoByTitle() { | |
| 135 | - $whitelabel_infos = $this->getPluginsWhitelabelInfos(); | |
| 136 | - $whitelabel_infos_by_title = array(); | |
| 137 | - foreach ($whitelabel_infos as $slug => $whitelabel_info) { | |
| 138 | - if (is_array($whitelabel_info) && array_key_exists('default_title', $whitelabel_info) && isset($whitelabel_info['default_title'])) { | |
| 139 | - $whitelabel_info['slug'] = $slug; | |
| 140 | - $whitelabel_infos_by_title[$whitelabel_info['default_title']] = $whitelabel_info; | |
| 141 | - } | |
| 142 | - } | |
| 143 | - return $whitelabel_infos_by_title; | |
| 144 | - } | |
| 145 | - | |
| 146 | 67 | public function getBrandName() { |
| 147 | - $brand = $this->getPluginWhitelabelInfo(); | |
| 68 | + $brand = $this->getBrandInfo(); | |
| 148 | 69 | if (is_array($brand) && array_key_exists('menuname', $brand)) { |
| 149 | 70 | return $brand['menuname']; |
| 150 | 71 | } |
| 72 | + | |
| 151 | 73 | return $this->brandname; |
| 152 | 74 | } |
| 153 | 75 | |
| 154 | 76 | public function getBrandIcon() { |
| 155 | - $brand = $this->getPluginWhitelabelInfo(); | |
| 77 | + $brand = $this->getBrandInfo(); | |
| 156 | 78 | if (is_array($brand) && array_key_exists('brand_icon', $brand)) { |
| 157 | 79 | return $brand['brand_icon']; |
| 158 | 80 | } |
| 159 | 81 | return $this->brand_icon; |
| @@ -167,9 +89,9 @@ | ||
| 167 | 89 | public function appUrl() { |
| 168 | 90 | if (defined('BV_APP_URL')) { |
| 169 | 91 | return BV_APP_URL; |
| 170 | 92 | } else { |
| 171 | - $brand = $this->getPluginWhitelabelInfo(); | |
| 93 | + $brand = $this->getBrandInfo(); | |
| 172 | 94 | if (is_array($brand) && array_key_exists('appurl', $brand)) { |
| 173 | 95 | return $brand['appurl']; |
| 174 | 96 | } |
| 175 | 97 | return $this->appurl; |