Skip to:
Content

bbPress.org

Changeset 4331


Ignore:
Timestamp:
11/04/2012 04:22:18 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Code Improvement:

  • Revert part of r4258.
  • Cast as int instead of using absint()
  • Fixes regression that broke existing bbPress plugin (hierarchical replies.)
  • Fixes #2008.
Location:
trunk/includes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/extend/buddypress.php

    r4279 r4331  
    393393
    394394                // Try to get the activity ID of the post
    395                 $activity_id = absint( get_post_meta( $post_id, '_bbp_activity_id', true ) );
     395                $activity_id = (int) get_post_meta( $post_id, '_bbp_activity_id', true );
    396396
    397397                // Bail if no activity ID is in post meta
  • trunk/includes/forums/template-tags.php

    r4258 r4331  
    11771177        function bbp_get_forum_subforum_count( $forum_id = 0, $integer = false ) {
    11781178                $forum_id    = bbp_get_forum_id( $forum_id );
    1179                 $forum_count = absint( get_post_meta( $forum_id, '_bbp_forum_subforum_count', true ) );
     1179                $forum_count = (int) get_post_meta( $forum_id, '_bbp_forum_subforum_count', true );
    11801180                $filter      = ( true === $integer ) ? 'bbp_get_forum_subforum_count_int' : 'bbp_get_forum_subforum_count';
    11811181
     
    12141214                $forum_id = bbp_get_forum_id( $forum_id );
    12151215                $meta_key = empty( $total_count ) ? '_bbp_topic_count' : '_bbp_total_topic_count';
    1216                 $topics   = absint( get_post_meta( $forum_id, $meta_key, true ) );
     1216                $topics   = (int) get_post_meta( $forum_id, $meta_key, true );
    12171217                $filter   = ( true === $integer ) ? 'bbp_get_forum_topic_count_int' : 'bbp_get_forum_topic_count';
    12181218
     
    12511251                $forum_id = bbp_get_forum_id( $forum_id );
    12521252                $meta_key = empty( $total_count ) ? '_bbp_reply_count' : '_bbp_total_reply_count';
    1253                 $replies  = absint( get_post_meta( $forum_id, $meta_key, true ) );
     1253                $replies  = (int) get_post_meta( $forum_id, $meta_key, true );
    12541254                $filter   = ( true === $integer ) ? 'bbp_get_forum_reply_count_int' : 'bbp_get_forum_reply_count';
    12551255
     
    12891289                $topics   = bbp_get_forum_topic_count( $forum_id, $total_count, true );
    12901290                $meta_key = empty( $total_count ) ? '_bbp_reply_count' : '_bbp_total_reply_count';
    1291                 $replies  = absint( get_post_meta( $forum_id, $meta_key, true ) );
     1291                $replies  = (int) get_post_meta( $forum_id, $meta_key, true );
    12921292                $retval   = $replies + $topics;
    12931293                $filter   = ( true === $integer ) ? 'bbp_get_forum_post_count_int' : 'bbp_get_forum_post_count';
     
    13251325        function bbp_get_forum_topic_count_hidden( $forum_id = 0, $integer = false ) {
    13261326                $forum_id = bbp_get_forum_id( $forum_id );
    1327                 $topics   = absint( get_post_meta( $forum_id, '_bbp_topic_count_hidden', true ) );
     1327                $topics   = (int) get_post_meta( $forum_id, '_bbp_topic_count_hidden', true );
    13281328                $filter   = ( true === $integer ) ? 'bbp_get_forum_topic_count_hidden_int' : 'bbp_get_forum_topic_count_hidden';
    13291329
  • trunk/includes/replies/functions.php

    r4267 r4331  
    13631363
    13641364        // Filter and return
    1365         return absint( apply_filters( 'bbp_get_replies_per_page', $retval, $default ) );
     1365        return (int) apply_filters( 'bbp_get_replies_per_page', $retval, $default );
    13661366}
    13671367
     
    13861386
    13871387        // Filter and return
    1388         return absint( apply_filters( 'bbp_get_replies_per_rss_page', $retval, $default ) );
     1388        return (int) apply_filters( 'bbp_get_replies_per_rss_page', $retval, $default );
    13891389}
    13901390
  • trunk/includes/replies/template-tags.php

    r4258 r4331  
    698698 */
    699699function bbp_get_reply_revision_count( $reply_id = 0, $integer = false ) {
    700         $count = absint( count( bbp_get_reply_revisions( $reply_id ) ) );
     700        $count  = (int) count( bbp_get_reply_revisions( $reply_id ) );
    701701        $filter = ( true === $integer ) ? 'bbp_get_reply_revision_count_int' : 'bbp_get_reply_revision_count';
    702702
  • trunk/includes/topics/functions.php

    r4267 r4331  
    30703070
    30713071        // Filter and return
    3072         return absint( apply_filters( 'bbp_get_topics_per_page', $retval, $default ) );
     3072        return (int) apply_filters( 'bbp_get_topics_per_page', $retval, $default );
    30733073}
    30743074
     
    30933093
    30943094        // Filter and return
    3095         return absint( apply_filters( 'bbp_get_topics_per_rss_page', $retval, $default ) );
     3095        return (int) apply_filters( 'bbp_get_topics_per_rss_page', $retval, $default );
    30963096}
    30973097
  • trunk/includes/topics/template-tags.php

    r4322 r4331  
    927927 */
    928928function bbp_get_topic_revision_count( $topic_id = 0, $integer = false ) {
    929         $count  = absint( count( bbp_get_topic_revisions( $topic_id ) ) );
     929        $count  = (int) count( bbp_get_topic_revisions( $topic_id ) );
    930930        $filter = ( true === $integer ) ? 'bbp_get_topic_revision_count_int' : 'bbp_get_topic_revision_count';
    931931
     
    19241924        function bbp_get_topic_reply_count( $topic_id = 0, $integer = false ) {
    19251925                $topic_id = bbp_get_topic_id( $topic_id );
    1926                 $replies  = absint( get_post_meta( $topic_id, '_bbp_reply_count', true ) );
     1926                $replies  = (int) get_post_meta( $topic_id, '_bbp_reply_count', true );
    19271927                $filter   = ( true === $integer ) ? 'bbp_get_topic_reply_count_int' : 'bbp_get_topic_reply_count';
    19281928
     
    19571957        function bbp_get_topic_post_count( $topic_id = 0, $integer = false ) {
    19581958                $topic_id = bbp_get_topic_id( $topic_id );
    1959                 $replies  = absint( get_post_meta( $topic_id, '_bbp_reply_count', true ) ) + 1;
     1959                $replies  = (int) get_post_meta( $topic_id, '_bbp_reply_count', true ) + 1;
    19601960                $filter   = ( true === $integer ) ? 'bbp_get_topic_post_count_int' : 'bbp_get_topic_post_count';
    19611961
     
    19921992        function bbp_get_topic_reply_count_hidden( $topic_id = 0, $integer = false ) {
    19931993                $topic_id = bbp_get_topic_id( $topic_id );
    1994                 $replies  = absint( get_post_meta( $topic_id, '_bbp_reply_count_hidden', true ) );
     1994                $replies  = (int) get_post_meta( $topic_id, '_bbp_reply_count_hidden', true );
    19951995                $filter   = ( true === $integer ) ? 'bbp_get_topic_reply_count_hidden_int' : 'bbp_get_topic_reply_count_hidden';
    19961996
     
    20232023        function bbp_get_topic_voice_count( $topic_id = 0, $integer = false ) {
    20242024                $topic_id = bbp_get_topic_id( $topic_id );
    2025                 $voices   = absint( get_post_meta( $topic_id, '_bbp_voice_count', true ) );
     2025                $voices   = (int) get_post_meta( $topic_id, '_bbp_voice_count', true );
    20262026                $filter   = ( true === $integer ) ? 'bbp_get_topic_voice_count_int' : 'bbp_get_topic_voice_count';
    20272027
  • trunk/includes/users/options.php

    r4258 r4331  
    152152                        return false;
    153153
    154                 $count  = absint( get_user_option( '_bbp_topic_count', $user_id ) );
     154                $count  = (int) get_user_option( '_bbp_topic_count', $user_id );
    155155                $filter = ( false == $integer ) ? 'bbp_get_user_topic_count_int' : 'bbp_get_user_topic_count';
    156156
     
    190190                        return false;
    191191
    192                 $count  = absint( get_user_option( '_bbp_reply_count', $user_id ) );
     192                $count  = (int) get_user_option( '_bbp_reply_count', $user_id );
    193193                $filter = ( true == $integer ) ? 'bbp_get_user_topic_count_int' : 'bbp_get_user_topic_count';
    194194
     
    230230                $topics  = bbp_get_user_topic_count( $user_id, true );
    231231                $replies = bbp_get_user_reply_count( $user_id, true );
    232                 $count   = absint( $topics + $replies );
     232                $count   = (int) $topics + $replies;
    233233                $filter  = ( true == $integer ) ? 'bbp_get_user_post_count_int' : 'bbp_get_user_post_count';
    234234
Note: See TracChangeset for help on using the changeset viewer.