public function plugin_branch_switcher($plugin_file, $plugin_data)
{
$options = get_site_option('github_updater');
if (empty($options['branch_switch'])) {
return false;
}
$enclosure = $this->update_row_enclosure($plugin_file, 'plugin', true);
$plugin = $this->get_repo_slugs(dirname($plugin_file));
$nonced_update_url = wp_nonce_url($this->get_update_url('plugin', 'upgrade-plugin', $plugin_file), 'upgrade-plugin_' . $plugin_file);
if (!empty($plugin)) {
$id = $plugin['repo'] . '-id';
$branches = isset($this->config[$plugin['repo']]) ? $this->config[$plugin['repo']]->branches : null;
} else {
return false;
}
/*
* Get current branch.
*/
foreach (parent::$git_servers as $server) {
$branch_key = $server . ' Branch';
$branch = !empty($plugin_data[$branch_key]) ? $plugin_data[$branch_key] : 'master';
if ('master' !== $branch) {
break;
}
}
$branch_switch_data = array();
$branch_switch_data['slug'] = $plugin['repo'];
$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_plugin_row_
*/
echo $enclosure['open'];
$this->make_branch_switch_row($branch_switch_data);
echo $enclosure['close'];
return true;
}