[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/simplepie/simplepie/library/SimplePie/ -> Source.php (source)

   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-2016, 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   * @copyright 2004-2016 Ryan Parman, Geoffrey Sneddon, Ryan McCue
  37   * @author Ryan Parman
  38   * @author Geoffrey Sneddon
  39   * @author Ryan McCue
  40   * @link http://simplepie.org/ SimplePie
  41   * @license http://www.opensource.org/licenses/bsd-license.php BSD License
  42   */
  43  
  44  /**
  45   * Handles `<atom:source>`
  46   *
  47   * Used by {@see SimplePie_Item::get_source()}
  48   *
  49   * This class can be overloaded with {@see SimplePie::set_source_class()}
  50   *
  51   * @package SimplePie
  52   * @subpackage API
  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  
  83          return null;
  84      }
  85  
  86  	public function get_base($element = array())
  87      {
  88          return $this->item->get_base($element);
  89      }
  90  
  91  	public function sanitize($data, $type, $base = '')
  92      {
  93          return $this->item->sanitize($data, $type, $base);
  94      }
  95  
  96  	public function get_item()
  97      {
  98          return $this->item;
  99      }
 100  
 101  	public function get_title()
 102      {
 103          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
 104          {
 105              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
 106          }
 107          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
 108          {
 109              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
 110          }
 111          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
 112          {
 113              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 114          }
 115          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
 116          {
 117              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 118          }
 119          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
 120          {
 121              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 122          }
 123          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
 124          {
 125              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 126          }
 127          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
 128          {
 129              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 130          }
 131  
 132          return null;
 133      }
 134  
 135  	public function get_category($key = 0)
 136      {
 137          $categories = $this->get_categories();
 138          if (isset($categories[$key]))
 139          {
 140              return $categories[$key];
 141          }
 142  
 143          return null;
 144      }
 145  
 146  	public function get_categories()
 147      {
 148          $categories = array();
 149  
 150          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'category') as $category)
 151          {
 152              $term = null;
 153              $scheme = null;
 154              $label = null;
 155              if (isset($category['attribs']['']['term']))
 156              {
 157                  $term = $this->sanitize($category['attribs']['']['term'], SIMPLEPIE_CONSTRUCT_TEXT);
 158              }
 159              if (isset($category['attribs']['']['scheme']))
 160              {
 161                  $scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
 162              }
 163              if (isset($category['attribs']['']['label']))
 164              {
 165                  $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
 166              }
 167              $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
 168          }
 169          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
 170          {
 171              // This is really the label, but keep this as the term also for BC.
 172              // Label will also work on retrieving because that falls back to term.
 173              $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 174              if (isset($category['attribs']['']['domain']))
 175              {
 176                  $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
 177              }
 178              else
 179              {
 180                  $scheme = null;
 181              }
 182              $categories[] = $this->registry->create('Category', array($term, $scheme, null));
 183          }
 184          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
 185          {
 186              $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
 187          }
 188          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
 189          {
 190              $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
 191          }
 192  
 193          if (!empty($categories))
 194          {
 195              return array_unique($categories);
 196          }
 197  
 198          return null;
 199      }
 200  
 201  	public function get_author($key = 0)
 202      {
 203          $authors = $this->get_authors();
 204          if (isset($authors[$key]))
 205          {
 206              return $authors[$key];
 207          }
 208  
 209          return null;
 210      }
 211  
 212  	public function get_authors()
 213      {
 214          $authors = array();
 215          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
 216          {
 217              $name = null;
 218              $uri = null;
 219              $email = null;
 220              if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
 221              {
 222                  $name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 223              }
 224              if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
 225              {
 226                  $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]));
 227              }
 228              if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
 229              {
 230                  $email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 231              }
 232              if ($name !== null || $email !== null || $uri !== null)
 233              {
 234                  $authors[] = $this->registry->create('Author', array($name, $uri, $email));
 235              }
 236          }
 237          if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
 238          {
 239              $name = null;
 240              $url = null;
 241              $email = null;
 242              if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
 243              {
 244                  $name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 245              }
 246              if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
 247              {
 248                  $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]));
 249              }
 250              if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
 251              {
 252                  $email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 253              }
 254              if ($name !== null || $email !== null || $url !== null)
 255              {
 256                  $authors[] = $this->registry->create('Author', array($name, $url, $email));
 257              }
 258          }
 259          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
 260          {
 261              $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
 262          }
 263          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
 264          {
 265              $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
 266          }
 267          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
 268          {
 269              $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
 270          }
 271  
 272          if (!empty($authors))
 273          {
 274              return array_unique($authors);
 275          }
 276  
 277          return null;
 278      }
 279  
 280  	public function get_contributor($key = 0)
 281      {
 282          $contributors = $this->get_contributors();
 283          if (isset($contributors[$key]))
 284          {
 285              return $contributors[$key];
 286          }
 287  
 288          return null;
 289      }
 290  
 291  	public function get_contributors()
 292      {
 293          $contributors = array();
 294          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
 295          {
 296              $name = null;
 297              $uri = null;
 298              $email = null;
 299              if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
 300              {
 301                  $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 302              }
 303              if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
 304              {
 305                  $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]));
 306              }
 307              if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
 308              {
 309                  $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 310              }
 311              if ($name !== null || $email !== null || $uri !== null)
 312              {
 313                  $contributors[] = $this->registry->create('Author', array($name, $uri, $email));
 314              }
 315          }
 316          foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
 317          {
 318              $name = null;
 319              $url = null;
 320              $email = null;
 321              if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
 322              {
 323                  $name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 324              }
 325              if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
 326              {
 327                  $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]));
 328              }
 329              if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
 330              {
 331                  $email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 332              }
 333              if ($name !== null || $email !== null || $url !== null)
 334              {
 335                  $contributors[] = $this->registry->create('Author', array($name, $url, $email));
 336              }
 337          }
 338  
 339          if (!empty($contributors))
 340          {
 341              return array_unique($contributors);
 342          }
 343  
 344          return null;
 345      }
 346  
 347  	public function get_link($key = 0, $rel = 'alternate')
 348      {
 349          $links = $this->get_links($rel);
 350          if (isset($links[$key]))
 351          {
 352              return $links[$key];
 353          }
 354  
 355          return null;
 356      }
 357  
 358      /**
 359       * Added for parity between the parent-level and the item/entry-level.
 360       */
 361  	public function get_permalink()
 362      {
 363          return $this->get_link(0);
 364      }
 365  
 366  	public function get_links($rel = 'alternate')
 367      {
 368          if (!isset($this->data['links']))
 369          {
 370              $this->data['links'] = array();
 371              if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link'))
 372              {
 373                  foreach ($links as $link)
 374                  {
 375                      if (isset($link['attribs']['']['href']))
 376                      {
 377                          $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
 378                          $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
 379                      }
 380                  }
 381              }
 382              if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link'))
 383              {
 384                  foreach ($links as $link)
 385                  {
 386                      if (isset($link['attribs']['']['href']))
 387                      {
 388                          $link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
 389                          $this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
 390  
 391                      }
 392                  }
 393              }
 394              if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))
 395              {
 396                  $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 397              }
 398              if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
 399              {
 400                  $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 401              }
 402              if ($links = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
 403              {
 404                  $this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
 405              }
 406  
 407              $keys = array_keys($this->data['links']);
 408              foreach ($keys as $key)
 409              {
 410                  if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
 411                  {
 412                      if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
 413                      {
 414                          $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
 415                          $this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
 416                      }
 417                      else
 418                      {
 419                          $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
 420                      }
 421                  }
 422                  elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
 423                  {
 424                      $this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
 425                  }
 426                  $this->data['links'][$key] = array_unique($this->data['links'][$key]);
 427              }
 428          }
 429  
 430          if (isset($this->data['links'][$rel]))
 431          {
 432              return $this->data['links'][$rel];
 433          }
 434  
 435          return null;
 436      }
 437  
 438  	public function get_description()
 439      {
 440          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
 441          {
 442              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
 443          }
 444          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
 445          {
 446              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
 447          }
 448          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
 449          {
 450              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 451          }
 452          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
 453          {
 454              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 455          }
 456          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
 457          {
 458              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
 459          }
 460          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
 461          {
 462              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 463          }
 464          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
 465          {
 466              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 467          }
 468          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
 469          {
 470              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 471          }
 472          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
 473          {
 474              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
 475          }
 476  
 477          return null;
 478      }
 479  
 480  	public function get_copyright()
 481      {
 482          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
 483          {
 484              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
 485          }
 486          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
 487          {
 488              return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
 489          }
 490          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
 491          {
 492              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 493          }
 494          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
 495          {
 496              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 497          }
 498          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
 499          {
 500              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 501          }
 502  
 503          return null;
 504      }
 505  
 506  	public function get_language()
 507      {
 508          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'language'))
 509          {
 510              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 511          }
 512          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'language'))
 513          {
 514              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 515          }
 516          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'language'))
 517          {
 518              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
 519          }
 520          elseif (isset($this->data['xml_lang']))
 521          {
 522              return $this->sanitize($this->data['xml_lang'], SIMPLEPIE_CONSTRUCT_TEXT);
 523          }
 524  
 525          return null;
 526      }
 527  
 528  	public function get_latitude()
 529      {
 530          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
 531          {
 532              return (float) $return[0]['data'];
 533          }
 534          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))
 535          {
 536              return (float) $match[1];
 537          }
 538  
 539          return null;
 540      }
 541  
 542  	public function get_longitude()
 543      {
 544          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
 545          {
 546              return (float) $return[0]['data'];
 547          }
 548          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
 549          {
 550              return (float) $return[0]['data'];
 551          }
 552          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))
 553          {
 554              return (float) $match[2];
 555          }
 556  
 557          return null;
 558      }
 559  
 560  	public function get_image_url()
 561      {
 562          if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'image'))
 563          {
 564              return $this->sanitize($return[0]['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI);
 565          }
 566          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'logo'))
 567          {
 568              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 569          }
 570          elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'icon'))
 571          {
 572              return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($return[0]));
 573          }
 574  
 575          return null;
 576      }
 577  }