equal
deleted
inserted
replaced
130 $ec3->advanced=false; |
130 $ec3->advanced=false; |
131 } |
131 } |
132 |
132 |
133 |
133 |
134 /** Rewrite date restrictions if the query is day- or category- specific. */ |
134 /** Rewrite date restrictions if the query is day- or category- specific. */ |
135 function ec3_filter_posts_where(&$where) |
135 function ec3_filter_posts_where($where) |
136 { |
136 { |
137 global $ec3,$wp_query,$wpdb; |
137 global $ec3,$wp_query,$wpdb; |
138 |
138 |
139 // To prevent breaking prior to WordPress v2.3 |
139 // To prevent breaking prior to WordPress v2.3 |
140 if(function_exists('get_the_tags') && $wp_query->is_tag) |
140 if(function_exists('get_the_tags') && $wp_query->is_tag) |
223 |
223 |
224 return $where; |
224 return $where; |
225 } |
225 } |
226 |
226 |
227 /** */ |
227 /** */ |
228 function ec3_filter_posts_join(&$join) |
228 function ec3_filter_posts_join($join) |
229 { |
229 { |
230 global $ec3,$wpdb; |
230 global $ec3,$wpdb; |
231 // The necessary joins are decided upon in ec3_filter_posts_where(). |
231 // The necessary joins are decided upon in ec3_filter_posts_where(). |
232 if($ec3->join_ec3_sch || $ec3->order_by_start) |
232 if($ec3->join_ec3_sch || $ec3->order_by_start) |
233 { |
233 { |
237 } |
237 } |
238 return $join; |
238 return $join; |
239 } |
239 } |
240 |
240 |
241 /** Change the order of event listings (only advanced mode). */ |
241 /** Change the order of event listings (only advanced mode). */ |
242 function ec3_filter_posts_orderby(&$orderby) |
242 function ec3_filter_posts_orderby($orderby) |
243 { |
243 { |
244 global $ec3, $wpdb; |
244 global $ec3, $wpdb; |
245 if($ec3->order_by_start) |
245 if($ec3->order_by_start) |
246 { |
246 { |
247 $regexp="/(?<!DATE_FORMAT[(])\b$wpdb->posts\.post_date\b( DESC\b| ASC\b)?/i"; |
247 $regexp="/(?<!DATE_FORMAT[(])\b$wpdb->posts\.post_date\b( DESC\b| ASC\b)?/i"; |
261 return $orderby; |
261 return $orderby; |
262 } |
262 } |
263 |
263 |
264 |
264 |
265 /** Eliminate double-listings for posts with >1 scheduled event. */ |
265 /** Eliminate double-listings for posts with >1 scheduled event. */ |
266 function ec3_filter_posts_groupby(&$groupby) |
266 function ec3_filter_posts_groupby($groupby) |
267 { |
267 { |
268 global $ec3,$wpdb; |
268 global $ec3,$wpdb; |
269 if($ec3->join_ec3_sch || $ec3->order_by_start) |
269 if($ec3->join_ec3_sch || $ec3->order_by_start) |
270 { |
270 { |
271 if(empty($groupby)) |
271 if(empty($groupby)) |
276 return $groupby; |
276 return $groupby; |
277 } |
277 } |
278 |
278 |
279 |
279 |
280 /** Add a sched_id field, if we want a listing. */ |
280 /** Add a sched_id field, if we want a listing. */ |
281 function ec3_filter_posts_fields(&$fields) |
281 function ec3_filter_posts_fields($fields) |
282 { |
282 { |
283 global $ec3; |
283 global $ec3; |
284 if($ec3->is_listing && ($ec3->join_ec3_sch || $ec3->order_by_start)) |
284 if($ec3->is_listing && ($ec3->join_ec3_sch || $ec3->order_by_start)) |
285 $fields.=',ec3_sch.sched_id'; |
285 $fields.=',ec3_sch.sched_id'; |
286 return $fields; |
286 return $fields; |