- Timestamp:
- 10/12/2015 05:45:14 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-query.php
r10248 r10253 7 7 */ 8 8 9 // Exit if accessed directly 9 // Exit if accessed directly. 10 10 defined( 'ABSPATH' ) || exit; 11 11 … … 57 57 * @param array $query { 58 58 * Array of query clauses. 59 *60 59 * @type array { 61 60 * @type string $column Required. The column to query against. Basically, any DB column in the main … … 88 87 * @param string $alias An existing table alias that is compatible with the current query clause. 89 88 * Default: 'a'. BP_Activity_Activity::get() uses 'a', so we default to that. 90 *91 89 * @return string SQL fragment to append to the main WHERE clause. 92 90 */ … … 98 96 $sql = $this->get_sql_clauses(); 99 97 100 // we only need the 'where' clause98 // We only need the 'where' clause. 101 99 // 102 // also trim trailing "AND" clause from parent BP_Recursive_Query class103 // since it's not necessary for our needs 100 // Also trim trailing "AND" clause from parent BP_Recursive_Query class 101 // since it's not necessary for our needs. 104 102 return preg_replace( '/^\sAND/', '', $sql['where'] ); 105 103 } … … 112 110 * @param array $clause Array of arguments belonging to the clause. 113 111 * @param array $parent_query Parent query to which the clause belongs. 114 *115 112 * @return array { 116 113 * @type array $where Array of subclauses for the WHERE statement. … … 138 135 } 139 136 140 // default 'compare' to '=' if no valid operator is found137 // Default 'compare' to '=' if no valid operator is found. 141 138 if ( ! in_array( $clause['compare'], array( 142 139 '=', '!=', '>', '>=', '<', '<=', … … 156 153 $where = ''; 157 154 158 // value.155 // Value. 159 156 if ( isset( $clause['value'] ) ) { 160 157 if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) { … … 164 161 } 165 162 166 // tinyint163 // Tinyint. 167 164 if ( ! empty( $column ) && true === in_array( $column, array( 'hide_sitewide', 'is_spam' ) ) ) { 168 165 $sql_chunks['where'][] = $wpdb->prepare( "{$alias}{$column} = %d", $value ); … … 170 167 } else { 171 168 switch ( $compare ) { 172 // IN uses different syntax 169 // IN uses different syntax. 173 170 case 'IN' : 174 171 case 'NOT IN' : … … 223 220 * 224 221 * @param array $query Clause to check. 225 *226 222 * @return bool 227 223 */ … … 239 235 * 240 236 * @param string $column The user-supplied column name. 241 *242 237 * @return string A validated column name value. 243 238 */
Note: See TracChangeset
for help on using the changeset viewer.