[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  <?php
   2  
   3  // SPDX-FileCopyrightText: 2004-2023 Ryan Parman, Sam Sneddon, Ryan McCue
   4  // SPDX-License-Identifier: BSD-3-Clause
   5  
   6  declare(strict_types=1);
   7  
   8  namespace SimplePie;
   9  
  10  /**
  11   * Manages `<media:copyright>` copyright tags as defined in Media RSS
  12   *
  13   * Used by {@see \SimplePie\Enclosure::get_copyright()}
  14   *
  15   * This class can be overloaded with {@see \SimplePie\SimplePie::set_copyright_class()}
  16   */
  17  class Copyright
  18  {
  19      /**
  20       * Copyright URL
  21       *
  22       * @var ?string
  23       * @see get_url()
  24       */
  25      public $url;
  26  
  27      /**
  28       * Attribution
  29       *
  30       * @var ?string
  31       * @see get_attribution()
  32       */
  33      public $label;
  34  
  35      /**
  36       * Constructor, used to input the data
  37       *
  38       * For documentation on all the parameters, see the corresponding
  39       * properties and their accessors
  40       */
  41      public function __construct(
  42          ?string $url = null,
  43          ?string $label = null
  44      ) {
  45          $this->url = $url;
  46          $this->label = $label;
  47      }
  48  
  49      /**
  50       * String-ified version
  51       *
  52       * @return string
  53       */
  54      public function __toString()
  55      {
  56          // There is no $this->data here
  57          return md5(serialize($this));
  58      }
  59  
  60      /**
  61       * Get the copyright URL
  62       *
  63       * @return string|null URL to copyright information
  64       */
  65      public function get_url()
  66      {
  67          if ($this->url !== null) {
  68              return $this->url;
  69          }
  70  
  71          return null;
  72      }
  73  
  74      /**
  75       * Get the attribution text
  76       *
  77       * @return string|null
  78       */
  79      public function get_attribution()
  80      {
  81          if ($this->label !== null) {
  82              return $this->label;
  83          }
  84  
  85          return null;
  86      }
  87  }
  88  
  89  class_alias('SimplePie\Copyright', 'SimplePie_Copyright');


Generated : Thu Oct 2 08:20:03 2025 Cross-referenced by PHPXref