Overview

Packages

  • None
  • SimplePie

Classes

  • SimplePie
  • SimplePie_Author
  • SimplePie_Autoloader
  • SimplePie_Cache
  • SimplePie_Cache_DB
  • SimplePie_Cache_File
  • SimplePie_Cache_Memcache
  • SimplePie_Cache_MySQL
  • SimplePie_Caption
  • SimplePie_Category
  • SimplePie_Content_Type_Sniffer
  • SimplePie_Copyright
  • SimplePie_Core
  • SimplePie_Credit
  • SimplePie_Decode_HTML_Entities
  • SimplePie_Enclosure
  • SimplePie_File
  • SimplePie_gzdecode
  • SimplePie_HTTP_Parser
  • SimplePie_IRI
  • SimplePie_Item
  • SimplePie_Locator
  • SimplePie_Misc
  • SimplePie_Net_IPv6
  • SimplePie_Parse_Date
  • SimplePie_Parser
  • SimplePie_Rating
  • SimplePie_Registry
  • SimplePie_Restriction
  • SimplePie_Sanitize
  • SimplePie_Source
  • SimplePie_XML_Declaration_Parser

Interfaces

  • SimplePie_Cache_Base
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * SimplePie
  4:  *
  5:  * A PHP-Based RSS and Atom Feed Framework.
  6:  * Takes the hard work out of managing a complete RSS/Atom solution.
  7:  *
  8:  * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
  9:  * All rights reserved.
 10:  *
 11:  * Redistribution and use in source and binary forms, with or without modification, are
 12:  * permitted provided that the following conditions are met:
 13:  *
 14:  *  * Redistributions of source code must retain the above copyright notice, this list of
 15:  *    conditions and the following disclaimer.
 16:  *
 17:  *  * Redistributions in binary form must reproduce the above copyright notice, this list
 18:  *    of conditions and the following disclaimer in the documentation and/or other materials
 19:  *    provided with the distribution.
 20:  *
 21:  *  * Neither the name of the SimplePie Team nor the names of its contributors may be used
 22:  *    to endorse or promote products derived from this software without specific prior
 23:  *    written permission.
 24:  *
 25:  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 26:  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 27:  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
 28:  * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 29:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 30:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 31:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 32:  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 33:  * POSSIBILITY OF SUCH DAMAGE.
 34:  *
 35:  * @package SimplePie
 36:  * @version 1.3-dev
 37:  * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
 38:  * @author Ryan Parman
 39:  * @author Geoffrey Sneddon
 40:  * @author Ryan McCue
 41:  * @link http://simplepie.org/ SimplePie
 42:  * @license http://www.opensource.org/licenses/bsd-license.php BSD License
 43:  */
 44: 
 45: /**
 46:  * Handles `<atom:source>`
 47:  *
 48:  * Used by {@see SimplePie_Item::get_source()}
 49:  *
 50:  * This class can be overloaded with {@see SimplePie::set_source_class()}
 51:  *
 52:  * @package SimplePie
 53:  */
 54: class SimplePie_Source
 55: {
 56:     var $item;
 57:     var $data = array();
 58:     protected $registry;
 59: 
 60:     public function __construct($item, $data)
 61:     {
 62:         $this->item = $item;
 63:         $this->data = $data;
 64:     }
 65: 
 66:     public function set_registry(SimplePie_Registry &$registry)
 67:     {
 68:         $this->registry = &$registry;
 69:     }
 70: 
 71:     public function __toString()
 72:     {
 73:         return md5(serialize($this->data));
 74:     }
 75: 
 76:     public function get_source_tags($namespace, $tag)
 77:     {
 78:         if (isset($this->data['child'][$namespace][$tag]))
 79:         {
 80:             return $this->data['child'][$namespace][$tag];
 81:         }
 82:         else
 83:         {
 84:             return null;
 85:         }
 86:     }
 87: 
 88:     public function get_base($element = array())
 89:     {
 90:         return $this->item->get_base($element);
 91:     }
 92: 
 93:     public function sanitize($data, $type, $base = '')
 94:     {
 95:         return $this->item->sanitize($data, $type, $base);
 96:     }
 97: 
 98:     public function get_item()
 99:     {
100:         return $this->item;
101:     }
102: 
103:     public function get_title()
104:     {
105:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
106:         {
107:             return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
108:         }
109:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
110:         {
111:             return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
112:         }
113:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
114:         {
115:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
116:         }
117:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
118:         {
119:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
120:         }
121:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
122:         {
123:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
124:         }
125:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
126:         {
127:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
128:         }
129:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
130:         {
131:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
132:         }
133:         else
134:         {
135:             return null;
136:         }
137:     }
138: 
139:     public function get_category($key = 0)
140:     {
141:         $categories = $this->get_categories();
142:         if (isset($categories[$key]))
143:         {
144:             return $categories[$key];
145:         }
146:         else
147:         {
148:             return null;
149:         }
150:     }
151: 
152:     public function get_categories()
153:     {
154:         $categories = array();
155: 
156:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
157:         {
158:             $term = null;
159:             $scheme = null;
160:             $label = null;
161:             if (isset($category['attribs']['']['term']))
162:             {
163:                 $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
164:             }
165:             if (isset($category['attribs']['']['scheme']))
166:             {
167:                 $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
168:             }
169:             if (isset($category['attribs']['']['label']))
170:             {
171:                 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
172:             }
173:             $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
174:         }
175:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
176:         {
177:             // This is really the label, but keep this as the term also for BC.
178:             // Label will also work on retrieving because that falls back to term.
179:             $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
180:             if (isset($category['attribs']['']['domain']))
181:             {
182:                 $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
183:             }
184:             else
185:             {
186:                 $scheme = null;
187:             }
188:             $categories[] = $this->registry->create('Category', array($term, $scheme, null));
189:         }
190:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
191:         {
192:             $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
193:         }
194:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
195:         {
196:             $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
197:         }
198: 
199:         if (!empty($categories))
200:         {
201:             return $this->registry->call('Misc', 'array_unique', array($categories));
202:         }
203:         else
204:         {
205:             return null;
206:         }
207:     }
208: 
209:     public function get_author($key = 0)
210:     {
211:         $authors = $this->get_authors();
212:         if (isset($authors[$key]))
213:         {
214:             return $authors[$key];
215:         }
216:         else
217:         {
218:             return null;
219:         }
220:     }
221: 
222:     public function get_authors()
223:     {
224:         $authors = array();
225:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
226:         {
227:             $name = null;
228:             $uri = null;
229:             $email = null;
230:             if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
231:             {
232:                 $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
233:             }
234:             if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
235:             {
236:                 $uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
237:             }
238:             if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
239:             {
240:                 $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
241:             }
242:             if ($name !== null || $email !== null || $uri !== null)
243:             {
244:                 $authors[] = $this->registry->create('Author', array($name, $uri, $email));
245:             }
246:         }
247:         if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
248:         {
249:             $name = null;
250:             $url = null;
251:             $email = null;
252:             if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
253:             {
254:                 $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
255:             }
256:             if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
257:             {
258:                 $url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
259:             }
260:             if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
261:             {
262:                 $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
263:             }
264:             if ($name !== null || $email !== null || $url !== null)
265:             {
266:                 $authors[] = $this->registry->create('Author', array($name, $url, $email));
267:             }
268:         }
269:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
270:         {
271:             $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
272:         }
273:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
274:         {
275:             $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
276:         }
277:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
278:         {
279:             $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
280:         }
281: 
282:         if (!empty($authors))
283:         {
284:             return $this->registry->call('Misc', 'array_unique', array($authors));
285:         }
286:         else
287:         {
288:             return null;
289:         }
290:     }
291: 
292:     public function get_contributor($key = 0)
293:     {
294:         $contributors = $this->get_contributors();
295:         if (isset($contributors[$key]))
296:         {
297:             return $contributors[$key];
298:         }
299:         else
300:         {
301:             return null;
302:         }
303:     }
304: 
305:     public function get_contributors()
306:     {
307:         $contributors = array();
308:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
309:         {
310:             $name = null;
311:             $uri = null;
312:             $email = null;
313:             if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
314:             {
315:                 $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
316:             }
317:             if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
318:             {
319:                 $uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
320:             }
321:             if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
322:             {
323:                 $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
324:             }
325:             if ($name !== null || $email !== null || $uri !== null)
326:             {
327:                 $contributors[] = $this->registry->create('Author', array($name, $uri, $email));
328:             }
329:         }
330:         foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
331:         {
332:             $name = null;
333:             $url = null;
334:             $email = null;
335:             if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
336:             {
337:                 $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
338:             }
339:             if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
340:             {
341:                 $url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
342:             }
343:             if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
344:             {
345:                 $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
346:             }
347:             if ($name !== null || $email !== null || $url !== null)
348:             {
349:                 $contributors[] = $this->registry->create('Author', array($name, $url, $email));
350:             }
351:         }
352: 
353:         if (!empty($contributors))
354:         {
355:             return $this->registry->call('Misc', 'array_unique', array($contributors));
356:         }
357:         else
358:         {
359:             return null;
360:         }
361:     }
362: 
363:     public function get_link($key = 0, $rel = 'alternate')
364:     {
365:         $links = $this->get_links($rel);
366:         if (isset($links[$key]))
367:         {
368:             return $links[$key];
369:         }
370:         else
371:         {
372:             return null;
373:         }
374:     }
375: 
376:     /**
377:      * Added for parity between the parent-level and the item/entry-level.
378:      */
379:     public function get_permalink()
380:     {
381:         return $this->get_link(0);
382:     }
383: 
384:     public function get_links($rel = 'alternate')
385:     {
386:         if (!isset($this->data['links']))
387:         {
388:             $this->data['links'] = array();
389:             if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
390:             {
391:                 foreach ($links as $link)
392:                 {
393:                     if (isset($link['attribs']['']['href']))
394:                     {
395:                         $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
396:                         $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
397:                     }
398:                 }
399:             }
400:             if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
401:             {
402:                 foreach ($links as $link)
403:                 {
404:                     if (isset($link['attribs']['']['href']))
405:                     {
406:                         $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
407:                         $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
408: 
409:                     }
410:                 }
411:             }
412:             if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
413:             {
414:                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
415:             }
416:             if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
417:             {
418:                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
419:             }
420:             if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
421:             {
422:                 $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
423:             }
424: 
425:             $keys = array_keys($this->data['links']);
426:             foreach ($keys as $key)
427:             {
428:                 if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
429:                 {
430:                     if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
431:                     {
432:                         $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
433:                         $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
434:                     }
435:                     else
436:                     {
437:                         $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
438:                     }
439:                 }
440:                 elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
441:                 {
442:                     $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
443:                 }
444:                 $this->data['links'][$key] = array_unique($this->data['links'][$key]);
445:             }
446:         }
447: 
448:         if (isset($this->data['links'][$rel]))
449:         {
450:             return $this->data['links'][$rel];
451:         }
452:         else
453:         {
454:             return null;
455:         }
456:     }
457: 
458:     public function get_description()
459:     {
460:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
461:         {
462:             return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
463:         }
464:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
465:         {
466:             return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
467:         }
468:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
469:         {
470:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
471:         }
472:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
473:         {
474:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
475:         }
476:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
477:         {
478:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
479:         }
480:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
481:         {
482:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
483:         }
484:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
485:         {
486:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
487:         }
488:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
489:         {
490:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
491:         }
492:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
493:         {
494:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
495:         }
496:         else
497:         {
498:             return null;
499:         }
500:     }
501: 
502:     public function get_copyright()
503:     {
504:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
505:         {
506:             return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
507:         }
508:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
509:         {
510:             return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
511:         }
512:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
513:         {
514:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
515:         }
516:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
517:         {
518:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
519:         }
520:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
521:         {
522:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
523:         }
524:         else
525:         {
526:             return null;
527:         }
528:     }
529: 
530:     public function get_language()
531:     {
532:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
533:         {
534:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
535:         }
536:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
537:         {
538:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
539:         }
540:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
541:         {
542:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
543:         }
544:         elseif (isset($this->data['xml_lang']))
545:         {
546:             return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
547:         }
548:         else
549:         {
550:             return null;
551:         }
552:     }
553: 
554:     public function get_latitude()
555:     {
556:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
557:         {
558:             return (float) $return[0]['data'];
559:         }
560:         elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
561:         {
562:             return (float) $match[1];
563:         }
564:         else
565:         {
566:             return null;
567:         }
568:     }
569: 
570:     public function get_longitude()
571:     {
572:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
573:         {
574:             return (float) $return[0]['data'];
575:         }
576:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
577:         {
578:             return (float) $return[0]['data'];
579:         }
580:         elseif (($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
581:         {
582:             return (float) $match[2];
583:         }
584:         else
585:         {
586:             return null;
587:         }
588:     }
589: 
590:     public function get_image_url()
591:     {
592:         if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
593:         {
594:             return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
595:         }
596:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
597:         {
598:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
599:         }
600:         elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
601:         {
602:             return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
603:         }
604:         else
605:         {
606:             return null;
607:         }
608:     }
609: }
610: 
611: 
SimplePie Documentation API documentation generated by ApiGen 2.4.0