- Timestamp:
- 06/01/2016 04:59:31 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-activity.php
r10588 r10853 108 108 * @var int 109 109 */ 110 var $hide_sitewide = false;110 var $hide_sitewide = 0; 111 111 112 112 /** … … 143 143 public function __construct( $id = false ) { 144 144 if ( !empty( $id ) ) { 145 $this->id = $id;145 $this->id = (int) $id; 146 146 $this->populate(); 147 147 } … … 176 176 $this->content = $row->content; 177 177 $this->date_recorded = $row->date_recorded; 178 $this->hide_sitewide = $row->hide_sitewide;178 $this->hide_sitewide = (int) $row->hide_sitewide; 179 179 $this->mptt_left = (int) $row->mptt_left; 180 180 $this->mptt_right = (int) $row->mptt_right; 181 $this->is_spam = $row->is_spam;181 $this->is_spam = (int) $row->is_spam; 182 182 } 183 183 … … 709 709 // Now fetch data from the cache. 710 710 foreach ( $activity_ids as $activity_id ) { 711 $activities[] = wp_cache_get( $activity_id, 'bp_activity' ); 711 // Integer casting. 712 $activity = wp_cache_get( $activity_id, 'bp_activity' ); 713 if ( ! empty( $activity ) ) { 714 $activity->id = (int) $activity->id; 715 $activity->user_id = (int) $activity->user_id; 716 $activity->item_id = (int) $activity->item_id; 717 $activity->secondary_item_id = (int) $activity->secondary_item_id; 718 $activity->hide_sitewide = (int) $activity->hide_sitewide; 719 $activity->mptt_left = (int) $activity->mptt_left; 720 $activity->mptt_right = (int) $activity->mptt_right; 721 $activity->is_spam = (int) $activity->is_spam; 722 } 723 724 $activities[] = $activity; 712 725 } 713 726 … … 1072 1085 if ( ! empty( $where_args ) ) { 1073 1086 $where_sql = 'WHERE ' . join( ' AND ', $where_args ); 1074 return $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ); 1087 $result = $wpdb->get_var( "SELECT id FROM {$bp->activity->table_name} {$where_sql}" ); 1088 1089 return is_numeric( $result ) ? (int) $result : false; 1075 1090 } 1076 1091 … … 1764 1779 $bp = buddypress(); 1765 1780 1766 return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) ); 1781 $result = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->activity->table_name} WHERE content = %s", $content ) ); 1782 1783 return is_numeric( $result ) ? (int) $result : false; 1767 1784 } 1768 1785
Note: See TracChangeset
for help on using the changeset viewer.