本文整理汇总了PHP中getXML函数的典型用法代码示例。如果您正苦于以下问题:PHP getXML函数的具体用法?PHP getXML怎么用?PHP getXML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getXML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: im_customfield_def
function im_customfield_def()
{
global $im_customfield_def;
if ($im_customfield_def == null) {
$files = GSDATAOTHERPATH . IM_CUSTOMFIELDS_FILE;
if (file_exists($files)) {
$data = getXML($files);
$items = $data->item;
if (count($items) > 0) {
foreach ($items as $item) {
$cf = array();
$cf['key'] = (string) $item->desc;
$cf['label'] = (string) $item->label;
$cf['type'] = (string) $item->type;
$cf['value'] = (string) $item->value;
if ($item->type == "dropdown") {
$cf['options'] = array();
foreach ($item->option as $option) {
$cf['options'][] = (string) $option;
}
}
$im_customfield_def[] = $cf;
}
}
}
}
return $im_customfield_def;
}
示例2: __construct
function __construct($filename, $logdefaults = true)
{
// @todo check filename, must be .log
if ($this->validFilename($filename)) {
$this->_xmlfile = GSDATAOTHERPATH . 'logs/' . $filename;
if (file_exists($this->_xmlfile)) {
$xml = getXML($this->_xmlfile);
if (!is_object($xml)) {
$this->_xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
} else {
$this->_xml = $xml;
}
} else {
$this->_xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
}
// create entry and add date
$thislog = $this->_xml->addChild('entry');
$thislog->addChild('date', date('r'));
$this->_entry = $thislog;
if ($logdefaults == true) {
$this->defaults();
}
} else {
return false;
}
}
示例3: i18n_customfield_defs
function i18n_customfield_defs()
{
global $i18n_customfield_defs, $i18n_customfield_types;
if ($i18n_customfield_defs === null) {
$i18n_customfield_defs = array();
$i18n_customfield_types = array();
$file = GSDATAOTHERPATH . I18N_CUSTOMFIELDS_FILE;
if (file_exists($file)) {
$data = getXML($file);
$items = $data->item;
if (count($items) > 0) {
foreach ($items as $item) {
$cf = array();
$cf['key'] = (string) $item->desc;
$cf['label'] = (string) $item->label;
$cf['type'] = (string) $item->type;
$cf['value'] = (string) $item->value;
if ($item->type == "dropdown") {
$cf['options'] = array();
foreach ($item->option as $option) {
$cf['options'][] = (string) $option;
}
}
$cf['index'] = (bool) $item->index;
$i18n_customfield_defs[] = $cf;
$i18n_customfield_types[$cf['key']] = $cf['type'];
}
}
}
}
return $i18n_customfield_defs;
}
示例4: getData
function getData($searchString)
{
$newLink = getSubstring($searchString, "a-link-normal a-text-normal", "<a", "href=\"", "\"");
$searchString = getXML($newLink);
$imgLink = getSubstring($searchString, "imgBlkFront", "<img", "src=\"", "\"", "\"");
$price = getSubstring($searchString, "offer-price", "<span", ">", "<", ">");
return array($imgLink, $price);
}
示例5: DM_nibbler_init
function DM_nibbler_init()
{
global $nibblercode, $DM_nibbler_config_file, $thisfile_nibbler;
$success = null;
$error = null;
if (isset($_POST['submit'])) {
$nibblercode = isset($_POST['nibblercode']) ? $_POST['nibblercode'] : $nibblercode;
if (!$error) {
$xml = @new SimpleXMLElement('<item></item>');
$xml->addChild('nibblercode', $nibblercode);
if (!$xml->asXML($DM_nibbler_config_file)) {
$error = i18n_r($thisfile_nibbler . '/NIBBLER_ERROR');
} else {
$x = getXML($DM_nibbler_config_file);
$nibblercode = $x->nibblercode;
$success = i18n_r($thisfile_nibbler . '/NIBBLER_SUCCESS');
}
}
}
//Main Navigation For Admin Panel
?>
<h3 class="floated"><?php
echo i18n_r($thisfile_nibbler . '/NIBBLER_TITLE');
?>
</h3> <br/><br/>
<?php
if ($success) {
echo '<p style="color:#669933;"><b>' . $success . '</b></p>';
}
if ($error) {
echo '<p style="color:#cc0000;"><b>' . $error . '</b></p>';
}
?>
<form method="post" action="<?php
echo $_SERVER['REQUEST_URI'];
?>
">
<p><label for="nibblercode" ><?php
echo i18n_r($thisfile_nibbler . '/NIBBLER_DESC');
?>
</label>
<input id="nibblercode" name="nibblercode" class="text" value="<?php
echo $nibblercode;
?>
" />
</p>
<p><input type="submit" id="submit" class="submit" value="<?php
echo i18n_r($thisfile_nibbler . '/NIBBLER_SAVE');
?>
" name="submit" /></p>
</form>
<?php
}
示例6: loadSettings
private static function loadSettings()
{
self::$settings = array();
if (file_exists(GSDATAOTHERPATH . I18N_SETTINGS_FILE)) {
$data = getXML(GSDATAOTHERPATH . I18N_SETTINGS_FILE);
foreach ($data->children() as $child) {
self::$settings[$child->getName()] = (string) $child;
}
}
}
示例7: Innovation_Settings
/**
* Innovation Settings
*
* This defines variables based on the theme plugin's settings
*
* @return bool
*/
function Innovation_Settings()
{
$file = GSDATAOTHERPATH . 'InnovationSettings.xml';
if (file_exists($file)) {
$p = getXML($file);
return $p;
} else {
return false;
}
}
示例8: read_pluginsxml
/**
* read_pluginsxml
*
* Read in the plugins.xml file and populate the $live_plugins array
*
* @since 2.04
* @uses $live_plugins
*
*/
function read_pluginsxml()
{
global $live_plugins;
$data = getXML(GSDATAOTHERPATH . "plugins.xml");
$componentsec = $data->item;
$count = 0;
if (count($componentsec) != 0) {
foreach ($componentsec as $component) {
$live_plugins[(string) $component->plugin] = (string) $component->enabled;
}
}
}
示例9: generateSitemapWithoutPing
public static function generateSitemapWithoutPing()
{
global $SITEURL;
$filenames = getFiles(GSDATAPAGESPATH);
if (count($filenames)) {
foreach ($filenames as $file) {
if (isFile($file, GSDATAPAGESPATH, 'xml')) {
$data = getXML(GSDATAPAGESPATH . $file);
if ($data->url != '404' && $data->private != 'Y') {
$pagesArray[] = array('url' => (string) $data->url, 'parent' => (string) $data->parent, 'date' => (string) $data->pubDate, 'menuStatus' => (string) $data->menuStatus);
}
}
}
}
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
$languages = return_i18n_available_languages();
$deflang = return_i18n_default_language();
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
$xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance');
$xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
if (count($pagesSorted)) {
foreach ($pagesSorted as $page) {
// set <loc>
if (count($languages) > 1) {
$pos = strrpos($page['url'], '_');
if ($pos !== false) {
$pageLoc = find_i18n_url(substr($page['url'], 0, $pos), $page['parent'], substr($page['url'], $pos + 1));
} else {
$pageLoc = find_i18n_url($page['url'], $page['parent'], $deflang);
}
} else {
$pageLoc = find_i18n_url($page['url'], $page['parent']);
}
// set <lastmod>
$pageLastMod = makeIso8601TimeStamp(date("Y-m-d H:i:s", strtotime($page['date'])));
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
$pagePriority = $page['menuStatus'] == 'Y' ? '1.0' : '0.5';
//add to sitemap
$url_item = $xml->addChild('url');
$url_item->addChild('loc', htmlspecialchars($pageLoc));
$url_item->addChild('lastmod', $pageLastMod);
$url_item->addChild('changefreq', $pageChangeFreq);
$url_item->addChild('priority', $pagePriority);
}
}
//create xml file
$file = GSROOTPATH . 'sitemap.xml';
XMLsave($xml, $file);
}
示例10: bm_get_url
function bm_get_url($query = false)
{
global $SITEURL, $PRETTYURLS, $BMPAGEURL, $BMPRETTYURLS;
$data = getXML(GSDATAPAGESPATH . $BMPAGEURL . '.xml');
$url = find_url($BMPAGEURL, $data->parent);
if ($query) {
if ($PRETTYURLS == 1 && $BMPRETTYURLS == 'Y') {
$url .= $query . '/';
} elseif ($BMPAGEURL == 'index') {
$url = $SITEURL . "index.php?{$query}=";
} else {
$url = $SITEURL . "index.php?id={$BMPAGEURL}&{$query}=";
}
}
return $url;
}
示例11: bm_edit_book
function bm_edit_book($slug)
{
$file = BMBOOKPATH . "{$slug}.xml";
# get book data, if it exists
$data = @getXML($file);
$title = @stripslashes($data->title);
$date = !empty($data) ? date('m/d/Y', strtotime($data->date)) : '';
$time = !empty($data) ? date('H:i', strtotime($data->date)) : '';
$tags = @str_replace(',', ', ', $data->tags);
$private = @$data->private != '' ? 'checked' : '';
$content = @stripslashes($data->content);
# show edit book form
include BMTEMPLATEPATH . 'edit_book.php';
if (file_exists($file)) {
$mtime = date(i18n_r('DATE_AND_TIME_FORMAT'), filemtime($file));
echo '<small>' . i18n_r('books_manager/LAST_SAVED') . ": {$mtime}</small>";
}
include BMTEMPLATEPATH . 'ckeditor.php';
}
示例12: ahf_show
function ahf_show()
{
global $ahf_header;
global $ahf_footer;
global $ahf_file;
global $i18n;
// submitted form
if (isset($_POST['submit'])) {
$ahf_header = htmlentities($_POST['ahf_head'], ENT_QUOTES, 'UTF-8');
$ahf_footer = htmlentities($_POST['ahf_foot'], ENT_QUOTES, 'UTF-8');
$xml = @new SimpleXMLElement('<item></item>');
$xml->addChild('header', $ahf_header);
$xml->addChild('footer', $ahf_footer);
if (!$xml->asXML($ahf_file)) {
$error = $i18n['CHMOD_ERROR'];
} else {
$x = getXML($ahf_file);
$ahf_header = stripslashes(htmlspecialchars_decode($x->header, ENT_QUOTES));
$ahf_footer = stripslashes(htmlspecialchars_decode($x->footer, ENT_QUOTES));
}
}
?>
<h3>Admin Header Footer</h3>
<form method="post" action="<?php
echo $_SERVER['REQUEST_URI'];
?>
">
<p><b>Code for Header</b>:<br /><textarea name="ahf_head" class="shorttext" ><?php
echo @$ahf_header;
?>
</textarea><br />
<span class="hint">"Header" should only include code to be shown within the <head> tag or PHP code</span></p>
<p><b>Code for Footer</b>:<br /><textarea name="ahf_foot" class="shorttext" ><?php
echo @$ahf_footer;
?>
</textarea><br />
<span class="hint">"Footer" can echo any text or run any javascript or PHP code</span></p>
<p><input type="submit" id="submit" class="submit" value="Save Header/Footer Code" name="submit" /></p>
</form>
<?php
}
示例13: loadRates
private function loadRates($lang)
{
$this->rates = array();
$data = array();
$filename = GSDATAPATH . RATES_DIR . RATES_FILENAME . '_' . $lang . '.xml';
if (!file_exists($filename)) {
$filename = GSDATAPATH . RATES_DIR . RATES_FILENAME . '.xml';
}
if (file_exists($filename)) {
$data = getXML($filename);
if ($data) {
foreach ($data as $key => $value) {
if ($key == "category") {
$category = $this->extractCategory($value);
$this->rates[] = $category;
}
}
}
}
}
示例14: getGallery
public static function getGallery($name)
{
$gallery = array('items' => array());
if (!file_exists(GSDATAPATH . 'i18n_gallery/' . $name . '.xml')) {
return $gallery;
}
$data = getXML(GSDATAPATH . I18N_GALLERY_DIR . $name . '.xml');
if (!$data) {
return $gallery;
}
$dofilter = basename($_SERVER['PHP_SELF']) == 'index.php';
foreach ($data as $key => $value) {
if ($key != 'item' && $key != 'items') {
$gallery[$key] = (string) $value;
} else {
$include = true;
if ($dofilter) {
global $filters;
$filename = (string) $value->filename;
$tags = preg_split('/\\s*,\\s*/', (string) $value->tags);
foreach ($filters as $filter) {
if ($filter['filter'] == 'image-veto') {
if (call_user_func_array($filter['function'], array($name, $filename, $tags))) {
$include = false;
break;
}
}
}
}
if ($include) {
$item = array();
foreach ($value as $itemkey => $itemvalue) {
$item[$itemkey] = (string) $itemvalue;
}
$gallery['items'][] = $item;
}
}
}
return $gallery;
}
示例15: getCustomFields
public function getCustomFields()
{
$cfData = getXML(BLOGCUSTOMFIELDS);
$cf = array('options' => '', 'main' => '');
$count_options = 0;
$count_main = 0;
$count_opt = 0;
foreach ($cfData->item as $custom_field) {
if ($custom_field->area == 'options') {
$cf['options'][$count_options]['key'] = (string) $custom_field->desc;
$cf['options'][$count_options]['label'] = (string) $custom_field->label;
$cf['options'][$count_options]['type'] = (string) $custom_field->type;
$cf['options'][$count_options]['value'] = (string) $custom_field->value;
if ($custom_field->type == "dropdown") {
$count_opt = 0;
$cf['options'][$count_options]['options'] = array();
foreach ($custom_field->option as $option) {
$cf['options'][$count_options]['options'][] = (string) $option;
$count_opt++;
}
}
$count_options++;
} elseif ($custom_field->area == 'main') {
$cf['main'][$count_main]['key'] = (string) $custom_field->desc;
$cf['main'][$count_main]['label'] = (string) $custom_field->label;
$cf['main'][$count_main]['type'] = (string) $custom_field->type;
$cf['main'][$count_main]['value'] = (string) $custom_field->value;
if ($custom_field->type == "dropdown") {
$count_opt = 0;
$cf['main'][$count_main]['options'] = array();
foreach ($custom_field->option as $option) {
$cf['main'][$count_main]['options'][] = (string) $option;
$count_opt++;
}
}
$count_main++;
}
}
return $cf;
}