Constructor cleanup. Props ocean90. fixes #16768

git-svn-id: http://svn.automattic.com/wordpress/trunk@17771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-04-29 20:05:12 +00:00
parent e0ffff9fb5
commit 04487fc268
33 changed files with 54 additions and 122 deletions

View File

@ -43,14 +43,14 @@ class Custom_Background {
var $page = '';
/**
* PHP4 Constructor - Register administration header callback.
* Constructor - Register administration header callback.
*
* @since 3.0.0
* @param callback $admin_header_callback
* @param callback $admin_image_div_callback Optional custom image div output callback.
* @return Custom_Background
*/
function Custom_Background($admin_header_callback = '', $admin_image_div_callback = '') {
function __construct($admin_header_callback = '', $admin_image_div_callback = '') {
$this->admin_header_callback = $admin_header_callback;
$this->admin_image_div_callback = $admin_image_div_callback;
}

View File

@ -62,14 +62,14 @@ class Custom_Image_Header {
var $page = '';
/**
* PHP4 Constructor - Register administration header callback.
* Constructor - Register administration header callback.
*
* @since 2.1.0
* @param callback $admin_header_callback
* @param callback $admin_image_div_callback Optional custom image div output callback.
* @return Custom_Image_Header
*/
function Custom_Image_Header($admin_header_callback, $admin_image_div_callback = '') {
function __construct($admin_header_callback, $admin_image_div_callback = '') {
$this->admin_header_callback = $admin_header_callback;
$this->admin_image_div_callback = $admin_image_div_callback;
}

View File

@ -21,7 +21,7 @@ class WP_Comments_List_Table extends WP_List_Table {
var $pending_count = array();
function WP_Comments_List_Table() {
function __construct() {
global $post_id;
$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
@ -29,7 +29,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( get_option('show_avatars') )
add_filter( 'comment_author', 'floated_admin_avatar' );
parent::WP_List_Table( array(
parent::__construct( array(
'plural' => 'comments',
'singular' => 'comment',
'ajax' => true,

View File

@ -21,7 +21,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
*
* @param mixed $arg ingored argument
*/
function WP_Filesystem_Direct($arg) {
function __construct($arg) {
$this->method = 'direct';
$this->errors = new WP_Error();
}

View File

@ -19,7 +19,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
var $errors = null;
var $options = array();
function WP_Filesystem_FTPext($opt='') {
function __construct($opt='') {
$this->method = 'ftpext';
$this->errors = new WP_Error();

View File

@ -19,7 +19,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
var $errors = null;
var $options = array();
function WP_Filesystem_ftpsockets($opt = '') {
function __construct($opt = '') {
$this->method = 'ftpsockets';
$this->errors = new WP_Error();

View File

@ -48,7 +48,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
var $errors = array();
var $options = array();
function WP_Filesystem_SSH2($opt='') {
function __construct($opt='') {
$this->method = 'ssh2';
$this->errors = new WP_Error();

View File

@ -10,10 +10,6 @@ class WP_Importer {
*/
function __construct() {}
function WP_Importer() {
$this->__construct();
}
/**
* Returns array with imported permalinks from WordPress database
*

View File

@ -9,8 +9,8 @@
*/
class WP_Links_List_Table extends WP_List_Table {
function WP_Links_List_Table() {
parent::WP_List_Table( array(
function __construct() {
parent::__construct( array(
'plural' => 'bookmarks',
) );
}

View File

@ -77,7 +77,7 @@ class WP_List_Table {
* @param array $args An associative array with information about the current table
* @access protected
*/
function WP_List_Table( $args = array() ) {
function __construct( $args = array() ) {
$args = wp_parse_args( $args, array(
'plural' => '',
'singular' => '',

View File

@ -9,10 +9,10 @@
*/
class WP_Media_List_Table extends WP_List_Table {
function WP_Media_List_Table() {
function __construct() {
$this->detached = isset( $_REQUEST['detached'] ) || isset( $_REQUEST['find_detached'] );
parent::WP_List_Table( array(
parent::__construct( array(
'plural' => 'media'
) );
}

View File

@ -9,8 +9,8 @@
*/
class WP_MS_Sites_List_Table extends WP_List_Table {
function WP_MS_Sites_List_Table() {
parent::WP_List_Table( array(
function __construct() {
parent::__construct( array(
'plural' => 'sites',
) );
}

View File

@ -12,7 +12,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
var $site_id;
var $is_site_themes;
function WP_MS_Themes_List_Table() {
function __construct() {
global $status, $page;
$default_status = get_user_option( 'themes_last_view' );
@ -32,7 +32,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
if ( $this->is_site_themes )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
parent::WP_List_Table( array(
parent::__construct( array(
'plural' => 'themes'
) );
}

View File

@ -9,7 +9,7 @@
*/
class WP_Plugins_List_Table extends WP_List_Table {
function WP_Plugins_List_Table() {
function __construct() {
global $status, $page;
$default_status = get_user_option( 'plugins_last_view' );
@ -23,7 +23,7 @@ class WP_Plugins_List_Table extends WP_List_Table {
$page = $this->get_pagenum();
parent::WP_List_Table( array(
parent::__construct( array(
'plural' => 'plugins',
) );
}

View File

@ -45,7 +45,7 @@ class WP_Posts_List_Table extends WP_List_Table {
*/
var $sticky_posts_count = 0;
function WP_Posts_List_Table() {
function __construct() {
global $post_type_object, $post_type, $wpdb;
if ( !isset( $_REQUEST['post_type'] ) )
@ -74,7 +74,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
}
parent::WP_List_Table( array(
parent::__construct( array(
'plural' => 'posts',
) );
}

View File

@ -11,7 +11,7 @@ class WP_Terms_List_Table extends WP_List_Table {
var $callback_args;
function WP_Terms_List_Table() {
function __construct() {
global $post_type, $taxonomy, $tax;
wp_reset_vars( array( 'action', 'taxonomy', 'post_type' ) );
@ -27,7 +27,7 @@ class WP_Terms_List_Table extends WP_List_Table {
if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'public' => true ) ) ) )
$post_type = 'post';
parent::WP_List_Table( array(
parent::__construct( array(
'plural' => 'tags',
'singular' => 'tag',
) );

View File

@ -25,9 +25,6 @@ class WP_Upgrader {
var $skin = null;
var $result = array();
function WP_Upgrader($skin = null) {
return $this->__construct($skin);
}
function __construct($skin = null) {
if ( null == $skin )
$this->skin = new WP_Upgrader_Skin();
@ -925,9 +922,6 @@ class WP_Upgrader_Skin {
var $done_header = false;
var $result = false;
function WP_Upgrader_Skin($args = array()) {
return $this->__construct($args);
}
function __construct($args = array()) {
$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
$this->options = wp_parse_args($args, $defaults);
@ -1014,10 +1008,6 @@ class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
var $plugin_active = false;
var $plugin_network_active = false;
function Plugin_Upgrader_Skin($args = array()) {
return $this->__construct($args);
}
function __construct($args = array()) {
$defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
$args = wp_parse_args($args, $defaults);
@ -1070,10 +1060,6 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
var $in_loop = false;
var $error = false;
function Bulk_Upgrader_Skin($args = array()) {
return $this->__construct($args);
}
function __construct($args = array()) {
$defaults = array( 'url' => '', 'nonce' => '' );
$args = wp_parse_args($args, $defaults);
@ -1178,7 +1164,8 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
var $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
function Plugin_Upgrader_Skin($args = array()) {
function __construct($args = array()) {
parent::__construct($args);
}
@ -1209,7 +1196,8 @@ class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin {
var $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
function Theme_Upgrader_Skin($args = array()) {
function __construct($args = array()) {
parent::__construct($args);
}
@ -1251,10 +1239,6 @@ class Plugin_Installer_Skin extends WP_Upgrader_Skin {
var $api;
var $type;
function Plugin_Installer_Skin($args = array()) {
return $this->__construct($args);
}
function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults);
@ -1319,10 +1303,6 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
var $api;
var $type;
function Theme_Installer_Skin($args = array()) {
return $this->__construct($args);
}
function __construct($args = array()) {
$defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
$args = wp_parse_args($args, $defaults);
@ -1385,10 +1365,6 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
var $theme = '';
function Theme_Upgrader_Skin($args = array()) {
return $this->__construct($args);
}
function __construct($args = array()) {
$defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
$args = wp_parse_args($args, $defaults);
@ -1440,9 +1416,6 @@ class File_Upload_Upgrader {
var $package;
var $filename;
function File_Upload_Upgrader($form, $urlholder) {
return $this->__construct($form, $urlholder);
}
function __construct($form, $urlholder) {
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
wp_die($uploads['error']);

View File

@ -12,14 +12,14 @@ class WP_Users_List_Table extends WP_List_Table {
var $site_id;
var $is_site_users;
function WP_Users_List_Table() {
function __construct() {
$screen = get_current_screen();
$this->is_site_users = 'site-users-network' == $screen->id;
if ( $this->is_site_users )
$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
parent::WP_List_Table( array(
parent::__construct( array(
'singular' => 'user',
'plural' => 'users'
) );

View File

@ -216,12 +216,12 @@ class AtomServer {
var $do_output = true;
/**
* PHP4 constructor - Sets up object properties.
* Constructor - Sets up object properties.
*
* @since 2.2.0
* @return AtomServer
*/
function AtomServer() {
function __construct() {
$this->script_name = array_pop( $var_by_ref = explode( '/', $_SERVER['SCRIPT_NAME'] ) );
$this->app_base = site_url( $this->script_name . '/' );

View File

@ -456,7 +456,7 @@ class WP_User {
var $filter = null;
/**
* PHP4 Constructor - Sets up the object properties.
* Constructor - Sets up the object properties.
*
* Retrieves the userdata and then assigns all of the data keys to direct
* properties of the object. Calls {@link WP_User::_init_caps()} after
@ -470,7 +470,7 @@ class WP_User {
* @param int $blog_id Optional Blog ID, defaults to current blog.
* @return WP_User
*/
function WP_User( $id, $name = '', $blog_id = '' ) {
function __construct( $id, $name = '', $blog_id = '' ) {
if ( empty( $id ) && empty( $name ) )
return;

View File

@ -4,15 +4,6 @@ if ( !class_exists('SimplePie') )
require_once (ABSPATH . WPINC . '/class-simplepie.php');
class WP_Feed_Cache extends SimplePie_Cache {
/**
* Don't call the constructor. Please.
*
* @access private
*/
function WP_Feed_Cache() {
trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
}
/**
* Create a new SimplePie_Cache object
*
@ -29,7 +20,7 @@ class WP_Feed_Cache_Transient {
var $mod_name;
var $lifetime = 43200; //Default lifetime in cache of 12 hours
function WP_Feed_Cache_Transient($location, $filename, $extension) {
function __construct($location, $filename, $extension) {
$this->name = 'feed_' . $filename;
$this->mod_name = 'feed_mod_' . $filename;
$this->lifetime = apply_filters('wp_feed_cache_transient_lifetime', $this->lifetime, $filename);
@ -65,7 +56,7 @@ class WP_Feed_Cache_Transient {
class WP_SimplePie_File extends SimplePie_File {
function WP_SimplePie_File($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) {
function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false) {
$this->url = $url;
$this->timeout = $timeout;
$this->redirects = $redirects;

View File

@ -1408,17 +1408,6 @@ class WP_Http_Cookie {
*/
var $domain;
/**
* PHP4 style Constructor - Calls PHP5 Style Constructor.
*
* @access public
* @since 2.8.0
* @param string|array $data Raw cookie data.
*/
function WP_Http_Cookie( $data ) {
$this->__construct( $data );
}
/**
* Sets up this cookie object.
*

View File

@ -16,7 +16,7 @@ class WP_Ajax_Response {
var $responses = array();
/**
* PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.
* Constructor - Passes args to {@link WP_Ajax_Response::add()}.
*
* @since 2.1.0
* @see WP_Ajax_Response::add()
@ -24,7 +24,7 @@ class WP_Ajax_Response {
* @param string|array $args Optional. Will be passed to add() method.
* @return WP_Ajax_Response
*/
function WP_Ajax_Response( $args = '' ) {
function __construct( $args = '' ) {
if ( !empty($args) )
$this->add($args);
}

View File

@ -38,7 +38,7 @@ class WP_Error {
var $error_data = array();
/**
* PHP4 Constructor - Sets up error message.
* Constructor - Sets up error message.
*
* If code parameter is empty then nothing will be done. It is possible to
* add multiple messages to the same code, but with other methods in the
@ -54,7 +54,7 @@ class WP_Error {
* @param mixed $data Optional. Error data.
* @return WP_Error
*/
function WP_Error($code = '', $message = '', $data = '') {
function __construct($code = '', $message = '', $data = '') {
if ( empty($code) )
return;

View File

@ -7,7 +7,8 @@
*
*/
class WP_HTTP_IXR_Client extends IXR_Client {
function WP_HTTP_IXR_Client($server, $path = false, $port = 80, $timeout = 15) {
function __construct($server, $path = false, $port = 80, $timeout = 15) {
if ( ! $path ) {
// Assume we have been given a URL instead
$bits = parse_url($server);

View File

@ -24,7 +24,7 @@ class wp_xmlrpc_server extends IXR_Server {
/**
* Register all of the XMLRPC methods that XMLRPC server understands.
*
* PHP4 constructor and sets up server and method property. Passes XMLRPC
* Sets up server and method property. Passes XMLRPC
* methods through the 'xmlrpc_methods' filter to allow plugins to extend
* or replace XMLRPC methods.
*
@ -32,7 +32,7 @@ class wp_xmlrpc_server extends IXR_Server {
*
* @return wp_xmlrpc_server
*/
function wp_xmlrpc_server() {
function __construct() {
$this->methods = array(
// WordPress API
'wp.getUsersBlogs' => 'this:wp_getUsersBlogs',

View File

@ -504,18 +504,6 @@ class WP {
do_action_ref_array('wp', array(&$this));
}
/**
* PHP4 Constructor - Does nothing.
*
* Call main() method when ready to run setup.
*
* @since 2.0.0
*
* @return WP
*/
function WP() {
// Empty.
}
}
/**

View File

@ -221,7 +221,7 @@ class _WP_Dependency {
var $extra = array();
function _WP_Dependency() {
function __construct() {
@list($this->handle, $this->src, $this->deps, $this->ver, $this->args) = func_get_args();
if ( !is_array($this->deps) )
$this->deps = array();

View File

@ -314,7 +314,7 @@ class WP_Locale {
}
/**
* PHP4 style constructor which calls helper methods to set up object variables
* Constructor which calls helper methods to set up object variables
*
* @uses WP_Locale::init()
* @uses WP_Locale::register_globals()
@ -322,7 +322,7 @@ class WP_Locale {
*
* @return WP_Locale
*/
function WP_Locale() {
function __construct() {
$this->init();
$this->register_globals();
}

View File

@ -2970,7 +2970,7 @@ class WP_Query {
}
/**
* PHP4 type constructor.
* Constructor.
*
* Sets up the WordPress query, if parameter is not empty.
*
@ -2980,7 +2980,7 @@ class WP_Query {
* @param string $query URL query string.
* @return WP_Query
*/
function WP_Query($query = '') {
function __construct($query = '') {
if ( ! empty($query) ) {
$this->query($query);
}

View File

@ -1976,14 +1976,14 @@ class WP_Rewrite {
}
/**
* PHP4 Constructor - Calls init(), which runs setup.
* Constructor - Calls init(), which runs setup.
*
* @since 1.5.0
* @access public
*
* @return WP_Rewrite
*/
function WP_Rewrite() {
function __construct() {
$this->init();
}
}

View File

@ -361,12 +361,6 @@ class WP_User_Query {
var $query_orderby;
var $query_limit;
/**
* PHP4 constructor
*/
function WP_User_Query( $query = null ) {
$this->__construct( $query );
}
/**
* PHP5 constructor

View File

@ -60,7 +60,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
var $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
/**
* PHP4 Constructor - Call parent constructor with params array.
* Constructor - Call parent constructor with params array.
*
* This will set class properties based on the key value pairs in the array.
*
@ -68,7 +68,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
*
* @param array $params
*/
function Text_Diff_Renderer_Table( $params = array() ) {
function __construct( $params = array() ) {
$parent = get_parent_class($this);
$this->$parent( $params );
}