Making WordPress.org


Ignore:
Timestamp:
06/29/2018 08:57:02 PM (8 years ago)
Author:
obenland
Message:

Main: phpcs updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/page-about-testimonials.php

    r6972 r7350  
    77 * @package WordPressdotorg\MainTheme
    88 */
     9
     10// phpcs:disable WordPress.VIP.RestrictedFunctions
    911
    1012namespace WordPressdotorg\MainTheme;
    … …  
    2325} );
    2426
    25 // See inc/page-meta-descriptions.php for the meta description for this page.
     27/* See inc/page-meta-descriptions.php for the meta description for this page. */
    2628
    27 // Pull list of testimonial URLs from the news page holding them
     29// Pull list of testimonial URLs from the news page holding them.
    2830switch_to_blog( 8 );
    29 $testpage = get_page_by_path( 'testimonials' );
     31$testimonials_post = get_page_by_path( 'testimonials' );
    3032restore_current_blog();
    3133
    32 // we only need the URLs in the post_content
    33 preg_match_all( '|https://\S+|', $testpage->post_content, $testimonials );
    34 $testimonials = $testimonials[0];
     34if ( $testimonials_post instanceof \WP_Post ) {
     35        // We only need the URLs in the post_content.
     36        preg_match_all( '|https://\S+|', $testimonials_post->post_content, $testimonials );
     37        $testimonials = $testimonials[0];
     38} else {
     39        $testimonials = [];
     40}
    3541
    36 // separate out the twiiter from the WPs
    37 $embed_tweets = array_values( array_filter( $testimonials, function ($t) { return strpos( $t, 'https://twitter.com' ) === 0; } ) );
    38 $embed_wps    = array_values( array_filter( $testimonials, function ($t) { return strpos( $t, 'https://twitter.com' ) !== 0; } ) );
     42// Separate out the twitter from the WPs.
     43$embed_tweets = array_values( array_filter( $testimonials, function( $t ) {
     44        return strpos( $t, 'https://twitter.com' ) === 0;
     45} ) );
     46$embed_wps = array_values( array_filter( $testimonials, function( $t ) {
     47        return strpos( $t, 'https://twitter.com' ) !== 0;
     48} ) );
    3949
    40 // Randomize the tweet order
     50// Randomize the tweet order.
    4151shuffle( $embed_tweets );
    4252
    43 // Strip out everything but the Tweet ID
     53// Strip out everything but the Tweet ID.
    4454array_walk( $embed_tweets, function ( &$tweet ) {
    4555        $tweet = preg_replace( '|https?://twitter.com/.*/status/([0-9]+)|', '$1', $tweet );
    … …  
    7080                                conversation: 'none',
    7181                                cards: 'hidden',
    72                                 margin: 0, width: 372
     82                                margin: 0,
     83                                width: 372
    7384                        }
    7485                ).then( function() {
    … …  
    92103wp_add_inline_script( 'twitter-widgets', $custom_js );
    93104wp_localize_script( 'twitter-widgets', 'embeds', array(
    94         'tweets' => $embed_tweets,
     105        'tweets'   => $embed_tweets,
    95106        'wpembeds' => $embed_wps,
    96107) );
    … …  
    107118
    108119                        <div class="entry-content row">
    109 
    110120                                <section class="col-8">
    111                                         <h3><?php _e( 'Share your WordPress story', 'wporg' ); ?></h3>
    112 
    113                                         <p><?php _e( 'Want to have your story featured on this page?', 'wporg' ); ?></p>
    114 
    115                                         <p><?php
     121                                        <h3><?php esc_html_e( 'Share your WordPress story', 'wporg' ); ?></h3>
     122                                        <p><?php esc_html_e( 'Want to have your story featured on this page?', 'wporg' ); ?></p>
     123                                        <p>
     124                                                <?php
    116125                                                /* translators: Link to the twitter #ilovewp feed */
    117                                                 printf( __( "Make a blog post with your story and tweet a link to it using the <a href='%s'>#ilovewp</a> hashtag. We'll select the best ones and feature them here!", 'wporg' ), 'https://twitter.com/search?q=%23ilovewp' );
    118                                         ?></p>
     126                                                printf( wp_kses_post( __( 'Make a blog post with your story and tweet a link to it using the <a href="%s">#ilovewp</a> hashtag. We&#8217;ll select the best ones and feature them here!', 'wporg' ) ), 'https://twitter.com/search?q=%23ilovewp' );
     127                                                ?>
     128                                        </p>
    119129
    120130                                        <p>
    … …  
    126136                                                </a>
    127137                                        </p>
    128 
    129138                                </section>
    130139
    131                                 <section class="col-10" id="embeds">
    132                                 </section>
     140                                <section class="col-10" id="embeds"></section>
    133141                        </div><!-- .entry-content -->
    134 
    135142                </article><!-- #post-## -->
    136143
Note: See TracChangeset for help on using the changeset viewer.