`foreach` is a statement, not a function.

See #33491.

Built from https://develop.svn.wordpress.org/trunk@33734


git-svn-id: http://core.svn.wordpress.org/trunk@33702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-08-25 20:28:22 +00:00
parent c2a0336d22
commit ef87172270
47 changed files with 98 additions and 98 deletions

View File

@ -92,7 +92,7 @@ if ( $doaction ) {
case 'trash':
$trashed = $locked = 0;
foreach( (array) $post_ids as $post_id ) {
foreach ( (array) $post_ids as $post_id ) {
if ( !current_user_can( 'delete_post', $post_id) )
wp_die( __('You are not allowed to move this item to the Trash.') );
@ -111,7 +111,7 @@ if ( $doaction ) {
break;
case 'untrash':
$untrashed = 0;
foreach( (array) $post_ids as $post_id ) {
foreach ( (array) $post_ids as $post_id ) {
if ( !current_user_can( 'delete_post', $post_id) )
wp_die( __('You are not allowed to restore this item from the Trash.') );
@ -124,7 +124,7 @@ if ( $doaction ) {
break;
case 'delete':
$deleted = 0;
foreach( (array) $post_ids as $post_id ) {
foreach ( (array) $post_ids as $post_id ) {
$post_del = get_post($post_id);
if ( !current_user_can( 'delete_post', $post_id ) )

View File

@ -868,7 +868,7 @@ class WP_List_Table {
// We need a primary defined so responsive views show something,
// so let's fall back to the first non-checkbox column.
foreach( $columns as $col => $column_name ) {
foreach ( $columns as $col => $column_name ) {
if ( 'cb' === $col ) {
continue;
}

View File

@ -984,7 +984,7 @@ class WP_Press_This {
}
if ( ! empty( $data['_embeds'] ) ) {
foreach( $data['_embeds'] as $src ) {
foreach ( $data['_embeds'] as $src ) {
$prot_relative_src = preg_replace( '/^https?:/', '', $src );
if ( in_array( $prot_relative_src, $this->embeds ) ) {
@ -1012,7 +1012,7 @@ class WP_Press_This {
$selected_images = array();
if ( ! empty( $data['_images'] ) ) {
foreach( $data['_images'] as $src ) {
foreach ( $data['_images'] as $src ) {
if ( false !== strpos( $src, 'gravatar.com' ) ) {
$src = preg_replace( '%http://[\d]+\.gravatar\.com/%', 'https://secure.gravatar.com/', $src );
}

View File

@ -1069,7 +1069,7 @@ function wp_dashboard_primary() {
* @param array $feeds Array of RSS feeds.
*/
function wp_dashboard_primary_output( $widget_id, $feeds ) {
foreach( $feeds as $type => $args ) {
foreach ( $feeds as $type => $args ) {
$args['type'] = $type;
echo '<div class="rss-widget">';
if ( $type === 'plugins' ) {

View File

@ -1239,7 +1239,7 @@ function get_attachment_fields_to_edit($post, $errors = null) {
}
// Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
// The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
// The recursive merge is easily traversed with array casting: foreach ( (array) $things as $thing )
$form_fields = array_merge_recursive($form_fields, (array) $errors);
// This was formerly in image_attachment_fields_to_edit().
@ -1627,7 +1627,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
}
// Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
// The recursive merge is easily traversed with array casting: foreach( (array) $things as $thing )
// The recursive merge is easily traversed with array casting: foreach ( (array) $things as $thing )
$form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
/** This filter is documented in wp-admin/includes/media.php */

View File

@ -158,7 +158,7 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
}
$stack = array_reverse( $stack ); // Last added dirs are deepest
foreach( (array) $stack as $dir ) {
foreach ( (array) $stack as $dir ) {
if ( $dir != $top_dir)
@rmdir( $dir );
}
@ -802,7 +802,7 @@ function choose_primary_blog() {
$found = false;
?>
<select name="primary_blog" id="primary_blog">
<?php foreach( (array) $all_blogs as $blog ) {
<?php foreach ( (array) $all_blogs as $blog ) {
if ( $primary_blog == $blog->userblog_id )
$found = true;
?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php

View File

@ -426,7 +426,7 @@ function _wp_ajax_menu_quick_search( $request = array() ) {
));
if ( empty( $terms ) || is_wp_error( $terms ) )
return;
foreach( (array) $terms as $term ) {
foreach ( (array) $terms as $term ) {
if ( 'markup' == $response_format ) {
echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
} elseif ( 'json' == $response_format ) {
@ -1081,7 +1081,7 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) {
// Loop through all the menu items' POST values.
foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
foreach ( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
if (
// Checkbox is not checked.
empty( $_item_object_data['menu-item-object-id'] ) &&
@ -1214,7 +1214,7 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
return new WP_Error( 'menu_walker_not_exist', sprintf( __('The Walker class named <strong>%s</strong> does not exist.'), $walker_class_name ) );
$some_pending_menu_items = $some_invalid_menu_items = false;
foreach( (array) $menu_items as $menu_item ) {
foreach ( (array) $menu_items as $menu_item ) {
if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status )
$some_pending_menu_items = true;
if ( ! empty( $menu_item->_invalid ) )
@ -1271,7 +1271,7 @@ function _wp_delete_orphaned_draft_menu_items() {
// Delete orphaned draft menu items.
$menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
foreach( (array) $menu_items_to_delete as $menu_item_id )
foreach ( (array) $menu_items_to_delete as $menu_item_id )
wp_delete_post( $menu_item_id, true );
}
@ -1302,7 +1302,7 @@ function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_select
wp_defer_term_counting( true );
// Loop through all the menu items' POST variables
if ( ! empty( $_POST['menu-item-db-id'] ) ) {
foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
// Menu item title can't be blank
if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] )

View File

@ -497,7 +497,7 @@ function install_plugin_information() {
<?php }
if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
foreach( $api->ratings as $key => $ratecount ) {
foreach ( $api->ratings as $key => $ratecount ) {
// Avoid div-by-zero.
$_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
?>

View File

@ -765,7 +765,7 @@ function delete_plugins( $plugins, $deprecated = '' ) {
return false;
$checked = array();
foreach( $plugins as $plugin )
foreach ( $plugins as $plugin )
$checked[] = 'checked[]=' . $plugin;
ob_start();
@ -813,7 +813,7 @@ function delete_plugins( $plugins, $deprecated = '' ) {
$errors = array();
foreach( $plugins as $plugin_file ) {
foreach ( $plugins as $plugin_file ) {
// Run Uninstall hook.
if ( is_uninstallable_plugin( $plugin_file ) ) {
uninstall_plugin($plugin_file);

View File

@ -371,7 +371,7 @@ function edit_post( $post_data = null ) {
if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) {
$fields = array( 'post_title', 'post_content', 'post_excerpt' );
foreach( $fields as $field ) {
foreach ( $fields as $field ) {
if ( isset( $post_data[ $field ] ) ) {
$post_data[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $post_data[ $field ] );
}
@ -1123,7 +1123,7 @@ function wp_edit_attachments_query_vars( $q = false ) {
unset($q['post_mime_type']);
}
foreach( array_keys( $post_mime_types ) as $type ) {
foreach ( array_keys( $post_mime_types ) as $type ) {
if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" == $q['attachment-filter'] ) {
$q['post_mime_type'] = $type;
break;

View File

@ -256,7 +256,7 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) {
$checked_categories = array();
$keys = array_keys( $categories );
foreach( $keys as $k ) {
foreach ( $keys as $k ) {
if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
$checked_categories[] = $categories[$k];
unset( $categories[$k] );

View File

@ -881,7 +881,7 @@ function update_core($from, $to) {
if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) )
$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2
if ( is_array( $checksums ) ) {
foreach( $checksums as $file => $checksum ) {
foreach ( $checksums as $file => $checksum ) {
if ( 'wp-content' == substr( $file, 0, 10 ) )
continue;
if ( ! file_exists( ABSPATH . $file ) )

View File

@ -288,7 +288,7 @@ function wp_plugin_update_rows() {
$plugins = get_site_transient( 'update_plugins' );
if ( isset($plugins->response) && is_array($plugins->response) ) {
$plugins = array_keys( $plugins->response );
foreach( $plugins as $plugin_file ) {
foreach ( $plugins as $plugin_file ) {
add_action( "after_plugin_row_$plugin_file", 'wp_plugin_update_row', 10, 2 );
}
}
@ -401,7 +401,7 @@ function wp_theme_update_rows() {
if ( isset($themes->response) && is_array($themes->response) ) {
$themes = array_keys( $themes->response );
foreach( $themes as $theme ) {
foreach ( $themes as $theme ) {
add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 );
}
}

View File

@ -559,7 +559,7 @@ function upgrade_100() {
// Get the title and ID of every post, post_name to check if it already has a value
$posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
if ($posts) {
foreach($posts as $post) {
foreach ($posts as $post) {
if ('' == $post->post_name) {
$newtitle = sanitize_title($post->post_title);
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );
@ -699,7 +699,7 @@ function upgrade_130() {
// Remove extraneous backslashes.
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
if ($posts) {
foreach($posts as $post) {
foreach ($posts as $post) {
$post_content = addslashes(deslash($post->post_content));
$post_title = addslashes(deslash($post->post_title));
$post_excerpt = addslashes(deslash($post->post_excerpt));
@ -716,7 +716,7 @@ function upgrade_130() {
// Remove extraneous backslashes.
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
if ($comments) {
foreach($comments as $comment) {
foreach ($comments as $comment) {
$comment_content = deslash($comment->comment_content);
$comment_author = deslash($comment->comment_author);
@ -727,7 +727,7 @@ function upgrade_130() {
// Remove extraneous backslashes.
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
if ($links) {
foreach($links as $link) {
foreach ($links as $link) {
$link_name = deslash($link->link_name);
$link_description = deslash($link->link_description);
@ -1205,7 +1205,7 @@ function upgrade_280() {
if ( is_multisite() ) {
$start = 0;
while( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) {
foreach( $rows as $row ) {
foreach ( $rows as $row ) {
$value = $row->option_value;
if ( !@unserialize( $value ) )
$value = stripslashes( $value );
@ -1639,7 +1639,7 @@ function upgrade_network() {
$start = 0;
while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
foreach( $rows as $row ) {
foreach ( $rows as $row ) {
$value = $row->meta_value;
if ( !@unserialize( $value ) )
$value = stripslashes( $value );
@ -1721,7 +1721,7 @@ function upgrade_network() {
if ( wp_should_upgrade_global_tables() ) {
$upgrade = false;
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
foreach( $indexes as $index ) {
foreach ( $indexes as $index ) {
if ( 'domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part ) {
$upgrade = true;
break;
@ -2025,7 +2025,7 @@ function dbDelta( $queries = '', $execute = true ) {
$for_update = array();
// Create a tablename index for an array ($cqueries) of queries
foreach($queries as $qry) {
foreach ($queries as $qry) {
if ( preg_match( "|CREATE TABLE ([^ ]*)|", $qry, $matches ) ) {
$cqueries[ trim( $matches[1], '`' ) ] = $qry;
$for_update[$matches[1]] = 'Created table '.$matches[1];
@ -2214,7 +2214,7 @@ function dbDelta( $queries = '', $execute = true ) {
"$index_string ($alt_index_columns)",
);
foreach( $index_strings as $index_string ) {
foreach ( $index_strings as $index_string ) {
if ( ! ( ( $aindex = array_search( $index_string, $indices ) ) === false ) ) {
unset( $indices[ $aindex ] );
break;
@ -2265,7 +2265,7 @@ function dbDelta( $queries = '', $execute = true ) {
function make_db_current( $tables = 'all' ) {
$alterations = dbDelta( $tables );
echo "<ol>\n";
foreach($alterations as $alteration) echo "<li>$alteration</li>\n";
foreach ($alterations as $alteration) echo "<li>$alteration</li>\n";
echo "</ol>\n";
}

View File

@ -135,7 +135,7 @@ $out = '';
$wp_scripts = new WP_Scripts();
wp_default_scripts($wp_scripts);
foreach( $load as $handle ) {
foreach ( $load as $handle ) {
if ( !array_key_exists($handle, $wp_scripts->registered) )
continue;

View File

@ -115,7 +115,7 @@ $out = '';
$wp_styles = new WP_Styles();
wp_default_styles($wp_styles);
foreach( $load as $handle ) {
foreach ( $load as $handle ) {
if ( !array_key_exists($handle, $wp_styles->registered) )
continue;

View File

@ -67,7 +67,7 @@ switch ( $action ) {
// Set up the data we need in one pass through the array of menu items.
$dbids_to_orders = array();
$orders_to_dbids = array();
foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) {
if ( isset( $ordered_menu_item_object->ID ) ) {
if ( isset( $ordered_menu_item_object->menu_order ) ) {
$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
@ -140,7 +140,7 @@ switch ( $action ) {
// Set up the data we need in one pass through the array of menu items.
$dbids_to_orders = array();
$orders_to_dbids = array();
foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
foreach ( (array) $ordered_menu_items as $ordered_menu_item_object ) {
if ( isset( $ordered_menu_item_object->ID ) ) {
if ( isset( $ordered_menu_item_object->menu_order ) ) {
$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
@ -460,7 +460,7 @@ if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
}
// Generate truncated menu names.
foreach( (array) $nav_menus as $key => $_nav_menu ) {
foreach ( (array) $nav_menus as $key => $_nav_menu ) {
$nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' );
}
@ -588,7 +588,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
</h2>
<?php
foreach( $messages as $message ) :
foreach ( $messages as $message ) :
echo $message . "\n";
endforeach;
?>
@ -668,7 +668,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<?php if ( $add_new_screen ) : ?>
<option value="0" selected="selected"><?php _e( '&mdash; Select &mdash;' ); ?></option>
<?php endif; ?>
<?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
<?php foreach ( (array) $nav_menus as $_nav_menu ) : ?>
<option value="<?php echo esc_attr( $_nav_menu->term_id ); ?>" <?php selected( $_nav_menu->term_id, $nav_menu_selected_id ); ?>>
<?php
echo esc_html( $_nav_menu->truncated_name ) ;

View File

@ -96,7 +96,7 @@ if ( $action ) {
$themes = (array) $_POST['checked'];
$action = 'enabled';
$n = count( $themes );
foreach( (array) $themes as $theme )
foreach ( (array) $themes as $theme )
$allowed_themes[ $theme ] = true;
} else {
$action = 'error';
@ -109,7 +109,7 @@ if ( $action ) {
$themes = (array) $_POST['checked'];
$action = 'disabled';
$n = count( $themes );
foreach( (array) $themes as $theme )
foreach ( (array) $themes as $theme )
unset( $allowed_themes[ $theme ] );
} else {
$action = 'error';

View File

@ -53,7 +53,7 @@ if ( $action ) {
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
exit;
}
foreach( (array) $themes as $theme )
foreach ( (array) $themes as $theme )
$allowed_themes[ $theme ] = true;
update_site_option( 'allowedthemes', $allowed_themes );
wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) );
@ -65,7 +65,7 @@ if ( $action ) {
wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
exit;
}
foreach( (array) $themes as $theme )
foreach ( (array) $themes as $theme )
unset( $allowed_themes[ $theme ] );
update_site_option( 'allowedthemes', $allowed_themes );
wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) );

View File

@ -231,7 +231,7 @@ if ( isset( $_GET['action'] ) ) {
}
$i = 0;
if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) )
foreach( $_POST['user'] as $id ) {
foreach ( $_POST['user'] as $id ) {
if ( ! current_user_can( 'delete_user', $id ) )
continue;
wpmu_delete_user( $id );

View File

@ -265,7 +265,7 @@ if ( $action ) {
// Get plugins list from that folder.
if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
foreach( $folder_plugins as $plugin_file => $data ) {
foreach ( $folder_plugins as $plugin_file => $data ) {
$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
if ( ! $plugin_info[ $plugin_file ]['Network'] ) {

View File

@ -309,7 +309,7 @@ switch($step) {
<p><?php _e( "Sorry, but I can&#8217;t write the <code>wp-config.php</code> file." ); ?></p>
<p><?php _e( 'You can create the <code>wp-config.php</code> manually and paste the following text into it.' ); ?></p>
<textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php
foreach( $config_file as $line ) {
foreach ( $config_file as $line ) {
echo htmlentities($line, ENT_COMPAT, 'UTF-8');
}
?></textarea>
@ -336,7 +336,7 @@ if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
$handle = fopen( $path_to_wp_config, 'w' );
foreach( $config_file as $line ) {
foreach ( $config_file as $line ) {
fwrite( $handle, $line );
}
fclose( $handle );

View File

@ -135,7 +135,7 @@ function dismissed_updates() {
<?php
echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
echo '<ul id="dismissed-updates" class="core-updates dismissed">';
foreach( (array) $dismissed as $update) {
foreach ( (array) $dismissed as $update) {
echo '<li>';
list_core_update( $update );
echo '</li>';
@ -197,7 +197,7 @@ function core_upgrade_preamble() {
}
echo '<ul class="core-updates">';
foreach( (array) $updates as $update ) {
foreach ( (array) $updates as $update ) {
echo '<li>';
list_core_update( $update );
echo '</li>';

View File

@ -405,7 +405,7 @@ class WP_oEmbed {
*/
$provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );
foreach( array( 'json', 'xml' ) as $format ) {
foreach ( array( 'json', 'xml' ) as $format ) {
$result = $this->_fetch_with_format( $provider, $format );
if ( is_wp_error( $result ) && 'not-implemented' == $result->get_error_code() )
continue;

View File

@ -386,7 +386,7 @@ class WP_Customize_Control {
* @access public
*/
public function input_attrs() {
foreach( $this->input_attrs as $attr => $value ) {
foreach ( $this->input_attrs as $attr => $value ) {
echo $attr . '="' . esc_attr( $value ) . '" ';
}
}

View File

@ -272,7 +272,7 @@ class WP_Embed {
if ( empty($post_metas) )
return;
foreach( $post_metas as $post_meta_key ) {
foreach ( $post_metas as $post_meta_key ) {
if ( '_oembed_' == substr( $post_meta_key, 0, 8 ) )
delete_post_meta( $post_ID, $post_meta_key );
}

View File

@ -460,7 +460,7 @@ abstract class WP_Image_Editor {
$mime_types = wp_get_mime_types();
$extensions = array_keys( $mime_types );
foreach( $extensions as $_extension ) {
foreach ( $extensions as $_extension ) {
if ( preg_match( "/{$extension}/i", $_extension ) ) {
return $mime_types[$_extension];
}

View File

@ -148,7 +148,7 @@ class Walker {
// descend only when the depth is right and there are childrens for this element
if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
foreach( $children_elements[ $id ] as $child ){
foreach ( $children_elements[ $id ] as $child ){
if ( !isset($newlevel) ) {
$newlevel = true;
@ -250,7 +250,7 @@ class Walker {
if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
$empty_array = array();
foreach ( $children_elements as $orphans )
foreach( $orphans as $op )
foreach ( $orphans as $op )
$this->display_element( $op, $empty_array, 1, 0, $args, $output );
}
@ -374,7 +374,7 @@ class Walker {
if ( $end >= $total_top && count( $children_elements ) > 0 ) {
$empty_array = array();
foreach ( $children_elements as $orphans )
foreach( $orphans as $op )
foreach ( $orphans as $op )
$this->display_element( $op, $empty_array, 1, 0, $args, $output );
}

View File

@ -2948,7 +2948,7 @@ class wp_xmlrpc_server extends IXR_Server {
$tags = array();
if ( $all_tags = get_tags() ) {
foreach( (array) $all_tags as $tag ) {
foreach ( (array) $all_tags as $tag ) {
$struct = array();
$struct['tag_id'] = $tag->term_id;
$struct['name'] = $tag->name;
@ -4048,7 +4048,7 @@ class wp_xmlrpc_server extends IXR_Server {
$struct = array();
foreach( $post_types as $post_type ) {
foreach ( $post_types as $post_type ) {
if ( ! current_user_can( $post_type->cap->edit_posts ) )
continue;
@ -5367,7 +5367,7 @@ class wp_xmlrpc_server extends IXR_Server {
$categories = array();
$catids = wp_get_post_categories($post_ID);
foreach($catids as $catid)
foreach ($catids as $catid)
$categories[] = get_cat_name($catid);
$tagnames = array();
@ -5506,7 +5506,7 @@ class wp_xmlrpc_server extends IXR_Server {
$categories = array();
$catids = wp_get_post_categories($entry['ID']);
foreach( $catids as $catid )
foreach ( $catids as $catid )
$categories[] = get_cat_name($catid);
$tagnames = array();

View File

@ -445,7 +445,7 @@ class WP {
}
}
foreach( (array) $headers as $name => $field_value )
foreach ( (array) $headers as $name => $field_value )
@header("{$name}: {$field_value}");
if ( $exit_required )

View File

@ -96,7 +96,7 @@ class WP_Dependencies {
$handles = false === $handles ? $this->queue : (array) $handles;
$this->all_deps( $handles );
foreach( $this->to_do as $key => $handle ) {
foreach ( $this->to_do as $key => $handle ) {
if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
/*

View File

@ -2402,7 +2402,7 @@ function wp_new_comment( $commentdata ) {
if ( ! $comment_ID ) {
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
foreach( $fields as $field ) {
foreach ( $fields as $field ) {
if ( isset( $commentdata[ $field ] ) ) {
$commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] );
}

View File

@ -340,7 +340,7 @@ function wptexturize_primes( $haystack, $needle, $prime, $open_quote, $close_quo
$sentences = explode( $open_quote, $haystack );
foreach( $sentences as $key => &$sentence ) {
foreach ( $sentences as $key => &$sentence ) {
if ( false === strpos( $sentence, $needle ) ) {
continue;
} elseif ( 0 !== $key && 0 === substr_count( $sentence, $close_quote ) ) {
@ -4442,7 +4442,7 @@ function wp_encode_emoji( $content ) {
$matches = array();
if ( preg_match_all( $regex, $content, $matches ) ) {
if ( ! empty( $matches[1] ) ) {
foreach( $matches[1] as $emoji ) {
foreach ( $matches[1] as $emoji ) {
/*
* UTF-32's hex encoding is the same as HTML's hex encoding.
* So, by converting the emoji from UTF-8 to UTF-32, we magically

View File

@ -132,7 +132,7 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
if ( $timezone_string ) {
$timezone_object = timezone_open( $timezone_string );
$date_object = date_create( null, $timezone_object );
foreach( $timezone_formats as $timezone_format ) {
foreach ( $timezone_formats as $timezone_format ) {
if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
$formatted = date_format( $date_object, $timezone_format );
$dateformatstring = ' '.$dateformatstring;
@ -1080,7 +1080,7 @@ function nocache_headers() {
}
}
foreach( $headers as $name => $field_value )
foreach ( $headers as $name => $field_value )
@header("{$name}: {$field_value}");
}

View File

@ -776,7 +776,7 @@ function get_available_languages( $dir = null ) {
$lang_files = glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' );
if ( $lang_files ) {
foreach( $lang_files as $lang_file ) {
foreach ( $lang_files as $lang_file ) {
$lang_file = basename( $lang_file, '.mo' );
if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
0 !== strpos( $lang_file, 'admin-' ) ) {

View File

@ -644,7 +644,7 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
$GLOBALS['_menu_item_sort_prop'] = $args['output_key'];
usort($items, '_sort_nav_menu_items');
$i = 1;
foreach( $items as $k => $item ) {
foreach ( $items as $k => $item ) {
$items[$k]->{$args['output_key']} = $i++;
}
}
@ -848,7 +848,7 @@ function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_
'posts_per_page' => -1,
)
);
foreach( (array) $menu_items as $menu_item ) {
foreach ( (array) $menu_items as $menu_item ) {
if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) {
$menu_item_type = get_post_meta( $menu_item->ID, '_menu_item_type', true );
if (
@ -883,7 +883,7 @@ function _wp_delete_post_menu_item( $object_id = 0 ) {
$menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' );
foreach( (array) $menu_item_ids as $menu_item_id ) {
foreach ( (array) $menu_item_ids as $menu_item_id ) {
wp_delete_post( $menu_item_id, true );
}
}
@ -902,7 +902,7 @@ function _wp_delete_tax_menu_item( $object_id = 0, $tt_id, $taxonomy ) {
$menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy );
foreach( (array) $menu_item_ids as $menu_item_id ) {
foreach ( (array) $menu_item_ids as $menu_item_id ) {
wp_delete_post( $menu_item_id, true );
}
}

View File

@ -502,7 +502,7 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
// Set custom headers
if ( !empty( $headers ) ) {
foreach( (array) $headers as $name => $content ) {
foreach ( (array) $headers as $name => $content ) {
$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
}

View File

@ -207,7 +207,7 @@ function apply_filters( $tag, $value ) {
$args = func_get_args();
do {
foreach( (array) current($wp_filter[$tag]) as $the_ )
foreach ( (array) current($wp_filter[$tag]) as $the_ )
if ( !is_null($the_['function']) ){
$args[1] = $value;
$value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));
@ -264,7 +264,7 @@ function apply_filters_ref_array($tag, $args) {
reset( $wp_filter[ $tag ] );
do {
foreach( (array) current($wp_filter[$tag]) as $the_ )
foreach ( (array) current($wp_filter[$tag]) as $the_ )
if ( !is_null($the_['function']) )
$args[0] = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
@ -574,7 +574,7 @@ function do_action_ref_array($tag, $args) {
reset( $wp_filter[ $tag ] );
do {
foreach( (array) current($wp_filter[$tag]) as $the_ )
foreach ( (array) current($wp_filter[$tag]) as $the_ )
if ( !is_null($the_['function']) )
call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
@ -845,7 +845,7 @@ function _wp_call_all_hook($args) {
reset( $wp_filter['all'] );
do {
foreach( (array) current($wp_filter['all']) as $the_ )
foreach ( (array) current($wp_filter['all']) as $the_ )
if ( !is_null($the_['function']) )
call_user_func_array($the_['function'], $args);

View File

@ -221,7 +221,7 @@ function _post_format_get_term( $term ) {
function _post_format_get_terms( $terms, $taxonomies, $args ) {
if ( in_array( 'post_format', (array) $taxonomies ) ) {
if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) {
foreach( $terms as $order => $name ) {
foreach ( $terms as $order => $name ) {
$terms[$order] = get_post_format_string( str_replace( 'post-format-', '', $name ) );
}
} else {

View File

@ -2464,7 +2464,7 @@ function wp_count_attachments( $mime_type = '' ) {
$count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A );
$counts = array();
foreach( (array) $count as $row ) {
foreach ( (array) $count as $row ) {
$counts[ $row['post_mime_type'] ] = $row['num_posts'];
}
$counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
@ -3079,7 +3079,7 @@ function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
// Backward compatibility. Prior to 3.1 expected posts to be returned in array.
if ( ARRAY_A == $output ){
foreach( $results as $key => $result ) {
foreach ( $results as $key => $result ) {
$results[$key] = get_object_vars( $result );
}
return $results ? $results : array();
@ -3398,7 +3398,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
$emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
foreach( $emoji_fields as $emoji_field ) {
foreach ( $emoji_fields as $emoji_field ) {
if ( isset( $data[ $emoji_field ] ) ) {
$charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
if ( 'utf8' === $charset ) {
@ -4149,7 +4149,7 @@ function get_enclosed( $post_id ) {
foreach ( $custom_fields as $key => $val ) {
if ( 'enclosure' != $key || !is_array( $val ) )
continue;
foreach( $val as $enc ) {
foreach ( $val as $enc ) {
$enclosure = explode( "\n", $enc );
$pung[] = trim( $enclosure[ 0 ] );
}
@ -4239,7 +4239,7 @@ function trackback_url_list( $tb_list, $post_id ) {
}
$trackback_urls = explode( ',', $tb_list );
foreach( (array) $trackback_urls as $tb_url ) {
foreach ( (array) $trackback_urls as $tb_url ) {
$tb_url = trim( $tb_url );
trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id );
}
@ -4485,7 +4485,7 @@ function get_page_hierarchy( &$pages, $page_id = 0 ) {
*/
function _page_traverse_name( $page_id, &$children, &$result ){
if ( isset( $children[ $page_id ] ) ){
foreach( (array)$children[ $page_id ] as $child ) {
foreach ( (array)$children[ $page_id ] as $child ) {
$result[ $child->ID ] = $child->post_name;
_page_traverse_name( $child->ID, $children, $result );
}
@ -4774,7 +4774,7 @@ function get_pages( $args = array() ) {
if ( ! empty( $r['exclude_tree'] ) ) {
$exclude = wp_parse_id_list( $r['exclude_tree'] );
foreach( $exclude as $id ) {
foreach ( $exclude as $id ) {
$children = get_page_children( $id, $pages );
foreach ( $children as $child ) {
$exclude[] = $child->ID;

View File

@ -2176,7 +2176,7 @@ class WP_Query {
'Comma-separated list of search stopwords in your language' ) );
$stopwords = array();
foreach( $words as $word ) {
foreach ( $words as $word ) {
$word = trim( $word, "\r\n\t " );
if ( $word )
$stopwords[] = $word;

View File

@ -336,7 +336,7 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
$fields = array_keys( _wp_post_revision_fields() );
$update = array();
foreach( array_intersect( array_keys( $revision ), $fields ) as $field ) {
foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {
$update[$field] = $revision[$field];
}

View File

@ -599,7 +599,7 @@ function _response_to_rss ($resp) {
if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {
// find Etag, and Last-Modified
foreach( (array) $resp->headers as $h) {
foreach ( (array) $resp->headers as $h) {
// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
if (strpos($h, ": ")) {
list($field, $val) = explode(": ", $h, 2);

View File

@ -488,7 +488,7 @@ function shortcode_parse_atts($text) {
function shortcode_atts( $pairs, $atts, $shortcode = '' ) {
$atts = (array)$atts;
$out = array();
foreach($pairs as $name => $default) {
foreach ($pairs as $name => $default) {
if ( array_key_exists($name, $atts) )
$out[$name] = $atts[$name];
else

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33733';
$wp_version = '4.4-alpha-33734';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -840,7 +840,7 @@ class wpdb {
*/
$incompatible_modes = (array) apply_filters( 'incompatible_sql_modes', $this->incompatible_modes );
foreach( $modes as $i => $mode ) {
foreach ( $modes as $i => $mode ) {
if ( in_array( $mode, $incompatible_modes ) ) {
unset( $modes[ $i ] );
}
@ -2249,7 +2249,7 @@ class wpdb {
} elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
// Return an integer-keyed array of...
if ( $this->last_result ) {
foreach( (array) $this->last_result as $row ) {
foreach ( (array) $this->last_result as $row ) {
if ( $output == ARRAY_N ) {
// ...integer-keyed row arrays
$new_array[] = array_values( get_object_vars( $row ) );
@ -2594,7 +2594,7 @@ class wpdb {
}
// If any of the columns don't have one of these collations, it needs more sanity checking.
foreach( $this->col_meta[ $table ] as $col ) {
foreach ( $this->col_meta[ $table ] as $col ) {
if ( empty( $col->Collation ) ) {
continue;
}
@ -2944,7 +2944,7 @@ class wpdb {
if ( $col_offset == -1 ) {
$i = 0;
$new_array = array();
foreach( (array) $this->col_info as $col ) {
foreach ( (array) $this->col_info as $col ) {
$new_array[$i] = $col->{$info_type};
$i++;
}

View File

@ -175,7 +175,7 @@ unset( $mu_plugin );
// Load network activated plugins.
if ( is_multisite() ) {
foreach( wp_get_active_network_plugins() as $network_plugin ) {
foreach ( wp_get_active_network_plugins() as $network_plugin ) {
wp_register_plugin_realpath( $network_plugin );
include_once( $network_plugin );
}