Permalink
Browse files

[location-cards] Shortcode / @with/@of bugfix -- use = for singleton …

…arrays, allowing for ROWID queries. Google's sub-SQL dialect apparently can't handle sending ROWID through an IN operator?
  • Loading branch information...
1 parent cb9bfb8 commit 52da302b00469cf8b1d26ae5f7fa9483aca72ccd @radgeek committed Nov 19, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 extensions/fusion/occupysandyfrontend.php
@@ -86,16 +86,22 @@ function the_occupy_sandy_cards ($params = array()) {
if (is_array($params['matches'])) :
$whereClauses = array();
foreach ($params['matches'] as $col => $value) :
- if (is_array($value)) :
+ if (!is_array($value)) :
+ $value = array($value);
+ endif;
+
+ if (count($value) > 1) :
$operator = 'IN';
$operand = "(";
if (count($value) > 0) :
- $operand .= "'" . implode("', '", array_map(array($wpdb, 'escape'), $value)) . "'";
+ $operand .= "'" . implode("', '", array_map(function ($v) {
+ return $GLOBALS['wpdb']->escape(trim($v));
+ }, $value)) . "'";
endif;
$operand .= ")";
else :
$operator = '=';
- $operand = "'".$wpdb->escape($value)."'";
+ $operand = "'".$wpdb->escape(reset($value))."'";
endif;
$whereClauses[] = "$col $operator $operand";

0 comments on commit 52da302

Please sign in to comment.