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/template-parts/section.php

    r5399 r6284  
    1010global $section, $section_slug, $section_content, $section_read_more;
    1111
     12$prefix = in_array( $section_slug, array( 'screenshots', 'faq' ), true ) ? '' : 'tab-';
     13
     14$classes = [ 'plugin-' . $section_slug, 'section' ];
     15if ( $section_read_more ) {
     16    $classes[] = 'read-more';
     17}
     18$classes = implode( ' ', $classes );
    1219?>
    1320
    14 <div
    15 <?php if ( !in_array ( $section_slug, array( 'screenshots','faq' ) ) ) {
    16     $prefix = 'tab-';
    17 } else {
    18     $prefix = '';
    19 }
    20 ?>
    21     id="<?php echo esc_attr( $prefix.$section_slug ); ?>"
    22     class="plugin-<?php echo esc_attr( $section_slug ); ?> section <?php if ( $section_read_more ) { echo 'read-more'; } ?>"
    23 >
    24     <h2 id="<?php echo esc_attr( $section_slug . '-header' ); ?>"><?php echo $section['title']; ?></h2>
    25     <?php echo $section_content; ?>
     21<div id="<?php echo esc_attr( $prefix . $section_slug ); ?>" class="<?php echo esc_attr( $classes ); ?>">
     22    <h2 id="<?php echo esc_attr( $section_slug . '-header' ); ?>"><?php echo esc_html( $section['title'] ); ?></h2>
     23    <?php echo wp_kses_post( $section_content ); ?>
    2624</div>
    2725<?php if ( $section_read_more ) : ?>
    28 <button
    29     type="button"
    30     class="button-link section-toggle"
    31     aria-controls="<?php echo esc_attr( $prefix.$section_slug ); ?>"
    32     aria-describedby="<?php echo esc_attr( $section_slug . '-header' ); ?>"
    33     aria-expanded="false"
    34     data-show-less="<?php esc_attr_e( 'Show less', 'wporg-plugins' ); ?>"
    35     data-read-more="<?php esc_attr_e( 'Read more', 'wporg-plugins' ); ?>"
    36 ><?php _e( 'Read more', 'wporg-plugins' ); ?></button>
     26    <button
     27        type="button"
     28        class="button-link section-toggle"
     29        aria-controls="<?php echo esc_attr( $prefix . $section_slug ); ?>"
     30        aria-describedby="<?php echo esc_attr( $section_slug . '-header' ); ?>"
     31        aria-expanded="false"
     32        data-show-less="<?php esc_attr_e( 'Show less', 'wporg-plugins' ); ?>"
     33        data-read-more="<?php esc_attr_e( 'Read more', 'wporg-plugins' ); ?>"
     34    >
     35    <?php esc_html_e( 'Read more', 'wporg-plugins' ); ?>
     36    </button>
    3737<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.