Exemple #1
0
 public function getPageFooters($params = array())
 {
     $syses = xt_design_syspages();
     $footers = get_option(XT_OPTION_PAGE_FOOTERS);
     $pages = get_option(XT_OPTION_PAGE_HEADER_FOOTER);
     if (!empty($footers) && !empty($pages)) {
         $customIds = array();
         foreach ($pages as $page) {
             if ($page['type'] == 'system') {
                 //system
                 $page['url'] = $syses[$page['id']]['preview'];
                 $page['title'] = $syses[$page['id']]['title'];
             } else {
                 //custom
                 $customIds[] = $page['id'];
             }
             if (isset($footers[$page['footer']])) {
                 $footer = $footers[$page['footer']];
                 if (isset($footer['pages'])) {
                     $footer['pages'][$page['id']] = $page;
                 } else {
                     $footer['pages'] = array($page['id'] => $page);
                 }
                 $footers[$page['footer']] = $footer;
             }
         }
         if (!empty($customIds)) {
             $customs = array();
             query_posts(array('post_type' => 'page', 'post__in' => $customIds));
             if (have_posts()) {
                 while (have_posts()) {
                     the_post();
                     $customs[get_the_ID()] = array('url' => get_permalink(), 'title' => get_the_title());
                 }
             }
             if (!empty($customs)) {
                 foreach ($footers as $footer) {
                     if (!empty($footer['pages'])) {
                         foreach ($footer['pages'] as $_page) {
                             if (isset($customs[$_page['id']])) {
                                 $custom = $customs[$_page['id']];
                                 $footer['pages'][$_page['id']]['url'] = $custom['url'];
                                 $footer['pages'][$_page['id']]['title'] = $custom['title'];
                                 $footers[$footer['id']] = $footer;
                             }
                         }
                     }
                 }
             }
         }
     }
     return $footers;
 }
function _xt_sitemap_build_other($type = '')
{
    global $wpdb;
    $cats = $wpdb->get_col('SELECT id FROM ' . XT_TABLE_CATALOG . ' WHERE type=\'share\' ORDER BY id DESC');
    if ($type == 'baidu') {
    } else {
        $xml_begin = '<?xml version="1.0" encoding="utf-8"?><urlset>';
        $xml_indexs = '';
        $pages = xt_design_syspages();
        $timestamp = current_time('timestamp', 1);
        if (!empty($pages)) {
            foreach ($pages as $page) {
                if (!empty($page['preview'])) {
                    $xml_indexs .= '<url>';
                    $xml_indexs .= '<loc>' . $page['preview'] . '</loc>';
                    $xml_indexs .= '<lastmod>' . date('Y-m-d', $timestamp) . '</lastmod>';
                    $xml_indexs .= '<changefreq>' . XT_SITEMAP_OTHER_CHANGEFREQ . '</changefreq>';
                    $xml_indexs .= '<priority>' . XT_SITEMAP_OTHER_PRIORITY . '</priority>';
                    $xml_indexs .= '</url>';
                }
            }
        }
        if (!empty($cats)) {
            foreach ($cats as $cat) {
                $xml_indexs .= '<url>';
                $xml_indexs .= '<loc>' . xt_get_shares_search_url(array('cid' => $cat)) . '</loc>';
                $xml_indexs .= '<lastmod>' . date('Y-m-d', $timestamp) . '</lastmod>';
                $xml_indexs .= '<changefreq>' . XT_SITEMAP_OTHER_CHANGEFREQ . '</changefreq>';
                $xml_indexs .= '<priority>' . XT_SITEMAP_OTHER_PRIORITY . '</priority>';
                $xml_indexs .= '</url>';
            }
        }
        $xml_end = '</urlset>';
        return $xml_begin . $xml_indexs . $xml_end;
    }
}