本文整理汇总了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);
}
}
示例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');
}
}
示例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));
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
}
}
示例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);
}
示例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;
}