Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
/**
5
 * SimplePie
6
 *
7
 * A PHP-Based RSS and Atom Feed Framework.
8
 * Takes the hard work out of managing a complete RSS/Atom solution.
9
 *
10
 * Copyright (c) 2004-2022, Ryan Parman, Sam Sneddon, Ryan McCue, and contributors
11
 * All rights reserved.
12
 *
13
 * Redistribution and use in source and binary forms, with or without modification, are
14
 * permitted provided that the following conditions are met:
15
 *
16
 * 	* Redistributions of source code must retain the above copyright notice, this list of
17
 * 	  conditions and the following disclaimer.
18
 *
19
 * 	* Redistributions in binary form must reproduce the above copyright notice, this list
20
 * 	  of conditions and the following disclaimer in the documentation and/or other materials
21
 * 	  provided with the distribution.
22
 *
23
 * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
24
 * 	  to endorse or promote products derived from this software without specific prior
25
 * 	  written permission.
26
 *
27
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
28
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
29
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
30
 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
 * POSSIBILITY OF SUCH DAMAGE.
36
 *
37
 * @package SimplePie
38
 * @copyright 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
39
 * @author Ryan Parman
40
 * @author Sam Sneddon
41
 * @author Ryan McCue
42
 * @link http://simplepie.org/ SimplePie
43
 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
44
 */
45
 
46
namespace SimplePie;
47
 
48
/**
49
 * Handles `<media:text>` captions as defined in Media RSS.
50
 *
51
 * Used by {@see \SimplePie\Enclosure::get_caption()} and {@see \SimplePie\Enclosure::get_captions()}
52
 *
53
 * This class can be overloaded with {@see \SimplePie\SimplePie::set_caption_class()}
54
 *
55
 * @package SimplePie
56
 * @subpackage API
57
 */
58
class Caption
59
{
60
    /**
61
     * Content type
62
     *
63
     * @var string
64
     * @see get_type()
65
     */
66
    public $type;
67
 
68
    /**
69
     * Language
70
     *
71
     * @var string
72
     * @see get_language()
73
     */
74
    public $lang;
75
 
76
    /**
77
     * Start time
78
     *
79
     * @var string
80
     * @see get_starttime()
81
     */
82
    public $startTime;
83
 
84
    /**
85
     * End time
86
     *
87
     * @var string
88
     * @see get_endtime()
89
     */
90
    public $endTime;
91
 
92
    /**
93
     * Caption text
94
     *
95
     * @var string
96
     * @see get_text()
97
     */
98
    public $text;
99
 
100
    /**
101
     * Constructor, used to input the data
102
     *
103
     * For documentation on all the parameters, see the corresponding
104
     * properties and their accessors
105
     */
106
    public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
107
    {
108
        $this->type = $type;
109
        $this->lang = $lang;
110
        $this->startTime = $startTime;
111
        $this->endTime = $endTime;
112
        $this->text = $text;
113
    }
114
 
115
    /**
116
     * String-ified version
117
     *
118
     * @return string
119
     */
120
    public function __toString()
121
    {
122
        // There is no $this->data here
123
        return md5(serialize($this));
124
    }
125
 
126
    /**
127
     * Get the end time
128
     *
129
     * @return string|null Time in the format 'hh:mm:ss.SSS'
130
     */
131
    public function get_endtime()
132
    {
133
        if ($this->endTime !== null) {
134
            return $this->endTime;
135
        }
136
 
137
        return null;
138
    }
139
 
140
    /**
141
     * Get the language
142
     *
143
     * @link http://tools.ietf.org/html/rfc3066
144
     * @return string|null Language code as per RFC 3066
145
     */
146
    public function get_language()
147
    {
148
        if ($this->lang !== null) {
149
            return $this->lang;
150
        }
151
 
152
        return null;
153
    }
154
 
155
    /**
156
     * Get the start time
157
     *
158
     * @return string|null Time in the format 'hh:mm:ss.SSS'
159
     */
160
    public function get_starttime()
161
    {
162
        if ($this->startTime !== null) {
163
            return $this->startTime;
164
        }
165
 
166
        return null;
167
    }
168
 
169
    /**
170
     * Get the text of the caption
171
     *
172
     * @return string|null
173
     */
174
    public function get_text()
175
    {
176
        if ($this->text !== null) {
177
            return $this->text;
178
        }
179
 
180
        return null;
181
    }
182
 
183
    /**
184
     * Get the content type (not MIME type)
185
     *
186
     * @return string|null Either 'text' or 'html'
187
     */
188
    public function get_type()
189
    {
190
        if ($this->type !== null) {
191
            return $this->type;
192
        }
193
 
194
        return null;
195
    }
196
}
197
 
198
class_alias('SimplePie\Caption', 'SimplePie_Caption');