PluginProbe
FeedWordPress / 2014.0805
FeedWordPress v2014.0805
trunk 0.8 0.9 0.91 0.95 0.96 0.97 0.98 0.981 0.99 0.991 0.992 0.993 2008.1030 2008.1101 2008.1105 2008.1214 2009.0612 2009.0613 2009.0618 2009.0707 2009.1111 2009.1112 2010.0127 2010.0528 All 65 releases
← All changes | syndicationdataqueries.class.php +10 -11 trunk2014.0805 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2
3 3 class SyndicationDataQueries {
4 - public function __construct () {
4 + function SyndicationDataQueries () {
5 5 add_action('init', array($this, 'init'));
6 6 add_action('parse_query', array($this, 'parse_query'), 10, 1);
7 7 add_filter('posts_search', array($this, 'posts_search'), 10, 2);
8 8 add_filter('posts_where', array($this, 'posts_where'), 10, 2);
@@ -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);
@@ -45,9 +46,8 @@
45 46
46 47 // MD5 hashes
47 48 if (preg_match('/^[0-9a-f]{32}$/i', $guid)) :
48 49 $seek[] = SyndicatedPost::normalize_guid_prefix().$guid;
49 - $seek[] = SyndicatedPost::alternative_guid_prefix().$guid;
50 50 endif;
51 51
52 52 // Invalid URIs, URIs that WordPress just doesn't like, and URIs
53 53 // that WordPress decides to munge.
@@ -53,9 +53,8 @@
53 53 // that WordPress decides to munge.
54 54 $nGuid = SyndicatedPost::normalize_guid($guid);
55 55 if ($guid != $nGuid) :
56 56 $seek[] = $nGuid;
57 - $seek[] = SyndicatedPost::alternative_guid($guid);
58 57 endif;
59 58
60 59 // Escape to prevent frak-ups, injections, etc.
61 60 $seek = array_map('esc_sql', $seek);
@@ -75,9 +74,9 @@
75 74 endif;
76 75 return $search;
77 76 } /* SyndicationDataQueries::posts_search () */
78 77
79 - function posts_where ($where, $q) {
78 + function posts_where ($where, &$q) {
80 79 global $wpdb;
81 80
82 81 // Ugly hack to ensure we ONLY check by guid in syndicated freshness
83 82 // checks -- for reasons of both performance and correctness. Catch:
@@ -92,9 +91,9 @@
92 91
93 92 return $where;
94 93 } /* SyndicationDataQueries::post_where () */
95 94
96 - function posts_fields ($fields, $query) {
95 + function posts_fields ($fields, &$query) {
97 96 global $wpdb;
98 97 if ($f = $query->get('fields')) :
99 98 switch ($f) :
100 99 case '_synfresh' :