Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/24/2019 01:38:37 PM (4 years ago)
Author:
netweb
Message:

Build Tools: Add PHPCS with custom bbPress ruleset

  • This changeset adds an initial bbPress PHPCS ruleset
  • Future iteration of the rules in the ruleset can follow later
  • To run the PHPCS check run `grunt phpcs

Fixes #3294.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/formatting.php

    r6924 r7006  
    9797 */
    9898function bbp_kses_data( $data = '' ) {
    99     return wp_kses( $data , bbp_kses_allowed_tags() );
     99    return wp_kses( $data, bbp_kses_allowed_tags() );
    100100}
    101101
     
    112112function bbp_code_trick( $content = '' ) {
    113113    $content = str_replace( array( "\r\n", "\r" ), "\n", $content );
    114     $content = preg_replace_callback( "|(`)(.*?)`|",      'bbp_encode_callback', $content );
     114    $content = preg_replace_callback('|(`)(.*?)`|',      'bbp_encode_callback', $content );
    115115    $content = preg_replace_callback( "!(^|\n)`(.*?)`!s", 'bbp_encode_callback', $content );
    116116
     
    131131    // Setup variables
    132132    $openers = array( '<p>', '<br />' );
    133     $content = preg_replace_callback( "!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s", 'bbp_decode_callback', $content );
     133    $content = preg_replace_callback( '!(<pre><code>|<code>)(.*?)(</code></pre>|</code>)!s', 'bbp_decode_callback', $content );
    134134
    135135    // Do the do
     
    197197
    198198    // Trim inline code, not pre blocks (to prevent removing indentation)
    199     if ( "`" === $matches[1] ) {
     199    if ( '`' === $matches[1] ) {
    200200        $content = trim( $matches[2] );
    201201    } else {
     
    215215
    216216    // Wrap blocks in pre tags
    217     if ( "`" !== $matches[1] ) {
     217    if ('`' !== $matches[1] ) {
    218218        $content = "\n<pre>" . $content . "</pre>\n";
    219219    }
     
    235235    // Setup variables
    236236    $trans_table = array_flip( get_html_translation_table( HTML_ENTITIES ) );
    237     $amps        = array( '&#38;','&#038;', '&amp;' );
    238     $single      = array( '&#39;','&#039;'          );
     237    $amps        = array( '&#38;', '&#038;', '&amp;' );
     238    $single      = array( '&#39;', '&#039;'          );
    239239    $content     = $matches[2];
    240240    $content     = strtr( $content, $trans_table );
     
    314314    // Bail on links that match the current domain
    315315    if ( preg_match( '%href=["\'](' . preg_quote( set_url_scheme( $home_url, 'http'  ) ) . ')%i', $text ) ||
    316         preg_match( '%href=["\'](' . preg_quote( set_url_scheme( $home_url, 'https' ) ) . ')%i', $text )
     316        preg_match( '%href=["\'](' . preg_quote( set_url_scheme( $home_url, 'https' ) ) . ')%i', $text )
    317317    ) {
    318318        return "<a {$text}>";
     
    393393
    394394    // Cleanup of accidental links within links
    395     return preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a>([^<]*)</a>#i', "$1$3$4</a>", $r );
     395    return preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a>([^<]*)</a>#i', '$1$3$4</a>', $r );
    396396}
    397397
Note: See TracChangeset for help on using the changeset viewer.