本文整理汇总了PHP中getPagesXmlValues函数的典型用法代码示例。如果您正苦于以下问题:PHP getPagesXmlValues函数的具体用法?PHP getPagesXmlValues怎么用?PHP getPagesXmlValues使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPagesXmlValues函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getChildrenMulti
/**
* Get Page Children - returns multi fields
*
* Return an Array of pages that are children of the requested page/slug with optional fields.
*
* @since 3.1
* @param $page - slug of the page to retrieve content
* @param options - array of optional fields to return
*
* @returns - Array of slug names and optional fields.
*
*/
function getChildrenMulti($page, $options = array())
{
$pagesArray = getPagesXmlValues();
$count = 0;
$returnArray = array();
foreach ($pagesArray as $key => $value) {
if ($pagesArray[$key]['parent'] == $page) {
$returnArray[$count] = array();
$returnArray[$count]['url'] = $key;
foreach ($options as $option) {
$returnArray[$count][$option] = returnPageField($key, $option);
}
$count++;
}
}
return $returnArray;
}
开发者ID:promil23,项目名称:GetSimpleCMS,代码行数:29,代码来源:caching_functions.php
示例2: getPagesXmlValues
/**
* Get Cached Pages XML Values
*
* Loads the Cached XML data into the Array $pagesArray
* If the file does not exist it is created the first time.
*
* @since 3.1
*
*/
function getPagesXmlValues($chkcount = false)
{
global $pagesArray;
// debugLog(__FUNCTION__.": chkcount - " .(int)$chkcount);
// if page cache not load load it
if (!$pagesArray) {
$pagesArray = array();
$file = GSDATAOTHERPATH . "pages.xml";
if (file_exists($file)) {
// load the xml file and setup the array.
// debugLog(__FUNCTION__.": load pages.xml");
$thisfile = file_get_contents($file);
$data = simplexml_load_string($thisfile);
$pages = $data->item;
foreach ($pages as $page) {
$key = $page->url;
$pagesArray[(string) $key] = array();
foreach ($page->children() as $opt => $val) {
$pagesArray[(string) $key][(string) $opt] = (string) $val;
}
}
} else {
// no page cache, regen and then load it
// debugLog(__FUNCTION__.": pages.xml not exist");
if (create_pagesxml(true)) {
getPagesXmlValues(false);
}
return;
}
}
// if checking cache sync, regen cache if pages differ.
if ($chkcount == true) {
$path = GSDATAPAGESPATH;
$dir_handle = @opendir($path) or die("getPageXmlValues: Unable to open {$path}");
$filenames = array();
while ($filename = readdir($dir_handle)) {
$ext = substr($filename, strrpos($filename, '.') + 1);
if ($ext == "xml") {
$filenames[] = $filename;
}
}
if (count($pagesArray) != count($filenames)) {
// debugLog(__FUNCTION__.": count differs regen pages.xml");
if (create_pagesxml(true)) {
getPagesXmlValues(false);
}
}
}
}
开发者ID:Kevinf63,项目名称:KevPortfolio,代码行数:58,代码来源:caching_functions.php
示例3: i18n_r
$newxml->title = $newxml->title . ' [' . i18n_r('COPY') . ']';
$newxml->pubDate = date('r');
$status = XMLsave($newxml, $path . $newurl . '.xml');
if ($status) {
create_pagesxml('true');
header('Location: pages.php?upd=clone-success&id=' . $newurl);
} else {
$error = sprintf(i18n_r('CLONE_ERROR'), $_GET['id']);
header('Location: pages.php?error=' . $error);
}
} else {
$error = sprintf(i18n_r('CLONE_ERROR'), $_GET['id']);
header('Location: pages.php?error=' . $error);
}
}
getPagesXmlValues();
$count = 0;
foreach ($pagesArray as $page) {
if ($page['parent'] != '') {
$parentdata = getXML(GSDATAPAGESPATH . $page['parent'] . '.xml');
$parentTitle = $parentdata->title;
$sort = $parentTitle . ' ' . $page['title'];
} else {
$sort = $page['title'];
}
$page = array_merge($page, array('sort' => $sort));
$pagesArray_tmp[$count] = $page;
$count++;
}
$pagesArray = $pagesArray_tmp;
$pagesSorted = subval_sort($pagesArray, 'sort');
开发者ID:google-code-backups,项目名称:get-simple-cms,代码行数:31,代码来源:pages.php
示例4: getPagesXmlValues
/**
* Get Cached Pages XML Values
*
* Loads the Cached XML data into the Array $pagesArray
* If the file does not exist it is created the first time.
*
* @since 3.1
*
*/
function getPagesXmlValues($chkcount = true)
{
global $pagesArray;
$pagesArray = array();
$file = GSDATAOTHERPATH . "pages.xml";
if (file_exists($file)) {
// load the xml file and setup the array.
$thisfile = file_get_contents($file);
$data = simplexml_load_string($thisfile);
$pages = $data->item;
foreach ($pages as $page) {
$key = $page->url;
$pagesArray[(string) $key] = array();
foreach ($page->children() as $opt => $val) {
$pagesArray[(string) $key][(string) $opt] = (string) $val;
}
}
$path = GSDATAPAGESPATH;
$dir_handle = @opendir($path) or die("Unable to open {$path}");
$filenames = array();
while ($filename = readdir($dir_handle)) {
$ext = substr($filename, strrpos($filename, '.') + 1);
if ($ext == "xml") {
$filenames[] = $filename;
}
}
if ($chkcount == true) {
if (count($pagesArray) != count($filenames)) {
create_pagesxml('true');
getPagesXmlValues(false);
}
}
} else {
create_pagesxml(true);
getPagesXmlValues(false);
}
}
开发者ID:Emmett-Brown,项目名称:linea,代码行数:46,代码来源:caching_functions.php
示例5: i18n_r
$newxml->title = $newxml->title . ' [' . i18n_r('COPY') . ']';
$newxml->pubDate = date('r');
$status = XMLsave($newxml, $path . $newurl . '.xml');
if ($status) {
create_pagesxml('true');
header('Location: pages.php?upd=clone-success&id=' . $newurl);
} else {
$error = sprintf(i18n_r('CLONE_ERROR'), $_GET['id']);
header('Location: pages.php?error=' . $error);
}
} else {
$error = sprintf(i18n_r('CLONE_ERROR'), $_GET['id']);
header('Location: pages.php?error=' . $error);
}
}
getPagesXmlValues(true);
$count = 0;
foreach ($pagesArray as $page) {
if ($page['parent'] != '') {
$parentTitle = returnPageField($page['parent'], "title");
$sort = $parentTitle . ' ' . $page['title'];
$sort = $parentTitle . ' ' . $page['title'];
} else {
$sort = $page['title'];
}
$page = array_merge($page, array('sort' => $sort));
$pagesArray_tmp[$count] = $page;
$count++;
}
// $pagesArray = $pagesArray_tmp;
$pagesSorted = subval_sort($pagesArray_tmp, 'sort');
开发者ID:elephantcode,项目名称:elephantcode,代码行数:31,代码来源:pages.php
示例6: generate_sitemap
/**
* Creates Sitemap
*
* Creates GSSITEMAPFILE (sitemap.xml) in the site's root.
*/
function generate_sitemap()
{
if (getDef('GSNOSITEMAP', true)) {
return;
}
global $pagesArray;
// Variable settings
$SITEURL = getSiteURL(true);
$path = GSDATAPAGESPATH;
getPagesXmlValues(false);
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
if (count($pagesSorted) > 0) {
$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');
foreach ($pagesSorted as $page) {
if ($page['url'] != '404') {
if ($page['private'] != 'Y') {
// set <loc>
$pageLoc = find_url($page['url'], $page['parent'], 'full');
// set <lastmod>
$tmpDate = date("Y-m-d H:i:s", strtotime($page['pubDate']));
$pageLastMod = makeIso8601TimeStamp($tmpDate);
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
if ($page['menuStatus'] == 'Y') {
$pagePriority = '1.0';
} else {
$pagePriority = '0.5';
}
//add to sitemap
$url_item = $xml->addChild('url');
$url_item->addChild('loc', $pageLoc);
$url_item->addChild('lastmod', $pageLastMod);
$url_item->addChild('changefreq', $pageChangeFreq);
$url_item->addChild('priority', $pagePriority);
}
}
}
//create xml file
$file = GSROOTPATH . GSSITEMAPFILE;
$xml = exec_filter('sitemap', $xml);
// @filter sitemap (obj) filter the sitemap $xml obj
$status = XMLsave($xml, $file);
exec_action('sitemap-aftersave');
// @hook sitemap-aftersave after a sitemap data file was saved
#sitemap successfully created
return $status;
} else {
return true;
}
}
开发者ID:kix23,项目名称:GetSimpleCMS,代码行数:58,代码来源:template_functions.php
示例7: dropdown_pages
private function dropdown_pages()
{
getPagesXmlValues();
global $pagesArray;
$pages = $pagesArray;
?>
<select class="text" <?php
echo $this->properties;
?>
>
<?php
foreach ($pages as $slug => $properties) {
?>
<option value="<?php
echo $slug;
?>
" <?php
if ($slug == $this->value) {
echo 'selected="selected"';
}
?>
><?php
echo $properties['title'];
?>
</option>
<?php
}
?>
</select>
<?php
}
开发者ID:n00dles,项目名称:DM_Matrix,代码行数:31,代码来源:fields.display.php
示例8: generate_sitemap
/**
* Creates Sitemap
*
* Creates sitemap.xml in the site's root.
*/
function generate_sitemap()
{
if (getDef('GSNOSITEMAP', true)) {
return;
}
// Variable settings
global $SITEURL;
$path = GSDATAPAGESPATH;
global $pagesArray;
getPagesXmlValues(false);
$pagesSorted = subval_sort($pagesArray, 'menuStatus');
if (count($pagesSorted) != 0) {
$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');
foreach ($pagesSorted as $page) {
if ($page['url'] != '404') {
if ($page['private'] != 'Y') {
// set <loc>
$pageLoc = find_url($page['url'], $page['parent']);
// set <lastmod>
$tmpDate = date("Y-m-d H:i:s", strtotime($page['pubDate']));
$pageLastMod = makeIso8601TimeStamp($tmpDate);
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
if ($page['menuStatus'] == 'Y') {
$pagePriority = '1.0';
} else {
$pagePriority = '0.5';
}
//add to sitemap
$url_item = $xml->addChild('url');
$url_item->addChild('loc', $pageLoc);
$url_item->addChild('lastmod', $pageLastMod);
$url_item->addChild('changefreq', $pageChangeFreq);
$url_item->addChild('priority', $pagePriority);
}
}
}
//create xml file
$file = GSROOTPATH . 'sitemap.xml';
$xml = exec_filter('sitemap', $xml);
XMLsave($xml, $file);
exec_action('sitemap-aftersave');
}
if (!defined('GSDONOTPING')) {
if (file_exists(GSROOTPATH . 'sitemap.xml')) {
if (200 === ($status = pingGoogleSitemaps($SITEURL . 'sitemap.xml'))) {
#sitemap successfully created & pinged
return true;
} else {
error_log(i18n_r('SITEMAP_ERRORPING'));
return i18n_r('SITEMAP_ERRORPING');
}
} else {
error_log(i18n_r('SITEMAP_ERROR'));
return i18n_r('SITEMAP_ERROR');
}
} else {
#sitemap successfully created - did not ping
return true;
}
}
开发者ID:elephantcode,项目名称:elephantcode,代码行数:69,代码来源:template_functions.php
注:本文中的getPagesXmlValues函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论