public function execute() { $list_of_pages = SJB_PageManager::get_pages('user'); $scriptPath = explode(SJB_System::getSystemSettings("SYSTEM_URL_BASE"), __FILE__); $scriptPath = array_shift($scriptPath); $handle = fopen($scriptPath . "sitemap.xml", "w"); $text = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; fwrite($handle, $text); foreach ($list_of_pages as $page) { if ($page['uri'] == '/display-job/') { $request['action'] = 'search'; $request['listing_type']['equal'] = 'Job'; $found_listings_sids = $this->searchListings($request, 'Job'); foreach ($found_listings_sids as $sid) { $listing_info = SJB_ListingManager::getListingInfoBySID($sid); $title = htmlspecialchars($listing_info['Title']); $title = $sid . "/" . preg_replace("/[\\/\\\\:*?\"<>|%#\$\\s]/", "_", $title) . ".html"; $text = ' <url> <loc>' . SJB_System::getSystemSettings("SITE_URL") . $page['uri'] . $title . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>daily</changefreq> <priority>1</priority> </url>'; fwrite($handle, $text); } } elseif ($page['uri'] == '/display-resume/') { $request['action'] = 'search'; $request['listing_type']['equal'] = 'Resume'; $found_listings_sids = $this->searchListings($request, 'Resume'); foreach ($found_listings_sids as $sid) { $listing_info = SJB_ListingManager::getListingInfoBySID($sid); $title = htmlspecialchars($listing_info['Title']); $title = $sid . "/" . preg_replace("/[\\/\\\\:*?\"<>|%#\$\\s]/", "_", $title) . ".html"; $text = ' <url> <loc>' . SJB_System::getSystemSettings("SITE_URL") . $page['uri'] . $title . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>daily</changefreq> <priority>1</priority> </url>'; fwrite($handle, $text); } } elseif ($page['uri'] != '/callback/') { $text = ' <url> <loc>' . SJB_System::getSystemSettings("SITE_URL") . $page['uri'] . '</loc> <lastmod>' . date('Y-m-d') . '</lastmod> <changefreq>daily</changefreq> <priority>1</priority> </url>'; fwrite($handle, $text); } } $text = ' </urlset>'; fwrite($handle, $text); fclose($handle); }