Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
SeoController.php
Go to the documentation of this file.
1<?php
2
4
11
13 const SEO_PREFIX = 'seo';
14 protected $urlsKey = 'urls';
15 protected $seoTemplateFilename = '@framework/Seo/sitemap.xml.html';
16
17 public function index() {
18 $config = Startup::getConfig ();
19 $base = \rtrim ( $config ['siteUrl'], '/' );
20 UResponse::asXml ();
21 UResponse::noCache ();
22 $urls = $this->_getArrayUrls ();
23 if (\is_array ( $urls )) {
24 $parser = new UrlParser ();
25 $parser->parseArray ( $urls );
26 $this->loadView ( $this->seoTemplateFilename, [ 'urls' => $parser->getUrls (),'base' => $base ] );
27 }
28 }
29
30 public function _refresh() {
31 }
32
33 public function getPath() {
34 $seo = new ControllerSeo ( \get_class ( $this ) );
35 return $seo->getPath ();
36 }
37
38 public function _save($array) {
39 CacheManager::$cache->store ( $this->_getUrlsFilename (), $array );
40 }
41
42 public function _getArrayUrls() {
43 $key = $this->_getUrlsFilename ();
44 if (! CacheManager::$cache->exists ( $key )) {
45 $this->_save ( [ ] );
46 }
47 return CacheManager::$cache->fetch ( $key );
48 }
49
54 public function _getUrlsFilename() {
55 return self::getUrlsFileName ( $this->urlsKey );
56 }
57
58 public static function getUrlsFileName($urlsKey) {
59 return self::SEO_PREFIX . \DS . $urlsKey;
60 }
61
66 public function _getSeoTemplateFilename() {
68 }
69}
70
Manager for caches (Router, Rest, models).
Base class for controllers.
loadView(string $viewName, $pData=null, bool $asString=false)
Loads the view $viewName possibly passing the variables $pdata.
Starts the framework.
Definition Startup.php:19
Base class for SEO controllers Ubiquity\seo$ControllerSeo This class is part of Ubiquity.
Http Response utilities.
Definition UResponse.php:17