Skip to:
Content

BuddyPress.org

Changeset 13897


Ignore:
Timestamp:
06/02/2024 05:52:42 PM (2 years ago)
Author:
espellcaste
Message:

Use wp_strip_all_tags instead of strip_tags.

Props imath
Closes https://github.com/buddypress/buddypress/pull/306
See #7228

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-functions.php

    r13890 r13897  
    173173
    174174        // Try to find mentions.
    175         $usernames = bp_activity_find_mentions( strip_tags( $activity->content ) );
     175        $usernames = bp_activity_find_mentions( wp_strip_all_tags( $activity->content ) );
    176176
    177177        // Still empty? Stop now.
  • trunk/src/bp-activity/bp-activity-template.php

    r13844 r13897  
    32053205                 * @param int    $user_id ID of the queried user.
    32063206                 */
    3207                 $latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', trim( strip_tags( bp_create_excerpt( $update['content'], bp_activity_get_excerpt_length() ) ) ), $user_id );
     3207                $latest_update = apply_filters( 'bp_get_activity_latest_update_excerpt', wp_strip_all_tags( bp_create_excerpt( $update['content'], bp_activity_get_excerpt_length() ) ), $user_id );
    32083208
    32093209                $latest_update = sprintf(
     
    41964196
    41974197                $content = explode( '<span', $content );
    4198                 $title   = strip_tags( ent2ncr( trim( convert_chars( $content[0] ) ) ) );
     4198                $title   = wp_strip_all_tags( ent2ncr( trim( convert_chars( $content[0] ) ) ) );
    41994199
    42004200                if ( ':' === substr( $title, -1 ) ) {
     
    42034203
    42044204                if ( 'activity_update' === $activities_template->activity->type ) {
    4205                         $title .= ': ' . strip_tags( ent2ncr( trim( convert_chars( bp_create_excerpt( $activities_template->activity->content, 70, array( 'ending' => " [&#133;]" ) ) ) ) ) );
     4205                        $title .= ': ' . wp_strip_all_tags( ent2ncr( trim( convert_chars( bp_create_excerpt( $activities_template->activity->content, 70, array( 'ending' => " [&#133;]" ) ) ) ) ) );
    42064206                }
    42074207
  • trunk/src/bp-activity/classes/class-bp-activity-activity.php

    r13890 r13897  
    18811881                for ( $i = 0, $count = count( $activities ); $i < $count; ++$i ) {
    18821882                        $title                            = explode( '<span', $activities[$i]['content'] );
    1883                         $activity_feed[$i]['title']       = trim( strip_tags( $title[0] ) );
     1883                        $activity_feed[$i]['title']       = wp_strip_all_tags( $title[0] );
    18841884                        $activity_feed[$i]['link']        = $activities[$i]['primary_link'];
    18851885                        $activity_feed[$i]['description'] = @sprintf( $activities[$i]['content'], '' );
  • trunk/src/bp-activity/classes/class-bp-activity-feed.php

    r13816 r13897  
    201201        protected function setup_properties() {
    202202                $this->id               = sanitize_title( $this->id );
    203                 $this->title            = strip_tags( $this->title );
     203                $this->title            = wp_strip_all_tags( $this->title );
    204204                $this->link             = esc_url_raw( $this->link );
    205                 $this->description      = strip_tags( $this->description );
     205                $this->description      = wp_strip_all_tags( $this->description );
    206206                $this->ttl              = (int) $this->ttl;
    207                 $this->update_period    = strip_tags( $this->update_period );
     207                $this->update_period    = wp_strip_all_tags( $this->update_period );
    208208                $this->update_frequency = (int) $this->update_frequency;
    209209                $this->activity_args    = bp_parse_args(
  • trunk/src/bp-core/bp-core-template.php

    r13890 r13897  
    817817                }
    818818
    819                 $totalLength = mb_strlen( strip_tags( $ending ) );
     819                $totalLength = mb_strlen( wp_strip_all_tags( $ending ) );
    820820                $openTags    = array();
    821821                $truncate    = '';
     
    867867                // Strip HTML tags if necessary.
    868868                if ( ! empty( $r['strip_tags'] ) ) {
    869                         $text = strip_tags( $text );
     869                        $text = wp_strip_all_tags( $text );
    870870                }
    871871
     
    30593059                // Use component name on member pages.
    30603060                } else {
    3061                         $bp_title_parts = array_merge( $bp_title_parts, array_map( 'strip_tags', array(
     3061                        $bp_title_parts = array_merge( $bp_title_parts, array_map( 'wp_strip_all_tags', array(
    30623062                                $displayed_user_name,
    30633063                                $component_name,
     
    30663066                        // If we have a subnav name, add it separately for localization.
    30673067                        if ( ! empty( $component_subnav_name ) ) {
    3068                                 $bp_title_parts[] = strip_tags( $component_subnav_name );
     3068                                $bp_title_parts[] = wp_strip_all_tags( $component_subnav_name );
    30693069                        }
    30703070                }
  • trunk/src/bp-core/classes/class-bp-media-extractor.php

    r13893 r13897  
    933933         */
    934934        protected function strip_markup( $richtext ) {
    935                 $plaintext = strip_shortcodes( html_entity_decode( strip_tags( $richtext ) ) );
     935                $plaintext = strip_shortcodes( html_entity_decode( wp_strip_all_tags( $richtext ) ) );
    936936
    937937                /**
  • trunk/src/bp-groups/screens/single/request-membership.php

    r13882 r13897  
    5252                // If the member added a message to their request include it into the request arguments.
    5353                if ( isset( $_POST['group-request-membership-comments'] ) && $_POST['group-request-membership-comments'] ) {
    54                         $request_args['content'] = strip_tags( wp_unslash( $_POST['group-request-membership-comments'] ) );
     54                        $request_args['content'] = wp_strip_all_tags( wp_unslash( $_POST['group-request-membership-comments'] ) );
    5555                }
    5656
  • trunk/src/bp-members/bp-members-functions.php

    r13894 r13897  
    515515        return apply_filters( 'bp_core_get_user_displayname', get_the_author_meta( 'display_name', $user_id ), $user_id );
    516516}
    517 add_filter( 'bp_core_get_user_displayname', 'strip_tags', 1 );
     517add_filter( 'bp_core_get_user_displayname', 'wp_strip_all_tags', 1 );
    518518add_filter( 'bp_core_get_user_displayname', 'trim' );
    519519add_filter( 'bp_core_get_user_displayname', 'stripslashes' );
  • trunk/src/bp-members/bp-members-template.php

    r13844 r13897  
    10131013        add_filter( 'bp_get_member_name', 'wp_filter_kses' );
    10141014        add_filter( 'bp_get_member_name', 'stripslashes'   );
    1015         add_filter( 'bp_get_member_name', 'strip_tags'    );
     1015        add_filter( 'bp_get_member_name', 'wp_strip_all_tags' );
    10161016        add_filter( 'bp_get_member_name', 'esc_html'       );
    10171017
     
    11491149
    11501150                if ( ! empty( $update['content'] ) ) {
    1151                         $excerpt           = trim( strip_tags( bp_create_excerpt( $update['content'], $length ) ) );
    1152                         $update['content'] = trim( strip_tags( $update['content'] ) );
     1151                        $excerpt           = wp_strip_all_tags( bp_create_excerpt( $update['content'], $length ) );
     1152                        $update['content'] = wp_strip_all_tags( $update['content'] );
    11531153                        $update['excerpt'] = $excerpt;
    11541154                } else {
  • trunk/src/bp-messages/bp-messages-template.php

    r13878 r13897  
    206206                 * @param string $value Excerpt of the current thread in the loop.
    207207                 */
    208                 return apply_filters( 'bp_get_message_thread_excerpt', strip_tags( bp_create_excerpt( $messages_template->thread->last_message_content, 75 ) ) );
     208                return apply_filters( 'bp_get_message_thread_excerpt', wp_strip_all_tags( bp_create_excerpt( $messages_template->thread->last_message_content, 75 ) ) );
    209209        }
    210210
  • trunk/src/bp-templates/bp-nouveau/includes/messages/ajax.php

    r13878 r13897  
    503503                $thread->thread = array(
    504504                        'id'      => bp_get_the_thread_id(),
    505                         'subject' => strip_tags( bp_get_the_thread_subject() ),
     505                        'subject' => wp_strip_all_tags( bp_get_the_thread_subject() ),
    506506                );
    507507
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-field-type-url.php

    r13806 r13897  
    188188         */
    189189        public static function display_filter( $field_value, $field_id = '' ) {
    190                 $link      = strip_tags( $field_value );
     190                $link      = wp_strip_all_tags( $field_value );
    191191                $no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) );
    192192                $url_text  = str_replace( $link, $no_scheme, $field_value );
Note: See TracChangeset for help on using the changeset viewer.