29 if (isset ( $className ) && \class_exists ( $className )) {
30 $route = Router::getRouteInfoByControllerAction ( $className,
"index" );
32 $this->route =
$route [
"path"];
34 $ctrl =
new $className ();
35 $this->name = $className;
36 $this->urlsFile = $ctrl->_getUrlsFilename ();
37 $this->siteMapTemplate = $ctrl->_getSeoTemplateFilename ();
116 public static function init() {
118 $config = Startup::getConfig ();
121 $robotsFile = Startup::getApplicationDir () . \DS .
'robots.txt';
122 if (\file_exists ( $robotsFile )) {
123 $robotsContent = UFileSystem::load ( $robotsFile );
125 $files = CacheManager::getControllersFiles ( $config,
true );
127 $restCtrls = CacheManager::getRestCache ();
128 }
catch ( \Exception $e ) {
132 foreach ( $files as $file ) {
133 if (is_file ( $file )) {
134 $controllerClass = ClassUtils::getClassFullNameFromFile ( $file );
135 if (isset ( $restCtrls [$controllerClass] ) ===
false) {
136 if (\class_exists ( $controllerClass,
true )) {
137 $reflect = new \ReflectionClass ( $controllerClass );
138 if (! $reflect->isAbstract () && $reflect->isSubclassOf (
'Ubiquity\controllers\seo\SeoController' )) {
140 $path = $ctrlSeo->getPath ();
141 $ctrlSeo->setInRobots ( $robotsContent !==
false && (\strpos ( $robotsContent, $path ) !==
false) );
142 $result [] = $ctrlSeo;