Changeset 6923 for trunk/src/includes/topics/template.php
- Timestamp:
- 11/09/2019 05:35:42 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r6922 r6923 805 805 ), 'get_topic_pagination' ); 806 806 807 // Slug must be checked for topics that have never been approved/published 808 $has_slug = bbp_get_topic( $r['topic_id'] )->post_name; 809 807 810 // If pretty permalinks are enabled, make our pagination pretty 808 $base = bbp_use_pretty_urls()811 $base = ! empty( $has_slug ) && bbp_use_pretty_urls() && ! bbp_is_topic_pending( $r['topic_id'] ) 809 812 ? trailingslashit( get_permalink( $r['topic_id'] ) ) . user_trailingslashit( bbp_get_paged_slug() . '/%#%/' ) 810 813 : add_query_arg( 'paged', '%#%', get_permalink( $r['topic_id'] ) ); … … 947 950 948 951 $revision_log = get_post_meta( $topic_id, '_bbp_revision_log', true ); 949 $revision_log = empty( $revision_log ) ? array() : $revision_log; 952 $revision_log = ! empty( $revision_log ) 953 ? $revision_log 954 : array(); 950 955 951 956 // Filter & return … … 1658 1663 function bbp_get_topic_forum_id( $topic_id = 0 ) { 1659 1664 $topic_id = bbp_get_topic_id( $topic_id ); 1660 $forum_id = get_post_field( 'post_parent', $topic_id );1665 $forum_id = (int) get_post_field( 'post_parent', $topic_id ); 1661 1666 1662 1667 // Meta-data fallback 1663 1668 if ( empty( $forum_id ) ) { 1664 $forum_id = get_post_meta( $topic_id, '_bbp_forum_id', true );1669 $forum_id = (int) get_post_meta( $topic_id, '_bbp_forum_id', true ); 1665 1670 } 1666 1671 1667 1672 // Filter 1668 1673 if ( ! empty( $forum_id ) ) { 1669 $forum_id = bbp_get_forum_id( $forum_id );1670 } 1671 1672 // Filter & return 1673 return (int) apply_filters( 'bbp_get_topic_forum_id', (int)$forum_id, $topic_id );1674 $forum_id = (int) bbp_get_forum_id( $forum_id ); 1675 } 1676 1677 // Filter & return 1678 return (int) apply_filters( 'bbp_get_topic_forum_id', $forum_id, $topic_id ); 1674 1679 } 1675 1680 … … 1694 1699 function bbp_get_topic_last_active_id( $topic_id = 0 ) { 1695 1700 $topic_id = bbp_get_topic_id( $topic_id ); 1696 $active_id = get_post_meta( $topic_id, '_bbp_last_active_id', true );1697 1698 // Filter & return 1699 return (int) apply_filters( 'bbp_get_topic_last_active_id', (int)$active_id, $topic_id );1701 $active_id = (int) get_post_meta( $topic_id, '_bbp_last_active_id', true ); 1702 1703 // Filter & return 1704 return (int) apply_filters( 'bbp_get_topic_last_active_id', $active_id, $topic_id ); 1700 1705 } 1701 1706 … … 1856 1861 function bbp_get_topic_last_reply_id( $topic_id = 0 ) { 1857 1862 $topic_id = bbp_get_topic_id( $topic_id ); 1858 $reply_id = get_post_meta( $topic_id, '_bbp_last_reply_id', true );1859 1860 // Filter & return 1861 return (int) apply_filters( 'bbp_get_topic_last_reply_id', (int)$reply_id, $topic_id );1863 $reply_id = (int) get_post_meta( $topic_id, '_bbp_last_reply_id', true ); 1864 1865 // Filter & return 1866 return (int) apply_filters( 'bbp_get_topic_last_reply_id', $reply_id, $topic_id ); 1862 1867 } 1863 1868 … … 2058 2063 function bbp_get_topic_reply_count( $topic_id = 0, $integer = false ) { 2059 2064 $topic_id = bbp_get_topic_id( $topic_id ); 2060 $replies = get_post_meta( $topic_id, '_bbp_reply_count', true );2065 $replies = (int) get_post_meta( $topic_id, '_bbp_reply_count', true ); 2061 2066 $filter = ( true === $integer ) 2062 2067 ? 'bbp_get_topic_reply_count_int' … … 2088 2093 function bbp_get_topic_post_count( $topic_id = 0, $integer = false ) { 2089 2094 $topic_id = bbp_get_topic_id( $topic_id ); 2090 $replies = get_post_meta( $topic_id, '_bbp_reply_count', true) + 1;2095 $replies = ( (int) get_post_meta( $topic_id, '_bbp_reply_count', true ) ) + 1; 2091 2096 $filter = ( true === $integer ) 2092 2097 ? 'bbp_get_topic_post_count_int' … … 2120 2125 function bbp_get_topic_reply_count_hidden( $topic_id = 0, $integer = false ) { 2121 2126 $topic_id = bbp_get_topic_id( $topic_id ); 2122 $replies = get_post_meta( $topic_id, '_bbp_reply_count_hidden', true );2127 $replies = (int) get_post_meta( $topic_id, '_bbp_reply_count_hidden', true ); 2123 2128 $filter = ( true === $integer ) 2124 2129 ? 'bbp_get_topic_reply_count_hidden_int' … … 2148 2153 function bbp_get_topic_voice_count( $topic_id = 0, $integer = false ) { 2149 2154 $topic_id = bbp_get_topic_id( $topic_id ); 2150 $voices = get_post_meta( $topic_id, '_bbp_voice_count', true );2155 $voices = (int) get_post_meta( $topic_id, '_bbp_voice_count', true ); 2151 2156 $filter = ( true === $integer ) 2152 2157 ? 'bbp_get_topic_voice_count_int' … … 2343 2348 // See if links need to be unset 2344 2349 $topic_status = bbp_get_topic_status( $r['id'] ); 2345 if ( in_array( $topic_status, array( bbp_get_spam_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id() )) ) {2350 if ( in_array( $topic_status, bbp_get_non_public_topic_statuses(), true ) ) { 2346 2351 2347 2352 // Close link shouldn't be visible on trashed/spammed/pending topics
Note: See TracChangeset
for help on using the changeset viewer.