[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/SimplePie/src/ -> Credit.php (source)

   1  <?php
   2  
   3  /**
   4   * SimplePie
   5   *
   6   * A PHP-Based RSS and Atom Feed Framework.
   7   * Takes the hard work out of managing a complete RSS/Atom solution.
   8   *
   9   * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
  10   * All rights reserved.
  11   *
  12   * Redistribution and use in source and binary forms, with or without modification, are
  13   * permitted provided that the following conditions are met:
  14   *
  15   *     * Redistributions of source code must retain the above copyright notice, this list of
  16   *       conditions and the following disclaimer.
  17   *
  18   *     * Redistributions in binary form must reproduce the above copyright notice, this list
  19   *       of conditions and the following disclaimer in the documentation and/or other materials
  20   *       provided with the distribution.
  21   *
  22   *     * Neither the name of the SimplePie Team nor the names of its contributors may be used
  23   *       to endorse or promote products derived from this software without specific prior
  24   *       written permission.
  25   *
  26   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
  27   * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  28   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
  29   * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  31   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  33   * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34   * POSSIBILITY OF SUCH DAMAGE.
  35   *
  36   * @package SimplePie
  37   * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
  38   * @author Ryan Parman
  39   * @author Sam 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  namespace SimplePie;
  46  
  47  /**
  48   * Handles `<media:credit>` as defined in Media RSS
  49   *
  50   * Used by {@see \SimplePie\Enclosure::get_credit()} and {@see \SimplePie\Enclosure::get_credits()}
  51   *
  52   * This class can be overloaded with {@see \SimplePie\SimplePie::set_credit_class()}
  53   *
  54   * @package SimplePie
  55   * @subpackage API
  56   */
  57  class Credit
  58  {
  59      /**
  60       * Credited role
  61       *
  62       * @var string
  63       * @see get_role()
  64       */
  65      public $role;
  66  
  67      /**
  68       * Organizational scheme
  69       *
  70       * @var string
  71       * @see get_scheme()
  72       */
  73      public $scheme;
  74  
  75      /**
  76       * Credited name
  77       *
  78       * @var string
  79       * @see get_name()
  80       */
  81      public $name;
  82  
  83      /**
  84       * Constructor, used to input the data
  85       *
  86       * For documentation on all the parameters, see the corresponding
  87       * properties and their accessors
  88       */
  89      public function __construct($role = null, $scheme = null, $name = null)
  90      {
  91          $this->role = $role;
  92          $this->scheme = $scheme;
  93          $this->name = $name;
  94      }
  95  
  96      /**
  97       * String-ified version
  98       *
  99       * @return string
 100       */
 101      public function __toString()
 102      {
 103          // There is no $this->data here
 104          return md5(serialize($this));
 105      }
 106  
 107      /**
 108       * Get the role of the person receiving credit
 109       *
 110       * @return string|null
 111       */
 112      public function get_role()
 113      {
 114          if ($this->role !== null) {
 115              return $this->role;
 116          }
 117  
 118          return null;
 119      }
 120  
 121      /**
 122       * Get the organizational scheme
 123       *
 124       * @return string|null
 125       */
 126      public function get_scheme()
 127      {
 128          if ($this->scheme !== null) {
 129              return $this->scheme;
 130          }
 131  
 132          return null;
 133      }
 134  
 135      /**
 136       * Get the credited person/entity's name
 137       *
 138       * @return string|null
 139       */
 140      public function get_name()
 141      {
 142          if ($this->name !== null) {
 143              return $this->name;
 144          }
 145  
 146          return null;
 147      }
 148  }
 149  
 150  class_alias('SimplePie\Credit', 'SimplePie_Credit');


Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref