* * The plugin emits a

and a \n"; return; } for ($i = 0; $i <= $nkw; $i++) { if ($set[$i]) { array_push($ltables, "{$wpdb->postmeta} p{$i}"); $lwhere .= " AND p.post_id = p{$i}.post_id AND p.meta_key = p{$i}.meta_key AND p{$i}.meta_value = '{$set[$i]}'"; } } $lsql = $sql . join(', ', $ltables) . $lwhere . " GROUP BY p.post_ID ORDER BY x.post_date DESC LIMIT $count"; $results = $wpdb->get_results($lsql); $good_results = 0; if (count($results)) { if (! $did_header) { echo "

Related Posts

\n"; echo "\n"; return; } if (! isset($seen[ $result->post_id ])) { echo '\n"; $seen[ $result->post_id ] = 1; $good_results += 1; } } } #print "\n$lsql\n"; #print_r($results); $count -= $good_results; // exit if we've already displayed all we've been asked to. if ($count <= 0) { if ($did_header) echo "\n"; return; } } if ($did_header) echo "\n"; } /* Determines all the possible sets based on $arr, * and returns an array of them */ function power_set ($arr) { $sets = array(); if (!$arr) return array($arr); foreach (power_set(array_slice($arr, 1)) as $i) { $sets[] = $i; $sets[] = array_merge(array($arr[0]), $i); } return $sets; } function _size_sort ($a, $b) { return count($a) == count($b) ? 0 : count($a) >= count($b) ? 1 : -1; }