0byt3m1n1
Path:
/
data
/
17
/
1
/
18
/
11
/
1670011
/
user
/
1801231
/
htdocs
/
marketting
/
system
/
application
/
controllers
/
[
Home
]
File: sitemap.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------------- | COPYRIGHT NOTICE | Copyright 2008 JROX Technologies, Inc. All Rights Reserved. | ------------------------------------------------------------------------- | This script may be only used and modified in accordance to the license | agreement attached (license.txt) except where expressly noted within | commented areas of the code body. This copyright notice and the | comments above and below must remain intact at all times. By using this | code you agree to indemnify JROX Technologies, Inc, its corporate agents | and affiliates from any liability that might arise from its use. | | Selling the code for this program without prior written consent is | expressly forbidden and in violation of Domestic and International | copyright laws. | | ------------------------------------------------------------------------- | FILENAME - sitemap.php | ------------------------------------------------------------------------- | | This controller file generates the xml and site map | */ class Sitemap extends Cron_Controller { function __construct() { parent::Cron_Controller(); //load sitemap model $this->load->model('sitemap_model', 'sitemap'); } // ------------------------------------------------------------------------ function index() { //load session library $this->load->library('session'); $this->session->sess_run('public'); //load required models $this->load->model('affiliate_marketing_model', 'aff'); $this->load->model('product_cat_model', 'prod_cat'); $this->load->model('cart_model', 'cart'); $this->load->model('init_model', 'init'); //set data array $data = $this->security_model->_load_config('public'); //initialize site with required db config $sdata = $this->init->_initialize(__CLASS__, __FUNCTION__); //set up the languages array $data['languages'] = $sdata['languages']; //set all text foreach ($sdata['text'] as $key => $val) { $data[$key] = $val; } //set referral info foreach ($sdata['aff_cfg'] as $key => $val) { $data[$key] = $val; } $data['lang_sitemap'] = $this->lang->line('sitemap'); $data['lang_categories'] = $this->lang->line('categories'); $data['page_title'] = $this->lang->line('sitemap'); $data['meta_keywords'] = $data['sts_store_default_keywords']; //get faq_articles $rows = $this->prod_cat->_get_all_product_categories(true); $sdata = array(); foreach ($rows as $row) { $row['category_name_url'] = url_title($row['category_name']); array_push($sdata, $row); } if (empty($sdata)) { $data['categories'] = array(); $data['no_categories'] = '1'; $data['lang_no_categories_found'] = $this->lang->line('no_categories_found'); } else { //add the data to the array $data['categories'] = $sdata; $data['no_categories'] = '0'; } //get content categories $this->load->model('content_model'); $content_cat = $this->content_model->_get_content_categories(false); if (!empty($content_cat)) { $cdata = array(); foreach ($content_cat as $cat_row) { switch ($cat_row['category_id']) { case '2': $cat_row['content_category_url'] = CONTENT_ROUTE . '/view/privacy_policy'; array_push($cdata, $cat_row); break; case '3': $cat_row['content_category_url'] = CONTENT_ROUTE . '/view/tos'; array_push($cdata, $cat_row); break; case '4': $cat_row['content_category_url'] = CONTENT_ROUTE . '/view/about_us'; array_push($cdata, $cat_row); break; case '5': case '6': continue; break; default: $cat_row['content_category_url'] = CONTENT_ROUTE . '/view/category_id/' . $cat_row['category_id']; array_push($cdata, $cat_row); break; } } } if (empty($content_cat) || empty($cdata)) { $data['categories'] = array(); $data['no_content_categories'] = '1'; $data['lang_no_categories_found'] = $this->lang->line('no_categories_found'); } else { $data['content_categories'] = $cdata; $data['no_content_categories'] = '0'; } $this->parser->_JROX_load_view('tpl_seo_sitemap', 'content_pages', $data); } // ------------------------------------------------------------------------ function site_index() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $data = ''; $html = '<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= $this->load->view('main/tpl_sitemap_index', $data, true); $html .= '</sitemapindex>'; header('Content-type: application/xml; charset="utf-8"',true); echo $html; } // ------------------------------------------------------------------------ function product_categories() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . CATEGORIES_ROUTE . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.6'; $data['urls'] = $this->sitemap->_generate_site_links('product_categories'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function products() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . PRODUCTS_ROUTE . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.9'; $data['urls'] = $this->sitemap->_generate_site_links('products'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function content_categories() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . CONTENT_ROUTE . '/view/</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.7'; $data['urls'] = $this->sitemap->_generate_site_links('content_categories'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function content_articles() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; //generate index page first $html .= ' <url> <loc>' . base_url() . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; $html .= ' <url> <loc>' . base_url() . CONTENT_ROUTE . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'weekly'; $data['priority'] = '0.8'; $data['urls'] = $this->sitemap->_generate_site_links('content_articles'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function faq_categories() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . FAQ_ROUTE . '/view/</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.7'; $data['urls'] = $this->sitemap->_generate_site_links('faq_categories'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function faq_articles() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . FAQ_ROUTE . '/view/</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.8'; $data['urls'] = $this->sitemap->_generate_site_links('faq_articles'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function profiles() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); if ($this->config->item('sts_affiliate_enable_profiles') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . '/view/</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.7'; $data['urls'] = $this->sitemap->_generate_site_links('profiles'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } // ------------------------------------------------------------------------ function affiliates() { if ($this->config->item('sts_content_auto_generate_xml_sitemap') == 0) exit(); if ($this->config->item('sts_affiliate_enable_affiliate_marketing') == 0) exit(); $html = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; $html .= ' <url> <loc>' . base_url() . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>monthly</changefreq> <priority>1.0</priority> </url>'; //get all links $data['change_frequency'] = 'monthly'; $data['priority'] = '0.7'; $data['urls'] = $this->sitemap->_generate_site_links('affiliates'); $html .= $this->load->view('main/tpl_sitemap', $data, true); header('Content-type: application/xml; charset="utf-8"',true); $html .= '</urlset>'; echo $html; } } ?>