Making WordPress.org


Ignore:
Timestamp:
06/29/2018 08:57:02 PM (7 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/functions.php

    r7348 r7350  
    7474    if ( is_page( 'stats' ) ) {
    7575        wp_enqueue_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', [], null, true );
    76         wp_enqueue_script( 'wporg-page-stats', get_theme_file_uri( '/js/page-stats.js' ), [ 'jquery', 'google-charts'], 1, true );
     76        wp_enqueue_script( 'wporg-page-stats', get_theme_file_uri( '/js/page-stats.js' ), [ 'jquery', 'google-charts' ], 1, true );
    7777        wp_localize_script( 'wporg-page-stats', 'wporgPageStats', [
    7878            'trunk'         => number_format( WP_CORE_STABLE_BRANCH + 0.1, 1 ), /* trunk */
     
    159159
    160160        // We want it before page-{page_name}.php but after {Page Template}.php.
    161         $page_name_index = array_search( "page-{$page->post_name}.php", $templates );
     161        $page_name_index = array_search( "page-{$page->post_name}.php", $templates, true );
    162162        $top             = array_slice( $templates, 0, $page_name_index );
    163163        $bottom          = array_slice( $templates, $page_name_index );
    164164
    165         $templates = array_merge( $top, ["page-{$parent->post_name}-{$page->post_name}.php"], $bottom );
     165        $templates = array_merge( $top, [ "page-{$parent->post_name}-{$page->post_name}.php" ], $bottom );
    166166    }
    167167
     
    187187add_filter( 'theme_page_templates', __NAMESPACE__ . '\rosetta_page_templates' );
    188188
     189/**
     190 * Passes SEO-optimized title and description to embeds.
     191 */
    189192function use_opengraph_data_for_embed_template() {
    190193    global $post;
    191     if ( 'page' != $post->post_type || ! $post->page_template || 'default' == $post->page_template ) {
     194
     195    if ( 'page' !== $post->post_type || ! $post->page_template || 'default' === $post->page_template ) {
    192196        return;
    193197    }
     
    195199    $meta = custom_open_graph_tags();
    196200    if ( $meta ) {
    197         add_filter( 'the_title', function( $title ) use( $meta ) {
     201        add_filter( 'the_title', function( $title ) use ( $meta ) {
    198202            return $meta['og:title'] ?? $title;
    199203        } );
    200         add_filter( 'the_content', function( $content ) use( $meta ) {
     204        add_filter( 'the_content', function( $content ) use ( $meta ) {
    201205            return $meta['og:description'] ?? $content;
    202206        } );
     
    208212 * Custom template tags.
    209213 */
    210 require_once get_stylesheet_directory() . '/inc/template-tags.php';
     214require_once __DIR__ . '/inc/template-tags.php';
    211215
    212216/**
    213217 * Custom meta descriptions for page templates.
    214218 */
    215 require_once get_stylesheet_directory() . '/inc/page-meta-descriptions.php';
     219require_once __DIR__ . '/inc/page-meta-descriptions.php';
    216220
    217221/**
    218222 * Include reCAPTCHA functions for privacy requests.
    219223 */
    220 include __DIR__ . '/inc/recaptcha.php';
     224require_once __DIR__ . '/inc/recaptcha.php';
    221225
    222226/**
    223227 * Include the Privacy request functions.
    224228 */
    225 include __DIR__ . '/inc/privacy-functions.php';
     229require_once __DIR__ . '/inc/privacy-functions.php';
Note: See TracChangeset for help on using the changeset viewer.