Author: Chuck Hagenbuch (chuck@horde.org)
Inheritance: implements ArrayAccess
Exemplo n.º 1
0
 /**
  * Constructor. Do basic error checking on the resposne.
  *
  * @param DOMElement $element The DOM element we're encapsulating.
  */
 public function __construct($element = null)
 {
     parent::__construct($element);
     if ($this['stat'] != 'ok') {
         throw new Horde_Service_Scribd_Exception($this->error['message'], $this->error['code']);
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param resource|string $xml The XML document received from the server.
  */
 public function __construct($xml)
 {
     if (is_resource($xml)) {
         rewind($xml);
         $xml = stream_get_contents($xml);
     }
     parent::registerNamespace('xlink', 'http://www.w3.org/1999/xlink');
     parent::__construct($xml);
 }
Exemplo n.º 3
0
 public function testIllegalFromArray()
 {
     $failed = false;
     $e = new Horde_Xml_Element('<element />');
     try {
         $e->fromArray(array('#name' => array('foo' => 'bar')));
     } catch (InvalidArgumentException $e) {
         $failed = true;
     }
     $this->assertTrue($failed);
 }
Exemplo n.º 4
0
 /**
  * Ensure that $_listItems is populated by calling the concrete implementation's
  * _buildItemsCache() method.
  */
 public function __wakeup()
 {
     parent::__wakeup();
     $this->_listItems = $this->_buildListItemCache();
 }
Exemplo n.º 5
0
 /**
  * Required by the ArrayAccess interface.
  *
  * @internal
  */
 public function offsetUnset($offset)
 {
     if (strpos($offset, ':') !== false) {
         list($ns, $attr) = explode(':', $offset, 2);
         $result = $this->_element->removeAttributeNS(Horde_Xml_Element::lookupNamespace($ns), $attr);
     } else {
         $result = $this->_element->removeAttribute($offset);
     }
     if ($result) {
         $this->_expireCachedChildren();
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 6
0
 public function __construct($uri = 'http://www.example.com/myfeed/', $xml = null)
 {
     parent::__construct($uri, $xml);
     Horde_Xml_Element::registerNamespace('myns', 'http://www.example.com/myns/');
 }