| @@ -8,10 +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 = 'wprbrand'; | |
| 13 | - public $version = '4.97'; | |
| 12 | + public $brand_option = 'bv_whitelabel_infos'; | |
| 13 | + public $version = '5.65'; | |
| 14 | 14 | public $webpage = 'https://wpremote.com'; |
| 15 | 15 | public $appurl = 'https://app.wpremote.com'; |
| 16 | 16 | public $slug = 'wpremote/plugin.php'; |
| 17 | 17 | public $plug_redirect = 'wprredirect'; |
| @@ -39,8 +39,51 @@ | ||
| 39 | 39 | public function hasValidDBVersion() { |
| 40 | 40 | return WPRInfo::DB_VERSION === $this->getCurrentDBVersion(); |
| 41 | 41 | } |
| 42 | 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 | + $encoded_url = base64_encode($bvsiteinfo->siteurl()); | |
| 64 | + $secret = WPRRecover::defaultSecret($this->settings); | |
| 65 | + | |
| 66 | + return base64_encode("v1:".$secret.":".$encoded_url); | |
| 67 | + } | |
| 68 | + | |
| 69 | + public function getDefaultSecret() { | |
| 70 | + require_once dirname( __FILE__ ) . '/recover.php'; | |
| 71 | + $bvsiteinfo = new WPRWPSiteInfo(); | |
| 72 | + return WPRRecover::defaultSecret($this->settings); | |
| 73 | + } | |
| 74 | + | |
| 75 | + public function getLatestElementorDBVersion($file) { | |
| 76 | + $managerClass = $file === "elementor/elementor.php" ? '\Elementor\Core\Upgrade\Manager' : '\ElementorPro\Core\Upgrade\Manager'; | |
| 77 | + | |
| 78 | + if (!class_exists($managerClass)) { | |
| 79 | + return false; | |
| 80 | + } | |
| 81 | + | |
| 82 | + $manager = new $managerClass(); | |
| 83 | + return $manager->get_new_version(); | |
| 84 | + } | |
| 85 | + | |
| 43 | 86 | public static function getRequestID() { |
| 44 | 87 | if (!defined("BV_REQUEST_ID")) { |
| 45 | 88 | define("BV_REQUEST_ID", uniqid(mt_rand())); |
| 46 | 89 | } |
| @@ -61,14 +104,53 @@ | ||
| 61 | 104 | |
| 62 | 105 | return false; |
| 63 | 106 | } |
| 64 | 107 | |
| 108 | + public function canWhiteLabel($slug = NULL) { | |
| 109 | + if (array_key_exists("bv_override_global_whitelabel", $_REQUEST)) { | |
| 110 | + return false; | |
| 111 | + } | |
| 112 | + if (array_key_exists("bv_override_plugin_whitelabel", $_REQUEST) && isset($slug) && | |
| 113 | + $_REQUEST["bv_override_plugin_whitelabel"] === $slug) { | |
| 114 | + return false; | |
| 115 | + } | |
| 116 | + return true; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public function getPluginWhitelabelInfo($slug = null) { | |
| 120 | + if ($slug === null) { | |
| 121 | + $slug = $this->slug; | |
| 122 | + } | |
| 123 | + $whitelabel_infos = $this->getPluginsWhitelabelInfos(); | |
| 124 | + if (!array_key_exists($slug, $whitelabel_infos) || !is_array($whitelabel_infos[$slug])) { | |
| 125 | + return array(); | |
| 126 | + } | |
| 127 | + return $whitelabel_infos[$slug]; | |
| 128 | + } | |
| 129 | + | |
| 65 | 130 | public function getBrandInfo() { |
| 66 | 131 | return $this->settings->getOption($this->brand_option); |
| 67 | 132 | } |
| 68 | 133 | |
| 134 | + public function getPluginsWhitelabelInfos() { | |
| 135 | + $whitelabel_infos = $this->settings->getOption($this->brand_option); | |
| 136 | + return is_array($whitelabel_infos) ? $whitelabel_infos : array(); | |
| 137 | + } | |
| 138 | + | |
| 139 | + public function getPluginsWhitelabelInfoByTitle() { | |
| 140 | + $whitelabel_infos = $this->getPluginsWhitelabelInfos(); | |
| 141 | + $whitelabel_infos_by_title = array(); | |
| 142 | + foreach ($whitelabel_infos as $slug => $whitelabel_info) { | |
| 143 | + if (is_array($whitelabel_info) && array_key_exists('default_title', $whitelabel_info) && isset($whitelabel_info['default_title'])) { | |
| 144 | + $whitelabel_info['slug'] = $slug; | |
| 145 | + $whitelabel_infos_by_title[$whitelabel_info['default_title']] = $whitelabel_info; | |
| 146 | + } | |
| 147 | + } | |
| 148 | + return $whitelabel_infos_by_title; | |
| 149 | + } | |
| 150 | + | |
| 69 | 151 | public function getBrandName() { |
| 70 | - $brand = $this->getBrandInfo(); | |
| 152 | + $brand = $this->getPluginWhitelabelInfo(); | |
| 71 | 153 | if (is_array($brand) && array_key_exists('menuname', $brand)) { |
| 72 | 154 | return $brand['menuname']; |
| 73 | 155 | } |
| 74 | 156 | |
| @@ -75,9 +157,9 @@ | ||
| 75 | 157 | return $this->brandname; |
| 76 | 158 | } |
| 77 | 159 | |
| 78 | 160 | public function getBrandIcon() { |
| 79 | - $brand = $this->getBrandInfo(); | |
| 161 | + $brand = $this->getPluginWhitelabelInfo(); | |
| 80 | 162 | if (is_array($brand) && array_key_exists('brand_icon', $brand)) { |
| 81 | 163 | return $brand['brand_icon']; |
| 82 | 164 | } |
| 83 | 165 | return $this->brand_icon; |
| @@ -91,9 +173,9 @@ | ||
| 91 | 173 | public function appUrl() { |
| 92 | 174 | if (defined('BV_APP_URL')) { |
| 93 | 175 | return BV_APP_URL; |
| 94 | 176 | } else { |
| 95 | - $brand = $this->getBrandInfo(); | |
| 177 | + $brand = $this->getPluginWhitelabelInfo(); | |
| 96 | 178 | if (is_array($brand) && array_key_exists('appurl', $brand)) { |
| 97 | 179 | return $brand['appurl']; |
| 98 | 180 | } |
| 99 | 181 | return $this->appurl; |