upgrader->result['destination_name'] ) ) {
return;
}
$theme_info = $this->upgrader->theme_info();
if ( empty( $theme_info ) ) {
return;
}
$name = $theme_info->display( 'Name' );
$stylesheet = $this->upgrader->result['destination_name'];
$template = $theme_info->get_template();
$activate_link = add_query_arg(
array(
'action' => 'activate',
'template' => urlencode( $template ),
'stylesheet' => urlencode( $stylesheet ),
),
admin_url( 'themes.php' )
);
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
$install_actions = array();
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$install_actions['preview'] = '' . __( 'Live Preview', 'envato-market' ) . '' . sprintf( __( 'Live Preview “%s”', 'envato-market' ), $name ) . '';
}
if ( is_multisite() ) {
if ( current_user_can( 'manage_network_themes' ) ) {
$install_actions['network_enable'] = '' . __( 'Network Enable', 'envato-market' ) . '';
}
}
$install_actions['activate'] = '' . __( 'Activate', 'envato-market' ) . '' . sprintf( __( 'Activate “%s”', 'envato-market' ), $name ) . '';
$install_actions['themes_page'] = '' . __( 'Return to Theme Installer', 'envato-market' ) . '';
if ( ! $this->result || is_wp_error( $this->result ) || is_multisite() || ! current_user_can( 'switch_themes' ) ) {
unset( $install_actions['activate'], $install_actions['preview'] );
}
if ( ! empty( $install_actions ) ) {
$this->feedback( implode( ' | ', $install_actions ) );
}
}
}
endif;
if ( ! class_exists( 'Envato_Market_Plugin_Installer_Skin' ) ) :
/**
* Plugin Installer Skin.
*
* @class Envato_Market_Plugin_Installer_Skin
* @version 1.0.0
* @since 1.0.0
*/
class Envato_Market_Plugin_Installer_Skin extends Plugin_Installer_Skin {
/**
* Modify the install actions.
*
* @since 1.0.0
*/
public function after() {
$plugin_file = $this->upgrader->plugin_info();
$install_actions = array();
if ( current_user_can( 'activate_plugins' ) ) {
$install_actions['activate_plugin'] = '' . __( 'Activate Plugin', 'envato-market' ) . '';
}
if ( is_multisite() ) {
unset( $install_actions['activate_plugin'] );
if ( current_user_can( 'manage_network_plugins' ) ) {
$install_actions['network_activate'] = '' . __( 'Network Activate', 'envato-market' ) . '';
}
}
$install_actions['plugins_page'] = '' . __( 'Return to Plugin Installer', 'envato-market' ) . '';
if ( ! $this->result || is_wp_error( $this->result ) ) {
unset( $install_actions['activate_plugin'], $install_actions['site_activate'], $install_actions['network_activate'] );
}
if ( ! empty( $install_actions ) ) {
$this->feedback( implode( ' | ', $install_actions ) );
}
}
}
endif;