source: extensions/Google2Piwigo/include/Zend/Gdata/App/Extension/Text.php @ 17475

Last change on this file since 17475 was 17475, checked in by mistic100, 12 years ago

new extension: Google2Piwigo

File size: 2.4 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 App
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: Text.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * @see Zend_Gdata_App_Extension
26 */
27require_once 'Zend/Gdata/App/Extension.php';
28
29/**
30 * Abstract class for data models that require only text and type-- such as:
31 * title, summary, etc.
32 *
33 * @category   Zend
34 * @package    Zend_Gdata
35 * @subpackage App
36 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
37 * @license    http://framework.zend.com/license/new-bsd     New BSD License
38 */
39abstract class Zend_Gdata_App_Extension_Text extends Zend_Gdata_App_Extension
40{
41
42    protected $_rootElement = null;
43    protected $_type = 'text';
44
45    public function __construct($text = null, $type = 'text')
46    {
47        parent::__construct();
48        $this->_text = $text;
49        $this->_type = $type;
50    }
51
52    public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
53    {
54        $element = parent::getDOM($doc, $majorVersion, $minorVersion);
55        if ($this->_type !== null) {
56            $element->setAttribute('type', $this->_type);
57        }
58        return $element;
59    }
60
61    protected function takeAttributeFromDOM($attribute)
62    {
63        switch ($attribute->localName) {
64        case 'type':
65            $this->_type = $attribute->nodeValue;
66            break;
67        default:
68            parent::takeAttributeFromDOM($attribute);
69        }
70    }
71
72    /*
73     * @return Zend_Gdata_App_Extension_Type
74     */
75    public function getType()
76    {
77        return $this->_type;
78    }
79
80    /*
81     * @param string $value
82     * @return Zend_Gdata_App_Extension_Text Provides a fluent interface
83     */
84    public function setType($value)
85    {
86        $this->_type = $value;
87        return $this;
88    }
89
90}
Note: See TracBrowser for help on using the repository browser.