| 1 | efrain | 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 |  * Manages `<media:copyright>` copyright tags as defined in Media RSS
 | 
        
           |  |  | 49 |  *
 | 
        
           |  |  | 50 |  * Used by {@see \SimplePie\Enclosure::get_copyright()}
 | 
        
           |  |  | 51 |  *
 | 
        
           |  |  | 52 |  * This class can be overloaded with {@see \SimplePie\SimplePie::set_copyright_class()}
 | 
        
           |  |  | 53 |  *
 | 
        
           |  |  | 54 |  * @package SimplePie
 | 
        
           |  |  | 55 |  * @subpackage API
 | 
        
           |  |  | 56 |  */
 | 
        
           |  |  | 57 | class Copyright
 | 
        
           |  |  | 58 | {
 | 
        
           |  |  | 59 |     /**
 | 
        
           |  |  | 60 |      * Copyright URL
 | 
        
           |  |  | 61 |      *
 | 
        
           |  |  | 62 |      * @var string
 | 
        
           |  |  | 63 |      * @see get_url()
 | 
        
           |  |  | 64 |      */
 | 
        
           |  |  | 65 |     public $url;
 | 
        
           |  |  | 66 |   | 
        
           |  |  | 67 |     /**
 | 
        
           |  |  | 68 |      * Attribution
 | 
        
           |  |  | 69 |      *
 | 
        
           |  |  | 70 |      * @var string
 | 
        
           |  |  | 71 |      * @see get_attribution()
 | 
        
           |  |  | 72 |      */
 | 
        
           |  |  | 73 |     public $label;
 | 
        
           |  |  | 74 |   | 
        
           |  |  | 75 |     /**
 | 
        
           |  |  | 76 |      * Constructor, used to input the data
 | 
        
           |  |  | 77 |      *
 | 
        
           |  |  | 78 |      * For documentation on all the parameters, see the corresponding
 | 
        
           |  |  | 79 |      * properties and their accessors
 | 
        
           |  |  | 80 |      */
 | 
        
           |  |  | 81 |     public function __construct($url = null, $label = null)
 | 
        
           |  |  | 82 |     {
 | 
        
           |  |  | 83 |         $this->url = $url;
 | 
        
           |  |  | 84 |         $this->label = $label;
 | 
        
           |  |  | 85 |     }
 | 
        
           |  |  | 86 |   | 
        
           |  |  | 87 |     /**
 | 
        
           |  |  | 88 |      * String-ified version
 | 
        
           |  |  | 89 |      *
 | 
        
           |  |  | 90 |      * @return string
 | 
        
           |  |  | 91 |      */
 | 
        
           |  |  | 92 |     public function __toString()
 | 
        
           |  |  | 93 |     {
 | 
        
           |  |  | 94 |         // There is no $this->data here
 | 
        
           |  |  | 95 |         return md5(serialize($this));
 | 
        
           |  |  | 96 |     }
 | 
        
           |  |  | 97 |   | 
        
           |  |  | 98 |     /**
 | 
        
           |  |  | 99 |      * Get the copyright URL
 | 
        
           |  |  | 100 |      *
 | 
        
           |  |  | 101 |      * @return string|null URL to copyright information
 | 
        
           |  |  | 102 |      */
 | 
        
           |  |  | 103 |     public function get_url()
 | 
        
           |  |  | 104 |     {
 | 
        
           |  |  | 105 |         if ($this->url !== null) {
 | 
        
           |  |  | 106 |             return $this->url;
 | 
        
           |  |  | 107 |         }
 | 
        
           |  |  | 108 |   | 
        
           |  |  | 109 |         return null;
 | 
        
           |  |  | 110 |     }
 | 
        
           |  |  | 111 |   | 
        
           |  |  | 112 |     /**
 | 
        
           |  |  | 113 |      * Get the attribution text
 | 
        
           |  |  | 114 |      *
 | 
        
           |  |  | 115 |      * @return string|null
 | 
        
           |  |  | 116 |      */
 | 
        
           |  |  | 117 |     public function get_attribution()
 | 
        
           |  |  | 118 |     {
 | 
        
           |  |  | 119 |         if ($this->label !== null) {
 | 
        
           |  |  | 120 |             return $this->label;
 | 
        
           |  |  | 121 |         }
 | 
        
           |  |  | 122 |   | 
        
           |  |  | 123 |         return null;
 | 
        
           |  |  | 124 |     }
 | 
        
           |  |  | 125 | }
 | 
        
           |  |  | 126 |   | 
        
           |  |  | 127 | class_alias('SimplePie\Copyright', 'SimplePie_Copyright');
 |