/** * create an instance of Sitemap_Base using sitemap * * @return void * @author Andy Bennett */ public static function instance() { if (self::$instance == NULL) { self::$instance = Sitemap_Base::factory('sitemap'); } return self::$instance; }
public static function getInstance() { if (!self::$instance && !is_object(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * get a list of pages * * @return void * @author Andy Bennett */ public function get_pages() { $map = Sitemap::instance()->get_sitemap(); $pages = $map->xpath('/root//item'); $arr = array(); foreach ($pages as $page) { $tmp = new stdClass(); $tmp->id = (string) $page->name; $tmp->title = (string) $page->title; $arr[] = $tmp; } return $arr; }
/** * simple test to show navigation * * @return void * @author Andy Bennett */ public function index() { echo '<style type="text/css" media="screen"> ul { clear: left; background: #ccc; height: 30px; } li { list-style: none; float: left; line-height: 30px; height: 30px; } li.current { background: white; color: red; } li span { margin-top: 5px; display: block; border-right: 1px solid red; line-height: 16px; padding: 2px 1em; } li.last span { border-right: none; } li a { color: black; text-decoration: none; } li a:hover { text-decoration: underline; } </style>'; echo Sitemap::instance()->navigation(2, 0); }
function index() { Sitemap::instance()->google(); }
/** * pass the edited tree to the sitemap to be saved * * @return void * @author Andy Bennett */ public function save() { $tree = Input::instance()->post('tree'); $xml_string = tree_helper::return_xml_string($tree); echo Sitemap::instance()->save_sitemap($xml_string) ? 'Saved successfully' : 0; }