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(); }
/** * Prints a XML error. * @param sring $message Error */ function as_error($message) { $message = xml($message); print "<error>{$message}</error>\n</xml>"; exit; }
$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']);
?> <?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; ?>
?> <?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 } ?>
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; }
/** * 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; }
?> <?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; ?>
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; }
<?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);
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; }
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(); */ } }
<?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()); }
//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); }
* @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
/** * Print result of trackback posting and exit * * @param bool $error print error * @param string $msg addtional text to display * @param bool */ function respondExit($msg = "", $error = false) { header("Content-Type: text/xml\n\n"); print "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"; print "<response>\n"; if ($error) { printf("<error>1</error>\n%s\n", xml("message", $msg)); } else { printf("<error>0</error>\n%s", $msg); } print "</response>\n"; exit; }
<enclosure url="<?php echo xml($mp3->url()); ?> " length="<?php echo $mp3->size(); ?> " type="audio/mpeg" /> <guid><?php echo xml($mp3->url()); ?> </guid> <?php } ?> <itunes:duration><?php echo xml($item->duration()); ?> </itunes:duration> <itunes:keywords><?php echo xml($item->keywords()); ?> </itunes:keywords> </item> <?php } ?> </channel> </rss>
?> <?php foreach ($items as $item) { ?> <item> <title><?php echo xml($item->title()); ?> </title> <link><?php echo xml(str_replace('/projects', '', $item->url())); ?> </link> <guid><?php echo xml(str_replace('/projects', '', $item->url())); ?> </guid> <pubDate><?php echo $item->date() ? date('r', $item->date()) : date('r', $item->modified()); ?> </pubDate> <?php if (isset($descriptionField)) { ?> <?php if (!$descriptionExcerpt) { ?> <description><![CDATA[<?php echo kirbytext($item->{$descriptionField});