public function createSitemap() { $where = "published = 1 and menutype = 'mainmenu' and access IN (1)"; $result = $this->db->select($this->table_prefix . "menu", "*", "{$where}", 'std'); $dom = new DOMDocument('1.0'); $dom->formatOutput = true; $root = $dom->createElement('urlset'); $root = $dom->appendChild($root); $ns = $dom->createAttributeNS("http://www.sitemaps.org/schemas/sitemap/0.9", "xmlns"); foreach ($result["value"] as $row) { $link_arr = parse_url($row['link']); if (isset($link_arr['query'])) { parse_str(html_entity_decode($link_arr['query']), $link_vars); $option = HELPER::getValue($link_vars, 'option', ''); $view = HELPER::getValue($link_vars, 'view', ''); $layout = HELPER::getValue($link_vars, 'layout', ''); if ($option == "com_virtuemart" && $view == "category") { $id = HELPER::getValue($link_vars, 'virtuemart_category_id', 0); } elseif ($option == "com_fabrik" && $view == "form") { $id = HELPER::getValue($link_vars, 'formid', 0); } else { $id = HELPER::getValue($link_vars, 'id', 0); } $url = $dom->createElement('url'); $url = $root->appendChild($url); $this->setMenuUrl($view, $row, $option, $id, $dom, $root, $url); } } $str = $dom->saveXML(); echo "Создана карта сайта sitemap.xml, размер " . $dom->save($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $this->SITEMAP_FILE_NAME) . " байт."; }
public static function replace_space($str = '') { if (isset(APP::$settings->replace_many_space_to_one) && (int) APP::$settings->replace_many_space_to_one == 1) { $str = HELPER::replace_many_space($str); } return $str; }
public static function load_messages($file) { $file = MESSAGES . $file; return HELPER::load_file($file); }
public static function size($file = '') { return is_file($file) ? HELPER::format_byte(filesize($file)) : 'error'; }