<?php /** * Add import operation */ $GLOBALS['BE_MOD']['design']['page']['importRobotsTxt'] = array('Hofff\\Contao\\RobotsTxtEditor\\RobotsTxtEditor', 'importRobotsTxt'); /** * File constants */ define('FILE_ROBOTS_TXT', 'robots.txt'); define('FILE_ROBOTS_TXT_DEFAULT', 'robots.txt.default'); define('FILE_ROBOTS_TXT_DOMAIN_SPECIFIC_Folder', 'share'); define('FILE_ROBOTS_TXT_DOMAIN_SPECIFIC_PREFIX', 'robots_'); define('FILE_ROBOTS_TXT_DOMAIN_SPECIFIC_SUFFIX', '.txt'); /** * Configuration */ // Rewrite condition and rule (escape % with %% !!!): // RewriteCond %{HTTP_HOST} ^(www\.)?domain-a\.tld$ // RewriteRule ^robots\.txt share/robots_alias\.txt $GLOBALS['TL_CONFIG']['RobotsTxtEditorRewriteCond'] = "RewriteCond %%{HTTP_HOST} ^(www\\.)?%s\$"; $GLOBALS['TL_CONFIG']['RobotsTxtEditorRewriteRule'] = "RewriteRule ^%s %s"; if (Hofff\Contao\RobotsTxtEditor\RobotsTxtEditor::isHtaccessEnabled()) { $GLOBALS['TL_EVENT_SUBSCRIBERS'][] = 'Hofff\\Contao\\RobotsTxtEditor\\RobotsTxtEditorHtaccessWriter'; }
<?php $GLOBALS['TL_DCA']['tl_page']['config']['onload_callback'][] = array('tl_page_hofff_robots_txt_editor', 'modifyPaletteAndFields'); $GLOBALS['TL_DCA']['tl_page']['fields']['dns']['eval']['mandatory'] = true; $GLOBALS['TL_DCA']['tl_page']['fields']['fallback']['eval']['submitOnChange'] = true; $GLOBALS['TL_DCA']['tl_page']['fields']['createRobotsTxt'] = array('label' => &$GLOBALS['TL_LANG']['tl_page']['createRobotsTxt'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50', 'submitOnChange' => true), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_page']['fields']['robotsTxtContent'] = array('label' => &$GLOBALS['TL_LANG']['tl_page']['robotsTxtContent'], 'exclude' => true, 'inputType' => 'textarea', 'eval' => array('style' => ' min-height:60px', 'tl_class' => 'clr'), 'xlabel' => array(array('tl_page_hofff_robots_txt_editor', 'robotsTxtImportWizard')), 'sql' => "text NULL"); $GLOBALS['TL_DCA']['tl_page']['fields']['useDomainSpecificRobotsTxt'] = array('label' => Hofff\Contao\RobotsTxtEditor\RobotsTxtEditor::isHtaccessEnabled() ? $GLOBALS['TL_LANG']['tl_page']['useDomainSpecificRobotsTxt_htaccessInstalled'] : $GLOBALS['TL_LANG']['tl_page']['useDomainSpecificRobotsTxt_htaccessNotInstalled'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50', 'submitOnChange' => true, 'disabled' => !Hofff\Contao\RobotsTxtEditor\RobotsTxtEditor::isHtaccessEnabled()), 'sql' => "char(1) NOT NULL default ''"); $GLOBALS['TL_DCA']['tl_page']['fields']['robotsTxtAddAbsoluteSitemapPath'] = array('label' => &$GLOBALS['TL_LANG']['tl_page']['robotsTxtAddAbsoluteSitemapPath'], 'exclude' => true, 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50 clr'), 'sql' => "char(1) NOT NULL default ''"); /** * Table tl_page */ $GLOBALS['TL_DCA']['tl_page']['config']['onsubmit_callback'][] = array('tl_page_hofff_robots_txt_editor', 'updateRobotsTxt'); $GLOBALS['TL_DCA']['tl_page']['config']['onsubmit_callback'][] = array('tl_page_hofff_robots_txt_editor', 'updateHtaccess'); /** * Class tl_page_hofff_robots_txt_editor * * Provide miscellaneous methods that are used by the data configuration array. * @copyright Hofff.com 2016-2016 * @author Cliff Parnitzky <*****@*****.**> * @package Core */ class tl_page_hofff_robots_txt_editor extends tl_page { /** * Import the back end user object */ public function __construct() { parent::__construct(); }