Plugin_Installer_Skin

Plugin Installer Skin for WordPress Plugin Installer.

Defined (1)

The class is defined in the following location(s).

/wp-admin/includes/class-plugin-installer-skin.php  
  1. class Plugin_Installer_Skin extends WP_Upgrader_Skin { 
  2. public $api; 
  3. public $type; 
  4.  
  5. /** 
  6. * @param array $args 
  7. */ 
  8. public function __construct($args = array()) { 
  9. $defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' ); 
  10. $args = wp_parse_args($args, $defaults); 
  11.  
  12. $this->type = $args['type']; 
  13. $this->api = isset($args['api']) ? $args['api'] : array(); 
  14.  
  15. parent::__construct($args); 
  16.  
  17. /** 
  18. * @access public 
  19. */ 
  20. public function before() { 
  21. if ( !empty($this->api) ) 
  22. $this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version); 
  23.  
  24. /** 
  25. * @access public 
  26. */ 
  27. public function after() { 
  28. $plugin_file = $this->upgrader->plugin_info(); 
  29.  
  30. $install_actions = array(); 
  31.  
  32. $from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins'; 
  33.  
  34. if ( 'import' == $from ) 
  35. $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&from=import&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin & Run Importer' ) . '</a>'; 
  36. else 
  37. $install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>'; 
  38.  
  39. if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) { 
  40. $install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url( 'plugins.php?action=activate&networkwide=1&plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Network Activate' ) . '</a>'; 
  41. unset( $install_actions['activate_plugin'] ); 
  42.  
  43. if ( 'import' == $from ) { 
  44. $install_actions['importers_page'] = '<a href="' . admin_url( 'import.php' ) . '" target="_parent">' . __( 'Return to Importers' ) . '</a>'; 
  45. } elseif ( $this->type == 'web' ) { 
  46. $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugin-install.php' ) . '" target="_parent">' . __( 'Return to Plugin Installer' ) . '</a>'; 
  47. } elseif ( 'upload' == $this->type && 'plugins' == $from ) { 
  48. $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugin-install.php' ) . '">' . __( 'Return to Plugin Installer' ) . '</a>'; 
  49. } else { 
  50. $install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>'; 
  51.  
  52. if ( ! $this->result || is_wp_error($this->result) ) { 
  53. unset( $install_actions['activate_plugin'], $install_actions['network_activate'] ); 
  54. } elseif ( ! current_user_can( 'activate_plugins' ) ) { 
  55. unset( $install_actions['activate_plugin'] ); 
  56.  
  57. /** 
  58. * Filters the list of action links available following a single plugin installation. 
  59. * @since 2.7.0 
  60. * @param array $install_actions Array of plugin action links. 
  61. * @param object $api Object containing WordPress.org API plugin data. Empty 
  62. * for non-API installs, such as when a plugin is installed 
  63. * via upload. 
  64. * @param string $plugin_file Path to the plugin file. 
  65. */ 
  66. $install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file ); 
  67.  
  68. if ( ! empty( $install_actions ) ) { 
  69. $this->feedback( implode( ' ', (array) $install_actions ) );