Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/22/2025 06:05:25 AM (12 months ago)
Author:
johnjamesjacoby
Message:

Tools - Code Improvement: stop ignoring these PHPCS sniffs:

  • Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
  • Generic.CodeAnalysis.EmptyStatement.DetectedElseif
  • Generic.CodeAnalysis.EmptyStatement.DetectedIf
  • Generic.CodeAnalysis.UselessOverridingMethod.Found
  • Generic.ControlStructures.InlineControlStructure.NotAllowed
  • Generic.Files.LineEndings.InvalidEOLChar
  • Generic.Formatting.DisallowMultipleStatements.SameLine
  • Generic.Formatting.SpaceAfterCast.TooMuchSpace
  • Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace
  • Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
  • NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerMultiLine
  • NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine
  • NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserMultiLine
  • NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLineCloserSameLine
  • PEAR.Functions.FunctionCallSignature.CloseBracketLine
  • PEAR.Functions.FunctionCallSignature.EmptyLine
  • PEAR.Functions.FunctionCallSignature.Indent
  • PEAR.Functions.FunctionCallSignature.MultipleArguments
  • PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
  • PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess.Found
  • PSR2.Classes.ClassDeclaration.CloseBraceAfterBody
  • PSR2.Classes.PropertyDeclaration.ScopeMissing
  • PSR2.Classes.PropertyDeclaration.Underscore
  • PSR2.Classes.PropertyDeclaration.VarUsed
  • PSR2.ControlStructures.ElseIfDeclaration.NotAllowed
  • PSR2.ControlStructures.SwitchDeclaration.BreakIndent
  • PSR2.Methods.MethodDeclaration.Underscore
  • Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace
  • Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen
  • Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose
  • Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace
  • Squiz.PHP.DisallowSizeFunctionsInLoops.Found
  • Squiz.Scope.MethodScope.Missing
  • Squiz.WhiteSpace.SuperfluousWhitespace.EndLine
  • Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
  • Universal.NamingConventions.NoReservedKeywordParameterNames.echoFound
  • Universal.NamingConventions.NoReservedKeywordParameterNames.parentFound
  • Universal.Operators.DisallowStandalonePostIncrementDecrement.PostDecrementFound
  • Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
  • Universal.Operators.StrictComparisons.LooseEqual
  • Universal.Operators.StrictComparisons.LooseNotEqual
  • WordPress.Arrays.ArrayKeySpacingRestrictions.TooMuchSpaceAfterKey
  • WordPress.DateTime.CurrentTimeTimestamp.Requested
  • WordPress.DateTime.RestrictedFunctions.date_date
  • WordPress.Files.FileName.NotHyphenatedLowercase
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
  • WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
  • WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
  • WordPress.PHP.IniSet.Risky
  • WordPress.PHP.PregQuoteDelimiter.Missing
  • WordPress.PHP.StrictInArray.MissingTrueStrict
  • WordPress.WP.AlternativeFunctions.parse_url_parse_url
  • WordPress.WP.AlternativeFunctions.rand_mt_rand
  • WordPress.WP.AlternativeFunctions.strip_tags_strip_tag
  • WordPress.WP.AlternativeFunctions.strip_tags_strip_tags
  • WordPress.WP.Capabilities.Unknown
  • WordPress.WP.DeprecatedParameters.Get_termsParam2Found
  • WordPress.WP.DeprecatedParameters.Wp_count_termsParam2Found
  • WordPress.WP.DiscouragedFunctions.query_posts_query_posts
  • WordPress.WP.DiscouragedFunctions.wp_reset_query_wp_reset_query
  • WordPress.WP.EnqueuedResourceParameters.NotInFooter
  • WordPress.WP.GlobalVariablesOverride.Prohibited
  • WordPress.WP.I18n.LowLevelTranslationFunction

This commit includes code formatting changes for the above sniffs.

