Exemplo n.º 1
0
 public function sitmap()
 {
     $this->load->library('Sitemap');
     // 基礎設定
     $domain = 'http://www.zeusdesign.com.tw';
     $sit_map = new Sitemap($domain);
     $sit_map->setPath(FCPATH . 'sitemap' . DIRECTORY_SEPARATOR);
     $sit_map->setDomain($domain);
     // main pages
     $sit_map->addItem('/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/abouts/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/contacts/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/works/', '0.8', 'daily', date('c'));
     $sit_map->addItem('/articles/', '0.8', 'daily', date('c'));
     // all articles
     foreach (Article::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_visibled = ? AND destroy_user_id IS NULL', Article::IS_VISIBLED))) as $article) {
         $sit_map->addItem('/article/' . $article->site_show_page_last_uri(), '1', 'daily', $article->updated_at->format('c'));
     }
     // all article tags
     foreach (ArticleTag::all(array('select' => 'id')) as $tag) {
         $sit_map->addItem('/article-tag/' . $tag->id . '/articles/', '0.8', 'daily', date('c'));
     }
     // all works
     foreach (Work::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_enabled = ? AND destroy_user_id IS NULL', Work::ENABLE_YES))) as $work) {
         $sit_map->addItem('/work/' . $work->site_show_page_last_uri(), '1', 'daily', $work->updated_at->format('c'));
     }
     // all work tags
     foreach (WorkTag::all(array('select' => 'id')) as $tag) {
         $sit_map->addItem('/work-tag/' . $tag->id . '/works/', '0.8', 'daily', date('c'));
     }
     $sit_map->createSitemapIndex($domain . '/sitemap/', date('c'));
 }
Exemplo n.º 2
0
 public static function createXMLSiteMap()
 {
     $domain = str_ireplace('www.', '', $_SERVER["HTTP_HOST"]);
     if (!file_exists("../sitemap.xml") && file_exists("../robots.txt")) {
         $file = '../robots.txt';
         $siteMapLine = "\n\nSitemap: http://" . $domain . '/sitemap.xml';
         file_put_contents($file, $siteMapLine, FILE_APPEND);
     }
     $siteMap = new Sitemap('http://' . $domain . '/');
     $siteMap->setPath('../');
     $blogData = new BlogData();
     $postPageName = $blogData->getPostPageName();
     $siteMap->addItem('', '1', 'daily');
     $pagesData = new PagesData();
     $pages = $pagesData->getData();
     foreach ($pages as $page) {
         if ($page != $postPageName && $page != 'error' && $page != 'index') {
             $siteMap->addItem($page . '/', '0.5', 'daily');
         }
     }
     $blogList = $blogData->getBlogList();
     if (!empty($blogList)) {
         foreach ($blogList as $blog) {
             if (isset($blog['published'])) {
                 $siteMap->addItem($postPageName . '/' . $blog['external'] . '/', '1', 'monthly');
             }
         }
     }
     $siteMap->createSitemapIndex('http://' . $domain . '/', 'Today');
 }
Exemplo n.º 3
0
 public static function generate()
 {
     //@TODO: Implemet your own  logic here
     $path = $_SERVER['DOCUMENT_ROOT'];
     $xmlDateFormat = "Y-m-d";
     $changeFreq = "weekly";
     $timeZoneInst = new DateTimeZone(CURRENT_TIMEZONE);
     $dateTime = new DateTime("now", $timeZoneInst);
     $sitemapGenInst = new Sitemap("http://" . $_SERVER['SERVER_NAME']);
     $sitemapGenInst->setPath($path . "/");
     $dateTime->setTimestamp(time());
     $sitemapGenInst->addItem('/', 1.0, $changeFreq, $dateTime->format($xmlDateFormat));
     $dateTime->setTimestamp(time());
     $sitemapGenInst->addItem('/contacts', 0.5, $changeFreq, $dateTime->format($xmlDateFormat));
     $sitemapGenInst->createSitemapIndex("http://" . $_SERVER['SERVER_NAME'] . "/");
     return true;
 }
Exemplo n.º 4
0
 function index()
 {
     $arrTmp = $this->product->findall();
     $products = $arrTmp['rpta'] == true ? $arrTmp['array'] : array();
     unlink(APPPATH . "../tmp/sitemap.xml");
     unlink(APPPATH . "../tmp/sitemap-index.xml");
     $sitemap = new Sitemap("https://www.lifeleg.com");
     $sitemap->setPath('tmp/');
     $sitemap->setFilename('sitemap');
     ///AGREGAR ITEMS AL XML CON LAS RUTAS DE LAS PAGINAS WEB
     $sitemap->addItem('/', '1.0', 'daily', 'Today');
     $hoy = getdate();
     $sitemap->addItem('/index.php/Petshop', '0.8', 'weekly', $hoy['month'] . " " . $hoy['mday']);
     foreach ($products as $key => $value) {
         $sitemap->addItem('/index.php/Petshop/detail/' . $value['url'], '0.8', 'weekly', $hoy['month'] . " " . $hoy['mday']);
     }
     /// SE CREA EL ARCHIVO
     $sitemap->createSitemapIndex('https://www.lifeleg.com/tmp/', 'Today');
 }
