gyro/modules/robots/controller/robots.controller.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * @defgroup Robots 00004 * @ingroup Modules 00005 * 00006 * Replaces robots.txt by a view, allowing a different robots.txt for test and live mode 00007 * 00008 * The template is named robots.txt.tpl.php and located at /app/view/templates/{lang}/. 00009 */ 00010 00011 /** 00012 * Replaces robots.txt with a view 00013 * 00014 * @author Gerd Riesselmann 00015 * @ingroup Robots 00016 */ 00017 class RobotsController extends ControllerBase { 00018 /** 00019 * Return array of Route instances which are handled by this controller 00020 * 00021 * @return array Array of Routes 00022 */ 00023 public function get_routes() { 00024 return array( 00025 new ExactMatchRoute('robots.txt', $this, 'robots_txt'), 00026 ); 00027 } 00028 00029 /** 00030 * Render robots.txt 00031 * 00032 * @param PageData $page_data 00033 * @return void 00034 */ 00035 public function action_robots_txt(PageData $page_data) { 00036 $view = ViewFactory::create_view(ViewFactoryMime::MIME, 'robots.txt', $page_data); 00037 $view->assign(MimeView::MIMETYPE, 'text/plain'); 00038 $view->render(); 00039 } 00040 }