| @@ 438-493 (lines=56) @@ | ||
| 435 | * @since Beta 3 |
|
| 436 | * @return array|null List of {@see SimplePie_Category} objects |
|
| 437 | */ |
|
| 438 | public function get_categories() |
|
| 439 | { |
|
| 440 | $categories = array(); |
|
| 441 | ||
| 442 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) |
|
| 443 | { |
|
| 444 | $term = null; |
|
| 445 | $scheme = null; |
|
| 446 | $label = null; |
|
| 447 | if (isset($category['attribs']['']['term'])) |
|
| 448 | { |
|
| 449 | $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 450 | } |
|
| 451 | if (isset($category['attribs']['']['scheme'])) |
|
| 452 | { |
|
| 453 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 454 | } |
|
| 455 | if (isset($category['attribs']['']['label'])) |
|
| 456 | { |
|
| 457 | $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 458 | } |
|
| 459 | $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); |
|
| 460 | } |
|
| 461 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) |
|
| 462 | { |
|
| 463 | // This is really the label, but keep this as the term also for BC. |
|
| 464 | // Label will also work on retrieving because that falls back to term. |
|
| 465 | $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 466 | if (isset($category['attribs']['']['domain'])) |
|
| 467 | { |
|
| 468 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 469 | } |
|
| 470 | else |
|
| 471 | { |
|
| 472 | $scheme = null; |
|
| 473 | } |
|
| 474 | $categories[] = $this->registry->create('Category', array($term, $scheme, null)); |
|
| 475 | } |
|
| 476 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
|
| 477 | { |
|
| 478 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
|
| 479 | } |
|
| 480 | foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) |
|
| 481 | { |
|
| 482 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
|
| 483 | } |
|
| 484 | ||
| 485 | if (!empty($categories)) |
|
| 486 | { |
|
| 487 | return array_unique($categories); |
|
| 488 | } |
|
| 489 | else |
|
| 490 | { |
|
| 491 | return null; |
|
| 492 | } |
|
| 493 | } |
|
| 494 | ||
| 495 | /** |
|
| 496 | * Get an author for the item |
|
| @@ 153-208 (lines=56) @@ | ||
| 150 | } |
|
| 151 | } |
|
| 152 | ||
| 153 | public function get_categories() |
|
| 154 | { |
|
| 155 | $categories = array(); |
|
| 156 | ||
| 157 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) |
|
| 158 | { |
|
| 159 | $term = null; |
|
| 160 | $scheme = null; |
|
| 161 | $label = null; |
|
| 162 | if (isset($category['attribs']['']['term'])) |
|
| 163 | { |
|
| 164 | $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 165 | } |
|
| 166 | if (isset($category['attribs']['']['scheme'])) |
|
| 167 | { |
|
| 168 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 169 | } |
|
| 170 | if (isset($category['attribs']['']['label'])) |
|
| 171 | { |
|
| 172 | $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 173 | } |
|
| 174 | $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); |
|
| 175 | } |
|
| 176 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) |
|
| 177 | { |
|
| 178 | // This is really the label, but keep this as the term also for BC. |
|
| 179 | // Label will also work on retrieving because that falls back to term. |
|
| 180 | $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 181 | if (isset($category['attribs']['']['domain'])) |
|
| 182 | { |
|
| 183 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 184 | } |
|
| 185 | else |
|
| 186 | { |
|
| 187 | $scheme = null; |
|
| 188 | } |
|
| 189 | $categories[] = $this->registry->create('Category', array($term, $scheme, null)); |
|
| 190 | } |
|
| 191 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
|
| 192 | { |
|
| 193 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
|
| 194 | } |
|
| 195 | foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) |
|
| 196 | { |
|
| 197 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
|
| 198 | } |
|
| 199 | ||
| 200 | if (!empty($categories)) |
|
| 201 | { |
|
| 202 | return array_unique($categories); |
|
| 203 | } |
|
| 204 | else |
|
| 205 | { |
|
| 206 | return null; |
|
| 207 | } |
|
| 208 | } |
|
| 209 | ||
| 210 | public function get_author($key = 0) |
|
| 211 | { |
|
| @@ 2076-2131 (lines=56) @@ | ||
| 2073 | * @since Unknown |
|
| 2074 | * @return array|null List of {@see SimplePie_Category} objects |
|
| 2075 | */ |
|
| 2076 | public function get_categories() |
|
| 2077 | { |
|
| 2078 | $categories = array(); |
|
| 2079 | ||
| 2080 | foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category) |
|
| 2081 | { |
|
| 2082 | $term = null; |
|
| 2083 | $scheme = null; |
|
| 2084 | $label = null; |
|
| 2085 | if (isset($category['attribs']['']['term'])) |
|
| 2086 | { |
|
| 2087 | $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 2088 | } |
|
| 2089 | if (isset($category['attribs']['']['scheme'])) |
|
| 2090 | { |
|
| 2091 | $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 2092 | } |
|
| 2093 | if (isset($category['attribs']['']['label'])) |
|
| 2094 | { |
|
| 2095 | $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 2096 | } |
|
| 2097 | $categories[] = $this->registry->create('Category', array($term, $scheme, $label)); |
|
| 2098 | } |
|
| 2099 | foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category) |
|
| 2100 | { |
|
| 2101 | // This is really the label, but keep this as the term also for BC. |
|
| 2102 | // Label will also work on retrieving because that falls back to term. |
|
| 2103 | $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 2104 | if (isset($category['attribs']['']['domain'])) |
|
| 2105 | { |
|
| 2106 | $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT); |
|
| 2107 | } |
|
| 2108 | else |
|
| 2109 | { |
|
| 2110 | $scheme = null; |
|
| 2111 | } |
|
| 2112 | $categories[] = $this->registry->create('Category', array($term, $scheme, null)); |
|
| 2113 | } |
|
| 2114 | foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category) |
|
| 2115 | { |
|
| 2116 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
|
| 2117 | } |
|
| 2118 | foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category) |
|
| 2119 | { |
|
| 2120 | $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null)); |
|
| 2121 | } |
|
| 2122 | ||
| 2123 | if (!empty($categories)) |
|
| 2124 | { |
|
| 2125 | return array_unique($categories); |
|
| 2126 | } |
|
| 2127 | else |
|
| 2128 | { |
|
| 2129 | return null; |
|
| 2130 | } |
|
| 2131 | } |
|
| 2132 | ||
| 2133 | /** |
|
| 2134 | * Get an author for the feed |
|