| @@ -16,14 +16,10 @@ | ||
| 16 | 16 | endif; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function id () { |
| 20 | - if (is_null($this->post) or !is_object($this->post)) : | |
| 21 | - return NULL; | |
| 22 | - else : | |
| 23 | - return $this->post->ID; | |
| 24 | - endif; | |
| 25 | - } /* FeedWordPressLocalPost::id () */ | |
| 20 | + return $this->post->ID; | |
| 21 | + } | |
| 26 | 22 | |
| 27 | 23 | public function meta ($what, $params = array()) { |
| 28 | 24 | |
| 29 | 25 | // -=-=-= 1. INITIAL SETUP. =-=-=- |
| @@ -34,14 +30,8 @@ | ||
| 34 | 30 | "unproxied setting" => NULL, |
| 35 | 31 | "unproxy" => false, |
| 36 | 32 | )); |
| 37 | 33 | |
| 38 | - // If we got put through the_content without a current | |
| 39 | - // $post object set, then bail out immediately. | |
| 40 | - if (is_null($this->post) or !is_object($this->post)) : | |
| 41 | - return $params['default']; | |
| 42 | - endif; | |
| 43 | - | |
| 44 | 34 | // This is a little weird, just bear with me here. |
| 45 | 35 | $results = array(); |
| 46 | 36 | |
| 47 | 37 | // Has this been left up to the admin setting? |
| @@ -53,9 +43,9 @@ | ||
| 53 | 43 | |
| 54 | 44 | // Now if we are supposed to look for ultimate source data (e.g. from |
| 55 | 45 | // <atom:source> ... </atom:source> elements), do so here. |
| 56 | 46 | if ($params['unproxy']) : |
| 57 | - if ( !is_string($params['unproxied setting'])) : | |
| 47 | + if (!is_string($params['unproxied setting'])) : | |
| 58 | 48 | // Default pattern for unproxied settings: {$name}_original |
| 59 | 49 | $params['unproxied setting'] = $what . '_original'; |
| 60 | 50 | endif; |
| 61 | 51 | |
| @@ -72,9 +62,9 @@ | ||
| 72 | 62 | |
| 73 | 63 | // -=-=-= 3. DEAL WITH THE RESULTS, IF ANY, OR FALLBACK VALUES. =-=-=- |
| 74 | 64 | |
| 75 | 65 | // If we have results now, cool. Just pass them back. |
| 76 | - if ( !empty($results)) : | |
| 66 | + if (!empty($results)) : | |
| 77 | 67 | $ret = ($params['single'] ? $results[0] : $results); |
| 78 | 68 | |
| 79 | 69 | // If we got no results but we have a fallback global setting, cool. Use |
| 80 | 70 | // that. Jam it into a singleton array for queries expecting an array of |
| @@ -93,9 +83,9 @@ | ||
| 93 | 83 | return $ret; |
| 94 | 84 | } |
| 95 | 85 | |
| 96 | 86 | public function is_syndicated () { |
| 97 | - return ( !is_null($this->feed_id(/*single=*/ false))); | |
| 87 | + return (!is_null($this->feed_id(/*single=*/ false))); | |
| 98 | 88 | } |
| 99 | 89 | |
| 100 | 90 | public function syndication_permalink () { |
| 101 | 91 | return $this->meta('syndication_permalink'); |
| @@ -102,11 +92,9 @@ | ||
| 102 | 92 | } |
| 103 | 93 | |
| 104 | 94 | public function feed () { |
| 105 | 95 | global $feedwordpress; |
| 106 | - if (is_object($feedwordpress) and method_exists($feedwordpress, 'subscription')) : | |
| 107 | - $this->link = $feedwordpress->subscription($this->feed_id()); | |
| 108 | - endif; | |
| 96 | + $this->link = $feedwordpress->subscription($this->feed_id()); | |
| 109 | 97 | return $this->link; |
| 110 | 98 | } |
| 111 | 99 | |
| 112 | 100 | public function feed_id () { |
| @@ -145,9 +133,9 @@ | ||
| 145 | 133 | |
| 146 | 134 | public function is_exposed_to_formatting_filters () { |
| 147 | 135 | |
| 148 | 136 | return ( |
| 149 | - ! $this->is_syndicated() | |
| 137 | + !$this->is_syndicated() | |
| 150 | 138 | or ( |
| 151 | 139 | 'yes' == $this->meta( |
| 152 | 140 | '_feedwordpress_formatting_filters', |
| 153 | 141 | array( |
| @@ -161,43 +149,20 @@ | ||
| 161 | 149 | } /* FeedWordPressLocalPost::is_exposed_to_formatting_filters () */ |
| 162 | 150 | |
| 163 | 151 | |
| 164 | 152 | public function content () { |
| 165 | - if (is_null($this->post) or !is_object($this->post)) : | |
| 166 | - $post_content = NULL; | |
| 167 | - $post_id = NULL; | |
| 168 | - else : | |
| 169 | - $post_content = $this->post->post_content; | |
| 170 | - $post_id = $this->post->ID; | |
| 171 | - endif; | |
| 172 | - return apply_filters('the_content', $post_content, $post_id); | |
| 153 | + return apply_filters('the_content', $this->post->post_content, $this->post->ID); | |
| 173 | 154 | } |
| 174 | 155 | |
| 175 | 156 | public function title () { |
| 176 | - if (is_null($this->post) or !is_object($this->post)) : | |
| 177 | - $post_title = NULL; | |
| 178 | - $post_id = NULL; | |
| 179 | - else : | |
| 180 | - $post_title = $this->post->post_title; | |
| 181 | - $post_id = $this->post->ID; | |
| 182 | - endif; | |
| 183 | - return apply_filters('the_title', $post_title, $post_id); | |
| 157 | + return apply_filters('the_title', $this->post->post_title, $this->post->ID); | |
| 184 | 158 | } |
| 185 | 159 | |
| 186 | 160 | public function guid () { |
| 187 | - if (is_null($this->post) or !is_object($this->post)) : | |
| 188 | - $post_guid = NULL; | |
| 189 | - else : | |
| 190 | - $post_guid = $this->post->guid; | |
| 191 | - endif; | |
| 192 | - return apply_filters('get_the_guid', $post_guid); | |
| 161 | + return apply_filters('get_the_guid', $this->post->guid); | |
| 193 | 162 | } |
| 194 | 163 | |
| 195 | 164 | public function get_categories () { |
| 196 | - if (is_null($this->post) or !is_object($this->post)) : | |
| 197 | - return array(); | |
| 198 | - endif; | |
| 199 | - | |
| 200 | 165 | $terms = wp_get_object_terms( |
| 201 | 166 | $this->post->ID, |
| 202 | 167 | get_taxonomies(array( |
| 203 | 168 | 'public' => true, |