Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/15/2015 02:34:21 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Topics: Move is_sticky functions to above open/closed functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/topics/template.php

    r5681 r5682  
    10791079
    10801080/**
    1081  * Output the status of the topic
    1082  *
    1083  * @since bbPress (r2667)
    1084  *
    1085  * @param int $topic_id Optional. Topic id
    1086  * @uses bbp_get_topic_status() To get the topic status
    1087  */
    1088 function bbp_topic_status( $topic_id = 0 ) {
    1089         echo bbp_get_topic_status( $topic_id );
    1090 }
    1091         /**
    1092          * Return the status of the topic
    1093          *
    1094          * @since bbPress (r2667)
    1095          *
    1096          * @param int $topic_id Optional. Topic id
    1097          * @uses bbp_get_topic_id() To get the topic id
    1098          * @uses get_post_status() To get the topic status
    1099          * @uses apply_filters() Calls 'bbp_get_topic_status' with the status
    1100          *                        and topic id
    1101          * @return string Status of topic
    1102          */
    1103         function bbp_get_topic_status( $topic_id = 0 ) {
    1104                 $topic_id = bbp_get_topic_id( $topic_id );
    1105 
    1106                 return apply_filters( 'bbp_get_topic_status', get_post_status( $topic_id ), $topic_id );
    1107         }
    1108 
    1109 /**
    1110  * Is the topic open to new replies?
    1111  *
    1112  * @since bbPress (r2727)
    1113  *
    1114  * @uses bbp_get_topic_status()
    1115  *
    1116  * @param int $topic_id Optional. Topic id
    1117  * @uses bbp_is_topic_closed() To check if the topic is closed
    1118  * @return bool True if open, false if closed.
    1119  */
    1120 function bbp_is_topic_open( $topic_id = 0 ) {
    1121         return ! bbp_is_topic_closed( $topic_id );
    1122 }
    1123 
    1124         /**
    1125          * Is the topic closed to new replies?
    1126          *
    1127          * @since bbPress (r2746)
    1128          *
    1129          * @param int $topic_id Optional. Topic id
    1130          * @uses bbp_get_topic_status() To get the topic status
    1131          * @uses apply_filters() Calls 'bbp_is_topic_closed' with the topic id
    1132          *
    1133          * @return bool True if closed, false if not.
    1134          */
    1135         function bbp_is_topic_closed( $topic_id = 0 ) {
    1136                 $closed = bbp_get_topic_status( $topic_id ) === bbp_get_closed_status_id();
    1137                 return (bool) apply_filters( 'bbp_is_topic_closed', (bool) $closed, $topic_id );
    1138         }
    1139 
    1140 /**
    11411081 * Is the topic a sticky or super sticky?
    11421082 *
     
    11831123
    11841124        return (bool) apply_filters( 'bbp_is_topic_super_sticky', $retval, $topic_id );
     1125}
     1126
     1127/**
     1128 * Output the status of the topic
     1129 *
     1130 * @since bbPress (r2667)
     1131 *
     1132 * @param int $topic_id Optional. Topic id
     1133 * @uses bbp_get_topic_status() To get the topic status
     1134 */
     1135function bbp_topic_status( $topic_id = 0 ) {
     1136        echo bbp_get_topic_status( $topic_id );
     1137}
     1138        /**
     1139         * Return the status of the topic
     1140         *
     1141         * @since bbPress (r2667)
     1142         *
     1143         * @param int $topic_id Optional. Topic id
     1144         * @uses bbp_get_topic_id() To get the topic id
     1145         * @uses get_post_status() To get the topic status
     1146         * @uses apply_filters() Calls 'bbp_get_topic_status' with the status
     1147         *                        and topic id
     1148         * @return string Status of topic
     1149         */
     1150        function bbp_get_topic_status( $topic_id = 0 ) {
     1151                $topic_id = bbp_get_topic_id( $topic_id );
     1152
     1153                return apply_filters( 'bbp_get_topic_status', get_post_status( $topic_id ), $topic_id );
     1154        }
     1155
     1156/**
     1157 * Is the topic closed to new replies?
     1158 *
     1159 * @since bbPress (r2746)
     1160 *
     1161 * @param int $topic_id Optional. Topic id
     1162 * @uses bbp_get_topic_status() To get the topic status
     1163 * @uses apply_filters() Calls 'bbp_is_topic_closed' with the topic id
     1164 *
     1165 * @return bool True if closed, false if not.
     1166 */
     1167function bbp_is_topic_closed( $topic_id = 0 ) {
     1168        $topic_id     = bbp_get_topic_id( $topic_id );
     1169        $status       = bbp_get_closed_status_id();
     1170        $topic_status = bbp_get_topic_status( $topic_id ) === $status;
     1171
     1172        return (bool) apply_filters( 'bbp_is_topic_closed', (bool) $topic_status, $topic_id );
     1173}
     1174
     1175/**
     1176 * Is the topic open to new replies?
     1177 *
     1178 * @since bbPress (r2727)
     1179 *
     1180 * @uses bbp_get_topic_status()
     1181 *
     1182 * @param int $topic_id Optional. Topic id
     1183 * @uses bbp_is_topic_closed() To check if the topic is closed
     1184 * @return bool True if open, false if closed.
     1185 */
     1186function bbp_is_topic_open( $topic_id = 0 ) {
     1187        return ! bbp_is_topic_closed( $topic_id );
    11851188}
    11861189
Note: See TracChangeset for help on using the changeset viewer.