PluginProbe
Migrate to WordPress.com / 5.88
Migrate to WordPress.com v5.88
6.72 6.65 trunk 5.72 5.81 5.88
wpcom-migration / callback / wings / brand.php

brand.php in Migrate to WordPress.com 5.88, at callback/wings/brand.php

47 lines 1.3 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('BVBrandCallback')) :
5
6 class BVBrandCallback extends BVCallbackBase {
7 public $settings;
8
9 const BRAND_WING_VERSION = 1.1;
10
11 public function __construct($callback_handler) {
12 $this->settings = $callback_handler->settings;
13 }
14
15 public function process($request) {
16 $bvinfo = new WPCOMInfo($this->settings);
17 $option_name = $bvinfo->brand_option;
18 $whitelabel_infos = $bvinfo->getPluginsWhitelabelInfos();
19 $params = $request->params;
20 switch($request->method) {
21 case 'setbrand':
22 foreach ($params as $slug => $whitelabel_info) {
23 if (isset($slug) && is_array($whitelabel_info)) {
24 $whitelabel_infos[$slug] = $whitelabel_info;
25 }
26 }
27 $this->settings->updateOption($option_name, $whitelabel_infos);
28 $resp = array("setbrand" => $this->settings->getOption($option_name));
29 break;
30 case 'rmbrand':
31 foreach ($params["delete_keys"] as $slug) {
32 unset($whitelabel_infos[$slug]);
33 }
34 $this->settings->updateOption($option_name, $whitelabel_infos);
35 $resp = array("rmbrand" => true);
36 break;
37 case 'rmallbrands':
38 $this->settings->deleteOption($option_name);
39 $resp = array("rmallbrands" => !$this->settings->getOption($option_name));
40 break;
41 default:
42 $resp = false;
43 }
44 return $resp;
45 }
46 }
47 endif;