- Timestamp:
- 08/23/2021 02:03:02 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-notifications/classes/class-bp-notifications-template.php
r10523 r13091 142 142 /** 143 143 * Constructor method. 144 *145 * @see bp_has_notifications() For information on the array format.146 144 * 147 145 * @since 1.9.0 … … 171 169 'max' => null, 172 170 'meta_query' => false, 173 'date_query' => false 171 'date_query' => false, 174 172 ) ); 175 173 176 174 // Sort order direction. 177 175 $orders = array( 'ASC', 'DESC' ); 178 if ( ! empty( $_GET['sort_order'] ) && in_array( $_GET['sort_order'], $orders ) ) {176 if ( ! empty( $_GET['sort_order'] ) && in_array( $_GET['sort_order'], $orders, true ) ) { 179 177 $r['sort_order'] = $_GET['sort_order']; 180 178 } else { … … 184 182 // Setup variables. 185 183 $this->pag_arg = sanitize_key( $r['page_arg'] ); 186 $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page'] 187 $this->pag_num = bp_sanitize_pagination_arg( 'num', 184 $this->pag_page = bp_sanitize_pagination_arg( $this->pag_arg, $r['page'] ); 185 $this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] ); 188 186 $this->user_id = $r['user_id']; 189 187 $this->is_new = $r['is_new']; … … 239 237 'current' => $this->pag_page, 240 238 'prev_text' => _x( '←', 'Notifications pagination previous text', 'buddypress' ), 241 'next_text' => _x( '→', 'Notifications pagination next text', 239 'next_text' => _x( '→', 'Notifications pagination next text', 'buddypress' ), 242 240 'mid_size' => 1, 243 241 'add_args' => $add_args, … … 256 254 */ 257 255 public function has_notifications() { 258 if ( $this->notification_count ) { 259 return true; 260 } 261 262 return false; 256 return ! empty( $this->notification_count ); 263 257 } 264 258 … … 268 262 * @since 1.9.0 269 263 * 270 * @return objectThe next notification to iterate over.264 * @return BP_Notifications_Notification The next notification to iterate over. 271 265 */ 272 266 public function next_notification() { … … 312 306 return true; 313 307 314 } elseif ( $this->current_notification + 1 == $this->notification_count ) {308 } elseif ( $this->current_notification + 1 === $this->notification_count ) { 315 309 316 310 /** … … 319 313 * @since 1.9.0 320 314 */ 321 do_action( 'notifications_loop_end' );315 do_action( 'notifications_loop_end' ); 322 316 323 317 $this->rewind_notifications();
Note: See TracChangeset
for help on using the changeset viewer.