Making WordPress.org


Ignore:
Timestamp:
12/18/2017 05:42:35 PM (7 years ago)
Author:
obenland
Message:

Plugins: Conform to WPCS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r6249 r6284  
    99
    1010namespace WordPressdotorg\Plugin_Directory\Theme;
     11
    1112use WordPressdotorg\Plugin_Directory\Plugin_Directory;
    1213use WordPressdotorg\Plugin_Directory\Template;
     
    2425    add_theme_support( 'automatic-feed-links' );
    2526
    26     // Don't include Adjacent Posts functionality
     27    // Don't include Adjacent Posts functionality.
    2728    remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
    2829
     
    6061function scripts() {
    6162    $suffix = is_rtl() ? '-rtl' : '';
    62     wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . "/css/style{$suffix}.css", ['open-sans'], '20171206a' );
     63    wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . "/css/style{$suffix}.css", [ 'open-sans', 'dashicons' ], '20171206a' );
    6364
    6465    wp_enqueue_script( 'wporg-plugins-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
     
    9899    }
    99100
    100     // React is currently only used on detail pages
     101    // React is currently only used on detail pages.
    101102    if ( is_single() ) {
    102103        wp_enqueue_script( 'wporg-plugins-client', get_template_directory_uri() . '/js/theme.js', array(), '20170501', true );
     
    111112                'Plural-Forms' => _x( 'nplurals=2; plural=n != 1;', 'plural forms', 'wporg-plugins' ),
    112113                'Language'     => _x( 'en', 'language (fr, fr_CA)', 'wporg-plugins' ),
    113                 'localeSlug'   => _x( 'en', 'locale slug', 'wporg-plugins' ) ,
     114                'localeSlug'   => _x( 'en', 'locale slug', 'wporg-plugins' ),
    114115            ),
    115116        ) );
     
    148149
    149150    // Remove version argument.
    150     if ( in_array( $handle, ['open-sans'], true ) ) {
     151    if ( in_array( $handle, [ 'open-sans' ], true ) ) {
    151152        $src = remove_query_arg( 'ver', $src );
    152153    }
     
    154155    return $src;
    155156}
    156 add_filter( 'style_loader_src',  __NAMESPACE__ . '\loader_src', 10, 2 );
     157add_filter( 'style_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
    157158add_filter( 'script_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 );
    158159
     
    171172 */
    172173function customize_register( $wp_customize ) {
    173     $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
    174     $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
     174    $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
     175    $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
    175176}
    176177add_action( 'customize_register', __NAMESPACE__ . '\customize_register' );
     
    182183    wp_enqueue_script( 'wporg_plugins_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true );
    183184}
    184 add_action( 'customize_preview_init',  __NAMESPACE__ . '\customize_preview_js' );
    185 
    186 
     185add_action( 'customize_preview_init', __NAMESPACE__ . '\customize_preview_js' );
     186
     187/**
     188 * Filters the list of CSS body classes for the current post or page.
     189 *
     190 * @param array $classes An array of body classes.
     191 * @return array
     192 */
    187193function custom_body_class( $classes ) {
    188194    $classes[] = 'no-js';
     
    206212function document_title( $title ) {
    207213    if ( is_front_page() ) {
    208         $title['title'] = __( 'WordPress Plugins', 'wporg-plugins' );
     214        $title['title']   = __( 'WordPress Plugins', 'wporg-plugins' );
    209215        $title['tagline'] = __( 'Plugins extend and expand the functionality of WordPress.', 'wporg-plugins' );
    210216    } else {
     
    260266    }
    261267
    262     $banner  = Template::get_plugin_banner();
     268    $icon   = Template::get_plugin_icon();
     269    $banner = Template::get_plugin_banner();
     270
    263271    $banner['banner_2x'] = $banner['banner_2x'] ? $banner['banner'] : false;
    264     $icon = Template::get_plugin_icon();
    265272
    266273    printf( '<meta property="og:title" content="%s" />' . "\n", the_title_attribute( array( 'echo' => false ) ) );
     
    295302add_action( 'wp_head', function() {
    296303    add_filter( 'post_type_archive_title', __NAMESPACE__ . '\strong_archive_title' );
    297     add_filter( 'single_term_title',       __NAMESPACE__ . '\strong_archive_title' );
    298     add_filter( 'single_cat_title',        __NAMESPACE__ . '\strong_archive_title' );
    299     add_filter( 'single_tag_title',        __NAMESPACE__ . '\strong_archive_title' );
    300     add_filter( 'get_the_date',            __NAMESPACE__ . '\strong_archive_title' );
     304    add_filter( 'single_term_title', __NAMESPACE__ . '\strong_archive_title' );
     305    add_filter( 'single_cat_title', __NAMESPACE__ . '\strong_archive_title' );
     306    add_filter( 'single_tag_title', __NAMESPACE__ . '\strong_archive_title' );
     307    add_filter( 'get_the_date', __NAMESPACE__ . '\strong_archive_title' );
    301308} );
    302309
Note: See TracChangeset for help on using the changeset viewer.