Coding Standards: Always use parentheses when instantiating an object.
Note: This will be enforced by WPCS 3.0.0. Props jrf. See #56791. Built from https://develop.svn.wordpress.org/trunk@54891 git-svn-id: http://core.svn.wordpress.org/trunk@54443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ab923804f4
commit
3ba44120d0
|
@ -97,7 +97,7 @@ if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
|
|||
}
|
||||
|
||||
$registered = $wp_scripts->registered;
|
||||
$wp_scripts = new WP_Scripts;
|
||||
$wp_scripts = new WP_Scripts();
|
||||
$wp_scripts->registered = $registered;
|
||||
|
||||
add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
|
||||
|
|
|
@ -1570,7 +1570,7 @@ function wp_ajax_add_menu_item() {
|
|||
'before' => '',
|
||||
'link_after' => '',
|
||||
'link_before' => '',
|
||||
'walker' => new $walker_class_name,
|
||||
'walker' => new $walker_class_name(),
|
||||
);
|
||||
|
||||
echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
|
||||
|
|
|
@ -59,7 +59,7 @@ function edit_link( $link_id = 0 ) {
|
|||
* @return stdClass Default link object.
|
||||
*/
|
||||
function get_default_link_to_edit() {
|
||||
$link = new stdClass;
|
||||
$link = new stdClass();
|
||||
if ( isset( $_GET['linkurl'] ) ) {
|
||||
$link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
|
||||
} else {
|
||||
|
|
|
@ -62,7 +62,7 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||
* Avoid messing with VCS installations, at least for now.
|
||||
* Noted: this is not the ideal way to accomplish this.
|
||||
*/
|
||||
$check_vcs = new WP_Automatic_Updater;
|
||||
$check_vcs = new WP_Automatic_Updater();
|
||||
if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ class WP_Automatic_Updater {
|
|||
*/
|
||||
public function should_update( $type, $item, $context ) {
|
||||
// Used to see if WP_Filesystem is set up to allow unattended updates.
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
|
||||
if ( $this->is_disabled() ) {
|
||||
return false;
|
||||
|
@ -305,7 +305,7 @@ class WP_Automatic_Updater {
|
|||
* @return null|WP_Error
|
||||
*/
|
||||
public function update( $type, $item ) {
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
|
||||
switch ( $type ) {
|
||||
case 'core':
|
||||
|
|
|
@ -280,7 +280,7 @@ class WP_Site_Health_Auto_Updates {
|
|||
require_once ABSPATH . 'wp-admin/includes/file.php';
|
||||
}
|
||||
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
$success = $skin->request_filesystem_credentials( false, ABSPATH );
|
||||
|
||||
if ( ! $success ) {
|
||||
|
@ -313,7 +313,7 @@ class WP_Site_Health_Auto_Updates {
|
|||
|
||||
require ABSPATH . WPINC . '/version.php'; // $wp_version; // x.y.z
|
||||
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
$success = $skin->request_filesystem_credentials( false, ABSPATH );
|
||||
|
||||
if ( ! $success ) {
|
||||
|
|
|
@ -739,7 +739,7 @@ function wp_restore_image( $post_id ) {
|
|||
$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
|
||||
$old_backup_sizes = $backup_sizes;
|
||||
$restored = false;
|
||||
$msg = new stdClass;
|
||||
$msg = new stdClass();
|
||||
|
||||
if ( ! is_array( $backup_sizes ) ) {
|
||||
$msg->error = __( 'Cannot load image metadata.' );
|
||||
|
@ -827,7 +827,7 @@ function wp_restore_image( $post_id ) {
|
|||
function wp_save_image( $post_id ) {
|
||||
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
|
||||
|
||||
$return = new stdClass;
|
||||
$return = new stdClass();
|
||||
$success = false;
|
||||
$delete = false;
|
||||
$scaled = false;
|
||||
|
|
|
@ -32,7 +32,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
|
|||
}
|
||||
|
||||
if ( 'markup' === $response_format ) {
|
||||
$args['walker'] = new Walker_Nav_Menu_Checklist;
|
||||
$args['walker'] = new Walker_Nav_Menu_Checklist();
|
||||
}
|
||||
|
||||
if ( 'get-post-item' === $type ) {
|
||||
|
@ -429,14 +429,14 @@ function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) {
|
|||
}
|
||||
|
||||
// @todo Transient caching of these results with proper invalidation on updating of a post of this type.
|
||||
$get_posts = new WP_Query;
|
||||
$get_posts = new WP_Query();
|
||||
$posts = $get_posts->query( $args );
|
||||
|
||||
// Only suppress and insert when more than just suppression pages available.
|
||||
if ( ! $get_posts->post_count ) {
|
||||
if ( ! empty( $suppress_page_ids ) ) {
|
||||
unset( $args['post__not_in'] );
|
||||
$get_posts = new WP_Query;
|
||||
$get_posts = new WP_Query();
|
||||
$posts = $get_posts->query( $args );
|
||||
} else {
|
||||
echo '<p>' . __( 'No items.' ) . '</p>';
|
||||
|
@ -1059,7 +1059,7 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
|
|||
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
|
||||
|
||||
if ( class_exists( $walker_class_name ) ) {
|
||||
$walker = new $walker_class_name;
|
||||
$walker = new $walker_class_name();
|
||||
} else {
|
||||
return new WP_Error(
|
||||
'menu_walker_not_exist',
|
||||
|
|
|
@ -716,7 +716,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
|||
wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
|
||||
}
|
||||
} else {
|
||||
$post = new stdClass;
|
||||
$post = new stdClass();
|
||||
$post->ID = 0;
|
||||
$post->post_author = '';
|
||||
$post->post_date = '';
|
||||
|
|
|
@ -535,7 +535,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
|
|||
wp_delete_file( $archive_pathname );
|
||||
}
|
||||
|
||||
$zip = new ZipArchive;
|
||||
$zip = new ZipArchive();
|
||||
if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
|
||||
if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
|
||||
$error = __( 'Unable to archive the personal data export file (JSON format).' );
|
||||
|
|
|
@ -1050,7 +1050,7 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam
|
|||
* created.
|
||||
*/
|
||||
if ( ! is_multisite() ) {
|
||||
$current_site = new stdClass;
|
||||
$current_site = new stdClass();
|
||||
$current_site->domain = $domain;
|
||||
$current_site->path = $path;
|
||||
$current_site->site_name = ucfirst( $domain );
|
||||
|
|
|
@ -104,7 +104,7 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
|
|||
$parsed_args = wp_parse_args( $params, $defaults );
|
||||
|
||||
if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) {
|
||||
$walker = new Walker_Category_Checklist;
|
||||
$walker = new Walker_Category_Checklist();
|
||||
} else {
|
||||
$walker = $parsed_args['walker'];
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ function wp_download_language_pack( $download ) {
|
|||
$translation = (object) $translation;
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
$upgrader = new Language_Pack_Upgrader( $skin );
|
||||
$translation->type = 'core';
|
||||
$result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
|
||||
|
@ -263,7 +263,7 @@ function wp_can_install_language_pack() {
|
|||
}
|
||||
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$skin = new Automatic_Upgrader_Skin();
|
||||
$upgrader = new Language_Pack_Upgrader( $skin );
|
||||
$upgrader->init();
|
||||
|
||||
|
|
|
@ -1395,7 +1395,7 @@ function update_core( $from, $to ) {
|
|||
// If a error occurs partway through this final step, keep the error flowing through, but keep process going.
|
||||
if ( is_wp_error( $_result ) ) {
|
||||
if ( ! is_wp_error( $result ) ) {
|
||||
$result = new WP_Error;
|
||||
$result = new WP_Error();
|
||||
}
|
||||
|
||||
$result->add(
|
||||
|
|
|
@ -93,7 +93,7 @@ function find_core_auto_update() {
|
|||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
|
||||
$auto_update = false;
|
||||
$upgrader = new WP_Automatic_Updater;
|
||||
$upgrader = new WP_Automatic_Updater();
|
||||
foreach ( $updates->updates as $update ) {
|
||||
if ( 'autoupdate' !== $update->response ) {
|
||||
continue;
|
||||
|
@ -235,7 +235,7 @@ function core_update_footer( $msg = '' ) {
|
|||
|
||||
$cur = get_preferred_from_update_core();
|
||||
if ( ! is_object( $cur ) ) {
|
||||
$cur = new stdClass;
|
||||
$cur = new stdClass();
|
||||
}
|
||||
|
||||
if ( ! isset( $cur->current ) ) {
|
||||
|
|
|
@ -2617,7 +2617,7 @@ function maybe_convert_table_to_utf8mb4( $table ) {
|
|||
*/
|
||||
function get_alloptions_110() {
|
||||
global $wpdb;
|
||||
$all_options = new stdClass;
|
||||
$all_options = new stdClass();
|
||||
$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
|
||||
if ( $options ) {
|
||||
foreach ( $options as $option ) {
|
||||
|
|
|
@ -29,7 +29,7 @@ function add_user() {
|
|||
*/
|
||||
function edit_user( $user_id = 0 ) {
|
||||
$wp_roles = wp_roles();
|
||||
$user = new stdClass;
|
||||
$user = new stdClass();
|
||||
$user_id = (int) $user_id;
|
||||
if ( $user_id ) {
|
||||
$update = true;
|
||||
|
|
|
@ -104,7 +104,7 @@ if ( is_multisite()
|
|||
if ( IS_PROFILE_PAGE && isset( $_GET['newuseremail'] ) && $current_user->ID ) {
|
||||
$new_email = get_user_meta( $current_user->ID, '_new_email', true );
|
||||
if ( $new_email && hash_equals( $new_email['hash'], $_GET['newuseremail'] ) ) {
|
||||
$user = new stdClass;
|
||||
$user = new stdClass();
|
||||
$user->ID = $current_user->ID;
|
||||
$user->user_email = esc_html( trim( $new_email['newemail'] ) );
|
||||
if ( is_multisite() && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
|
||||
|
|
|
@ -41,7 +41,7 @@ function _wp_admin_bar_init() {
|
|||
*/
|
||||
$admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
|
||||
if ( class_exists( $admin_bar_class ) ) {
|
||||
$wp_admin_bar = new $admin_bar_class;
|
||||
$wp_admin_bar = new $admin_bar_class();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -975,7 +975,7 @@ function user_can( $user, $capability, ...$args ) {
|
|||
if ( empty( $user ) ) {
|
||||
// User is logged out, create anonymous user object.
|
||||
$user = new WP_User( 0 );
|
||||
$user->init( new stdClass );
|
||||
$user->init( new stdClass() );
|
||||
}
|
||||
|
||||
return $user->has_cap( $capability, ...$args );
|
||||
|
|
|
@ -1110,7 +1110,7 @@ function _wp_object_count_sort_cb( $a, $b ) {
|
|||
function walk_category_tree( ...$args ) {
|
||||
// The user's options are the third parameter.
|
||||
if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
|
||||
$walker = new Walker_Category;
|
||||
$walker = new Walker_Category();
|
||||
} else {
|
||||
/**
|
||||
* @var Walker $walker
|
||||
|
@ -1136,7 +1136,7 @@ function walk_category_tree( ...$args ) {
|
|||
function walk_category_dropdown_tree( ...$args ) {
|
||||
// The user's options are the third parameter.
|
||||
if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
|
||||
$walker = new Walker_CategoryDropdown;
|
||||
$walker = new Walker_CategoryDropdown();
|
||||
} else {
|
||||
/**
|
||||
* @var Walker $walker
|
||||
|
|
|
@ -41,7 +41,7 @@ class WP_Admin_Bar {
|
|||
* @since 3.1.0
|
||||
*/
|
||||
public function initialize() {
|
||||
$this->user = new stdClass;
|
||||
$this->user = new stdClass();
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
/* Populate settings we need for the menu based on the current user. */
|
||||
|
|
|
@ -1799,7 +1799,7 @@ final class _WP_Editors {
|
|||
$query = apply_filters( 'wp_link_query_args', $query );
|
||||
|
||||
// Do main query.
|
||||
$get_posts = new WP_Query;
|
||||
$get_posts = new WP_Query();
|
||||
$posts = $get_posts->query( $query );
|
||||
|
||||
// Build results.
|
||||
|
|
|
@ -581,7 +581,7 @@ class WP_Http {
|
|||
|
||||
// Transport claims to support request, instantiate it and give it a whirl.
|
||||
if ( empty( $transports[ $class ] ) ) {
|
||||
$transports[ $class ] = new $class;
|
||||
$transports[ $class ] = new $class();
|
||||
}
|
||||
|
||||
$response = $transports[ $class ]->request( $url, $args );
|
||||
|
|
|
@ -639,7 +639,7 @@ class WP_oEmbed {
|
|||
return false;
|
||||
}
|
||||
|
||||
$dom = new DOMDocument;
|
||||
$dom = new DOMDocument();
|
||||
$success = $dom->loadXML( $response_body );
|
||||
if ( ! $success ) {
|
||||
return false;
|
||||
|
@ -660,7 +660,7 @@ class WP_oEmbed {
|
|||
return false;
|
||||
}
|
||||
|
||||
$return = new stdClass;
|
||||
$return = new stdClass();
|
||||
foreach ( $xml as $key => $value ) {
|
||||
$return->$key = (string) $value;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
|
|||
foreach ( $orig_matches as $o => $f ) {
|
||||
if ( is_numeric( $o ) && is_numeric( $f ) ) {
|
||||
$text_diff = new Text_Diff( 'auto', array( array( $orig[ $o ] ), array( $final[ $f ] ) ) );
|
||||
$renderer = new $this->inline_diff_renderer;
|
||||
$renderer = new $this->inline_diff_renderer();
|
||||
$diff = $renderer->render( $text_diff );
|
||||
|
||||
// If they're too different, don't include any <ins> or <del>'s.
|
||||
|
|
|
@ -156,7 +156,7 @@ class WP_User {
|
|||
if ( $data ) {
|
||||
$this->init( $data, $site_id );
|
||||
} else {
|
||||
$this->data = new stdClass;
|
||||
$this->data = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2238,7 +2238,7 @@ function wp_list_comments( $args = array(), $comments = null ) {
|
|||
wp_queue_comments_for_comment_meta_lazyload( $_comments );
|
||||
|
||||
if ( empty( $parsed_args['walker'] ) ) {
|
||||
$walker = new Walker_Comment;
|
||||
$walker = new Walker_Comment();
|
||||
} else {
|
||||
$walker = $parsed_args['walker'];
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ function get_approved_comments( $post_id, $args = array() ) {
|
|||
);
|
||||
$parsed_args = wp_parse_args( $args, $defaults );
|
||||
|
||||
$query = new WP_Comment_Query;
|
||||
$query = new WP_Comment_Query();
|
||||
return $query->query( $parsed_args );
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ function get_comment( $comment = null, $output = OBJECT ) {
|
|||
* @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true.
|
||||
*/
|
||||
function get_comments( $args = '' ) {
|
||||
$query = new WP_Comment_Query;
|
||||
$query = new WP_Comment_Query();
|
||||
return $query->query( $args );
|
||||
}
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ function get_comment_pages_count( $comments = null, $per_page = null, $threaded
|
|||
}
|
||||
|
||||
if ( $threaded ) {
|
||||
$walker = new Walker_Comment;
|
||||
$walker = new Walker_Comment();
|
||||
$count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );
|
||||
} else {
|
||||
$count = ceil( count( $comments ) / $per_page );
|
||||
|
|
|
@ -4302,7 +4302,7 @@ function _wp_json_sanity_check( $data, $depth ) {
|
|||
}
|
||||
}
|
||||
} elseif ( is_object( $data ) ) {
|
||||
$output = new stdClass;
|
||||
$output = new stdClass();
|
||||
foreach ( $data as $id => $el ) {
|
||||
if ( is_string( $id ) ) {
|
||||
$clean_id = _wp_json_convert_string( $id );
|
||||
|
|
|
@ -1306,7 +1306,7 @@ function get_translations_for_domain( $domain ) {
|
|||
|
||||
static $noop_translations = null;
|
||||
if ( null === $noop_translations ) {
|
||||
$noop_translations = new NOOP_Translations;
|
||||
$noop_translations = new NOOP_Translations();
|
||||
}
|
||||
|
||||
return $noop_translations;
|
||||
|
|
|
@ -297,7 +297,7 @@ function ms_load_current_site_and_network( $domain, $path, $subdomain = false )
|
|||
|
||||
// If the network is defined in wp-config.php, we can simply use that.
|
||||
if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
|
||||
$current_site = new stdClass;
|
||||
$current_site = new stdClass();
|
||||
$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
|
||||
$current_site->domain = DOMAIN_CURRENT_SITE;
|
||||
$current_site->path = PATH_CURRENT_SITE;
|
||||
|
@ -387,7 +387,7 @@ function ms_load_current_site_and_network( $domain, $path, $subdomain = false )
|
|||
|
||||
// During activation of a new subdomain, the requested site does not yet exist.
|
||||
if ( empty( $current_blog ) && wp_installing() ) {
|
||||
$current_blog = new stdClass;
|
||||
$current_blog = new stdClass();
|
||||
$current_blog->blog_id = 1;
|
||||
$blog_id = 1;
|
||||
$current_blog->public = 1;
|
||||
|
|
|
@ -617,7 +617,7 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
|
|||
* @return string The HTML list content for the menu items.
|
||||
*/
|
||||
function walk_nav_menu_tree( $items, $depth, $args ) {
|
||||
$walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker;
|
||||
$walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu() : $args->walker;
|
||||
|
||||
return $walker->walk( $items, $depth, $args );
|
||||
}
|
||||
|
|
|
@ -1010,7 +1010,7 @@ function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_
|
|||
$object_id = (int) $object_id;
|
||||
$menu_item_ids = array();
|
||||
|
||||
$query = new WP_Query;
|
||||
$query = new WP_Query();
|
||||
$menu_items = $query->query(
|
||||
array(
|
||||
'meta_key' => '_menu_item_object_id',
|
||||
|
|
|
@ -105,7 +105,7 @@ if ( ! function_exists( 'get_user_by' ) ) :
|
|||
return false;
|
||||
}
|
||||
|
||||
$user = new WP_User;
|
||||
$user = new WP_User();
|
||||
$user->init( $userdata );
|
||||
|
||||
return $user;
|
||||
|
|
|
@ -1546,7 +1546,7 @@ function wp_page_menu( $args = array() ) {
|
|||
*/
|
||||
function walk_page_tree( $pages, $depth, $current_page, $args ) {
|
||||
if ( empty( $args['walker'] ) ) {
|
||||
$walker = new Walker_Page;
|
||||
$walker = new Walker_Page();
|
||||
} else {
|
||||
/**
|
||||
* @var Walker $walker
|
||||
|
@ -1578,7 +1578,7 @@ function walk_page_tree( $pages, $depth, $current_page, $args ) {
|
|||
*/
|
||||
function walk_page_dropdown_tree( ...$args ) {
|
||||
if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter.
|
||||
$walker = new Walker_PageDropdown;
|
||||
$walker = new Walker_PageDropdown();
|
||||
} else {
|
||||
/**
|
||||
* @var Walker $walker
|
||||
|
|
|
@ -2410,7 +2410,7 @@ function get_posts( $args = null ) {
|
|||
$parsed_args['ignore_sticky_posts'] = true;
|
||||
$parsed_args['no_found_rows'] = true;
|
||||
|
||||
$get_posts = new WP_Query;
|
||||
$get_posts = new WP_Query();
|
||||
return $get_posts->query( $parsed_args );
|
||||
|
||||
}
|
||||
|
@ -3013,7 +3013,7 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
|
|||
global $wpdb;
|
||||
|
||||
if ( ! post_type_exists( $type ) ) {
|
||||
return new stdClass;
|
||||
return new stdClass();
|
||||
}
|
||||
|
||||
$cache_key = _count_posts_cache_key( $type, $perm );
|
||||
|
|
|
@ -255,15 +255,15 @@ function create_initial_rest_routes() {
|
|||
}
|
||||
|
||||
// Post types.
|
||||
$controller = new WP_REST_Post_Types_Controller;
|
||||
$controller = new WP_REST_Post_Types_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Post statuses.
|
||||
$controller = new WP_REST_Post_Statuses_Controller;
|
||||
$controller = new WP_REST_Post_Statuses_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Taxonomies.
|
||||
$controller = new WP_REST_Taxonomies_Controller;
|
||||
$controller = new WP_REST_Taxonomies_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Terms.
|
||||
|
@ -278,7 +278,7 @@ function create_initial_rest_routes() {
|
|||
}
|
||||
|
||||
// Users.
|
||||
$controller = new WP_REST_Users_Controller;
|
||||
$controller = new WP_REST_Users_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Application Passwords
|
||||
|
@ -286,7 +286,7 @@ function create_initial_rest_routes() {
|
|||
$controller->register_routes();
|
||||
|
||||
// Comments.
|
||||
$controller = new WP_REST_Comments_Controller;
|
||||
$controller = new WP_REST_Comments_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
$search_handlers = array(
|
||||
|
@ -318,15 +318,15 @@ function create_initial_rest_routes() {
|
|||
$controller->register_routes();
|
||||
|
||||
// Global Styles.
|
||||
$controller = new WP_REST_Global_Styles_Controller;
|
||||
$controller = new WP_REST_Global_Styles_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Settings.
|
||||
$controller = new WP_REST_Settings_Controller;
|
||||
$controller = new WP_REST_Settings_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Themes.
|
||||
$controller = new WP_REST_Themes_Controller;
|
||||
$controller = new WP_REST_Themes_Controller();
|
||||
$controller->register_routes();
|
||||
|
||||
// Plugins.
|
||||
|
@ -562,7 +562,7 @@ function rest_get_server() {
|
|||
* @param string $class_name The name of the server class. Default 'WP_REST_Server'.
|
||||
*/
|
||||
$wp_rest_server_class = apply_filters( 'wp_rest_server_class', 'WP_REST_Server' );
|
||||
$wp_rest_server = new $wp_rest_server_class;
|
||||
$wp_rest_server = new $wp_rest_server_class();
|
||||
|
||||
/**
|
||||
* Fires when preparing to serve a REST API request.
|
||||
|
|
|
@ -227,7 +227,7 @@ class WP_REST_Response extends WP_HTTP_Response {
|
|||
return null;
|
||||
}
|
||||
|
||||
$error = new WP_Error;
|
||||
$error = new WP_Error();
|
||||
|
||||
if ( is_array( $this->get_data() ) ) {
|
||||
$data = $this->get_data();
|
||||
|
|
|
@ -766,7 +766,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
|
||||
// Ensure empty details is an empty object.
|
||||
if ( empty( $data['media_details'] ) ) {
|
||||
$data['media_details'] = new stdClass;
|
||||
$data['media_details'] = new stdClass();
|
||||
} elseif ( ! empty( $data['media_details']['sizes'] ) ) {
|
||||
|
||||
foreach ( $data['media_details']['sizes'] as $size => &$size_data ) {
|
||||
|
@ -797,7 +797,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
$data['media_details']['sizes'] = new stdClass;
|
||||
$data['media_details']['sizes'] = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||
*/
|
||||
$prepared_args = apply_filters( 'rest_comment_query', $prepared_args, $request );
|
||||
|
||||
$query = new WP_Comment_Query;
|
||||
$query = new WP_Comment_Query();
|
||||
$query_result = $query->query( $prepared_args );
|
||||
|
||||
$comments = array();
|
||||
|
@ -295,7 +295,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||
// Out-of-bounds, run the query again without LIMIT for total count.
|
||||
unset( $prepared_args['number'], $prepared_args['offset'] );
|
||||
|
||||
$query = new WP_Comment_Query;
|
||||
$query = new WP_Comment_Query();
|
||||
$prepared_args['count'] = true;
|
||||
|
||||
$total_comments = $query->query( $prepared_args );
|
||||
|
|
|
@ -807,7 +807,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
|
|||
* @return object Term object.
|
||||
*/
|
||||
public function prepare_item_for_database( $request ) {
|
||||
$prepared_term = new stdClass;
|
||||
$prepared_term = new stdClass();
|
||||
|
||||
$schema = $this->get_item_schema();
|
||||
if ( isset( $request['name'] ) && ! empty( $schema['properties']['name'] ) ) {
|
||||
|
|
|
@ -1121,7 +1121,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
|||
* @return object User object.
|
||||
*/
|
||||
protected function prepare_item_for_database( $request ) {
|
||||
$prepared_user = new stdClass;
|
||||
$prepared_user = new stdClass();
|
||||
|
||||
$schema = $this->get_item_schema();
|
||||
|
||||
|
|
|
@ -529,7 +529,7 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
|
|||
|
||||
if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
|
||||
// Use new stdClass so that JSON result is {} and not [].
|
||||
$response['instance']['raw'] = empty( $instance ) ? new stdClass : $instance;
|
||||
$response['instance']['raw'] = empty( $instance ) ? new stdClass() : $instance;
|
||||
}
|
||||
|
||||
return rest_ensure_response( $response );
|
||||
|
|
|
@ -715,7 +715,7 @@ class WP_REST_Widgets_Controller extends WP_REST_Controller {
|
|||
|
||||
if ( ! empty( $widget_object->widget_options['show_instance_in_rest'] ) ) {
|
||||
// Use new stdClass so that JSON result is {} and not [].
|
||||
$prepared['instance']['raw'] = empty( $instance ) ? new stdClass : $instance;
|
||||
$prepared['instance']['raw'] = empty( $instance ) ? new stdClass() : $instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1331,7 +1331,7 @@ function _get_random_header_data() {
|
|||
}
|
||||
|
||||
if ( empty( $headers ) ) {
|
||||
return new stdClass;
|
||||
return new stdClass();
|
||||
}
|
||||
|
||||
$_wp_random_header = (object) $headers[ array_rand( $headers ) ];
|
||||
|
|
|
@ -44,7 +44,7 @@ function wp_version_check( $extra_stats = array(), $force_check = false ) {
|
|||
}
|
||||
|
||||
if ( ! is_object( $current ) ) {
|
||||
$current = new stdClass;
|
||||
$current = new stdClass();
|
||||
$current->updates = array();
|
||||
$current->version_checked = $wp_version;
|
||||
}
|
||||
|
@ -327,10 +327,10 @@ function wp_update_plugins( $extra_stats = array() ) {
|
|||
$current = get_site_transient( 'update_plugins' );
|
||||
|
||||
if ( ! is_object( $current ) ) {
|
||||
$current = new stdClass;
|
||||
$current = new stdClass();
|
||||
}
|
||||
|
||||
$updates = new stdClass;
|
||||
$updates = new stdClass();
|
||||
$updates->last_checked = time();
|
||||
$updates->response = array();
|
||||
$updates->translations = array();
|
||||
|
@ -595,7 +595,7 @@ function wp_update_themes( $extra_stats = array() ) {
|
|||
$last_update = get_site_transient( 'update_themes' );
|
||||
|
||||
if ( ! is_object( $last_update ) ) {
|
||||
$last_update = new stdClass;
|
||||
$last_update = new stdClass();
|
||||
}
|
||||
|
||||
$themes = array();
|
||||
|
@ -734,7 +734,7 @@ function wp_update_themes( $extra_stats = array() ) {
|
|||
return;
|
||||
}
|
||||
|
||||
$new_update = new stdClass;
|
||||
$new_update = new stdClass();
|
||||
$new_update->last_checked = time();
|
||||
$new_update->checked = $checked;
|
||||
|
||||
|
@ -846,7 +846,7 @@ function wp_maybe_auto_update() {
|
|||
include_once ABSPATH . 'wp-admin/includes/admin.php';
|
||||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
|
||||
$upgrader = new WP_Automatic_Updater;
|
||||
$upgrader = new WP_Automatic_Updater();
|
||||
$upgrader->run();
|
||||
}
|
||||
|
||||
|
|
|
@ -951,7 +951,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
|
|||
|
||||
if ( ! is_multisite() ) {
|
||||
$site_id = get_current_blog_id();
|
||||
$sites = array( $site_id => new stdClass );
|
||||
$sites = array( $site_id => new stdClass() );
|
||||
$sites[ $site_id ]->userblog_id = $site_id;
|
||||
$sites[ $site_id ]->blogname = get_option( 'blogname' );
|
||||
$sites[ $site_id ]->domain = '';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-alpha-54890';
|
||||
$wp_version = '6.2-alpha-54891';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
|
@ -81,7 +81,7 @@ $post_default_title = '';
|
|||
* @param string $class The name of the XML-RPC server class.
|
||||
*/
|
||||
$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
|
||||
$wp_xmlrpc_server = new $wp_xmlrpc_server_class;
|
||||
$wp_xmlrpc_server = new $wp_xmlrpc_server_class();
|
||||
|
||||
// Fire off the request.
|
||||
$wp_xmlrpc_server->serve_request();
|
||||
|
|
Loading…
Reference in New Issue