diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index 787cb4532..80e2c0562 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -75,7 +75,7 @@ function wpmu_delete_blog($blog_id, $drop = false) { $wpdb->query( "DROP TABLE IF EXISTS ". current( $drop_table ) ."" ); } $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id) ); - $dir = apply_filters( 'wpmu_delete_blog_upload_dir', constant( "WP_CONTENT_DIR" ) . "/blogs.dir/{$blog_id}/files/", $blog_id ); + $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id ); $dir = rtrim($dir, DIRECTORY_SEPARATOR); $top_dir = $dir; $stack = array($dir); diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index f05e5982d..811d1be66 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -1259,11 +1259,11 @@ function __get_option($setting) { global $wpdb; if ( $setting == 'home' && defined( 'WP_HOME' ) ) { - return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) ); + return preg_replace( '|/+$|', '', WP_HOME ); } if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) { - return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) ); + return preg_replace( '|/+$|', '', WP_SITEURL ); } $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) ); diff --git a/wp-admin/revision.php b/wp-admin/revision.php index 4a6e1144b..7ac404ae9 100644 --- a/wp-admin/revision.php +++ b/wp-admin/revision.php @@ -29,7 +29,7 @@ case 'restore' : if ( !$post = get_post( $revision->post_parent ) ) break; - if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave + if ( ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave break; check_admin_referer( "restore-post_$post->ID|$revision->ID" ); @@ -68,7 +68,7 @@ case 'diff' : else break; // Don't diff two unrelated revisions - if ( !constant('WP_POST_REVISIONS') ) { // Revisions disabled + if ( ! WP_POST_REVISIONS ) { // Revisions disabled if ( // we're not looking at an autosave ( !wp_is_post_autosave( $left_revision ) && !wp_is_post_autosave( $right_revision ) ) @@ -106,7 +106,7 @@ default : if ( !current_user_can( 'read_post', $revision->ID ) || !current_user_can( 'read_post', $post->ID ) ) break; - if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave + if ( ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave break; $post_type_object = get_post_type_object($post->post_type); @@ -207,7 +207,7 @@ endif; 'form-table', 'parent' => true, 'right' => $right, 'left' => $left ); -if ( !constant( 'WP_POST_REVISIONS' ) ) +if ( ! WP_POST_REVISIONS ) $args['type'] = 'autosave'; wp_list_post_revisions( $post, $args ); diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index ecc61f00f..38f292208 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -1274,8 +1274,7 @@ function signup_nonce_check( $result ) { function maybe_redirect_404() { global $current_site; - if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && constant( 'NOBLOGREDIRECT' ) != '' ) { - $destination = constant( 'NOBLOGREDIRECT' ); + if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = NOBLOGREDIRECT ) ) { if ( $destination == '%siteurl%' ) $destination = $current_site->domain . $current_site->path; wp_redirect( $destination ); diff --git a/wp-includes/ms-load.php b/wp-includes/ms-load.php index 77ba711b2..998013453 100644 --- a/wp-includes/ms-load.php +++ b/wp-includes/ms-load.php @@ -98,7 +98,7 @@ function get_current_site_name( $current_site ) { function wpmu_current_site() { global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain; if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) { - $current_site->id = (defined( 'SITE_ID_CURRENT_SITE' ) ? constant('SITE_ID_CURRENT_SITE') : 1); + $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1; $current_site->domain = DOMAIN_CURRENT_SITE; $current_site->path = $path = PATH_CURRENT_SITE; if ( defined( 'BLOGID_CURRENT_SITE' ) ) diff --git a/wp-includes/post.php b/wp-includes/post.php index af4b12eaa..6429f9f5e 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -4169,7 +4169,7 @@ function wp_save_post_revision( $post_id ) { return; // WP_POST_REVISIONS = 0, false - if ( !constant('WP_POST_REVISIONS') ) + if ( ! WP_POST_REVISIONS ) return; if ( !$post = get_post( $post_id, ARRAY_A ) ) @@ -4448,7 +4448,7 @@ function wp_delete_post_revision( $revision_id ) { * @return array empty if no revisions */ function wp_get_post_revisions( $post_id = 0, $args = null ) { - if ( !constant('WP_POST_REVISIONS') ) + if ( ! WP_POST_REVISIONS ) return array(); if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) ) return array(); diff --git a/wp-includes/template-loader.php b/wp-includes/template-loader.php index 9fd4ffe51..6185ca93c 100644 --- a/wp-includes/template-loader.php +++ b/wp-includes/template-loader.php @@ -3,7 +3,7 @@ * Loads the correct template based on the visitor's url * @package WordPress */ -if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) { +if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) { do_action('template_redirect'); if ( is_robots() ) { do_action('do_robots'); diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 92df1cd5d..4422292b6 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -345,7 +345,7 @@ class wpdb { * @param string $dbhost MySQL database host */ function wpdb($dbuser, $dbpassword, $dbname, $dbhost) { - if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) + if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB ) $this->db_connect(); return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost); } @@ -367,23 +367,22 @@ class wpdb { function __construct($dbuser, $dbpassword, $dbname, $dbhost) { register_shutdown_function(array(&$this, "__destruct")); - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) + if ( WP_DEBUG ) $this->show_errors(); if ( is_multisite() ) { $this->charset = 'utf8'; - if ( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' ) - $this->collate = constant( 'DB_COLLATE' ); + if ( defined( 'DB_COLLATE' ) && DB_COLLATE ) + $this->collate = DB_COLLATE; else $this->collate = 'utf8_general_ci'; + } elseif ( defined( 'DB_COLLATE' ) ) { + $this->collate = DB_COLLATE; } if ( defined('DB_CHARSET') ) $this->charset = DB_CHARSET; - if ( defined('DB_COLLATE') ) - $this->collate = DB_COLLATE; - $this->dbuser = $dbuser; $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true); @@ -666,7 +665,7 @@ class wpdb { if ( is_multisite() ) { $msg = "WordPress database error: [$str]\n{$this->last_query}\n"; if ( defined( 'ERRORLOGFILE' ) ) - error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) ); + error_log( $msg, 3, ERRORLOGFILE ); if ( defined( 'DIEONDBERROR' ) ) die( $msg ); } else { @@ -807,7 +806,7 @@ class wpdb { // use $this->dbh for read ops, and $this->dbhwrite for write ops // use $this->dbhglobal for gloal table ops unset( $dbh ); - if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) { + if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB ) { if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) { if( false == isset( $this->dbhglobal ) ) { $this->db_connect( $query );