Changeset 6442 for trunk/src/includes/common/functions.php
- Timestamp:
- 05/29/2017 08:02:13 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r6438 r6442 173 173 * @param string $post_date_gmt 174 174 * 175 * @uses bbp_allow_content_edit()() To make sure editing is allowed 175 176 * @uses get_option() Get the edit lock time 176 177 * @uses current_time() Get the current time … … 180 181 * @return bool 181 182 */ 182 function bbp_past_edit_lock( $post_date_gmt ) {183 function bbp_past_edit_lock( $post_date_gmt = '' ) { 183 184 184 185 // Assume editing is allowed 185 186 $retval = false; 186 187 187 // Bail if empty date 188 if ( ! empty( $post_date_gmt ) ) { 189 190 // Period of time 191 $lockable = '+' . get_option( '_bbp_edit_lock', '5' ) . ' minutes'; 192 193 // Now 194 $cur_time = current_time( 'timestamp', true ); 195 196 // Add lockable time to post time 197 $lock_time = strtotime( $lockable, strtotime( $post_date_gmt ) ); 198 199 // Compare 200 if ( $cur_time >= $lock_time ) { 188 // Check if date and editing is allowed 189 if ( ! empty( $post_date_gmt ) && bbp_allow_content_edit() ) { 190 191 // Get number of minutes to allow editing for 192 $minutes = get_option( '_bbp_edit_lock', '5' ); 193 194 // "0" minutes set, so allow forever 195 if ( 0 === (int) $minutes ) { 201 196 $retval = true; 197 198 // Not "0" so compare 199 } else { 200 201 // Period of time 202 $lockable = "+{$minutes} minutes"; 203 204 // Now 205 $cur_time = current_time( 'timestamp', true ); 206 207 // Add lockable time to post time 208 $lock_time = strtotime( $lockable, strtotime( $post_date_gmt ) ); 209 210 // Compare 211 if ( $cur_time >= $lock_time ) { 212 $retval = true; 213 } 202 214 } 203 215 } 204 216 205 217 // Filter & return 206 return apply_filters( 'bbp_past_edit_lock', (bool)$retval, $cur_time, $lock_time, $post_date_gmt );218 return (bool) apply_filters( 'bbp_past_edit_lock', $retval, $cur_time, $lock_time, $post_date_gmt ); 207 219 } 208 220 … … 669 681 * @param int $author_id Optional. Supply if it's a post by a logged in user. 670 682 * Do not supply if supplying $anonymous_data. 683 * 684 * @suse bbp_allow_content_throttle() To make sure flood checking is enabled 671 685 * @uses get_option() To get the throttle time 672 686 * @uses get_transient() To get the last posted transient of the ip 673 687 * @uses bbp_get_user_last_posted() To get the last posted time of the user 674 688 * @uses current_user_can() To check if the current user can throttle 689 * 675 690 * @return bool True if there is no flooding, false if there is 676 691 */ 677 692 function bbp_check_for_flood( $anonymous_data = array(), $author_id = 0 ) { 693 694 // Allow for flood check to be skipped 695 if ( apply_filters( 'bbp_bypass_check_for_flood', false, $anonymous_data, $author_id ) ) { 696 return true; 697 } 678 698 679 699 // Option disabled. No flood checks. 680 700 $throttle_time = get_option( '_bbp_throttle_time' ); 681 if ( empty( $throttle_time ) ) {701 if ( empty( $throttle_time ) || ! bbp_allow_content_throttle() ) { 682 702 return true; 683 703 }
Note: See TracChangeset
for help on using the changeset viewer.