Permalink
Browse files

wpdb::escape is deprecated since version 3.6

  • Loading branch information...
Flynsarmy committed Oct 11, 2013
1 parent d18d3a4 commit 5b779850442844815dbed14b121a5b840e249a81
Showing with 15 additions and 15 deletions.
  1. +15 −15 syndicationdataqueries.class.php
@@ -20,17 +20,17 @@ function parse_query (&$q) {
$q->is_single = false; // Causes nasty side-effects.
$q->is_singular = true; // Doesn't?
endif;
$ff = $q->get('fields');
if ($ff == '_synfresh' or $ff == '_synfrom') :
$q->query_vars['cache_results'] = false; // Not suitable.
endif;
} /* SyndicationDataQueries::parse_query () */
function pre_get_posts (&$q) {
//
//
}
function posts_request ($sql, &$query) {
if ($query->get('fields') == '_synfresh') :
FeedWordPress::diagnostic('feed_items:freshness:sql', "SQL: ".$sql);
@@ -43,7 +43,7 @@ function posts_search ($search, &$query) {
if ($guid = $query->get('guid')) :
if (strlen(trim($guid)) > 0) :
$seek = array($guid);
// MD5 hashes
if (preg_match('/^[0-9a-f]{32}$/i', $guid)) :
$seek[] = SyndicatedPost::normalize_guid_prefix().$guid;
@@ -55,43 +55,43 @@ function posts_search ($search, &$query) {
if ($guid != $nGuid) :
$seek[] = $nGuid;
endif;
// Escape to prevent frak-ups, injections, etc.
$seek = array_map('esc_sql', $seek);
// Assemble
$guidMatch = "(guid = '".implode("') OR (guid = '", $seek)."')";
$search .= " AND ($guidMatch)";
endif;
endif;
if ($query->get('fields')=='_synfresh') :
// Ugly hack to ensure we ONLY check by guid in syndicated freshness
// checks -- for reasons of both performance and correctness. Pitch:
$search .= " -- '";
elseif ($query->get('fields')=='_synfrom') :
$search .= " AND ({$wpdb->postmeta}.meta_key = '".$query->get('meta_key')."' AND {$wpdb->postmeta}.meta_value = '".$query->get('meta_value')."') -- '";
$search .= " AND ({$wpdb->postmeta}.meta_key = '".$query->get('meta_key')."' AND {$wpdb->postmeta}.meta_value = '".$query->get('meta_value')."') -- '";
endif;
return $search;
} /* SyndicationDataQueries::posts_search () */
function posts_where ($where, &$q) {
global $wpdb;
// Ugly hack to ensure we ONLY check by guid in syndicated freshness
// checks -- for reasons of both performance and correctness. Catch:
if (strpos($where, " -- '") !== false) :
$bits = explode(" -- '", $where, 2);
$where = $bits[0];
endif;
if ($psn = $q->get('post_status__not')) :
$where .= " AND ({$wpdb->posts}.post_status <> '".$wpdb->escape($psn)."')";
$where .= " AND ({$wpdb->posts}.post_status <> '".esc_sql($psn)."')";
endif;
return $where;
} /* SyndicationDataQueries::post_where () */
function posts_fields ($fields, &$query) {
global $wpdb;
if ($f = $query->get('fields')) :

0 comments on commit 5b77985

Please sign in to comment.