Exemplo n.º 5
0
<?php

include 'sitemap-php/Sitemap.php';
$sitemap = new Sitemap('http://www.wpstudiotw.com/test');
// $sitemap->startSitemap();
$sitemap->addItem('/', '1.0', 'daily', 'Today');
$sitemap->addItem('/about', '1.0', 'daily', 'Today');
$sitemap->setPath('sitemap/');
// $sitemap->setFilename('customsitemap');
$sitemap->createSitemapIndex('http://www.wpstudiotw.com/test/sitemap/', 'Today');
// $sitemap->endSitemap();
Exemplo n.º 6
0
// Init helpers
function canonical($language_id, $language_code, $url)
{
    return $language_id == DEFAULT_LANGUAGE_ID ? $url : str_replace(URL_BASE, URL_BASE . $language_code . '/', $url);
}
// Init request
$request = new Request();
// Init response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$response->setCompression(GZIP_COMPRESSION_LEVEL);
// Init URL
$url = new Url($db, $request, $response, URL_BASE);
// Init sitemap
$sitemap = new Sitemap(URL_BASE);
$sitemap->setPath(DIR_BASE . DIR_SEPARATOR . 'public' . DIR_SEPARATOR);
// Get alt languages
$statement = $db->query('SELECT * FROM `language`');
$languages = array();
foreach ($statement->fetchAll() as $language) {
    $languages[$language->language_id] = $language->code;
}
// Add information Pages
foreach ($languages as $language_id => $language_code) {
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/about')), '1.0', 'monthly');
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/team')), '1.0', 'monthly');
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/terms')), '1.0', 'monthly');
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/licenses')), '1.0', 'monthly');
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/faq')), '1.0', 'monthly');
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/bitcoin')), '1.0', 'monthly');
    $sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/promo')), '1.0', 'monthly');
Exemplo n.º 7
0
         }
         header('location:../../admin.php?mod=' . $mod);
     } else {
         header('location:../../404.php');
     }
 } elseif ($mod == 'setting' and $act == 'sitemap') {
     if ($currentRoleAccess->modify_access == "Y") {
         include_once 'sitemap.php';
         $changefreq = $val->validasi($_POST['changefreq'], 'xss');
         $priority = $val->validasi($_POST['priority'], 'xss');
         $tableset = new PoTable('setting');
         $currentSet = $tableset->findBy(id_setting, '1');
         $currentSet = $currentSet->current();
         $website_url = $currentSet->website_url;
         $sitemap = new Sitemap($website_url);
         $sitemap->setPath('../../../');
         $sitemap->addItem('/', $priority, $changefreq, $tgl_sekarang);
         $tablepages = new PoTable('pages');
         $datapagess = $tablepages->findByDESC('active', 'Y', 'id_pages');
         foreach ($datapagess as $datapages) {
             $sitemap->addItem('/pages/' . $datapages->seotitle, $priority, $changefreq, $datapages->date);
         }
         $tablecat = new PoTable('category');
         $datacats = $tablecat->findByDESC('active', 'Y', 'id_category');
         foreach ($datacats as $datacat) {
             $sitemap->addItem('/category/' . $datacat->seotitle, $priority, $changefreq, $tgl_sekarang);
         }
         $tablepost = new PoTable('post');
         $dataposts = $tablepost->findByDESC('active', 'Y', 'id_post');
         foreach ($dataposts as $dataposts) {
             $sitemap->addItem('/detailpost/' . $dataposts->seotitle, $priority, $changefreq, $dataposts->date);
Exemplo n.º 8
0
function generatePagesSitemap()
{
    $sitemap = new Sitemap(SITE_DOMAIN);
    $sitemap->setPath(DOC_ROOT . '/');
    $sitemap->setFilename('page');
    $posts = new Posts();
    $sitemap->addItem('', '1.0', 'daily', 'Today');
    while ($row = $posts->getPostsLoop(null, 'page')) {
        $sitemap->addItem($posts->getPostPermLink($row['ID'], $row['post_type'], $row['link_title']), '0.8', 'weekly', $row['post_date']);
    }
    $sitemap->createSitemapIndex(SITE_DOMAIN, 'Today');
}
Exemplo n.º 9
0
<?

include 'Sitemap.php';
include '../config/settings.inc.php';
$sitemap = new Sitemap('http://www.roseindigo.com');
$sitemap->setPath('maps/');	
// $sitemap->addItem('/filles/naissance', '1.0', 'daily', 'Today');
$sitemap->setFilename('categories');


// VENDEZ
$sitemap->addItem("/vendez", '0.5', 'daily', 'Today');
$sitemap->addItem("/concept", '0.5', 'daily', 'Today');
$sitemap->addItem("/livre-d-or", '0.5', 'daily', 'Today');

// MARQUES
$servername = _DB_SERVER_;
$username 	= _DB_USER_;
$password 	= _DB_PASSWD_;
// Create connection
$conn = new mysqli($servername, $username, $password);
$conn->select_db("presta");


// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
// print_r( "Connected successfully !!!!<br/>");
// print_r($conn);