Fragen\GitHub_Updater\Theme::multisite_branch_switcher PHP Метод

multisite_branch_switcher() публичный Метод

Create branch switcher row for multisite installation.
public multisite_branch_switcher ( $theme_key, $theme ) : boolean | void
$theme_key
$theme
Результат boolean | void
    public function multisite_branch_switcher($theme_key, $theme)
    {
        $options = get_site_option('github_updater');
        if (empty($options['branch_switch'])) {
            return false;
        }
        $enclosure = $this->update_row_enclosure($theme_key, 'theme', true);
        $id = $theme_key . '-id';
        $branches = isset($this->config[$theme_key]) ? $this->config[$theme_key]->branches : null;
        $nonced_update_url = wp_nonce_url($this->get_update_url('theme', 'upgrade-theme', $theme_key), 'upgrade-theme_' . $theme_key);
        /*
         * Get current branch.
         */
        foreach (parent::$git_servers as $server) {
            $branch_key = $server . ' Branch';
            $branch = $theme->get($branch_key) ? $theme->get($branch_key) : 'master';
            if ('master' !== $branch) {
                break;
            }
        }
        $branch_switch_data = array();
        $branch_switch_data['slug'] = $theme_key;
        $branch_switch_data['nonced_update_url'] = $nonced_update_url;
        $branch_switch_data['id'] = $id;
        $branch_switch_data['branch'] = $branch;
        $branch_switch_data['branches'] = $branches;
        /*
         * Create after_theme_row_
         */
        echo $enclosure['open'];
        $this->make_branch_switch_row($branch_switch_data);
        echo $enclosure['close'];
        return true;
    }