Changeset 9350
- Timestamp:
- 01/12/2015 11:11:38 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-template.php
r9349 r9350 120 120 */ 121 121 public function __construct( $args = array() ) { 122 global $wpdb, $bp;123 122 124 123 // Backward compatibility with old method of passing arguments … … 141 140 142 141 $r = wp_parse_args( $args, array( 143 'user_id' => bp_loggedin_user_id(),144 'box' => 'inbox',145 'per_page' => 10,146 'max' => false,147 'type' => 'all',142 'user_id' => bp_loggedin_user_id(), 143 'box' => 'inbox', 144 'per_page' => 10, 145 'max' => false, 146 'type' => 'all', 148 147 'search_terms' => '', 149 148 'page_arg' => 'mpage', … … 151 150 ) ); 152 151 153 $this->pag_page = isset( $_GET[ $r['page_arg'] ] ) ? intval( $_GET[ $r['page_arg'] ] ) : 1;154 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num']) : $r['per_page'];152 $this->pag_page = isset( $_GET[ $r['page_arg'] ] ) ? intval( $_GET[ $r['page_arg'] ] ) : 1; 153 $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $r['per_page']; 155 154 156 155 $this->user_id = $r['user_id']; … … 159 158 $this->search_terms = $r['search_terms']; 160 159 161 if ( 'notices' == $this->box ) {160 if ( 'notices' === $this->box ) { 162 161 $this->threads = BP_Messages_Notice::get_notices( array( 163 162 'pag_num' => $this->pag_num, … … 166 165 } else { 167 166 $threads = BP_Messages_Thread::get_current_threads_for_user( array( 168 'user_id' => $this->user_id,169 'box' => $this->box,170 'type' => $this->type,171 'limit' => $this->pag_num,172 'page' => $this->pag_page,167 'user_id' => $this->user_id, 168 'box' => $this->box, 169 'type' => $this->type, 170 'limit' => $this->pag_num, 171 'page' => $this->pag_page, 173 172 'search_terms' => $this->search_terms, 174 173 'meta_query' => $r['meta_query'], … … 185 184 $total_notice_count = BP_Messages_Notice::get_total_notice_count(); 186 185 187 if ( ! $r['max'] || $r['max'] >= (int) $total_notice_count) {188 if ( 'notices' == $this->box ) {186 if ( empty( $r['max'] ) || ( (int) $r['max'] >= (int) $total_notice_count ) ) { 187 if ( 'notices' === $this->box ) { 189 188 $this->total_thread_count = (int) $total_notice_count; 190 189 } … … 193 192 } 194 193 195 if ( $r['max']) {196 if ( $max>= count( $this->threads ) ) {194 if ( ! empty( $r['max'] ) ) { 195 if ( (int) $r['max'] >= count( $this->threads ) ) { 197 196 $this->thread_count = count( $this->threads ); 198 197 } else {
Note: See TracChangeset
for help on using the changeset viewer.