Skip to content

Commit

Permalink
Break Automattic_Developer_Empty_Upgrader_Skin out into an includes file
Browse files Browse the repository at this point in the history
  • Loading branch information
Viper007Bond committed Apr 20, 2012
1 parent 2d83d77 commit eeb1683
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 31 deletions.
36 changes: 5 additions & 31 deletions developer.php
Expand Up @@ -15,6 +15,11 @@
**************************************************************************/

// Load helper class if installing a plugin
if ( ! empty( $_POST['action'] ) && 'a8c_developer_install_plugin' == $_POST['action'] )
require_once( __DIR__ . '/includes/class-empty-upgrader-skin.php' );


class Automattic_Developer {

public $settings = array();
Expand Down Expand Up @@ -564,35 +569,4 @@ public function is_recommended_plugin_installed( $slug ) {

$Automattic_Developer = new Automattic_Developer();



if ( ! empty( $_POST['action'] ) && 'a8c_developer_install_plugin' == $_POST['action'] ) {

include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );

class Automattic_Developer_Empty_Upgrader_Skin extends WP_Upgrader_Skin {
function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args( $args, $defaults );

$this->type = $args['type'];
$this->api = isset( $args['api'] ) ? $args['api'] : array();

parent::__construct( $args );
}

public function request_filesystem_credentials() {
return true;
}

public function error() {
die( '-1' );
}

public function header() {}
public function footer() {}
public function feedback() {}
}
}

?>
27 changes: 27 additions & 0 deletions includes/class-empty-upgrader-skin.php
@@ -0,0 +1,27 @@
<?php

include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );

class Automattic_Developer_Empty_Upgrader_Skin extends WP_Upgrader_Skin {
function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args( $args, $defaults );

$this->type = $args['type'];
$this->api = isset( $args['api'] ) ? $args['api'] : array();

parent::__construct( $args );
}

public function request_filesystem_credentials() {
return true;
}

public function error() {
die( '-1' );
}

public function header() {}
public function footer() {}
public function feedback() {}
}

0 comments on commit eeb1683

Please sign in to comment.