Make WordPress Core

Ticket #27069: 27069.2.patch

File 27069.2.patch, 3.5 KB (added by Chouby, 11 years ago)
  • wp-content/themes/twentyfourteen/inc/widgets.php

     
    2424        private $formats = array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery' );
    2525
    2626        /**
    27          * Pluralized post format strings.
    28          *
    29          * @access private
    30          * @since Twenty Fourteen 1.0
    31          *
    32          * @var array
    33          */
    34         private $format_strings;
    35 
    36         /**
    3727         * Constructor.
    3828         *
    3929         * @since Twenty Fourteen 1.0
     
    4535                        'classname'   => 'widget_twentyfourteen_ephemera',
    4636                        'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts', 'twentyfourteen' ),
    4737                ) );
    48 
    49                 /*
    50                  * @todo http://core.trac.wordpress.org/ticket/23257: Add plural versions of Post Format strings
    51                  */
    52                 $this->format_strings = array(
    53                         'aside'   => __( 'Asides',    'twentyfourteen' ),
    54                         'image'   => __( 'Images',    'twentyfourteen' ),
    55                         'video'   => __( 'Videos',    'twentyfourteen' ),
    56                         'audio'   => __( 'Audio',     'twentyfourteen' ),
    57                         'quote'   => __( 'Quotes',    'twentyfourteen' ),
    58                         'link'    => __( 'Links',     'twentyfourteen' ),
    59                         'gallery' => __( 'Galleries', 'twentyfourteen' ),
    60                 );
    6138        }
    6239
    6340        /**
     
    7148         * @return void Echoes its output.
    7249         */
    7350        public function widget( $args, $instance ) {
    74                 $format = $instance['format'];
     51                switch ( $instance['format'] ) {
     52                        case 'aside':
     53                                $format_string = __( 'Asides', 'twentyfourteen' );
     54                                $format_string_more = __( 'More aside', 'twentyfourteen' );
     55                                break;
     56
     57                        case 'image':
     58                                $format_string = __( 'Images', 'twentyfourteen' );
     59                                $format_string_more = __( 'More images', 'twentyfourteen' );
     60                                break;
     61
     62                        case 'video':
     63                                $format_string = __( 'Videos', 'twentyfourteen' );
     64                                $format_string_more = __( 'More videos', 'twentyfourteen' );
     65                                break;
     66
     67                        case 'audio':
     68                                $format_string = __( 'Audio', 'twentyfourteen' );
     69                                $format_string_more = __( 'More audio', 'twentyfourteen' );
     70                                break;
     71
     72                        case 'quote':
     73                                $format_string = __( 'Quotes', 'twentyfourteen' );
     74                                $format_string_more = __( 'More quotes', 'twentyfourteen' );
     75                                break;
     76
     77                        case 'link':
     78                                $format_string = __( 'Links', 'twentyfourteen' );
     79                                $format_string_more = __( 'More links', 'twentyfourteen' );
     80                                break;
     81
     82                        case 'gallery':
     83                                $format_string = __( 'Galleries', 'twentyfourteen' );
     84                                $format_string_more = __( 'More galleries', 'twentyfourteen' );
     85                                break;
     86
     87                        default:
     88                                break;
     89
     90                }
     91
    7592                $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
    76                 $title  = apply_filters( 'widget_title', empty( $instance['title'] ) ? $this->format_strings[ $format ] : $instance['title'], $instance, $this->id_base );
     93                $title  = apply_filters( 'widget_title', empty( $instance['title'] ) ? $format_string : $instance['title'], $instance, $this->id_base );
    7794
    7895                $ephemera = new WP_Query( array(
    7996                        'order'          => 'DESC',
     
    191208                                <?php endwhile; ?>
    192209
    193210                        </ol>
    194                         <a class="post-format-archive-link" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php printf( __( 'More %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ), $this->format_strings[ $format ] ); ?></a>
     211                        <a class="post-format-archive-link" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php  _e( '%s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ); ?></a>
    195212                        <?php
    196213
    197214                        echo $args['after_widget'];