当前位置: 首页>>代码示例>>PHP>>正文


PHP xml::de方法代码示例

本文整理汇总了PHP中xml::de方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::de方法的具体用法?PHP xml::de怎么用?PHP xml::de使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml的用法示例。


在下文中一共展示了xml::de方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: announce

 function announce($tagname, $sort = null, $size = null, $parent = null)
 {
     global $_out;
     $xml = new xml(null, $tagname, false);
     $ns = $this->query('.//img');
     if ($ns->length) {
         if ($sort == 'desc') {
             $c = 0;
             for ($i = $ns->length - 1; $i >= 0; $i--) {
                 $xml->de()->appendChild($xml->importNode($ns->item($i)));
                 $c++;
                 if ($size && $c == $size) {
                     break;
                 }
             }
         } else {
             foreach ($ns as $i => $e) {
                 if ($i == $size) {
                     break;
                 }
                 $xml->de()->appendChild($xml->importNode($e));
             }
         }
         $_out->xmlIncludeTo($xml, $parent);
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:26,代码来源:photo.php

示例2: settings

 function settings($action)
 {
     global $_out, $_struct;
     if (($xml = $this->getDataXML()) && ($e = $xml->getElementById('settings'))) {
         $form = new form($e);
         $form->replaceURI(array('MODULE' => $this->getId(), 'SECTION' => $this->getSection()->getId(), 'PATH_DATA_FILE_CLIENT' => ABS_PATH_DATA_CLIENT . ap::id($this->getSection()->getId()) . '.xml', 'PATH_DATA_FILE_AP' => ABS_PATH_DATA_AP . ap::id($this->getSection()->getId()) . '.xml'));
         if ($ff = $form->getField('section')) {
             apSectionEdit::seclist(ap::getClientstructure()->de(), $ff, $ar = array());
         }
         switch ($action) {
             case 'update':
             case 'apply_update':
                 $form->save($_REQUEST);
                 break;
             case 'edit':
                 if (($id = param('section')) && ($sec = $_struct->getSection($id)) && ($modules = $sec->getModules())) {
                     $xml = new xml(null, 'modules', false);
                     foreach ($modules as $m) {
                         $xml->de()->appendChild($xml->importNode($m->getRootElement(), false));
                     }
                     ap::ajaxResponse($xml);
                 }
                 break;
         }
         $form->load();
         $_out->addSectionContent($form->getRootElement());
         $this->addTemplate('tpl.xsl');
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:29,代码来源:apAnnounce.php

示例3: run

 function run()
 {
     global $_out, $_sec;
     if (ap::isCurrentModule($this)) {
         ap::addMessage($this->getMessage());
         if ($form = $this->getForm()) {
             $form->replaceURI(array('ID' => $_sec->getId(), 'MD' => $this->getId(), 'PARENT' => $this->getSection()->GetParent()->getId()));
             switch ($action = param('action')) {
                 case 'save':
                     $values = $this->initImages($form, true);
                     $values = array_merge($_REQUEST, $values);
                     $form->save($values);
                     $this->updateImagesSize($form);
                     $this->redirect('save_ok');
                     break;
                 case 'fileinfo':
                     if (($path = urldecode(param('path'))) && ($f = ap::getFileInfo($_SERVER['DOCUMENT_ROOT'] . $path))) {
                         $f['path'] = $path;
                         $xml = new xml(null, 'file', false);
                         foreach ($f as $tagName => $value) {
                             $xml->de()->appendChild($xml->createElement($tagName, null, $value));
                         }
                         ap::ajaxResponse($xml);
                     }
                     vdump('Error file not found ' . $path);
                     break;
             }
             $this->initImages($form, false);
             $form->load();
             $_out->elementIncludeTo($form->getRootElement(), '/page/section');
         } else {
             throw new Exception('Form not found', EXCEPTION_XML);
         }
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:35,代码来源:apContent.php

示例4: run

 function run()
 {
     if (ap::isCurrentModule($this)) {
         switch ($this->getAction()) {
             case 'bannersize':
                 if (($path = urldecode(param('path'))) && is_file($path)) {
                     list($width, $height) = getimagesize($path);
                     $xml = new xml(null, 'size', false);
                     $xml->de()->setAttribute('width', $width);
                     $xml->de()->setAttribute('height', $height);
                     ap::ajaxResponse($xml);
                 }
                 vdump('Error file not found ' . $path);
                 break;
         }
     }
     parent::run();
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:18,代码来源:apBanners.php

示例5: xml

 function __construct($val, $num_rows = null, $cur_page = null, $page_size = null)
 {
     $xml = new xml('xml/_rowlist' . microtime() . '.tmp.xml', 'rowlist');
     parent::__construct($xml->de(), 'row');
     $this->setPageSize($page_size);
     $this->setNumRows($num_rows);
     $this->setCurrentPage($cur_page);
     if ($val instanceof DOMElement) {
         $this->importSettings($val);
     } else {
         $this->setHeaders($val);
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:13,代码来源:rowlist.php

示例6:

 function __construct(xml $xml, $tagName = null)
 {
     global $_struct;
     if (!$tagName) {
         $tagName = 'modules';
     }
     if ($modules = $xml->query($query = '/*/' . $tagName)->item(0)) {
     } else {
         $modules = $xml->de()->appendChild($xml->createElement($tagName));
     }
     parent::__construct($modules, 'module');
     $this->keyAttribute = 'id';
     $this->setStructure($_struct);
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:14,代码来源:modules.php

示例7: run

 function run()
 {
     global $_out;
     if (ap::isCurrentModule($this)) {
         switch ($action = param('action')) {
             case 'fileinfo':
                 if (($path = urldecode(param('path'))) && ($f = $this->getFileInfo($_SERVER['DOCUMENT_ROOT'] . $path))) {
                     $f['path'] = $path;
                     $xml = new xml(null, 'file', false);
                     foreach ($f as $tagName => $value) {
                         $xml->de()->appendChild($xml->createElement($tagName, null, $value));
                     }
                     ap::ajaxResponse($xml);
                 }
                 vdump('Error file not found ' . $path);
                 break;
         }
         parent::run();
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:20,代码来源:apUploads.php

示例8: create

 protected static function create($tagName, $type, $fieldName, $label = null, $uri = null)
 {
     $xml = new xml(null, $tagName);
     $xml->de()->setAttribute('type', $type);
     $xml->de()->setAttribute('name', $fieldName);
     if ($label) {
         $xml->de()->setAttribute('label', $label);
     }
     if ($uri) {
         $xml->de()->setAttribute('uri', $uri);
     }
     switch ($type) {
         case 'image':
             return new formImageField($xml->de());
         case 'multiselect':
             return new formSelect($xml->de());
         default:
             if ($xml->de()->tagName == 'param') {
                 return new formHiddenField($xml->de());
             } elseif (class_exists($classname = 'form' . ucfirst($type))) {
                 return new $classname($xml->de());
             } else {
                 return new formField($xml->de());
             }
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:26,代码来源:form.php

示例9: xml

 function __construct($uri)
 {
     $xml = new xml($uri, 'events');
     parent::__construct($xml->de(), 'event');
     $this->xml = $xml;
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:6,代码来源:events.php

示例10: run

 function run()
 {
     global $_out, $_sec;
     if (ap::isCurrentModule($this)) {
         ap::addMessage($this->getMessage());
         $action = param('action');
         $nowId = $this->getSection()->getId();
         $path = "//sec[@id='" . substr($nowId, 3) . "']";
         $form = $this->getForm();
         // если это корневой раздел то показываем форму по добавлению нового раздела
         switch ($action) {
             case 'ajax':
                 if ($parent = param('parent')) {
                     if (($sec_parent = ap::getClientSection($parent)) || $parent == 'apStruct') {
                         header('Content-type: text/xml');
                         $xml = new xml(null, 'seclist', false);
                         $res = ap::getClientstructure()->query($parent == 'apStruct' ? '/structure/sec' : '//sec[@id="' . $sec_parent->getId() . '"]/sec');
                         foreach ($res as $sec) {
                             $xml->de()->appendChild($xml->createElement('sec', array('id' => $sec->getAttribute('id'), 'title' => $sec->getAttribute('title'))));
                         }
                         echo $xml;
                     }
                     die;
                 }
                 break;
             case 'remove':
                 $struct = ap::getClientstructure();
                 $id = $this->getSection()->getParent()->getId();
                 apSectionEdit::removeSection($nowId);
                 $this->redirect($action, $id);
                 break;
             case 'save':
                 $form->replaceURI(array('PATH' => $this->getQueryPath(), 'PATH_STRUCT_CLIENT' => ABS_PATH_STRUCT_CLIENT));
                 // сохранение атрибутов
                 $form->save($_REQUEST);
                 // перенос элемента со сменой родителя и порядка
                 $struct = ap::getClientstructure(false);
                 if ($id = ap::getClientSection(param('id_sec'))->getId()) {
                     if (!($parent = $struct->query('/structure//sec[@id="' . param('parent') . '"]')->item(0))) {
                         $parent = $struct->query('/structure')->item(0);
                     }
                     if ($parent) {
                         $sec = $struct->query('/structure//sec[@id="' . $id . '"]')->item(0);
                         $sec = $sec->parentNode->removeChild($sec);
                         if (($pos = param('position')) && ($before = $struct->query('/structure//sec[@id="' . $pos . '"]')->item(0))) {
                             $parent->insertBefore($sec, $before);
                         } else {
                             $parent->appendChild($sec);
                         }
                         $struct->save();
                     }
                 }
                 $this->redirect($action, param('id_sec'));
                 break;
             case 'newtpl':
                 if (apSectionTemplate::createPackage(ap::id($this->getSection()->getId()), param('title'))) {
                     $this->redirect('newtpl_ok');
                 } else {
                     $this->redirect('newtpl_fail');
                 }
                 break;
             default:
                 $form->replaceURI(array('PATH' => $path, 'PATH_STRUCT_CLIENT' => ABS_PATH_STRUCT_CLIENT));
                 $form->getRootElement()->setAttribute('title', str_replace("%TITLE%", $_sec->getTitle(), $form->getRootElement()->getAttribute('title')));
                 //список разделов
                 if (($ff = $form->getField('parent')) && ($s = ap::getClientstructure()->getSection(ap::id($nowId)))) {
                     $ff->addOption('apStruct', 'Root');
                     $ar = array($s->getId());
                     $p = $s->getParent();
                     $this->seclist(ap::getClientstructure()->de(), $ff, $ar);
                     $ff->setValue($p ? $p->getId() : 'apStruct');
                 }
                 if ($ff = $form->getField('position')) {
                     $ff->setValue(ap::id($nowId));
                 }
                 if (!($nowId == 'apStruct')) {
                     $form->load();
                 }
                 $_sec->getTemplate()->addTemplate('../../modules/' . $this->getName() . '/template/sectionedit.xsl');
                 $_out->elementIncludeTo($form->getRootElement(), '/page/section');
                 break;
         }
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:84,代码来源:apSectionEdit.php

示例11: getTagList

 function getTagList()
 {
     $xml = new xml('xml/list.xml', 'row', false);
     return new taglist($xml->de(), 'row');
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:5,代码来源:apTaglist.php

示例12: disable

 function disable($val)
 {
     $xml = new xml($this->e);
     $nocache_xml = new xml($xml->documentURI(), $xml->de()->tagName, false);
     $users = new users($nocache_xml, $this->e->tagName);
     if ($usr = $users->getUser($this->getLogin())) {
         $val = $val ? 'disabled' : null;
         $usr->setDisabled($val);
         $nocache_xml->save();
         $this->setDisabled($val);
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:12,代码来源:users.php

示例13: run

 function run()
 {
     global $_out, $_struct, $_sec;
     if (ap::isCurrentModule($this)) {
         ap::addMessage($this->getMessage());
         $action = param('action');
         $nowId = $this->getSection()->getId();
         $form = $this->getForm();
         //если это корневой раздел то показываем форму по добавлению нового раздела
         switch ($action) {
             case 'ajax':
                 if ($parent = param('parent')) {
                     if (($sec_parent = ap::getClientSection($parent)) || $parent == 'apStruct') {
                         header('Content-type: text/xml');
                         $xml = new xml(null, 'seclist', false);
                         $res = ap::getClientstructure()->query($parent == 'apStruct' ? '/structure/sec' : '//sec[@id="' . $sec_parent->getId() . '"]/sec');
                         foreach ($res as $sec) {
                             $xml->de()->appendChild($xml->createElement('sec', array('id' => $sec->getAttribute('id'), 'title' => $sec->getAttribute('title'))));
                         }
                         echo $xml;
                     }
                     die;
                 }
                 if ($issetid = param('isset')) {
                     echo ap::getClientSection($issetid) ? '0' : '1';
                     die;
                 }
                 break;
             case 'add':
             case 'apply':
                 if (is_array($sec = param('sec')) && $sec['id']) {
                     $form->replaceURI(array('PATH' => $this->getQueryPath(param('parent')), 'PATH_STRUCT_CLIENT' => ABS_PATH_STRUCT_CLIENT));
                     $form->save($_REQUEST);
                     $_struct->addSection($sec['id'], $sec['title']);
                     /* позиция */
                     if (($id_pos = param('position')) && ($struct = ap::getClientstructure(false))) {
                         if (($sec_new = $struct->getSection($sec['id'])) && ($sec_pos = $struct->getSection($id_pos))) {
                             $sec_pos->getElement()->parentNode->insertBefore($sec_new->getElement(), $sec_pos->getElement());
                             $struct->save();
                         }
                     }
                     /* установить выбранный шаблон раздела */
                     if ($tpl_id = param('template')) {
                         apSectionTemplate::applyTemplate(ap::id($sec['id']), $tpl_id);
                     }
                     $this->redirect($action, $sec["id"]);
                 } else {
                     $this->redirect('fail');
                 }
                 break;
             default:
                 $form->replaceURI(array('PATH' => '', 'PATH_STRUCT_CLIENT' => ABS_PATH_STRUCT_CLIENT));
                 //список разделов
                 if ($ff = $form->getField('parent')) {
                     $s = ap::getClientstructure()->getSection(ap::id($nowId));
                     $ff->addOption('apStruct', 'Root');
                     $ar = array();
                     if ($s) {
                         $p = $s->getParent();
                     }
                     $this->seclist(ap::getClientstructure()->de(), $ff, $ar);
                     $ff->setValue($p ? $p->getId() : 'apStruct');
                 }
                 // список разделов шаблонов
                 if (($ff = $form->getField('template')) && ($tl = apSectionTemplate::getPackages())) {
                     if ($tl->getNum()) {
                         foreach ($tl as $e) {
                             $ff->addOption($e->getAttribute('id'), $e->getAttribute('title'));
                         }
                     } else {
                         $ff->remove();
                     }
                 }
                 $_sec->getTemplate()->addTemplate('../../modules/' . $this->getName() . '/template/sectionadd.xsl');
                 $_out->elementIncludeTo($form->getRootElement(), '/page/section');
                 break;
         }
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:79,代码来源:apSectionAdd.php

示例14: getList

 function getList($param)
 {
     $rl_xml = new xml(PATH_MODULE . __CLASS__ . '/form/rowlist.xml');
     if ($list_element = $rl_xml->de()) {
         $templates = $this->getTemplate();
         $rl = new rowlist($list_element, count($templates), param('page'));
         $headers = $rl->getHeaders();
         if (!$param['count']) {
             $list_elem = $rl->getRootElement();
             $list_elem->removeAttribute('add');
         }
         if ($templates) {
             foreach ($templates as $i => $template) {
                 if ($i >= $rl->getStartIndex() && $i <= $rl->getFinishIndex()) {
                     $rl->addRow($template->getAttribute('id'), array('id_template' => $template->getAttribute('id')));
                 }
             }
         }
         return $rl->getRootElement();
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:21,代码来源:apTemplateManager.php

示例15: ajaxResponse

 static function ajaxResponse($val, $message = null)
 {
     if ($val instanceof xml) {
         $xml = $val;
     } elseif ($val instanceof DOMElement) {
         $xml = new xml();
         $xml->appendChild($xml->importNode($val));
     } else {
         $xml = new xml(null, 'response', false);
         $xml->de()->appendChild($xml->createElement('value', null, $val));
         if ($message) {
             $xml->de()->appendChild($xml->createElement('message', null, $message));
         }
     }
     if ($xml) {
         header('Content-Type: text/xml; charset=utf-8');
         echo $xml;
     }
     die;
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:20,代码来源:ap.php


注:本文中的xml::de方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。