| @@ -63,10 +63,10 @@ | ||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function menu() { |
| 67 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 68 | - if (!is_array($brand) || (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand))) { | |
| 67 | + $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 68 | + if (!array_key_exists('hide', $brand) && !array_key_exists('hide_from_menu', $brand)) { | |
| 69 | 69 | $bname = $this->bvinfo->getBrandName(); |
| 70 | 70 | $icon = $this->bvinfo->getBrandIcon(); |
| 71 | 71 | add_menu_page($bname, $bname, 'manage_options', $this->bvinfo->plugname, |
| 72 | 72 | array($this, 'adminPage'), plugins_url($icon, __FILE__ )); |
| @@ -73,13 +73,17 @@ | ||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function hidePluginUpdate($plugins) { |
| 77 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 78 | - $bvslug = $this->bvinfo->slug; | |
| 79 | - if (isset($plugins->response[$bvslug]) && is_array($brand)) { | |
| 80 | - if (array_key_exists('hide_from_menu', $brand) || array_key_exists('hide', $brand)) { | |
| 81 | - unset($plugins->response[$bvslug]); | |
| 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 | + } | |
| 82 | 86 | } |
| 83 | 87 | } |
| 84 | 88 | return $plugins; |
| 85 | 89 | } |
| @@ -84,12 +88,13 @@ | ||
| 84 | 88 | return $plugins; |
| 85 | 89 | } |
| 86 | 90 | |
| 87 | 91 | public function hidePluginDetails($plugin_metas, $slug) { |
| 88 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 89 | - $bvslug = $this->bvinfo->slug; | |
| 90 | - | |
| 91 | - if ($slug === $bvslug && is_array($brand) && array_key_exists('hide_plugin_details', $brand)){ | |
| 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)) { | |
| 92 | 97 | foreach ($plugin_metas as $pluginKey => $pluginValue) { |
| 93 | 98 | if (strpos($pluginValue, sprintf('>%s<', translate('View details')))) { |
| 94 | 99 | unset($plugin_metas[$pluginKey]); |
| 95 | 100 | break; |
| @@ -99,31 +104,33 @@ | ||
| 99 | 104 | return $plugin_metas; |
| 100 | 105 | } |
| 101 | 106 | |
| 102 | 107 | public function handlePluginHealthInfo($plugins) { |
| 103 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 104 | - $title = $this->bvinfo->title; | |
| 105 | 108 | if (!isset($plugins["wp-plugins-active"]) || |
| 106 | - !isset($plugins["wp-plugins-active"]["fields"]) || | |
| 107 | - !isset($plugins["wp-plugins-active"]["fields"][$title])) { | |
| 109 | + !isset($plugins["wp-plugins-active"]["fields"]) || !$this->bvinfo->canWhiteLabel()) { | |
| 108 | 110 | return $plugins; |
| 109 | 111 | } |
| 110 | - if (is_array($brand)) { | |
| 111 | - if (array_key_exists('hide', $brand)) { | |
| 112 | - unset($plugins["wp-plugins-active"]["fields"][$title]); | |
| 113 | - } else { | |
| 114 | - $plugin = $plugins["wp-plugins-active"]["fields"][$title]; | |
| 115 | - $author = $this->bvinfo->author; | |
| 116 | - if (array_key_exists('name', $brand)) { | |
| 117 | - $plugin["label"] = $brand['name']; | |
| 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; | |
| 118 | 132 | } |
| 119 | - if (array_key_exists('author', $brand)) { | |
| 120 | - $plugin["value"] = str_replace($author, $brand['author'], $plugin["value"]); | |
| 121 | - } | |
| 122 | - if (array_key_exists('description', $brand)) { | |
| 123 | - $plugin["debug"] = str_replace($author, $brand['author'], $plugin["debug"]); | |
| 124 | - } | |
| 125 | - $plugins["wp-plugins-active"]["fields"][$title] = $plugin; | |
| 126 | 133 | } |
| 127 | 134 | } |
| 128 | 135 | return $plugins; |
| 129 | 136 | } |
| @@ -130,10 +137,10 @@ | ||
| 130 | 137 | |
| 131 | 138 | public function settingsLink($links, $file) { |
| 132 | 139 | #XNOTE: Fix this |
| 133 | 140 | if ( $file == plugin_basename( dirname(__FILE__).'/blogvault.php' ) ) { |
| 134 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 135 | - if (!$brand || !array_key_exists('hide_plugin_details', $brand)) { | |
| 141 | + $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 142 | + if (!array_key_exists('hide_plugin_details', $brand)) { | |
| 136 | 143 | $links[] = '<a href="'.$this->mainUrl().'">'.__( 'Settings' ).'</a>'; |
| 137 | 144 | } |
| 138 | 145 | } |
| 139 | 146 | return $links; |
| @@ -139,10 +146,10 @@ | ||
| 139 | 146 | return $links; |
| 140 | 147 | } |
| 141 | 148 | |
| 142 | 149 | public function getPluginLogo() { |
| 143 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 144 | - if (is_array($brand) && array_key_exists('logo', $brand)) { | |
| 150 | + $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 151 | + if (array_key_exists('logo', $brand)) { | |
| 145 | 152 | return $brand['logo']; |
| 146 | 153 | } |
| 147 | 154 | return $this->bvinfo->logo; |
| 148 | 155 | } |
| @@ -147,10 +154,10 @@ | ||
| 147 | 154 | return $this->bvinfo->logo; |
| 148 | 155 | } |
| 149 | 156 | |
| 150 | 157 | public function getWebPage() { |
| 151 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 152 | - if (is_array($brand) && array_key_exists('webpage', $brand)) { | |
| 158 | + $brand = $this->bvinfo->getPluginWhitelabelInfo(); | |
| 159 | + if (array_key_exists('webpage', $brand)) { | |
| 153 | 160 | return $brand['webpage']; |
| 154 | 161 | } |
| 155 | 162 | return $this->bvinfo->webpage; |
| 156 | 163 | } |
| @@ -212,17 +219,17 @@ | ||
| 212 | 219 | $this->showAddAccountPage(); |
| 213 | 220 | } |
| 214 | 221 | } |
| 215 | 222 | |
| 216 | - public function initBranding($plugins) { | |
| 217 | - $slug = $this->bvinfo->slug; | |
| 218 | - | |
| 219 | - if (!is_array($plugins) || !isset($slug, $plugins)) { | |
| 223 | + public function initWhitelabel($plugins) { | |
| 224 | + if (!is_array($plugins) || !$this->bvinfo->canWhiteLabel()) { | |
| 220 | 225 | return $plugins; |
| 221 | 226 | } |
| 222 | - | |
| 223 | - $brand = $this->bvinfo->getBrandInfo(); | |
| 224 | - if (is_array($brand)) { | |
| 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 | + } | |
| 225 | 232 | if (array_key_exists('hide', $brand)) { |
| 226 | 233 | unset($plugins[$slug]); |
| 227 | 234 | } else { |
| 228 | 235 | if (array_key_exists('name', $brand)) { |