예제 #1
0
 /**
  * 生成xml文件
  */
 function createXml()
 {
     $this->load->library('XMLParserLib');
     echo '<?xml version=\'1.0\' encoding=\'UTF-8\' ?>';
     $xml = new XMLTag('movies', array('version' => '1.0', 'type' => 'documentary', 'encoding' => 'UTF-8'));
     $xml->AddChild('movie', array(), 1);
     echo $xml->GetXML();
 }
 function add_subtag($name, $attributes = 0)
 {
     $tag = new XMLTag($this);
     $tag->set_name($name);
     if (is_array($attributes)) {
         $tag->set_attributes($attributes);
     }
     $this->tags[] =& $tag;
     $this->curtag =& $tag;
 }
예제 #3
0
 protected function onCharacterData($data, XMLTag $element)
 {
     $element->addChild(new TextElement($this->html_entities($data)));
 }
예제 #4
0
 public function insertCheckBox($var, $label, $value, $required = false)
 {
     $field = new XMLTag('field');
     $field->insertAttribute('type', 'boolean');
     $field->insertAttribute('var', $var);
     $field->insertAttribute('label', $label);
     $field->insertChildElement(XMLTag::newWithCharacterData('value', $value ? '1' : '0'));
     if ($required) {
         $field->insertChildElement(new XMLTag('required'));
     }
     $this->tag->insertChildElement($field);
 }
예제 #5
0
 protected function onCharacterData($data, XMLTag $element)
 {
     $data = trim($data);
     if (!empty($data)) {
         $element->addChild(new TextElement($data));
     }
 }
예제 #6
0
 public function __construct(XMLTag $command)
 {
     $this->cmdtag = $command;
     $this->form = is_null($form = $command->getChildByAttribute('x', 'xmlns', 'jabber:x:data')) ? NULL : new Form($form);
 }
예제 #7
0
 private function handleStreamStart(XMLTag $tag)
 {
     $this->send('<handshake>' . sha1($tag->getAttribute('id') . $this->password) . '</handshake>');
 }
예제 #8
0
 /**
  * Constructs a BSMAvatar instance from a <PHOTO> tag of the vCard
  * @param BSMXMLTag link to an instance of BSMXMLTag representing <PHOTO> element of the vCard
  */
 public function __construct(XMLTag $photo_tag)
 {
     $this->tag = $photo_tag;
     file_put_contents($this->filename = tempnam(sys_get_temp_dir(), 'xmpp_avatar'), base64_decode($photo_tag->getChildValue('BINVAL')));
     //parent::__construct($this->filename);
 }