See #3658.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/theme-compat.php

    r7376 r7378  
    4747         * @var array
    4848         */
    49         private $_data = array();
     49        private $_data = array(); // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
    5050
    5151        /**
    … …  
    447447        }
    448448
     449        // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
     450
    449451        // Set the $post global
    450452        $post = new WP_Post( (object) $dummy );
    … …  
    466468        $wp_query->is_singular = $wp_query->is_single;
    467469
     470        // phpcs:enable
     471
    468472        // Clean up the dummy post
    469473        unset( $dummy );
    … …  
    518522
    519523                // Reset post
    520                 bbp_theme_compat_reset_post( array(
    521                         'ID'             => 0,
    522                         'post_author'    => 0,
    523                         'post_date'      => bbp_get_empty_datetime(),
    524                         'post_content'   => bbp_buffer_template_part( 'content', 'single-user', false ),
    525                         'post_type'      => '',
    526                         'post_title'     => bbp_get_displayed_user_field( 'display_name' ),
    527                         'post_status'    => bbp_get_public_status_id(),
    528                         'is_archive'     => false,
    529                         'comment_status' => 'closed'
    530                 ) );
     524                bbp_theme_compat_reset_post(
     525                        array(
     526                                'ID'             => 0,
     527                                'post_author'    => 0,
     528                                'post_date'      => bbp_get_empty_datetime(),
     529                                'post_content'   => bbp_buffer_template_part( 'content', 'single-user', false ),
     530                                'post_type'      => '',
     531                                'post_title'     => bbp_get_displayed_user_field( 'display_name' ),
     532                                'post_status'    => bbp_get_public_status_id(),
     533                                'is_archive'     => false,
     534                                'comment_status' => 'closed'
     535                        )
     536                );
    531537
    532538        /** Forums ************************************************************/
    … …  
    573579
    574580                // Reset post
    575                 bbp_theme_compat_reset_post( array(
    576                         'ID'             => ! empty( $page->ID ) ? $page->ID : 0,
    577                         'post_title'     => $new_title,
    578                         'post_author'    => 0,
    579                         'post_date'      => bbp_get_empty_datetime(),
    580                         'post_content'   => $new_content,
    581                         'post_type'      => bbp_get_forum_post_type(),
    582                         'post_status'    => bbp_get_public_status_id(),
    583                         'is_archive'     => true,
    584                         'comment_status' => 'closed'
    585                 ) );
     581                bbp_theme_compat_reset_post(
     582                        array(
     583                                'ID'             => ! empty( $page->ID ) ? $page->ID : 0,
     584                                'post_title'     => $new_title,
     585                                'post_author'    => 0,
     586                                'post_date'      => bbp_get_empty_datetime(),
     587                                'post_content'   => $new_content,
     588                                'post_type'      => bbp_get_forum_post_type(),
     589                                'post_status'    => bbp_get_public_status_id(),
     590                                'is_archive'     => true,
     591                                'comment_status' => 'closed'
     592                        )
     593                );
    586594
    587595        // Single Forum
    … …  
    589597
    590598                // Reset post
    591                 bbp_theme_compat_reset_post( array(
    592                         'ID'             => bbp_get_forum_id(),
    593                         'post_title'     => bbp_get_forum_title(),
    594                         'post_author'    => bbp_get_forum_author_id(),
    595                         'post_date'      => bbp_get_empty_datetime(),
    596                         'post_content'   => $bbp_shortcodes->display_forum_form(),
    597                         'post_type'      => bbp_get_forum_post_type(),
    598                         'post_status'    => bbp_get_forum_visibility(),
    599                         'is_single'      => true,
    600                         'comment_status' => 'closed'
    601                 ) );
     599                bbp_theme_compat_reset_post(
     600                        array(
     601                                'ID'             => bbp_get_forum_id(),
     602                                'post_title'     => bbp_get_forum_title(),
     603                                'post_author'    => bbp_get_forum_author_id(),
     604                                'post_date'      => bbp_get_empty_datetime(),
     605                                'post_content'   => $bbp_shortcodes->display_forum_form(),
     606                                'post_type'      => bbp_get_forum_post_type(),
     607                                'post_status'    => bbp_get_forum_visibility(),
     608                                'is_single'      => true,
     609                                'comment_status' => 'closed'
     610                        )
     611                );
    602612
    603613                // Lock the forum from other edits
    … …  
    607617
    608618                // Reset post
    609                 bbp_theme_compat_reset_post( array(
    610                         'ID'             => bbp_get_forum_id(),
    611                         'post_title'     => bbp_get_forum_title(),
    612                         'post_author'    => bbp_get_forum_author_id(),
    613                         'post_date'      => bbp_get_empty_datetime(),
    614                         'post_content'   => $bbp_shortcodes->display_forum( array( 'id' => bbp_get_forum_id() ) ),
    615                         'post_type'      => bbp_get_forum_post_type(),
    616                         'post_status'    => bbp_get_forum_visibility(),
    617                         'is_single'      => true,
    618                         'comment_status' => 'closed'
    619                 ) );
     619                bbp_theme_compat_reset_post(
     620                        array(
     621                                'ID'             => bbp_get_forum_id(),
     622                                'post_title'     => bbp_get_forum_title(),
     623                                'post_author'    => bbp_get_forum_author_id(),
     624                                'post_date'      => bbp_get_empty_datetime(),
     625                                'post_content'   => $bbp_shortcodes->display_forum( array( 'id' => bbp_get_forum_id() ) ),
     626                                'post_type'      => bbp_get_forum_post_type(),
     627                                'post_status'    => bbp_get_forum_visibility(),
     628                                'is_single'      => true,
     629                                'comment_status' => 'closed'
     630                        )
     631                );
    620632
    621633        /** Topics ************************************************************/
    … …  
    646658
    647659                // Reset post
    648                 bbp_theme_compat_reset_post( array(
    649                         'ID'             => ! empty( $page->ID ) ? $page->ID : 0,
    650                         'post_title'     => $new_title,
    651                         'post_author'    => 0,
    652                         'post_date'      => bbp_get_empty_datetime(),
    653                         'post_content'   => $new_content,
    654                         'post_type'      => bbp_get_topic_post_type(),
    655                         'post_status'    => bbp_get_public_status_id(),
    656                         'is_archive'     => true,
    657                         'comment_status' => 'closed'
    658                 ) );
     660                bbp_theme_compat_reset_post(
     661                        array(
     662                                'ID'             => ! empty( $page->ID ) ? $page->ID : 0,
     663                                'post_title'     => $new_title,
     664                                'post_author'    => 0,
     665                                'post_date'      => bbp_get_empty_datetime(),
     666                                'post_content'   => $new_content,
     667                                'post_type'      => bbp_get_topic_post_type(),
     668                                'post_status'    => bbp_get_public_status_id(),
     669                                'is_archive'     => true,
     670                                'comment_status' => 'closed'
     671                        )
     672                );
    659673
    660674        // Single Topic
    … …  
    682696
    683697                // Reset post
    684                 bbp_theme_compat_reset_post( array(
    685                         'ID'             => bbp_get_topic_id(),
    686                         'post_title'     => bbp_get_topic_title(),
    687                         'post_author'    => bbp_get_topic_author_id(),
    688                         'post_date'      => bbp_get_empty_datetime(),
    689                         'post_content'   => $new_content,
    690                         'post_type'      => bbp_get_topic_post_type(),
    691                         'post_status'    => bbp_get_topic_status(),
    692                         'is_single'      => true,
    693                         'comment_status' => 'closed'
    694                 ) );
     698                bbp_theme_compat_reset_post(
     699                        array(
     700                                'ID'             => bbp_get_topic_id(),
     701                                'post_title'     => bbp_get_topic_title(),
     702                                'post_author'    => bbp_get_topic_author_id(),
     703                                'post_date'      => bbp_get_empty_datetime(),
     704                                'post_content'   => $new_content,
     705                                'post_type'      => bbp_get_topic_post_type(),
     706                                'post_status'    => bbp_get_topic_status(),
     707                                'is_single'      => true,
     708                                'comment_status' => 'closed'
     709                        )
     710                );
    695711
    696712        /** Replies ***********************************************************/
    … …  
    700716
    701717                // Reset post
    702                 bbp_theme_compat_reset_post( array(
    703                         'ID'             => 0,
    704                         'post_title'     => esc_html__( 'Replies', 'bbpress' ),
    705                         'post_author'    => 0,
    706                         'post_date'      => bbp_get_empty_datetime(),
    707                         'post_content'   => '',
    708                         'post_type'      => bbp_get_reply_post_type(),
    709                         'post_status'    => bbp_get_public_status_id(),
    710                         'is_archive'     => true,
    711                         'comment_status' => 'closed'
    712                 ) );
     718                bbp_theme_compat_reset_post(
     719                        array(
     720                                'ID'             => 0,
     721                                'post_title'     => esc_html__( 'Replies', 'bbpress' ),
     722                                'post_author'    => 0,
     723                                'post_date'      => bbp_get_empty_datetime(),
     724                                'post_content'   => '',
     725                                'post_type'      => bbp_get_reply_post_type(),
     726                                'post_status'    => bbp_get_public_status_id(),
     727                                'is_archive'     => true,
     728                                'comment_status' => 'closed'
     729                        )
     730                );
    713731
    714732        // Single Reply
    … …  
    732750
    733751                // Reset post
    734                 bbp_theme_compat_reset_post( array(
    735                         'ID'             => bbp_get_reply_id(),
    736                         'post_title'     => bbp_get_reply_title(),
    737                         'post_author'    => bbp_get_reply_author_id(),
    738                         'post_date'      => bbp_get_empty_datetime(),
    739                         'post_content'   => $new_content,
    740                         'post_type'      => bbp_get_reply_post_type(),
    741                         'post_status'    => bbp_get_reply_status(),
    742                         'is_single'      => true,
    743                         'comment_status' => 'closed'
    744                 ) );
     752                bbp_theme_compat_reset_post(
     753                        array(
     754                                'ID'             => bbp_get_reply_id(),
     755                                'post_title'     => bbp_get_reply_title(),
     756                                'post_author'    => bbp_get_reply_author_id(),
     757                                'post_date'      => bbp_get_empty_datetime(),
     758                                'post_content'   => $new_content,
     759                                'post_type'      => bbp_get_reply_post_type(),
     760                                'post_status'    => bbp_get_reply_status(),
     761                                'is_single'      => true,
     762                                'comment_status' => 'closed'
     763                        )
     764                );
    745765
    746766        /** Views *************************************************************/
    … …  
    749769
    750770                // Reset post
    751                 bbp_theme_compat_reset_post( array(
    752                         'ID'             => 0,
    753                         'post_title'     => bbp_get_view_title(),
    754                         'post_author'    => 0,
    755                         'post_date'      => bbp_get_empty_datetime(),
    756                         'post_content'   => $bbp_shortcodes->display_view( array( 'id' => get_query_var( bbp_get_view_rewrite_id() ) ) ),
    757                         'post_type'      => '',
    758                         'post_status'    => bbp_get_public_status_id(),
    759                         'is_archive'     => true,
    760                         'comment_status' => 'closed'
    761                 ) );
     771                bbp_theme_compat_reset_post(
     772                        array(
     773                                'ID'             => 0,
     774                                'post_title'     => bbp_get_view_title(),
     775                                'post_author'    => 0,
     776                                'post_date'      => bbp_get_empty_datetime(),
     777                                'post_content'   => $bbp_shortcodes->display_view( array( 'id' => get_query_var( bbp_get_view_rewrite_id() ) ) ),
     778                                'post_type'      => '',
     779                                'post_status'    => bbp_get_public_status_id(),
     780                                'is_archive'     => true,
     781                                'comment_status' => 'closed'
     782                        )
     783                );
    762784
    763785        /** Search ************************************************************/
    … …  
    766788
    767789                // Reset post
    768                 bbp_theme_compat_reset_post( array(
    769                         'ID'             => 0,
    770                         'post_title'     => bbp_get_search_title(),
    771                         'post_author'    => 0,
    772                         'post_date'      => bbp_get_empty_datetime(),
    773                         'post_content'   => $bbp_shortcodes->display_search( array( 'search' => get_query_var( bbp_get_search_rewrite_id() ) ) ),
    774                         'post_type'      => '',
    775                         'post_status'    => bbp_get_public_status_id(),
    776                         'is_archive'     => true,
    777                         'comment_status' => 'closed'
    778                 ) );
     790                bbp_theme_compat_reset_post(
     791                        array(
     792                                'ID'             => 0,
     793                                'post_title'     => bbp_get_search_title(),
     794                                'post_author'    => 0,
     795                                'post_date'      => bbp_get_empty_datetime(),
     796                                'post_content'   => $bbp_shortcodes->display_search( array( 'search' => get_query_var( bbp_get_search_rewrite_id() ) ) ),
     797                                'post_type'      => '',
     798                                'post_status'    => bbp_get_public_status_id(),
     799                                'is_archive'     => true,
     800                                'comment_status' => 'closed'
     801                        )
     802                );
    779803
    780804        /** Topic Tags ********************************************************/
    … …  
    796820
    797821                // Reset the post with our new title
    798                 bbp_theme_compat_reset_post( array(
    799                         'ID'             => 0,
    800                         'post_author'    => 0,
    801                         'post_date'      => bbp_get_empty_datetime(),
    802                         'post_content'   => $new_content,
    803                         'post_type'      => '',
    804                         /* translators: %s: Topic tag name */
    805                         'post_title'     => sprintf( esc_html__( 'Topic Tag: %s', 'bbpress' ), bbp_get_topic_tag_name() ),
    806                         'post_status'    => bbp_get_public_status_id(),
    807                         'is_tax'         => true,
    808                         'is_archive'     => true,
    809                         'comment_status' => 'closed'
    810                 ) );
     822                bbp_theme_compat_reset_post(
     823                        array(
     824                                'ID'             => 0,
     825                                'post_author'    => 0,
     826                                'post_date'      => bbp_get_empty_datetime(),
     827                                'post_content'   => $new_content,
     828                                'post_type'      => '',
     829                                /* translators: %s: Topic tag name */
     830                                'post_title'     => sprintf( esc_html__( 'Topic Tag: %s', 'bbpress' ), bbp_get_topic_tag_name() ),
     831                                'post_status'    => bbp_get_public_status_id(),
     832                                'is_tax'         => true,
     833                                'is_archive'     => true,
     834                                'comment_status' => 'closed'
     835                        )
     836                );
    811837        }
    812838
    … …  
    10001026        global $wp_filter, $merged_filters;
    10011027
     1028        // phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
     1029
    10021030        $bbp = bbpress();
    10031031
    … …  
    10351063        }
    10361064
     1065        // phpcs:enable
     1066
    10371067        return true;
    10381068}
Note: See TracChangeset for help on using the changeset viewer.