Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/wp-admin/includes/class-wp-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,7 @@ function get_cli_args( $param, $required = false ) {
$parts = explode( '=', $match[1] );
$key = preg_replace( '/[^a-z0-9]+/', '', $parts[0] );

if ( isset( $parts[1] ) ) {
$out[ $key ] = $parts[1];
} else {
$out[ $key ] = true;
}
$out[ $key ] = $parts[1] ?? true;

$last_arg = $key;
} elseif ( (bool) preg_match( '/^-([a-zA-Z0-9]+)/', $args[ $i ], $match ) ) {
Expand Down
6 changes: 1 addition & 5 deletions src/wp-admin/includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ function _wp_translate_postdata( $update = false, $post_data = null ) {
$post_data['post_status'] = 'pending';
}

if ( isset( $post_data['ID'] ) ) {
$post_id = $post_data['ID'];
} else {
$post_id = false;
}
$post_id = $post_data['ID'] ?? false;
$previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false;

if ( isset( $post_data['post_status'] ) && 'private' === $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) {
Expand Down
7 changes: 1 addition & 6 deletions src/wp-admin/includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -2296,12 +2296,7 @@ function _post_states( $post, $display = true ) {
*/
function get_post_states( $post ) {
$post_states = array();

if ( isset( $_REQUEST['post_status'] ) ) {
$post_status = $_REQUEST['post_status'];
} else {
$post_status = '';
}
$post_status = $_REQUEST['post_status'] ?? '';

if ( ! empty( $post->post_password ) ) {
$post_states['protected'] = _x( 'Password protected', 'post status' );
Expand Down
6 changes: 1 addition & 5 deletions src/wp-admin/includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,7 @@ function get_theme_feature_list( $api = true ) {
$wporg_features[ $feature_category ] = array();

foreach ( $feature_items as $feature ) {
if ( isset( $features[ $feature_category ][ $feature ] ) ) {
$wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ];
} else {
$wporg_features[ $feature_category ][ $feature ] = $feature;
}
$wporg_features[ $feature_category ][ $feature ] = $features[ $feature_category ][ $feature ] ?? $feature;
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/wp-admin/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@

delete_site_transient( 'update_core' );

if ( isset( $_GET['step'] ) ) {
$step = $_GET['step'];
} else {
$step = 0;
}
$step = $_GET['step'] ?? 0;

// Do it. No output.
if ( 'upgrade_db' === $step ) {
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/class-wp-date-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,7 @@ public function sanitize_query( $queries, $parent_query = null ) {
continue;
}

if ( isset( $parent_query[ $dkey ] ) ) {
$queries[ $dkey ] = $parent_query[ $dkey ];
} else {
$queries[ $dkey ] = $dvalue;
}
$queries[ $dkey ] = $parent_query[ $dkey ] ?? $dvalue;
}

// Validate the dates passed in the query.
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/class-wp-http-streams.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ public function request( $url, $args = array() ) {
}

if ( isset( $parsed_args['headers']['Host'] ) || isset( $parsed_args['headers']['host'] ) ) {
if ( isset( $parsed_args['headers']['Host'] ) ) {
$parsed_url['host'] = $parsed_args['headers']['Host'];
} else {
$parsed_url['host'] = $parsed_args['headers']['host'];
}
$parsed_url['host'] = $parsed_args['headers']['Host'] ?? $parsed_args['headers']['host'];
unset( $parsed_args['headers']['Host'], $parsed_args['headers']['host'] );
}

Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/class-wp-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,7 @@ public function set_props( $args ) {
$args['rewrite']['feeds'] = (bool) $args['has_archive'];
}
if ( ! isset( $args['rewrite']['ep_mask'] ) ) {
if ( isset( $args['permalink_epmask'] ) ) {
$args['rewrite']['ep_mask'] = $args['permalink_epmask'];
} else {
$args['rewrite']['ep_mask'] = EP_PERMALINK;
}
$args['rewrite']['ep_mask'] = $args['permalink_epmask'] ?? EP_PERMALINK;
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/class-wp-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,7 @@ public function do_item( $handle, $group = false ) {
}
}

if ( isset( $obj->args ) ) {
$media = $obj->args;
} else {
$media = 'all';
}
$media = $obj->args ?? 'all';

// A single item may alias a set of items, by having dependencies, but no source.
if ( ! $src ) {
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/class-wp-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -3673,11 +3673,7 @@ public function wp_getComments( $args ) {
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getComments', $args, $this );

if ( isset( $struct['status'] ) ) {
$status = $struct['status'];
} else {
$status = '';
}
$status = $struct['status'] ?? '';

if ( ! current_user_can( 'moderate_comments' ) && 'approve' !== $status ) {
return new IXR_Error( 401, __( 'Invalid comment status.' ) );
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1873,11 +1873,7 @@ function get_the_post_type_description() {
$post_type_obj = get_post_type_object( $post_type );

// Check if a description is set.
if ( isset( $post_type_obj->description ) ) {
$description = $post_type_obj->description;
} else {
$description = '';
}
$description = $post_type_obj->description ?? '';

/**
* Filters the description for a post type archive.
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -6036,11 +6036,7 @@ function wp_get_loading_optimization_attributes( $tag_name, $attr, $context ) {
* conflicting `decoding` attribute already present.
*/
if ( 'img' === $tag_name ) {
if ( isset( $attr['decoding'] ) ) {
$loading_attrs['decoding'] = $attr['decoding'];
} else {
$loading_attrs['decoding'] = 'async';
}
$loading_attrs['decoding'] = $attr['decoding'] ?? 'async';
}

// For any resources, width and height must be provided, to avoid layout shifts.
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,11 +674,7 @@ function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = fal

if ( ! $meta_cache ) {
$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
if ( isset( $meta_cache[ $object_id ] ) ) {
$meta_cache = $meta_cache[ $object_id ];
} else {
$meta_cache = null;
}
$meta_cache = $meta_cache[ $object_id ] ?? null;
}

if ( ! $meta_key ) {
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/rest-api/class-wp-rest-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,7 @@ public function serve_request( $path = null ) {
}

if ( empty( $path ) ) {
if ( isset( $_SERVER['PATH_INFO'] ) ) {
$path = $_SERVER['PATH_INFO'];
} else {
$path = '/';
}
$path = $_SERVER['PATH_INFO'] ?? '/';
}

$request = new WP_REST_Request( $_SERVER['REQUEST_METHOD'], $path );
Expand Down
17 changes: 6 additions & 11 deletions src/wp-includes/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -1529,17 +1529,12 @@ function get_uploaded_header_images() {
$header_data = wp_get_attachment_metadata( $header->ID );
$header_index = $header->ID;

$header_images[ $header_index ] = array();
$header_images[ $header_index ]['attachment_id'] = $header->ID;
$header_images[ $header_index ]['url'] = $url;
$header_images[ $header_index ]['thumbnail_url'] = $url;
$header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );

if ( isset( $header_data['attachment_parent'] ) ) {
$header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'];
} else {
$header_images[ $header_index ]['attachment_parent'] = '';
}
$header_images[ $header_index ] = array();
$header_images[ $header_index ]['attachment_id'] = $header->ID;
$header_images[ $header_index ]['url'] = $url;
$header_images[ $header_index ]['thumbnail_url'] = $url;
$header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
$header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'] ?? '';

if ( isset( $header_data['width'] ) ) {
$header_images[ $header_index ]['width'] = $header_data['width'];
Expand Down
Loading