Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/21/2017 06:19:56 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Meta: Filter _count_int and enforce integer values.

Also use convenience functions for forum post counts, to ensure proper filters are ran against all meta values.

See #3059.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/core/filters.php

    r6248 r6296  
    191191add_filter( 'bbp_get_form_reply_to',          'absint'   );
    192192
    193 // Add number format filter to functions requiring numeric output
     193// Add number format filter to functions requesting formatted values
    194194add_filter( 'bbp_get_user_topic_count',         'bbp_number_format', 10 );
    195195add_filter( 'bbp_get_user_reply_count',         'bbp_number_format', 10 );
     
    202202add_filter( 'bbp_get_topic_reply_count',        'bbp_number_format', 10 );
    203203add_filter( 'bbp_get_topic_post_count',         'bbp_number_format', 10 );
     204add_filter( 'bbp_get_topic_revision_count',     'bbp_number_format', 10 );
     205add_filter( 'bbp_get_reply_revision_count',     'bbp_number_format', 10 );
    204206add_filter( 'bbp_get_forum_topic_count_hidden', 'bbp_number_format', 10 );
    205207add_filter( 'bbp_get_topic_reply_count_hidden', 'bbp_number_format', 10 );
     208
     209// Add absint filter to functions expecting absolute values
     210add_filter( 'bbp_get_user_topic_count_int',         'intval', 10 );
     211add_filter( 'bbp_get_user_reply_count_int',         'absint', 10 );
     212add_filter( 'bbp_get_user_post_count_int',          'absint', 10 );
     213add_filter( 'bbp_get_forum_subforum_count_int',     'absint', 10 );
     214add_filter( 'bbp_get_forum_topic_count_int',        'absint', 10 );
     215add_filter( 'bbp_get_forum_reply_count_int',        'absint', 10 );
     216add_filter( 'bbp_get_forum_post_count_int',         'absint', 10 );
     217add_filter( 'bbp_get_topic_voice_count_int',        'absint', 10 );
     218add_filter( 'bbp_get_topic_reply_count_int',        'absint', 10 );
     219add_filter( 'bbp_get_topic_post_count_int',         'absint', 10 );
     220add_filter( 'bbp_get_forum_topic_count_hidden_int', 'absint', 10 );
     221add_filter( 'bbp_get_topic_reply_count_hidden_int', 'absint', 10 );
    206222
    207223// Sanitize displayed user data
Note: See TracChangeset for help on using the changeset viewer.