/** * Update site options with a specific key, when allowed to * * This should pick site options found in $options and update accordingly. * This should also update $options property. * * @param string $option_key * @param array $options all options under the option key */ public function update_site_options($option_key, array $options) { if (!self::is_multisite_admin() || !self::is_on_main_blog()) { return; } $site_options = array(); foreach ($this->site_options as $site_option_name) { if (array_key_exists($site_option_name, $options)) { $site_options[$site_option_name] = $options[$site_option_name]; } } // update site options only if there are options to update if (count($site_options) > 0) { $this->bridge->update_site_option($option_key, $site_options); $this->options = array_merge($this->options, $site_options); } }