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


PHP xml::importNode方法代码示例

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


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

 function getFormElement($id)
 {
     if ($e = $this->query('form' . ($id ? '[@id="' . $id . '"]' : null))->item(0)) {
         $xml = new xml(null, null, false);
         return $xml->appendChild($xml->importNode($e));
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:7,代码来源:apModule.php

示例4: getSiteInfo

 function getSiteInfo()
 {
     $xml = new xml();
     $xml->dd()->appendChild($xml->importNode($this->de()));
     $ns = $xml->query('/site/mysql | /site/users');
     foreach ($ns as $n) {
         $n->parentNode->removeChild($n);
     }
     return $xml;
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:10,代码来源:site.php

示例5: getForm

 function getForm($id, $isSettingsForm = false)
 {
     if (($xml = $this->getDataXML()) && ($e = $xml->query('//form[@id="' . $id . '"]')->item(0))) {
         $xml = new xml(null, null, false);
         $form = new form($xml->appendChild($xml->importNode($e)));
         $mysql = new mysql();
         $sec = $this->getSection();
         $form->replaceURI(array('TABLE' => $mysql->getTableName($this->table), 'MODULE' => $this->getId(), 'CONFIG_MODULE' => $this->getConf('module'), 'SECTION' => $sec->getId(), 'ROW' => $isSettingsForm ? null : $this->getRow(), 'PATH_DATA_FILE_CLIENT' => ABS_PATH_DATA_CLIENT . ap::id($sec->getId()) . '.xml', 'PATH_DATA_FILE_AP' => ABS_PATH_DATA_AP . ap::id($sec->getId()) . '.xml', 'PATH_SITE' => ABS_PATH_SITE));
         return $form;
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:11,代码来源:apMetaArticles.php

示例6: deleteRow

 function deleteRow($row)
 {
     if ($row && ($rl = $this->getList())) {
         if (!is_array($row)) {
             $row = array($row);
         }
         $form = $this->getForm('edit');
         foreach ($row as $id) {
             $xml = new xml();
             $f = new formGallery($xml->appendChild($xml->importNode($form->getRootElement()->cloneNode(true))));
             $f->replaceURI(array('ID' => $id, 'TABLE' => $rl->getTableName(), 'SECTION' => $this->getSection()->getId()));
             $f->deleteImages($id);
             $rl->deleteRow($id);
         }
         return true;
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:17,代码来源:apArticles.php

示例7: setImages

 static function setImages($e, $img, $singleOnly = false)
 {
     if ($e && is_array($img) && ($id = $e->getAttribute('id')) && isset($img[$id]) && is_array($img[$id])) {
         $xml = new xml($e);
         foreach ($img[$id] as $i) {
             if (isset($i['img'])) {
                 $pic = $e->appendChild($xml->importNode($i['img'], true));
                 if (isset($i['prv'])) {
                     $pic->appendChild($xml->importNode($i['prv'], true));
                 }
             } elseif (isset($i['prv'])) {
                 $e->appendChild($xml->importNode($i['prv'], true));
             }
             if ($singleOnly) {
                 break;
             }
         }
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:19,代码来源:articles.php

示例8: elementIncludeTo

 function elementIncludeTo($elem, $cont)
 {
     if (is_string($cont)) {
         $cont = $this->query($cont)->item(0);
     }
     if (is_object($elem) && is_object($cont) && $elem instanceof DOMElement && $cont instanceof DOMElement) {
         $xml = new xml($cont);
         return $cont->appendChild($xml->importNode($elem, true));
     }
     throw new Exception('XML->elementIncludeTo() wrong element type', EXCEPTION_XML);
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:11,代码来源:xml.php

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