| @@ -10,12 +10,13 @@ | ||
| 10 | 10 | add_filter('posts_request', array($this, 'posts_request'), 10, 2); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | function init () { |
| 14 | - // NOOP | |
| 14 | + global $wp; | |
| 15 | + $wp->add_query_var('guid'); | |
| 15 | 16 | } |
| 16 | 17 | |
| 17 | - function parse_query ($q) { | |
| 18 | + function parse_query (&$q) { | |
| 18 | 19 | if ($q->get('guid')) : |
| 19 | 20 | $q->is_single = false; // Causes nasty side-effects. |
| 20 | 21 | $q->is_singular = true; // Doesn't? |
| 21 | 22 | endif; |
| @@ -25,13 +26,13 @@ | ||
| 25 | 26 | $q->query_vars['cache_results'] = false; // Not suitable. |
| 26 | 27 | endif; |
| 27 | 28 | } /* SyndicationDataQueries::parse_query () */ |
| 28 | 29 | |
| 29 | - function pre_get_posts ($q) { | |
| 30 | - // Is this a stub? Nothing is used... (gwyneth 20230920) | |
| 30 | + function pre_get_posts (&$q) { | |
| 31 | + // | |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | - function posts_request ($sql, $query) { | |
| 34 | + function posts_request ($sql, &$query) { | |
| 34 | 35 | if ($query->get('fields') == '_synfresh') : |
| 35 | 36 | FeedWordPress::diagnostic('feed_items:freshness:sql', "SQL: ".$sql); |
| 36 | 37 | endif; |
| 37 | 38 | return $sql; |
| @@ -36,9 +37,9 @@ | ||
| 36 | 37 | endif; |
| 37 | 38 | return $sql; |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | - function posts_search ($search, $query) { | |
| 41 | + function posts_search ($search, &$query) { | |
| 41 | 42 | global $wpdb; |
| 42 | 43 | if ($guid = $query->get('guid')) : |
| 43 | 44 | if (strlen(trim($guid)) > 0) : |
| 44 | 45 | $seek = array($guid); |
| @@ -55,9 +56,9 @@ | ||
| 55 | 56 | if ($guid != $nGuid) : |
| 56 | 57 | $seek[] = $nGuid; |
| 57 | 58 | $seek[] = SyndicatedPost::alternative_guid($guid); |
| 58 | 59 | endif; |
| 59 | - | |
| 60 | + | |
| 60 | 61 | // Escape to prevent frak-ups, injections, etc. |
| 61 | 62 | $seek = array_map('esc_sql', $seek); |
| 62 | 63 | |
| 63 | 64 | // Assemble |
| @@ -75,9 +76,9 @@ | ||
| 75 | 76 | endif; |
| 76 | 77 | return $search; |
| 77 | 78 | } /* SyndicationDataQueries::posts_search () */ |
| 78 | 79 | |
| 79 | - function posts_where ($where, $q) { | |
| 80 | + function posts_where ($where, &$q) { | |
| 80 | 81 | global $wpdb; |
| 81 | 82 | |
| 82 | 83 | // Ugly hack to ensure we ONLY check by guid in syndicated freshness |
| 83 | 84 | // checks -- for reasons of both performance and correctness. Catch: |
| @@ -92,9 +93,9 @@ | ||
| 92 | 93 | |
| 93 | 94 | return $where; |
| 94 | 95 | } /* SyndicationDataQueries::post_where () */ |
| 95 | 96 | |
| 96 | - function posts_fields ($fields, $query) { | |
| 97 | + function posts_fields ($fields, &$query) { | |
| 97 | 98 | global $wpdb; |
| 98 | 99 | if ($f = $query->get('fields')) : |
| 99 | 100 | switch ($f) : |
| 100 | 101 | case '_synfresh' : |