`if` is a statment, not a function.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32800 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-06-16 20:00:15 +00:00
parent 9cf3adb204
commit 296c559baf
23 changed files with 41 additions and 41 deletions

View File

@ -472,7 +472,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$out = '';
if( $primary === $column_name ) {
if ( $primary === $column_name ) {
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );

View File

@ -286,7 +286,7 @@ class WP_Links_List_Table extends WP_List_Table {
* @return string Row action output for links.
*/
protected function handle_row_actions( $link, $column_name, $primary ) {
if( $primary === $column_name ) {
if ( $primary === $column_name ) {
$edit_link = get_edit_bookmark_link( $link );
$actions = array();

View File

@ -634,7 +634,7 @@ class WP_List_Table {
public function get_pagenum() {
$pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
if( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] )
$pagenum = $this->_pagination_args['total_pages'];
return max( 1, $pagenum );

View File

@ -633,7 +633,7 @@ class WP_Media_List_Table extends WP_List_Table {
* @return string Row action output for links.
*/
protected function handle_row_actions( $link, $column_name, $primary ) {
if( $primary === $column_name ) {
if ( $primary === $column_name ) {
return $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
}
}

View File

@ -1045,7 +1045,7 @@ class WP_Press_This {
if ( ! empty( $data['t'] ) ) {
$title = $data['t'];
} elseif( ! empty( $data['_meta'] ) ) {
} elseif ( ! empty( $data['_meta'] ) ) {
if ( ! empty( $data['_meta']['twitter:title'] ) ) {
$title = $data['_meta']['twitter:title'];
} else if ( ! empty( $data['_meta']['og:title'] ) ) {

View File

@ -572,9 +572,9 @@ class WP_User_Search {
function do_paging() {
if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
$args = array();
if( ! empty($this->search_term) )
if ( ! empty($this->search_term) )
$args['usersearch'] = urlencode($this->search_term);
if( ! empty($this->role) )
if ( ! empty($this->role) )
$args['role'] = urlencode($this->role);
$this->paging_text = paginate_links( array(

View File

@ -139,7 +139,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
</dl>
<div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?>">
<?php if( 'custom' == $item->type ) : ?>
<?php if ( 'custom' == $item->type ) : ?>
<p class="field-url description description-wide">
<label for="edit-menu-item-url-<?php echo $item_id; ?>">
<?php _e( 'URL' ); ?><br />
@ -197,7 +197,7 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
</p>
<div class="menu-item-actions description-wide submitbox">
<?php if( 'custom' != $item->type && $original_title !== false ) : ?>
<?php if ( 'custom' != $item->type && $original_title !== false ) : ?>
<p class="link-to-original">
<?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
</p>
@ -459,7 +459,7 @@ function wp_nav_menu_setup() {
add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
// If first time editing, disable advanced items by default.
if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
$user = wp_get_current_user();
update_user_option($user->ID, 'managenav-menuscolumnshidden',
array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', 4 => 'title-attribute', ),
@ -1180,7 +1180,7 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
$result .= '<p>' . __( 'Add menu items from the column on the left.' ) . '</p>';
$result .= '</div>';
if( empty($menu_items) )
if ( empty($menu_items) )
return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
/**

View File

@ -1318,7 +1318,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
}
if ( isset( $view_post ) ) {
if( 'draft' == $post->post_status ) {
if ( 'draft' == $post->post_status ) {
$preview_link = set_url_scheme( get_permalink( $post->ID ) );
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );

View File

@ -58,7 +58,7 @@ function network_domain_check() {
*/
function allow_subdomain_install() {
$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
if( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) )
if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) )
return false;
return true;

View File

@ -504,7 +504,7 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
&& ( $post_type_object->public )
&& ( $post_type_object->show_in_admin_bar ) )
{
if( 'draft' == $post->post_status ) {
if ( 'draft' == $post->post_status ) {
$preview_link = set_url_scheme( get_permalink( $post->ID ) );
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );

View File

@ -136,7 +136,7 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
try {
$this->image = new Imagick( $this->file );
if( ! $this->image->valid() )
if ( ! $this->image->valid() )
return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
// Select the first frame to handle animated images properly

View File

@ -348,7 +348,7 @@ abstract class WP_Image_Editor {
$info = pathinfo( $filename );
$dir = $info['dirname'];
if( isset( $info['extension'] ) )
if ( isset( $info['extension'] ) )
$ext = $info['extension'];
$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";

View File

@ -3962,12 +3962,12 @@ class wp_xmlrpc_server extends IXR_Server {
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
do_action( 'xmlrpc_call', 'wp.getPostType' );
if( ! post_type_exists( $post_type_name ) )
if ( ! post_type_exists( $post_type_name ) )
return new IXR_Error( 403, __( 'Invalid post type' ) );
$post_type = get_post_type_object( $post_type_name );
if( ! current_user_can( $post_type->cap->edit_posts ) )
if ( ! current_user_can( $post_type->cap->edit_posts ) )
return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );
return $this->_prepare_post_type( $post_type, $fields );
@ -4019,7 +4019,7 @@ class wp_xmlrpc_server extends IXR_Server {
$struct = array();
foreach( $post_types as $post_type ) {
if( ! current_user_can( $post_type->cap->edit_posts ) )
if ( ! current_user_can( $post_type->cap->edit_posts ) )
continue;
$struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields );

View File

@ -17,7 +17,7 @@ function wp_initial_constants() {
// set memory limits
if ( !defined('WP_MEMORY_LIMIT') ) {
if( is_multisite() ) {
if ( is_multisite() ) {
define('WP_MEMORY_LIMIT', '64M');
} else {
define('WP_MEMORY_LIMIT', '40M');

View File

@ -43,7 +43,7 @@ do_action( 'rss_tag_pre', 'atom-comments' );
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
<id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id>
<?php } elseif(is_search()) { ?>
<?php } elseif (is_search()) { ?>
<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>

View File

@ -109,7 +109,7 @@ function get_last_build_date_feed() {
$postids = implode( "','", $post_ids );
$max_post_time = max( $post_times );
if( $wp_query->is_comment_feed() ) {
if ( $wp_query->is_comment_feed() ) {
$max_comment_time = $wpdb->get_var( $wpdb->prepare( "SELECT MAX(comment_date_gmt) FROM $wpdb->comments WHERE comment_post_ID IN ('%s') AND comment_approved = '1'", $postids ) );
return max( $max_post_time, $max_comment_time );

View File

@ -1582,7 +1582,7 @@ function force_balance_tags( $text ) {
if ( isset($regex[1][0]) && '/' == $regex[1][0] ) { // End Tag
$tag = strtolower(substr($regex[1],1));
// if too many closing tags
if( $stacksize <= 0 ) {
if ( $stacksize <= 0 ) {
$tag = '';
// or close to be safe $tag = '/' . $tag;
}
@ -1637,7 +1637,7 @@ function force_balance_tags( $text ) {
// Attributes
$attributes = $regex[2];
if( ! empty( $attributes ) && $attributes[0] != '>' )
if ( ! empty( $attributes ) && $attributes[0] != '>' )
$attributes = ' ' . $attributes;
$tag = '<' . $tag . $attributes . '>';
@ -2742,7 +2742,7 @@ function ent2ncr( $text ) {
* @param string $text The text prior to entity conversion.
*/
$filtered = apply_filters( 'pre_ent2ncr', null, $text );
if( null !== $filtered )
if ( null !== $filtered )
return $filtered;
$to_ncr = array(

View File

@ -1484,7 +1484,7 @@ function wp_mkdir_p( $target ) {
$wrapper = null;
// Strip the protocol.
if( wp_is_stream( $target ) ) {
if ( wp_is_stream( $target ) ) {
list( $wrapper, $target ) = explode( '://', $target, 2 );
}
@ -1492,7 +1492,7 @@ function wp_mkdir_p( $target ) {
$target = str_replace( '//', '/', $target );
// Put the wrapper back on the target.
if( $wrapper !== null ) {
if ( $wrapper !== null ) {
$target = $wrapper . '://' . $target;
}

View File

@ -11,7 +11,7 @@
define( 'SHORTINIT', true );
require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
if( !is_multisite() )
if ( !is_multisite() )
die( 'Multisite support not enabled' );
ms_file_constants();
@ -30,10 +30,10 @@ if ( !is_file( $file ) ) {
}
$mime = wp_check_filetype( $file );
if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
if ( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
$mime[ 'type' ] = mime_content_type( $file );
if( $mime[ 'type' ] )
if ( $mime[ 'type' ] )
$mimetype = $mime[ 'type' ];
else
$mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );
@ -60,7 +60,7 @@ header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' );
// Support for Conditional GET - use stripslashes to avoid formatting.php dependency
$client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false;
if( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
if ( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = false;
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );

View File

@ -1863,7 +1863,7 @@ function global_terms( $term_id, $deprecated = '' ) {
clean_term_cache($term_id);
}
if( $recurse_start )
if ( $recurse_start )
$global_terms_recurse = null;
return $global_id;

View File

@ -409,7 +409,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
try {
// Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
$recipient_name = '';
if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
if ( count( $matches ) == 3 ) {
$recipient_name = $matches[1];
$recipient = $matches[2];
@ -431,7 +431,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
try {
// Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
$recipient_name = '';
if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
if ( count( $matches ) == 3 ) {
$recipient_name = $matches[1];
$recipient = $matches[2];
@ -449,7 +449,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
try {
// Break $recipient into name and address parts if in the format "Foo <bar@baz.com>"
$recipient_name = '';
if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
if ( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
if ( count( $matches ) == 3 ) {
$recipient_name = $matches[1];
$recipient = $matches[2];

View File

@ -3294,7 +3294,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) ) {
$post_status = 'future';
}
} elseif( 'future' == $post_status ) {
} elseif ( 'future' == $post_status ) {
$now = gmdate('Y-m-d H:i:59');
if ( mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false) ) {
$post_status = 'publish';

View File

@ -150,7 +150,7 @@ function wp_save_post_revision( $post_id ) {
$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
//don't save revision if post unchanged
if( ! $post_has_changed ) {
if ( ! $post_has_changed ) {
return;
}
}