| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | |
| 38 | 38 | if (array_key_exists('bvnonce', $_REQUEST) && |
| 39 | 39 | wp_verify_nonce($_REQUEST['bvnonce'], "bvnonce") && |
| 40 | 40 | array_key_exists('blogvaultkey', $_REQUEST) && |
| 41 | - (strlen(WPRAccount::sanitizeKey($_REQUEST['blogvaultkey'])) == 64) && | |
| 41 | + (strlen($_REQUEST['blogvaultkey']) == 64) && | |
| 42 | 42 | (array_key_exists('page', $_REQUEST) && |
| 43 | 43 | $_REQUEST['page'] == $this->bvinfo->plugname)) { |
| 44 | 44 | $keys = str_split($_REQUEST['blogvaultkey'], 32); |
| 45 | 45 | WPRAccount::addAccount($this->settings, $keys[0], $keys[1]); |
| @@ -56,9 +56,10 @@ | ||
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function wprsecAdminMenu($hook) { |
| 60 | - if ($hook === 'toplevel_page_wpremote' || WPRHelper::safePregMatch("/wpr_add_account$/", $hook) || WPRHelper::safePregMatch("/wpr_account_details$/", $hook)) { | |
| 60 | + if ($hook === 'toplevel_page_wpremote' || preg_match("/wpr_add_account$/", $hook) || preg_match("/wpr_account_details$/", $hook)) { | |
| 61 | + wp_enqueue_style( 'bvsurface', plugins_url('css/bvmui.min.css', __FILE__)); | |
| 61 | 62 | wp_enqueue_style( 'bootstrap', plugins_url('css/bootstrap.min.css', __FILE__)); |
| 62 | 63 | wp_enqueue_style( 'bvplugin', plugins_url('css/bvplugin.min.css', __FILE__)); |
| 63 | 64 | } |
| 64 | 65 | } |
| @@ -63,10 +64,10 @@ | ||
| 63 | 64 | } |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | public function menu() { |
| 67 | - $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 68 | - if (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand)) { | |
| 68 | + $brand = $this->bvinfo->getBrandInfo(); | |
| 69 | + if (!$brand || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) { | |
| 69 | 70 | $bname = $this->bvinfo->getBrandName(); |
| 70 | 71 | $icon = $this->bvinfo->getBrandIcon(); |
| 71 | 72 | add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname, |
| 72 | 73 | array($this, 'adminPage'), plugins_url($icon, __FILE__ )); |
| @@ -72,29 +73,13 @@ | ||
| 72 | 73 | array($this, 'adminPage'), plugins_url($icon, __FILE__ )); |
| 73 | 74 | } |
| 74 | 75 | } |
| 75 | 76 | |
| 76 | - public function hidePluginUpdate($plugins) { | |
| 77 | - if (!$this->bvinfo->canWhiteLabel()) { | |
| 78 | - return $plugins; | |
| 79 | - } | |
| 80 | - $whitelabel_infos = $this->bvinfo->getPluginsWhitelabelInfos(); | |
| 81 | - foreach ($whitelabel_infos as $slug => $brand) { | |
| 82 | - if ($this->bvinfo->canWhiteLabel($slug) && isset($plugins->response[$slug]) && is_array($brand)) { | |
| 83 | - if (array_key_exists('hide_from_menu', $brand) || array_key_exists('hide', $brand)) { | |
| 84 | - unset($plugins->response[$slug]); | |
| 85 | - } | |
| 86 | - } | |
| 87 | - } | |
| 88 | - return $plugins; | |
| 89 | - } | |
| 77 | + public function hidePluginDetails($plugin_metas, $slug) { | |
| 78 | + $brand = $this->bvinfo->getBrandInfo(); | |
| 79 | + $bvslug = $this->bvinfo->slug; | |
| 90 | 80 | |
| 91 | - public function hidePluginDetails($plugin_metas, $slug) { | |
| 92 | - if (!is_array($plugin_metas) || !$this->bvinfo->canWhiteLabel($slug)) { | |
| 93 | - return $plugin_metas; | |
| 94 | - } | |
| 95 | - $whitelabel_info = $this->bvinfo->getPluginWhitelabelInfo($slug); | |
| 96 | - if (array_key_exists('hide_plugin_details', $whitelabel_info)) { | |
| 81 | + if ($slug === $bvslug && $brand && array_key_exists('hide_plugin_details', $brand)){ | |
| 97 | 82 | foreach ($plugin_metas as $pluginKey => $pluginValue) { |
| 98 | 83 | if (strpos($pluginValue, sprintf('>%s<', translate('View details')))) { |
| 99 | 84 | unset($plugin_metas[$pluginKey]); |
| 100 | 85 | break; |
| @@ -103,44 +88,13 @@ | ||
| 103 | 88 | } |
| 104 | 89 | return $plugin_metas; |
| 105 | 90 | } |
| 106 | 91 | |
| 107 | - public function handlePluginHealthInfo($plugins) { | |
| 108 | - if (!isset($plugins["wp-plugins-active"]) || | |
| 109 | - !isset($plugins["wp-plugins-active"]["fields"]) || !$this->bvinfo->canWhiteLabel()) { | |
| 110 | - return $plugins; | |
| 111 | - } | |
| 112 | - | |
| 113 | - $whitelabel_infos_by_title = $this->bvinfo->getPluginsWhitelabelInfoByTitle(); | |
| 114 | - | |
| 115 | - foreach ($whitelabel_infos_by_title as $title => $brand) { | |
| 116 | - if (is_array($brand) && array_key_exists('slug', $brand) && $this->bvinfo->canWhiteLabel($brand["slug"])) { | |
| 117 | - if (array_key_exists('hide', $brand)) { | |
| 118 | - unset($plugins["wp-plugins-active"]["fields"][$title]); | |
| 119 | - } else { | |
| 120 | - $plugin = $plugins["wp-plugins-active"]["fields"][$title]; | |
| 121 | - $author = $brand['default_author']; | |
| 122 | - if (array_key_exists('name', $brand)) { | |
| 123 | - $plugin["label"] = $brand['name']; | |
| 124 | - } | |
| 125 | - if (array_key_exists('author', $brand)) { | |
| 126 | - $plugin["value"] = str_replace($author, $brand['author'], $plugin["value"]); | |
| 127 | - } | |
| 128 | - if (array_key_exists('description', $brand)) { | |
| 129 | - $plugin["debug"] = str_replace($author, $brand['author'], $plugin["debug"]); | |
| 130 | - } | |
| 131 | - $plugins["wp-plugins-active"]["fields"][$title] = $plugin; | |
| 132 | - } | |
| 133 | - } | |
| 134 | - } | |
| 135 | - return $plugins; | |
| 136 | - } | |
| 137 | - | |
| 138 | 92 | public function settingsLink($links, $file) { |
| 139 | 93 | #XNOTE: Fix this |
| 140 | 94 | if ( $file == plugin_basename( dirname(__FILE__).'/blogvault.php' ) ) { |
| 141 | - $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 142 | - if (!array_key_exists('hide_plugin_details', $brand)) { | |
| 95 | + $brand = $this->bvinfo->getBrandInfo(); | |
| 96 | + if (!$brand || !array_key_exists('hide_plugin_details', $brand)) { | |
| 143 | 97 | $links[] = '<a href="'.$this->mainUrl().'">'.__( 'Settings' ).'</a>'; |
| 144 | 98 | } |
| 145 | 99 | } |
| 146 | 100 | return $links; |
| @@ -146,10 +100,10 @@ | ||
| 146 | 100 | return $links; |
| 147 | 101 | } |
| 148 | 102 | |
| 149 | 103 | public function getPluginLogo() { |
| 150 | - $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 151 | - if (array_key_exists('logo', $brand)) { | |
| 104 | + $brand = $this->bvinfo->getBrandInfo(); | |
| 105 | + if ($brand && array_key_exists('logo', $brand)) { | |
| 152 | 106 | return $brand['logo']; |
| 153 | 107 | } |
| 154 | 108 | return $this->bvinfo->logo; |
| 155 | 109 | } |
| @@ -154,10 +108,10 @@ | ||
| 154 | 108 | return $this->bvinfo->logo; |
| 155 | 109 | } |
| 156 | 110 | |
| 157 | 111 | public function getWebPage() { |
| 158 | - $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 159 | - if (array_key_exists('webpage', $brand)) { | |
| 112 | + $brand = $this->bvinfo->getBrandInfo(); | |
| 113 | + if ($brand && array_key_exists('webpage', $brand)) { | |
| 160 | 114 | return $brand['webpage']; |
| 161 | 115 | } |
| 162 | 116 | return $this->bvinfo->webpage; |
| 163 | 117 | } |
| @@ -166,20 +120,20 @@ | ||
| 166 | 120 | require_once dirname( __FILE__ ) . '/recover.php'; |
| 167 | 121 | $bvnonce = wp_create_nonce("bvnonce"); |
| 168 | 122 | $public = WPRAccount::getApiPublicKey($this->settings); |
| 169 | 123 | $secret = WPRRecover::defaultSecret($this->settings); |
| 170 | - $tags = "<input type='hidden' name='url' value='".esc_attr($this->siteinfo->wpurl())."'/>\n". | |
| 171 | - "<input type='hidden' name='homeurl' value='".esc_attr($this->siteinfo->homeurl())."'/>\n". | |
| 172 | - "<input type='hidden' name='siteurl' value='".esc_attr($this->siteinfo->siteurl())."'/>\n". | |
| 173 | - "<input type='hidden' name='dbsig' value='".esc_attr($this->siteinfo->dbsig(false))."'/>\n". | |
| 174 | - "<input type='hidden' name='plug' value='".esc_attr($this->bvinfo->plugname)."'/>\n". | |
| 175 | - "<input type='hidden' name='adminurl' value='".esc_attr($this->mainUrl())."'/>\n". | |
| 176 | - "<input type='hidden' name='bvversion' value='".esc_attr($this->bvinfo->version)."'/>\n". | |
| 177 | - "<input type='hidden' name='serverip' value='".esc_attr($_SERVER["SERVER_ADDR"])."'/>\n". | |
| 178 | - "<input type='hidden' name='abspath' value='".esc_attr(ABSPATH)."'/>\n". | |
| 179 | - "<input type='hidden' name='secret' value='".esc_attr($secret)."'/>\n". | |
| 180 | - "<input type='hidden' name='public' value='".esc_attr($public)."'/>\n". | |
| 181 | - "<input type='hidden' name='bvnonce' value='".esc_attr($bvnonce)."'/>\n"; | |
| 124 | + $tags = "<input type='hidden' name='url' value='".$this->siteinfo->wpurl()."'/>\n". | |
| 125 | + "<input type='hidden' name='homeurl' value='".$this->siteinfo->homeurl()."'/>\n". | |
| 126 | + "<input type='hidden' name='siteurl' value='".$this->siteinfo->siteurl()."'/>\n". | |
| 127 | + "<input type='hidden' name='dbsig' value='".$this->siteinfo->dbsig(false)."'/>\n". | |
| 128 | + "<input type='hidden' name='plug' value='".$this->bvinfo->plugname."'/>\n". | |
| 129 | + "<input type='hidden' name='adminurl' value='".$this->mainUrl()."'/>\n". | |
| 130 | + "<input type='hidden' name='bvversion' value='".$this->bvinfo->version."'/>\n". | |
| 131 | + "<input type='hidden' name='serverip' value='".$_SERVER["SERVER_ADDR"]."'/>\n". | |
| 132 | + "<input type='hidden' name='abspath' value='".ABSPATH."'/>\n". | |
| 133 | + "<input type='hidden' name='secret' value='".$secret."'/>\n". | |
| 134 | + "<input type='hidden' name='public' value='".$public."'/>\n". | |
| 135 | + "<input type='hidden' name='bvnonce' value='".$bvnonce."'/>\n"; | |
| 182 | 136 | return $tags; |
| 183 | 137 | } |
| 184 | 138 | |
| 185 | 139 | public function activateWarning() { |
| @@ -186,9 +140,9 @@ | ||
| 186 | 140 | global $hook_suffix; |
| 187 | 141 | if (!WPRAccount::isConfigured($this->settings) && $hook_suffix == 'index.php' ) { |
| 188 | 142 | ?> |
| 189 | 143 | <div id="message" class="updated" style="padding: 8px; font-size: 16px; background-color: #dff0d8"> |
| 190 | - <a class="button-primary" href="<?php echo esc_url($this->mainUrl()); ?>">Activate WPRemote</a> | |
| 144 | + <a class="button-primary" href="<?php echo $this->mainUrl(); ?>">Activate WPRemote</a> | |
| 191 | 145 | <b>Almost Done:</b> Activate your WPRemote account to backup & secure your site. |
| 192 | 146 | </div> |
| 193 | 147 | <?php |
| 194 | 148 | } |
| @@ -219,17 +173,17 @@ | ||
| 219 | 173 | $this->showAddAccountPage(); |
| 220 | 174 | } |
| 221 | 175 | } |
| 222 | 176 | |
| 223 | - public function initWhitelabel($plugins) { | |
| 224 | - if (!is_array($plugins) || !$this->bvinfo->canWhiteLabel()) { | |
| 177 | + public function initBranding($plugins) { | |
| 178 | + $slug = $this->bvinfo->slug; | |
| 179 | + | |
| 180 | + if (!is_array($plugins) || !isset($slug, $plugins)) { | |
| 225 | 181 | return $plugins; |
| 226 | 182 | } |
| 227 | - $whitelabel_infos = $this->bvinfo->getPluginsWhitelabelInfos(); | |
| 228 | - foreach ($whitelabel_infos as $slug => $brand) { | |
| 229 | - if (!isset($slug) || !$this->bvinfo->canWhiteLabel($slug) || !array_key_exists($slug, $plugins) || !is_array($brand)) { | |
| 230 | - continue; | |
| 231 | - } | |
| 183 | + | |
| 184 | + $brand = $this->bvinfo->getBrandInfo(); | |
| 185 | + if ($brand) { | |
| 232 | 186 | if (array_key_exists('hide', $brand)) { |
| 233 | 187 | unset($plugins[$slug]); |
| 234 | 188 | } else { |
| 235 | 189 | if (array_key_exists('name', $brand)) { |