本文整理汇总了PHP中xml::getElementText方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::getElementText方法的具体用法?PHP xml::getElementText怎么用?PHP xml::getElementText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml
的用法示例。
在下文中一共展示了xml::getElementText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
function get($uri)
{
if ($e = $this->getNode($uri)) {
switch (get_class($e)) {
case 'DOMAttr':
return $e->value;
case 'DOMDocument':
case 'DOMElement':
return xml::getElementText($e);
}
}
}
示例2: getListXML
function getListXML($tagName)
{
if ($xml = parent::getListXML($tagName)) {
$ns = $xml->query('/*/row/article');
foreach ($ns as $n) {
if (($path = xml::getElementText($n)) && is_file($path)) {
$n->parentNode->appendChild($xml->createElement('file', array('path' => $path, 'size' => $this->file_size(filesize($path)), 'ext' => strtolower(pathinfo($path, PATHINFO_EXTENSION)))));
}
$n->parentNode->removeChild($n);
}
}
return $xml;
}
示例3: getModuleList
static function getModuleList()
{
$ar = array();
if ($dir = scandir(PATH_MODULE)) {
foreach ($dir as $entry) {
if ($entry != "." && $entry != ".." && is_dir($path = PATH_MODULE . $entry) && file_exists($path .= '/info.xml')) {
$ar[$entry] = array();
$xml = new xml($path);
$res = $xml->query('/*/*');
foreach ($res as $e) {
if ($e instanceof DOMElement) {
$ar[$entry][$e->tagName] = xml::getElementText($e);
}
}
}
}
}
return $ar;
}
示例4: getValue
function getValue()
{
return xml::getElementText($this->e);
}
示例5: run
function run()
{
global $_out;
$ns = $this->query('form');
foreach ($ns as $form) {
if (!$form->getAttribute('action')) {
$form->setAttribute('action', $_SERVER['REQUEST_URI']);
}
if ($this->isSent($form)) {
//форму отправили
$xml = new xml($form);
if (!$this->check($form) && ($res = $this->getSentData($form))) {
$resultSQL = $resultMail = true;
if (count($res['mysql'])) {
$resultSQL = $this->insertDB($res['mysql'], $form);
}
if ($res['xml']) {
$resultMail = $this->sendEmail($res['xml'], $form);
}
$form->appendChild($xml->createElement('message', array('type' => $resultSQL && $resultMail ? 'success' : 'fail'), xml::getElementText($this->query($resultSQL && $resultMail ? 'form/good' : 'form/fail')->item(0))));
} else {
// Ошибка - заполняем форму
$this->fillForm($form);
}
}
if ($form->hasAttribute('appendTo')) {
$_out->elementIncludeTo($form, $form->getAttribute('appendTo'));
} elseif (!$this->getSection()) {
$_out->elementIncludeTo($form, $_out->de());
} else {
$_out->addSectionContent($form);
}
if ($this->hasCaptcha($form)) {
$captcha = new captcha();
$captcha->setLanguage($_out->getLang());
$captcha->setParamName('captcha');
$captcha->create('userfiles/cptch.jpg');
}
}
}
示例6: __call
function __call($m, $a)
{
$xml = new xml($this->e);
switch ($m) {
case 'rewind':
case 'current':
case 'key':
case 'next':
case 'valid':
case 'setButton':
case 'getButtons':
return call_user_func(array($this, $m), $a);
default:
if (preg_match('/^get(\\w+)$/', $m, $res)) {
$name = strtolower($res[1]);
if ($name == row::IDATTR) {
return $this->e->getAttribute('id');
} elseif ($this->hasColumn($name) && ($e = $xml->query($name, $this->e)->item(0))) {
return xml::getElementText($e);
}
} elseif (preg_match('/^set(\\w+)$/', $m, $res)) {
switch ($name = strtolower($res[1])) {
case row::IDATTR:
if ($val = $a[0]) {
$this->e->setAttribute('id', $val);
} elseif ($this->e->hasAttribute('id')) {
$this->e->removeAttribute('id');
}
break;
default:
if ($this->hasColumn($name)) {
$e = null;
if ($e = $xml->query('cell[@name="' . htmlspecialchars($name) . '"]', $this->e)->item(0)) {
} else {
$e = $this->e->appendChild($xml->createElement('cell', array('name' => $name)));
}
if ($e) {
xml::setElementText($e, $a[0]);
}
}
}
}
}
}
示例7: run
function run()
{
global $_out;
$captcha = new captcha();
$captcha->setParamName('captcha');
if ($form = $this->query('form')->item(0)) {
//нашли форму
if (!$form->getAttribute('action')) {
$form->setAttribute('action', $_SERVER['REQUEST_URI']);
}
if ($this->isSent($form)) {
//форму отправили
if (!$this->check($form) && ($res = $this->getSentData($form))) {
$e = $this->getSection()->getXML()->createElement('final', null);
$resultSQL = $resultMail = true;
if (count($res['mysql'])) {
$resultSQL = $this->insertDB($res['mysql'], $form);
}
if ($res['xml']) {
$resultMail = $this->sendEmail($res['xml'], $form);
}
if ($resultSQL && $resultMail) {
xml::setElementText($e, xml::getElementText($this->getSection()->getXML()->query('good', $form)->item(0)));
} else {
xml::setElementText($e, xml::getElementText($this->getSection()->getXML()->query('fail', $form)->item(0)));
}
$form->appendChild($e);
} else {
// Ошибка - заполняем форму
$this->fillForm($form);
}
}
$_out->addSectionContent($form);
$captcha->setLanguage('en');
$captcha->create('userfiles/cptch.jpg');
}
}