本文整理汇总了PHP中xml函数的典型用法代码示例。如果您正苦于以下问题:PHP xml函数的具体用法?PHP xml怎么用?PHP xml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write_alert
function write_alert($message, $alert_type = 'ERROR')
{
xml('<' . '?xml version="1.0" encoding="UTF-8" ?' . '>');
xml('<IppDisplay>');
xml('<IppScreen ID="1" HiddenCount="0" CommandCount="0">');
xml(' <IppAlert Type="' . htmlEnt($alert_type) . '" Delay="5000">');
xml(' <Title>' . htmlEnt(__('Fehler')) . '</Title>');
xml(' <Text>' . htmlEnt($message) . '</Text>');
xml(' <Image></Image>');
xml(' </IppAlert>');
xml('</IppScreen>');
xml('</IppDisplay>');
xml_output();
}
示例2: as_error
/**
* Prints a XML error.
* @param sring $message Error
*/
function as_error($message)
{
$message = xml($message);
print "<error>{$message}</error>\n</xml>";
exit;
}
示例3: as_sql_error
$sql = 'SELECT s.*, u.user_colour, u.username, u.user_id FROM ' . SHOUTBOX_TABLE . ' s, ' . USERS_TABLE . ' u
WHERE
s.shout_user_id = u.user_id
ORDER BY s.shout_time DESC';
$result = $db->sql_query_limit($sql, $shout_number, $start);
if (!$result) {
as_sql_error($sql, __LINE__, __FILE__);
} else {
$row = $db->sql_fetchrow($result);
if (!$row) {
echo '<error>' . $user->lang['NO_MESSAGE'] . '</error></xml>';
exit;
}
do {
echo "<posts>\n";
$row['username'] = get_username_string('full', $row['user_id'], xml(htmlspecialchars_decode($row['username'])), $row['user_colour']);
$row['shout_time'] = $user->format_date($row['shout_time']);
$row['edit'] = false;
$row['msg_plain'] = 'No plain message';
// It will be replaced if user can edit ;).
if ($auth->acl_get('u_as_mod_edit') || $row['shout_user_id'] == $user->data['user_id'] && $auth->acl_get('u_as_edit')) {
$row['edit'] = true;
$row['msg_plain'] = $row['shout_text'];
decode_message($row['msg_plain'], $row['shout_bbcode_uid']);
if (empty($row['msg_plain'])) {
$sql = "DELETE FROM " . SHOUTBOX_TABLE . " WHERE shout_id = " . $row['shout_id'];
$db->sql_query($sql);
continue;
}
}
$row['shout_text'] = generate_text_for_display($row['shout_text'], $row['shout_bbcode_uid'], $row['shout_bbcode_bitfield'], $row['shout_bbcode_flags']);
示例4: foreach
?>
<?php
foreach ($items as $item) {
?>
<item>
<title><?php
echo xml($item->title());
?>
</title>
<link><?php
echo xml($item->url());
?>
</link>
<guid><?php
echo xml($item->id());
?>
</guid>
<pubDate><?php
echo $datefield == 'modified' ? $item->modified('r') : $item->date('r', $datefield);
?>
</pubDate>
<?php
if ($excerpt == true) {
?>
<?php
$excerptlimit = isset($excerptlimit) ? $excerptlimit : 'words';
?>
<?php
$excerptlenght = isset($excerptlenght) ? $excerptlenght : 40;
?>
示例5: foreach
?>
<?php
foreach ($items as $item) {
?>
<item>
<title><?php
echo xml($item->title());
?>
</title>
<link><?php
echo xml(getPostUrl($item));
?>
</link>
<guid><?php
echo xml(getPostUrl($item));
?>
</guid>
<pubDate><?php
echo $datefield == 'modified' ? $item->modified('r') : $item->date('r', $datefield);
?>
</pubDate>
<description><![CDATA[<?php
echo $item->{$textfield}()->kirbytext();
?>
]]></description>
</item>
<?php
}
?>
示例6: error
public function error($sql = '') {
$sql_error = $this->connect->error;
$sql_errno = $this->connect->errno;
$error = array('sql' => $sql, 'message' => $sql_error, 'code' => $sql_errno);
if (!$this->noerror) {
$xml = xml($error);
error_log($xml);
echo $xml;
exit;
}
return $error;
}
示例7: sql_error
/**
* return sql error array
* @access private
*/
function sql_error($sql = '') {
$error = @oci_error();
$error = (!$error) ? @oci_error($this->result) : $error;
$error = (!$error) ? @oci_error($this->connect) : $error;
if ($error) {
$this->last_error_result = $error;
} else {
$error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array();
}
if (!empty($this->message)) {
$error = $this->message;
}
$error = array(
'type' => 'oracle',
'message' => $error
);
if (!$this->noerror) {
$xml = xml($error);
error_log($xml);
$this->message = $error;
}
return $error;
}
示例8: foreach
?>
<?php
foreach ($items as $item) {
?>
<item>
<title><?php
echo xml($item->title());
?>
</title>
<link><?php
echo xml($item->url());
?>
</link>
<guid><?php
echo xml($item->url());
?>
</guid>
<pubDate><?php
echo $datefield == 'modified' ? $item->modified('r') : $item->date('r', $datefield);
?>
</pubDate>
<?php
if ($excerpt == true) {
?>
<?php
$excerptlimit = isset($excerptlimit) ? $excerptlimit : 'words';
?>
<?php
$excerptlenght = isset($excerptlenght) ? $excerptlenght : 40;
?>
示例9: xml
function xml($basenode, $rowArr)
{
if ($basenode == null) {
$structure = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><afids_batch_process/>");
} else {
$structure = $basenode;
}
foreach ($rowArr as $row) {
$record = $structure->addChild("record");
foreach ($row as $key => $value) {
// remove numbers from the keys in the xml
if (is_numeric($key)) {
$key = "item";
}
// replace anything not alpha numeric
$key = preg_replace('/[^a-z]/i', '', $key);
// if there is another array found recursively call this function
if (is_array($value)) {
//echo "array!";
//exit;
$node = $structure->addChild($key);
// recrusive call.
xml($basenode, $node);
} else {
// add single node.
$value = htmlentities($value, ENT_NOQUOTES, "UTF-8");
$cellNode = $record->addChild($key, $value);
}
}
}
return $structure;
}
示例10: console
<?php
function console($i)
{
echo "<pre>";
print_r($i);
echo "</pre>";
}
function xml_file($i)
{
$GLOBALS['xml']['reserved']['filelocation'] = $i;
}
function xml()
{
return simplexml_load_file($GLOBALS['xml']['reserved']['filelocation']);
}
xml_file('data.xml');
$x = xml()->book->year->a;
console($x);
示例11: sql_error
public function sql_error($sql = '')
{
$sql_error = $this->connect->error;
$sql_errno = $this->connect->errno;
if (!empty($this->message)) {
$sql_error = $this->message;
}
$error = array('type' => 'mysql', 'message' => array('code' => $sql_errno, 'message' => $sql_error, 'offset' => 0, 'sqltext' => $sql));
if (!$this->noerror) {
$xml = xml($error);
error_log($xml);
$this->message = $error;
}
return $error;
}
示例12: api
function api($output, $type = "data", $multi = "")
{
if ($GLOBALS['filetype'] == 'json') {
if (isset($_GET["callback"])) {
header('Content-Type: application/javascript');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');
print $_GET['callback'] . '(' . json_encode($output) . ');';
} else {
header("Content-Type: application/json", true);
print json_encode($output);
}
} elseif ($GLOBALS['filetype'] == 'xml') {
header("Content-type: application/xml");
$xml = new SimpleXMLElement('<?xml version="1.0"?><' . $type . '></' . $type . '>');
xml($output, $xml);
print $xml->asXML();
/*
$dom = new DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
print $dom->saveXML();
*/
}
}
示例13: xml
<?php
require_once '../asserts/Asserts.php';
require_once '../../core/Charts/XmlCharts/XmlChart.php';
require_once '../../core/Charts/XmlCharts/MultiSerie/XmlMultiSeries.php';
require_once '../../core/Charts/XmlCharts/MultiSerie/XmlMultiSeriesCombinationColumnLine.php';
$xmlExpected = xml();
$xmlTest = "test";
$xml = new XmlMultiSeriesCombinationColumnLine();
$xml->addChartAttribute("caption", "Product Sales and Downloads");
$xml->addChartAttribute("showValues", "0");
$xml->setPYAxisName("Sales");
$xml->setSYAxisName("Total Downloads");
$xml->addCategory("Jan");
$xml->addCategory("Fev");
$xml->addCategory("Mar");
$xml->addCategory("Abr");
$xml->newDataset("2006");
$xml->setValues(new ArrayObject(array("27400", "29800", "25800", "20580")), "2006");
$xml->setValues(new ArrayObject(array("10000", "11500", "12500", "13000")), "2005");
$xml->setValues(new ArrayObject(array("12000", "13000", "11000", "9500")), "2004");
$xml->setLineToAnAxis("2005", "S");
$xml->setLineToAnAxis("2004", "S");
$xmlFile = "text.xml";
assertEquals(formatGreaterAndSmallerSymbols($xml->buildXml($xmlFile)), $xmlExpected);
?>
<?
function xml(){
return formatGreaterAndSmallerSymbols(chart());
}
示例14: header
//echo "[$dir]\n";
$filename = $dir . '/progress.xml';
//echo "[$filename]\n";
header('Content-Type: text/xml');
/**
* Return XML packet with status set to passed in string.
*
* @param string $s Status string
*/
function xml($s)
{
return <<<EOT
<?xml version="1.0" encoding="ISO-8859-1"?>
<data>
<percentage>0</percentage>
<message>{$s}</message>
</data>
EOT;
}
if (!file_exists($filename)) {
echo xml("Please wait...");
} else {
if (($ret = file_get_contents($filename)) === FALSE) {
echo xml("Failure!");
} else {
echo $ret;
}
}
if ($deleteprogressfile && file_exists($filename)) {
unlink($filename);
}
示例15: function
* @param Field $field The calling Kirby Field instance
* @param string $context html|attr|css|js|url
* @return Field
*/
field::$methods['escape'] = field::$methods['esc'] = function ($field, $context = 'html') {
$field->value = esc($field->value, $context);
return $field;
};
/**
* Converts html entities and specialchars in the field
* value to valid xml entities
* @param Field $field The calling Kirby Field instance
* @return Field
*/
field::$methods['xml'] = field::$methods['x'] = function ($field) {
$field->value = xml($field->value);
return $field;
};
/**
* Parses the field value as kirbytext
* @param Field $field The calling Kirby Field instance
* @return Field
*/
field::$methods['kirbytext'] = field::$methods['kt'] = function ($field) {
$field->value = kirbytext($field);
return $field;
};
/**
* Parses the field value as markdown
* @param Field $field The calling Kirby Field instance
* @return Field