Bundled themes: replace array_shift() with current() for performance.

Props SergeyBiryukov, fixes #31260.
Built from https://develop.svn.wordpress.org/trunk@31453


git-svn-id: http://core.svn.wordpress.org/trunk@31434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2015-02-13 17:52:27 +00:00
parent 48a5bbf8a7
commit 86a133a79a
6 changed files with 6 additions and 6 deletions

View File

@ -36,7 +36,7 @@
$images = twentyeleven_get_gallery_images();
if ( $images ) :
$total_images = count( $images );
$image = array_shift( $images );
$image = current( $images );
?>
<figure class="gallery-thumb">
<a href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>

View File

@ -330,7 +330,7 @@ function twentyfourteen_the_attached_image() {
// or get the URL of the first image attachment.
else {
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
$next_attachment_url = get_attachment_link( current( $attachment_ids ) );
}
}

View File

@ -149,7 +149,7 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
if ( has_post_thumbnail() ) :
$post_thumbnail = get_the_post_thumbnail();
elseif ( $total_images > 0 ) :
$image = array_shift( $images );
$image = current( $images );
$post_thumbnail = wp_get_attachment_image( $image, 'post-thumbnail' );
endif;

View File

@ -75,7 +75,7 @@
$images = twentyten_get_gallery_images();
if ( $images ) :
$total_images = count( $images );
$image = array_shift( $images );
$image = current( $images );
?>
<div class="gallery-thumb">
<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>

View File

@ -431,7 +431,7 @@ function twentythirteen_the_attached_image() {
// or get the URL of the first image attachment.
else
$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
$next_attachment_url = get_attachment_link( current( $attachment_ids ) );
}
printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>',

View File

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