本文整理汇总了PHP中subval_sort函数的典型用法代码示例。如果您正苦于以下问题:PHP subval_sort函数的具体用法?PHP subval_sort怎么用?PHP subval_sort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了subval_sort函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: login_cookie_check
/**
* Menu Preview
*
* Previews the current main menu hierarchy
*
* @package GetSimple
* @subpackage Page-Edit
*/
# Setup
$load['plugin'] = true;
include 'inc/common.php';
login_cookie_check();
# get pages
getPagesXmlValues();
$pagesSorted = subval_sort($pagesArray, 'menuOrder');
global $LANG;
$LANG_header = preg_replace('/(?:(?<=([a-z]{2}))).*/', '', $LANG);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Share GetSimple</title>
<style>
.navigate {
padding:20px;
width:400px;
background:#f6f6f6;
}
table {border-collapse:collapse;font-family:arial;font-size:12px;margin:0;color:#333;width:100%;}
td, th {padding:5px 20px 5px 5px;text-shadow:1px 1px 0 #fff;}
示例3: getFiles
$filenames = getFiles($path);
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if (isFile($file, $path, 'xml')) {
$data = getXML($path . $file);
$status = $data->menuStatus;
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['parent'] = $data->parent;
$pagesArray[$count]['date'] = $data->pubDate;
$pagesArray[$count]['private'] = $data->private;
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$count++;
}
}
}
$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['private'] != 'Y') {
// set <loc>
$pageLoc = find_url($page['url'], $page['parent']);
// set <lastmod>
$tmpDate = date("Y-m-d H:i:s", strtotime($page['date']));
$pageLastMod = makeIso8601TimeStamp($tmpDate);
// set <changefreq>
$pageChangeFreq = 'weekly';
// set <priority>
if ($page['menuStatus'] == 'Y') {
示例4: getFileExtension
$dircount++;
} else {
$filesArray[$count]['name'] = $file;
$ext = getFileExtension($file);
$filetype = get_FileTypeToken($ext);
$filesArray[$count]['type'] = lowercase($filetype);
clearstatcache();
$ss = @stat($path . $file);
$filesArray[$count]['date'] = @date('M j, Y', $ss['ctime']);
$filesArray[$count]['size'] = fSize($ss['size']);
$totalsize = $totalsize + $ss['size'];
$count++;
}
}
$filesSorted = subval_sort($filesArray, 'name');
$dirsSorted = subval_sort($dirsArray, 'name');
}
echo '<div class="edit-nav clearfix" >';
echo '<select id="imageFilter">';
echo '<option value="all">' . i18n_r('SHOW_ALL') . '</option>';
if (count($filesSorted) > 0) {
foreach ($filesSorted as $filter) {
$filterArray[$filter['type']] = '';
}
if (count($filterArray) != 0) {
ksort($filterArray);
foreach ($filterArray as $type => $value) {
$sel = false;
# check for filter querystring
if (isset($_GET['type']) && $_GET['type'] == $type) {
$sel = true;
示例5: array
$coArray = array();
foreach ($ids as $id) {
if ($title[$ct] != null && $value[$ct] != null) {
if ($slug[$ct] == null) {
$slug_tmp = to7bit($title[$ct], 'UTF-8');
$slug[$ct] = clean_url($slug_tmp);
$slug_tmp = '';
}
$coArray[$ct]['id'] = $ids[$ct];
$coArray[$ct]['title'] = htmlentities($title[$ct], ENT_QUOTES, 'UTF-8');
$coArray[$ct]['slug'] = $slug[$ct];
$coArray[$ct]['value'] = htmlentities($value[$ct], ENT_QUOTES, 'UTF-8');
}
$ct++;
}
$ids = subval_sort($coArray, 'title');
$count = 0;
foreach ($ids as $comp) {
//body of xml file
$components = $xml->addChild('item');
$c_note = $components->addChild('title');
$c_note->addCData(@$comp['title']);
$components->addChild('slug', @$comp['slug']);
$c_note = $components->addChild('value');
$c_note->addCData(@$comp['value']);
$count++;
}
}
exec_action('component-save');
XMLsave($xml, $path . $file);
header('Location: components.php?upd=comp-success');
示例6: init
function init()
{
if (isset($_REQUEST['post'])) {
$post_id = $_REQUEST['post'];
} elseif (isset($_REQUEST['post_ID'])) {
$post_id = $_REQUEST['post_ID'];
} else {
$post_id = 99999999999999.0;
}
global $md_metabox;
function subval_sort($a, $subkey)
{
foreach ($a as $k => $v) {
$b[$k] = strtolower($v[$subkey]);
}
asort($b);
foreach ($b as $key => $val) {
$c[] = $a[$key];
}
return $c;
}
$md_metabox = subval_sort($md_metabox, 'order');
$form_helper = new FORM_HELPER($post_id, $md_metabox);
add_action('add_meta_boxes', 'page_metabox_init');
add_action('save_post', 'page_metabox_save');
function page_metabox_init()
{
add_meta_box('page-metabox', 'Advanced Page Options', 'page_metabox_ui');
}
function page_metabox_ui($post)
{
global $md_metabox;
wp_nonce_field(plugin_basename(__FILE__), 'nonce_page_metabox');
$form_helper = new FORM_HELPER($post->ID, $md_metabox);
$form_helper->metabox_init();
}
function page_metabox_save($post_id)
{
if (isset($_POST['nonce_page_metabox'])) {
// Autosave, do nothing
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
// Ajax not used here
if (defined('DOING_AJAX') && DOING_AJAX) {
return;
}
// Check user permissions
if (!current_user_can('edit_post', $post_id)) {
return;
}
// Return if it's a post revision
if (false !== wp_is_post_revision($post_id)) {
return;
}
// verify this came from the our screen and with proper authorization
if (!wp_verify_nonce($_POST['nonce_page_metabox'], plugin_basename(__FILE__))) {
return;
}
// OK, we're authenticated
global $md_metabox;
$form_helper = new FORM_HELPER($post_id, $md_metabox);
$form_helper->metabox_save();
}
}
}
示例7: generate_sitemap
/**
* Creates Sitemap
*
* Creates sitemap.xml in the site's root.
* Pending: read the content path (xml's)
*/
function generate_sitemap()
{
// Variable settings
global $SITEURL;
$path = GSDATAPAGESPATH;
$count = "0";
$filenames = getFiles($path);
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if (isFile($file, $path, 'xml')) {
$data = getXML($path . $file);
if ($data->url != '404') {
$status = $data->menuStatus;
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['parent'] = $data->parent;
$pagesArray[$count]['date'] = $data->pubDate;
$pagesArray[$count]['private'] = $data->private;
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$count++;
}
}
}
}
$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['private'] != 'Y') {
// set <loc>
$pageLoc = find_url($page['url'], $page['parent']);
// set <lastmod>
$tmpDate = date("Y-m-d H:i:s", strtotime($page['date']));
$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);
exec_action('sitemap-additem');
}
}
//create xml file
$file = GSROOTPATH . 'sitemap.xml';
exec_action('save-sitemap');
XMLsave($xml, $file);
}
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;
}
}
示例8: subval_sort
$count++;
}
}
$filesSorted = subval_sort($filesArray, 'name');
$dirsSorted = subval_sort($dirsArray, 'name');
}
echo '<div class="edit-nav" >';
echo '<select id="imageFilter">';
echo '<option value="All">' . i18n_r('SHOW_ALL') . '</option>';
if (count($filesSorted) > 0) {
foreach ($filesSorted as $filter) {
$filterArr[] = $filter['type'];
}
if (count($filterArr) != 0) {
$filterArray = array_unique($filterArr);
$filterArray = subval_sort($filterArray, 'type');
foreach ($filterArray as $type) {
# check for image type
if (strstr($type, ' Images')) {
$typeCleaned = 'Images';
$typeCleaned_2 = str_replace(' Images', '', $type);
} else {
$typeCleaned = $type;
$typeCleaned_2 = $type;
}
echo '<option value="' . $typeCleaned . '">' . $typeCleaned_2 . '</option>';
}
}
}
echo '</select><div class="clear" ></div></div>';
$pathParts = explode("/", $subPath);
示例9: eshop_parse_optsets
function eshop_parse_optsets($data)
{
global $wpdb;
$opt['optset'] = $data['optset'];
$addoprice = $data['addoprice'];
$oset = $qb = array();
$optings = unserialize($opt['optset']);
//then sort it how we want.
$optings = subval_sort($optings, 'id');
$c = 0;
if (isset($newoptings)) {
unset($newoptings);
}
foreach ($optings as $foo => $opst) {
if (!isset($opst['type']) || ($opst['type'] == '2' || $opst['type'] == '3') && (isset($opst['text']) && trim($opst['text']) != '')) {
$newoptings[] = $optings[$c];
$qb[] = "id={$opst['id']}";
}
$c++;
}
if (isset($newoptings)) {
$qbs = implode(" OR ", $qb);
$otable = $wpdb->prefix . 'eshop_option_sets';
$otablename = $wpdb->prefix . 'eshop_option_names';
$orowres = $wpdb->get_results("select o.name, o.price, o.id, t.type,t.name as oname from {$otable} as o, {$otablename} as t where ({$qbs}) && o.optid=t.optid ORDER BY id ASC");
$x = 0;
foreach ($orowres as $orow) {
if (isset($newoptings[$x]['id']) && $orow->id == $newoptings[$x]['id']) {
if (isset($newoptings[$x]['type']) && isset($newoptings[$x]['text']) && trim($newoptings[$x]['text']) != '' && ($newoptings[$x]['type'] == '2' || $newoptings[$x]['type'] == '3')) {
$oset[] = '<span class="eshopoptset"><span class="eshopoptname">' . stripslashes($orow->name) . "</span>\n" . '<span class="eshoptext">' . stripslashes($newoptings[$x]['text']) . '</span></span>';
} elseif (($orow->type == '2' || $orow->type == '3') && !isset($newoptings[$x]['text'])) {
$xxxx = '';
} else {
$oset[] = '<span class="eshopoptset"><span class="eshopoptname">' . stripslashes($orow->oname) . "</span>\n" . '<span class="eshoptext">' . stripslashes($orow->name) . '</span></span>';
}
$addoprice = $addoprice + $orow->price;
$x++;
}
}
$optset = "\n" . implode("\n", $oset);
} else {
$optset = '';
}
$data['optset'] = $optset;
$data['addoprice'] = $addoprice;
return $data;
}
示例10: get_navigation
/**
* Get Main Navigation
*
* This will return unordered list of main navigation
* This function uses the menu opitions listed within the 'Edit Page' control panel screen
*
* @since 1.0
* @uses GSDATAOTHERPATH
* @uses getXML
* @uses subval_sort
* @uses find_url
* @uses strip_quotes
* @uses exec_filter
*
* @param string $currentpage This is the ID of the current page the visitor is on
* @return string
*/
function get_navigation($currentpage)
{
$menu = '';
global $pagesArray;
$pagesSorted = subval_sort($pagesArray, 'menuOrder');
if (count($pagesSorted) != 0) {
foreach ($pagesSorted as $page) {
$sel = '';
$classes = '';
$url_nav = $page['url'];
if ($page['menuStatus'] == 'Y') {
if ("{$currentpage}" == "{$url_nav}") {
$classes = "current active " . $page['parent'] . " " . $url_nav;
} else {
$classes = trim($page['parent'] . " " . $url_nav);
}
if ($page['menu'] == '') {
$page['menu'] = $page['title'];
}
if ($page['title'] == '') {
$page['title'] = $page['menu'];
}
$menu .= '<li class="' . $classes . '"><a href="' . find_url($page['url'], $page['parent']) . '" title="' . encode_quotes(cl($page['title'])) . '">' . strip_decode($page['menu']) . '</a></li>' . "\n";
}
}
}
echo exec_filter('menuitems', $menu);
}
示例11: isset
$pluginid = isset($_GET['set']) ? $_GET['set'] : null;
$nonce = isset($_GET['nonce']) ? $_GET['nonce'] : null;
if ($pluginid) {
if (check_nonce($nonce, "set_" . pathinfo_filename($pluginid), "plugins.php")) {
$plugin = antixss($pluginid);
change_plugin($plugin);
redirect('plugins.php?success=' . i18n_r('PLUGIN_UPDATED'));
} else {
redirect('plugins.php?error=' . i18n_r('ERROR_OCCURED'));
}
}
// Variable settings
$counter = 0;
$table = '';
$needsupdate = false;
$plugin_info_sorted = subval_sort($plugin_info, 'name');
foreach ($plugin_info_sorted as $pluginid => $plugininfo) {
$setNonce = '&nonce=' . get_nonce("set_" . $pluginid, "plugins.php");
// @todo disabled plugins have a version of (str) 'disabled', should be 0 or null
$pluginver = $plugininfo['version'] == 'disabled' ? 0 : $plugininfo['version'];
if (plugin_active($pluginid)) {
$cls_Enabled = 'hidden';
$cls_Disabled = '';
$trclass = 'enabled';
} else {
$cls_Enabled = '';
$cls_Disabled = 'hidden';
$trclass = 'disabled';
}
// get extend api for this plugin filename
$api_data = json_decode(get_api_details('plugin', $pluginid));
示例12: displayMonthEvents
/**
* displayMonthEvents
*
* Displays a listing of events for a given month.
* Used on the homepage with the small calendar view.
*
* @param int $month
* @param int $year
*
* @return void
*/
function displayMonthEvents($month, $year)
{
$month = (int) $month;
$month = str_pad($month, 2, 0, STR_PAD_LEFT);
$year = (int) $year;
$gm_next = gmdate('Y-m-d H:i:s', gmmktime(gmdate('h'), gmdate('i'), gmdate('s'), $month + 1, 1, $year));
$nextMonth = fixDate('m', $this->fcmsUser->tzOffset, $gm_next);
$today = fixDate('Ymd', $this->fcmsUser->tzOffset, gmdate('Y-m-d H:i:s'));
$today_year = fixDate('Y', $this->fcmsUser->tzOffset, gmdate('Y-m-d H:i:s'));
$sql = "SELECT `id`, DATE_FORMAT(`date`, '%m%d') as day, `title`, `desc`, \n `date`, `private`, `created_by`, `repeat`\n FROM fcms_calendar \n WHERE (`date` LIKE '{$year}-{$month}-%%') \n OR (`date` LIKE '{$year}-{$nextMonth}-%%') \n OR (`date` LIKE '%%%%-{$month}-%%' AND `repeat` = 'yearly') \n OR (`date` LIKE '%%%%-{$nextMonth}-%%' AND `repeat` = 'yearly') \n ORDER BY day";
$rows = $this->fcmsDatabase->getRows($sql);
if ($rows === false) {
$this->fcmsError->displayError();
return;
}
$events = array();
if (count($rows) > 0) {
foreach ($rows as $row) {
$events[] = $row;
}
}
// Get birthdays
$sql = "SELECT `id`, `fname`, `lname`, `dob_year`, `dob_month`, `dob_day`, \n `dod_year`, `dod_month`, `dod_day` \n FROM `fcms_users` \n WHERE `dob_month` = ?";
$rows = $this->fcmsDatabase->getRows($sql, $month);
if ($rows === false) {
$this->fcmsError->displayError();
return;
}
if (count($rows) > 0) {
foreach ($rows as $r) {
if (empty($r['dob_month']) || empty($r['dob_day'])) {
continue;
}
if (!empty($r['dod_year']) || !empty($r['dod_month']) || !empty($r['dod_day'])) {
continue;
}
$age = getAge($r['dob_year'], $r['dob_month'], $r['dob_day'], "{$year}-{$month}-" . $r['dob_day']);
$r['id'] = 'birthday' . $r['id'];
$r['day'] = $r['dob_month'] . $r['dob_day'];
$r['date'] = $r['dob_year'] . '-' . $r['dob_month'] . '-' . $r['dob_day'];
$r['title'] = $r['fname'] . ' ' . $r['lname'];
$r['desc'] = sprintf(T_('%s turns %s today.'), $r['fname'], $age);
$r['private'] = 0;
$r['repeat'] = 'yearly';
$r['created_by'] = $r['id'];
$events[] = $r;
}
}
if (count($events) <= 0) {
return;
}
// show the next 5
$count = 0;
// fix order
$events = subval_sort($events, 'day');
foreach ($events as $row) {
if ($count > 5) {
break;
}
$show = false;
list($event_year, $event_month, $event_day) = explode("-", $row['date']);
// Fix repeating event year
if ($row['repeat'] == 'yearly') {
$event_year = $today_year;
}
// Skip events that have already happened
if ($event_year . $event_month . $event_day < $today) {
continue;
}
if ($row['private'] == 0) {
$show = true;
} else {
if ($row['created_by'] == $this->fcmsUser->id) {
$show = true;
}
}
if ($show) {
$count++;
$title = !empty($row['desc']) ? $row['desc'] : $row['title'];
$title = cleanOutput($title);
$event = cleanOutput($row['title']);
echo '
<div class="events">
<a title="' . $title . '" href="calendar.php?event=' . $row['id'] . '">' . $event . '</a><br/>
' . formatDate(T_('M. d'), $row['date']) . '
</div>';
}
}
}
示例13: getFiles
$filenames = getFiles($path);
$count = "0";
$pagesArray_tmp = array();
$pagesSorted = array();
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if (isFile($file, $path, 'bak')) {
$data = getXML($path . $file);
$status = $data->menuStatus;
$pagesArray_tmp[$count]['title'] = html_entity_decode($data->title, ENT_QUOTES, 'UTF-8');
$pagesArray_tmp[$count]['url'] = $data->url;
$pagesArray_tmp[$count]['date'] = $data->pubDate;
$count++;
}
}
$pagesSorted = subval_sort($pagesArray_tmp, 'title');
}
if (count($pagesSorted) != 0) {
foreach ($pagesSorted as $page) {
$counter++;
$table .= '<tr id="tr-' . $page['url'] . '" >';
if ($page['title'] == '') {
$page['title'] = '[No Title] » <em>' . $page['url'] . '</em>';
}
$table .= '<td class="pagetitle"><a title="' . i18n_r('VIEWPAGE_TITLE') . ' ' . cl($page['title']) . '" href="backup-edit.php?p=view&id=' . $page['url'] . '">' . cl($page['title']) . '</a></td>';
$table .= '<td style="width:80px;text-align:right;" ><span>' . output_date($page['date']) . '</span></td>';
$table .= '<td class="delete" ><a class="delconfirm" title="' . i18n_r('DELETEPAGE_TITLE') . ' ' . cl($page['title']) . '?" href="backup-edit.php?p=delete&id=' . $page['url'] . '&nonce=' . get_nonce("delete", "backup-edit.php") . '">×</a></td>';
$table .= '</tr>';
}
}
$pagetitle = i18n_r('BAK_MANAGEMENT');
示例14: array_merge
for ($i = 0; $i < count($regional_map_results); $i++) {
if ($regional_map_results[$i]["info"]["type"] == "Map") {
$mapinfo[$i] = array_merge($regional_map_results[$i]["map_info"][0]);
}
if ($regional_map_results[$i]["info"]["type"] == "Group") {
$groupinfo[$i] = array_merge($regional_map_results[$i]["map_info"]);
}
}
foreach ($groupinfo as $key => $groupvalue) {
$groupmapinfo[] = array_merge($groupinfo[$key]);
}
foreach ($groupmapinfo as $array) {
$group = array_merge($group, $array);
}
$merged_maps_tosort = array_merge($mapinfo, $group);
$merged_maps = subval_sort($merged_maps_tosort, "title");
$total_maps = count($merged_maps);
//code for pagination
$mapsperpage = get_option('arcgis_maps_per_page') != '' ? get_option('arcgis_maps_per_page') : '8';
if (isset($regional_map_results)) {
$total_pages = ceil($total_maps / $mapsperpage);
} else {
$total_pages = 1;
$total_maps = 0;
}
if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) {
$currentpage = (int) $_GET['currentpage'];
} else {
$currentpage = 1;
}
if ($currentpage > $total_pages) {
示例15: 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;
}
}