X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/256a3b381f63716209b3527d0a14442ae570c283..af50974463450c98503e763a7836a50e260461a9:/wp-content/themes/twentyfourteen/inc/widgets.php?ds=sidebyside diff --git a/wp-content/themes/twentyfourteen/inc/widgets.php b/wp-content/themes/twentyfourteen/inc/widgets.php index f78effed..9bd1e79e 100644 --- a/wp-content/themes/twentyfourteen/inc/widgets.php +++ b/wp-content/themes/twentyfourteen/inc/widgets.php @@ -23,16 +23,6 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget { */ private $formats = array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery' ); - /** - * Pluralized post format strings. - * - * @access private - * @since Twenty Fourteen 1.0 - * - * @var array - */ - private $format_strings; - /** * Constructor. * @@ -43,21 +33,8 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget { public function __construct() { parent::__construct( 'widget_twentyfourteen_ephemera', __( 'Twenty Fourteen Ephemera', 'twentyfourteen' ), array( 'classname' => 'widget_twentyfourteen_ephemera', - 'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts', 'twentyfourteen' ), + 'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts.', 'twentyfourteen' ), ) ); - - /* - * @todo http://core.trac.wordpress.org/ticket/23257: Add plural versions of Post Format strings - */ - $this->format_strings = array( - 'aside' => __( 'Asides', 'twentyfourteen' ), - 'image' => __( 'Images', 'twentyfourteen' ), - 'video' => __( 'Videos', 'twentyfourteen' ), - 'audio' => __( 'Audio', 'twentyfourteen' ), - 'quote' => __( 'Quotes', 'twentyfourteen' ), - 'link' => __( 'Links', 'twentyfourteen' ), - 'gallery' => __( 'Galleries', 'twentyfourteen' ), - ); } /** @@ -68,12 +45,44 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget { * * @param array $args An array of standard parameters for widgets in this theme. * @param array $instance An array of settings for this widget instance. - * @return void Echoes its output. */ public function widget( $args, $instance ) { - $format = $instance['format']; + $format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside'; + + switch ( $format ) { + case 'image': + $format_string = __( 'Images', 'twentyfourteen' ); + $format_string_more = __( 'More images', 'twentyfourteen' ); + break; + case 'video': + $format_string = __( 'Videos', 'twentyfourteen' ); + $format_string_more = __( 'More videos', 'twentyfourteen' ); + break; + case 'audio': + $format_string = __( 'Audio', 'twentyfourteen' ); + $format_string_more = __( 'More audio', 'twentyfourteen' ); + break; + case 'quote': + $format_string = __( 'Quotes', 'twentyfourteen' ); + $format_string_more = __( 'More quotes', 'twentyfourteen' ); + break; + case 'link': + $format_string = __( 'Links', 'twentyfourteen' ); + $format_string_more = __( 'More links', 'twentyfourteen' ); + break; + case 'gallery': + $format_string = __( 'Galleries', 'twentyfourteen' ); + $format_string_more = __( 'More galleries', 'twentyfourteen' ); + break; + case 'aside': + default: + $format_string = __( 'Asides', 'twentyfourteen' ); + $format_string_more = __( 'More asides', 'twentyfourteen' ); + break; + } + $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] ); - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? $this->format_strings[ $format ] : $instance['title'], $instance, $this->id_base ); + $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? $format_string : $instance['title'], $instance, $this->id_base ); $ephemera = new WP_Query( array( 'order' => 'DESC', @@ -102,7 +111,12 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
    - have_posts() ) : $ephemera->the_post(); ?> + have_posts() ) : + $ephemera->the_post(); + $tmp_more = $GLOBALS['more']; + $GLOBALS['more'] = 0; + ?>
  1. >
    @@ -186,7 +200,12 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
- →', 'twentyfourteen' ), $this->format_strings[ $format ] ); ?> + + →', 'twentyfourteen' ), $format_string_more ); + ?> +