Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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
 * Handles `<media:text>` captions as defined in Media RSS.
49
 *
50
 * Used by {@see \SimplePie\Enclosure::get_caption()} and {@see \SimplePie\Enclosure::get_captions()}
51
 *
52
 * This class can be overloaded with {@see \SimplePie\SimplePie::set_caption_class()}
53
 *
54
 * @package SimplePie
55
 * @subpackage API
56
 */
57
class Caption
58
{
59
    /**
60
     * Content type
61
     *
62
     * @var string
63
     * @see get_type()
64
     */
65
    public $type;
66
 
67
    /**
68
     * Language
69
     *
70
     * @var string
71
     * @see get_language()
72
     */
73
    public $lang;
74
 
75
    /**
76
     * Start time
77
     *
78
     * @var string
79
     * @see get_starttime()
80
     */
81
    public $startTime;
82
 
83
    /**
84
     * End time
85
     *
86
     * @var string
87
     * @see get_endtime()
88
     */
89
    public $endTime;
90
 
91
    /**
92
     * Caption text
93
     *
94
     * @var string
95
     * @see get_text()
96
     */
97
    public $text;
98
 
99
    /**
100
     * Constructor, used to input the data
101
     *
102
     * For documentation on all the parameters, see the corresponding
103
     * properties and their accessors
104
     */
105
    public function __construct($type = null, $lang = null, $startTime = null, $endTime = null, $text = null)
106
    {
107
        $this->type = $type;
108
        $this->lang = $lang;
109
        $this->startTime = $startTime;
110
        $this->endTime = $endTime;
111
        $this->text = $text;
112
    }
113
 
114
    /**
115
     * String-ified version
116
     *
117
     * @return string
118
     */
119
    public function __toString()
120
    {
121
        // There is no $this->data here
122
        return md5(serialize($this));
123
    }
124
 
125
    /**
126
     * Get the end time
127
     *
128
     * @return string|null Time in the format 'hh:mm:ss.SSS'
129
     */
130
    public function get_endtime()
131
    {
132
        if ($this->endTime !== null) {
133
            return $this->endTime;
134
        }
135
 
136
        return null;
137
    }
138
 
139
    /**
140
     * Get the language
141
     *
142
     * @link http://tools.ietf.org/html/rfc3066
143
     * @return string|null Language code as per RFC 3066
144
     */
145
    public function get_language()
146
    {
147
        if ($this->lang !== null) {
148
            return $this->lang;
149
        }
150
 
151
        return null;
152
    }
153
 
154
    /**
155
     * Get the start time
156
     *
157
     * @return string|null Time in the format 'hh:mm:ss.SSS'
158
     */
159
    public function get_starttime()
160
    {
161
        if ($this->startTime !== null) {
162
            return $this->startTime;
163
        }
164
 
165
        return null;
166
    }
167
 
168
    /**
169
     * Get the text of the caption
170
     *
171
     * @return string|null
172
     */
173
    public function get_text()
174
    {
175
        if ($this->text !== null) {
176
            return $this->text;
177
        }
178
 
179
        return null;
180
    }
181
 
182
    /**
183
     * Get the content type (not MIME type)
184
     *
185
     * @return string|null Either 'text' or 'html'
186
     */
187
    public function get_type()
188
    {
189
        if ($this->type !== null) {
190
            return $this->type;
191
        }
192
 
193
        return null;
194
    }
195
}
196
 
197
class_alias('SimplePie\Caption', 'SimplePie_Caption');