source: trunk/www.guidonia.net/wp/wp-content/plugins/webtv/Drivers/Zend/Gdata/Media/Extension/MediaContent.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 14 years ago
File size: 12.5 KB
Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
15 *
16 * @category Zend
17 * @package Zend_Gdata
18 * @subpackage Media
19 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
21 */
22
23/**
24 * @see Zend_Gdata_Extension
25 */
26require_once 'Zend/Gdata/Extension.php';
27
28/**
29 * Represents the media:content element of Media RSS.
30 * Represents media objects. Multiple media objects representing
31 * the same content can be represented using a
32 * media:group (Zend_Gdata_Media_Extension_MediaGroup) element.
33 *
34 * @category Zend
35 * @package Zend_Gdata
36 * @subpackage Media
37 * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
38 * @license http://framework.zend.com/license/new-bsd New BSD License
39 */
40class Zend_Gdata_Media_Extension_MediaContent extends Zend_Gdata_Extension
41{
42 protected $_rootElement = 'content';
43 protected $_rootNamespace = 'media';
44
45 /**
46 * @var string
47 */
48 protected $_url = null;
49
50 /**
51 * @var int
52 */
53 protected $_fileSize = null;
54
55 /**
56 * @var string
57 */
58 protected $_type = null;
59
60 /**
61 * @var string
62 */
63 protected $_medium = null;
64
65 /**
66 * @var string
67 */
68 protected $_isDefault = null;
69
70 /**
71 * @var string
72 */
73 protected $_expression = null;
74
75 /**
76 * @var int
77 */
78 protected $_bitrate = null;
79
80 /**
81 * @var int
82 */
83 protected $_framerate = null;
84
85 /**
86 * @var int
87 */
88 protected $_samplingrate = null;
89
90 /**
91 * @var int
92 */
93 protected $_channels = null;
94
95 /**
96 * @var int
97 */
98 protected $_duration = null;
99
100 /**
101 * @var int
102 */
103 protected $_height = null;
104
105 /**
106 * @var int
107 */
108 protected $_width = null;
109
110 /**
111 * @var string
112 */
113 protected $_lang = null;
114
115 /**
116 * Creates an individual MediaContent object.
117 */
118 public function __construct($url = null, $fileSize = null, $type = null,
119 $medium = null, $isDefault = null, $expression = null,
120 $bitrate = null, $framerate = null, $samplingrate = null,
121 $channels = null, $duration = null, $height = null, $width = null,
122 $lang = null)
123 {
124 $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces);
125 parent::__construct();
126 $this->_url = $url;
127 $this->_fileSize = $fileSize;
128 $this->_type = $type;
129 $this->_medium = $medium;
130 $this->_isDefault = $isDefault;
131 $this->_expression = $expression;
132 $this->_bitrate = $bitrate;
133 $this->_framerate = $framerate;
134 $this->_samplingrate = $samplingrate;
135 $this->_channels = $channels;
136 $this->_duration = $duration;
137 $this->_height = $height;
138 $this->_width = $width;
139 $this->_lang = $lang;
140 }
141
142
143 /**
144 * Retrieves a DOMElement which corresponds to this element and all
145 * child properties. This is used to build an entry back into a DOM
146 * and eventually XML text for sending to the server upon updates, or
147 * for application storage/persistence.
148 *
149 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
150 * @return DOMElement The DOMElement representing this element and all
151 * child properties.
152 */
153 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
154 {
155 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
156 if ($this->_url !== null) {
157 $element->setAttribute('url', $this->_url);
158 }
159 if ($this->_fileSize !== null) {
160 $element->setAttribute('fileSize', $this->_fileSize);
161 }
162 if ($this->_type !== null) {
163 $element->setAttribute('type', $this->_type);
164 }
165 if ($this->_medium !== null) {
166 $element->setAttribute('medium', $this->_medium);
167 }
168 if ($this->_isDefault !== null) {
169 $element->setAttribute('isDefault', $this->_isDefault);
170 }
171 if ($this->_expression !== null) {
172 $element->setAttribute('expression', $this->_expression);
173 }
174 if ($this->_bitrate !== null) {
175 $element->setAttribute('bitrate', $this->_bitrate);
176 }
177 if ($this->_framerate !== null) {
178 $element->setAttribute('framerate', $this->_framerate);
179 }
180 if ($this->_samplingrate !== null) {
181 $element->setAttribute('samplingrate', $this->_samplingrate);
182 }
183 if ($this->_channels !== null) {
184 $element->setAttribute('channels', $this->_channels);
185 }
186 if ($this->_duration !== null) {
187 $element->setAttribute('duration', $this->_duration);
188 }
189 if ($this->_height !== null) {
190 $element->setAttribute('height', $this->_height);
191 }
192 if ($this->_width !== null) {
193 $element->setAttribute('width', $this->_width);
194 }
195 if ($this->_lang !== null) {
196 $element->setAttribute('lang', $this->_lang);
197 }
198 return $element;
199 }
200
201 /**
202 * Given a DOMNode representing an attribute, tries to map the data into
203 * instance members. If no mapping is defined, the name and value are
204 * stored in an array.
205 *
206 * @param DOMNode $attribute The DOMNode attribute needed to be handled
207 */
208 protected function takeAttributeFromDOM($attribute)
209 {
210 switch ($attribute->localName) {
211 case 'url':
212 $this->_url = $attribute->nodeValue;
213 break;
214 case 'fileSize':
215 $this->_fileSize = $attribute->nodeValue;
216 break;
217 case 'type':
218 $this->_type = $attribute->nodeValue;
219 break;
220 case 'medium':
221 $this->_medium = $attribute->nodeValue;
222 break;
223 case 'isDefault':
224 $this->_isDefault = $attribute->nodeValue;
225 break;
226 case 'expression':
227 $this->_expression = $attribute->nodeValue;
228 break;
229 case 'bitrate':
230 $this->_bitrate = $attribute->nodeValue;
231 break;
232 case 'framerate':
233 $this->_framerate = $attribute->nodeValue;
234 break;
235 case 'samplingrate':
236 $this->_samplingrate = $attribute->nodeValue;
237 break;
238 case 'channels':
239 $this->_channels = $attribute->nodeValue;
240 break;
241 case 'duration':
242 $this->_duration = $attribute->nodeValue;
243 break;
244 case 'height':
245 $this->_height = $attribute->nodeValue;
246 break;
247 case 'width':
248 $this->_width = $attribute->nodeValue;
249 break;
250 case 'lang':
251 $this->_lang = $attribute->nodeValue;
252 break;
253 default:
254 parent::takeAttributeFromDOM($attribute);
255 }
256 }
257
258 /**
259 * Returns the URL representing this MediaContent object
260 *
261 * @return string The URL representing this MediaContent object.
262 */
263 public function __toString()
264 {
265 return $this->getUrl();
266 }
267
268 /**
269 * @return string The direct URL to the media object
270 */
271 public function getUrl()
272 {
273 return $this->_url;
274 }
275
276 /**
277 * @param string $value The direct URL to the media object
278 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
279 */
280 public function setUrl($value)
281 {
282 $this->_url = $value;
283 return $this;
284 }
285
286 /**
287 * @return int The size of the media in bytes
288 */
289 public function getFileSize()
290 {
291 return $this->_fileSize;
292 }
293
294 /**
295 * @param int $value
296 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
297 */
298 public function setFileSize($value)
299 {
300 $this->_fileSize = $value;
301 return $this;
302 }
303
304 /**
305 * @return string
306 */
307 public function getType()
308 {
309 return $this->_type;
310 }
311
312 /**
313 * @param string $value
314 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
315 */
316 public function setType($value)
317 {
318 $this->_type = $value;
319 return $this;
320 }
321
322 /**
323 * @return string
324 */
325 public function getMedium()
326 {
327 return $this->_medium;
328 }
329
330 /**
331 * @param string $value
332 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
333 */
334 public function setMedium($value)
335 {
336 $this->_medium = $value;
337 return $this;
338 }
339
340 /**
341 * @return bool
342 */
343 public function getIsDefault()
344 {
345 return $this->_isDefault;
346 }
347
348 /**
349 * @param bool $value
350 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
351 */
352 public function setIsDefault($value)
353 {
354 $this->_isDefault = $value;
355 return $this;
356 }
357
358 /**
359 * @return string
360 */
361 public function getExpression()
362 {
363 return $this->_expression;
364 }
365
366 /**
367 * @param string
368 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
369 */
370 public function setExpression($value)
371 {
372 $this->_expression = $value;
373 return $this;
374 }
375
376 /**
377 * @return int
378 */
379 public function getBitrate()
380 {
381 return $this->_bitrate;
382 }
383
384 /**
385 * @param int
386 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
387 */
388 public function setBitrate($value)
389 {
390 $this->_bitrate = $value;
391 return $this;
392 }
393
394 /**
395 * @return int
396 */
397 public function getFramerate()
398 {
399 return $this->_framerate;
400 }
401
402 /**
403 * @param int
404 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
405 */
406 public function setFramerate($value)
407 {
408 $this->_framerate = $value;
409 return $this;
410 }
411
412 /**
413 * @return int
414 */
415 public function getSamplingrate()
416 {
417 return $this->_samplingrate;
418 }
419
420 /**
421 * @param int
422 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
423 */
424 public function setSamplingrate($value)
425 {
426 $this->_samplingrate = $value;
427 return $this;
428 }
429
430 /**
431 * @return int
432 */
433 public function getChannels()
434 {
435 return $this->_channels;
436 }
437
438 /**
439 * @param int
440 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
441 */
442 public function setChannels($value)
443 {
444 $this->_channels = $value;
445 return $this;
446 }
447
448 /**
449 * @return int
450 */
451 public function getDuration()
452 {
453 return $this->_duration;
454 }
455
456 /**
457 *
458 * @param int
459 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
460 */
461 public function setDuration($value)
462 {
463 $this->_duration = $value;
464 return $this;
465 }
466
467 /**
468 * @return int
469 */
470 public function getHeight()
471 {
472 return $this->_height;
473 }
474
475 /**
476 * @param int
477 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
478 */
479 public function setHeight($value)
480 {
481 $this->_height = $value;
482 return $this;
483 }
484
485 /**
486 * @return int
487 */
488 public function getWidth()
489 {
490 return $this->_width;
491 }
492
493 /**
494 * @param int
495 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
496 */
497 public function setWidth($value)
498 {
499 $this->_width = $value;
500 return $this;
501 }
502
503 /**
504 * @return string
505 */
506 public function getLang()
507 {
508 return $this->_lang;
509 }
510
511 /**
512 * @param string
513 * @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
514 */
515 public function setLang($value)
516 {
517 $this->_lang = $value;
518 return $this;
519 }
520
521}
Note: See TracBrowser for help on using the repository browser.