-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/develop'
- Loading branch information
Showing
13 changed files
with
192 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
Contao Extension "hofff/contao-robots-txt-editor" | ||
------------------------------------------------- | ||
|
||
### Version 1.0.0-beta2 (2016-08-31) ### | ||
- Adds Multi-Site-Installation (see #1) | ||
- Improves extending `sitemap` section in BE (see #2) | ||
|
||
### Version 1.0.0-beta1 (2016-06-02) ### | ||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
CT_ROOT/system/modules/hofff_robots-txt-editor/classes/RobotsTxtEditorHtaccessWriter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/** | ||
* Contao Open Source CMS | ||
* | ||
* Copyright (c) 2005-2016 Leo Feyer | ||
* | ||
* @package Hofff_robots-txt-editor | ||
* @link https://contao.org | ||
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL | ||
*/ | ||
|
||
|
||
/** | ||
* Run in a custom namespace, so the class can be replaced | ||
*/ | ||
namespace Hofff\Contao\RobotsTxtEditor; | ||
|
||
|
||
/** | ||
* Class RobotsTxtEditorHtaccessWriter | ||
* | ||
* EventSubscriber to extend .htaccess file | ||
* @copyright Hofff.com 2016-2016 | ||
* @author Cliff Parnitzky <[email protected]> | ||
* @package Hofff_robots-txt-editor | ||
*/ | ||
class RobotsTxtEditorHtaccessWriter implements \Symfony\Component\EventDispatcher\EventSubscriberInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public static function getSubscribedEvents() | ||
{ | ||
return array( | ||
\Bit3\Contao\Htaccess\HtaccessEvents::GENERATE_REWRITES => 'generateRewrites', | ||
); | ||
} | ||
|
||
/** | ||
* Generate this sub module code. | ||
* | ||
* @return string | ||
*/ | ||
public function generateRewrites(\Bit3\Contao\Htaccess\Event\GenerateRewritesEvent $event) | ||
{ | ||
$objPages = \Contao\Database::getInstance()->prepare("SELECT alias, dns FROM tl_page WHERE createRobotsTxt = 1 AND useDomainSpecificRobotsTxt = 1 AND published = 1")->execute(); | ||
|
||
while ($objPages->next()) | ||
{ | ||
$strRewriteRule = sprintf($GLOBALS['TL_CONFIG']['RobotsTxtEditorRewriteCond'], $this->prepareUrl($objPages->dns)) | ||
. "\n" | ||
. sprintf($GLOBALS['TL_CONFIG']['RobotsTxtEditorRewriteRule'], $this->prepareUrl(FILE_ROBOTS_TXT), $this->prepareUrl(RobotsTxtEditor::getDomainSpecificFilePath($objPages->alias))); | ||
$pre = $event->getPre(); | ||
$pre->append(PHP_EOL . $strRewriteRule); | ||
} | ||
} | ||
|
||
private function prepareUrl($strUrl) | ||
{ | ||
$strUrl = str_replace('.', '\.', $strUrl); | ||
return $strUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
CT_ROOT/system/modules/hofff_robots-txt-editor/languages/de/default.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_LANG']['ERR']['no_robotstxt_default'] = "Es befindet sich keine <b>" . FILE_ROBOTS_TXT_DEFAULT . "</b> in ihrem Contao Root.<br/>Diese Datei hätte bei der Installation der Erweiterung initial erstellt werden sollen.<br/><br/>Der Import wurde abgebrochen.<br/><br/>Bitte installieren Sie die Erweiterung erneut."; | ||
$GLOBALS['TL_LANG']['ERR']['robotstxt_not_updated'] = "Die <b>" . FILE_ROBOTS_TXT . "</b> konnte nicht neu geschrieben werden (ggf. ist der Zugriff auf die Datei gesperrt)."; | ||
$GLOBALS['TL_LANG']['ERR']['robotstxt_not_updated'] = "Die " . FILE_ROBOTS_TXT . " Datei konnte nicht neu erstellt werden (ggf. ist der Zugriff auf die Datei gesperrt)."; | ||
|
||
$GLOBALS['TL_LANG']['MSC']['robotstxt_updated'] = "Die <b>" . FILE_ROBOTS_TXT . "</b> wurde neu geschrieben."; | ||
$GLOBALS['TL_LANG']['MSC']['robotstxt_updated'] = "Die " . FILE_ROBOTS_TXT . " Datei wurde neu erstellt."; | ||
|
||
$GLOBALS['TL_LANG']['MSC']['DomainSpecificRobotsTxt_cleared'] = "Der Seitenalias wurde geändert, deshalb wurde die alte domainspezifische robots.txt gelöscht."; |
9 changes: 6 additions & 3 deletions
9
CT_ROOT/system/modules/hofff_robots-txt-editor/languages/de/tl_page.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_LANG']['tl_page']['robotstxt_legend'] = "robots.txt Editor"; | ||
$GLOBALS['TL_LANG']['tl_page']['createRobotsTxt'] = array("Eine robots.txt erstellen", "Eine individuelle robots.txt erstellen."); | ||
$GLOBALS['TL_LANG']['tl_page']['robotsTxtContent'] = array("Inhalt der robots.txt", "Geben Sie den Inhalt der robots.txt an."); | ||
|
||
$GLOBALS['TL_LANG']['tl_page']['robotsTxtAddAbsoluteSitemapPath'] = array("Add absolute sitemap path to robots.txt", "Add the absolute path of the sitemap to the robots.txt"); | ||
$GLOBALS['TL_LANG']['tl_page']['createRobotsTxt'] = array("Eine robots.txt erstellen", "Eine individuelle robots.txt erstellen."); | ||
$GLOBALS['TL_LANG']['tl_page']['robotsTxtContent'] = array("Inhalt der robots.txt", "Geben Sie den Inhalt der robots.txt an."); | ||
$GLOBALS['TL_LANG']['tl_page']['useDomainSpecificRobotsTxt_htaccessInstalled'] = array("Domainspezifische robots.txt verwenden", "Wählen Sie, ob die robots.txt domainspezifisch sein soll, d.h. für die Domain dieses Seitenbaums wird eine individuelle robots.txt im <i>share</i> Verzeichnis angelegt und in die .htaccess Datei wird eine entsprechende Rewrite Regel eingetragen.<br/><br/>Erstellt folgenden .htaccess Eintrag (beispielhaft):<br/><br/><i>" . sprintf($GLOBALS['TL_CONFIG']['RobotsTxtEditorRewriteCond'], "domain-a\.tld") . "<br/>" . sprintf($GLOBALS['TL_CONFIG']['RobotsTxtEditorRewriteRule'], "robots\.txt", "share/robots_alias\.txt") . "</i>"); | ||
$GLOBALS['TL_LANG']['tl_page']['useDomainSpecificRobotsTxt_htaccessNotInstalled'] = array($GLOBALS['TL_LANG']['tl_page']['useDomainSpecificRobotsTxt_htaccessInstalled'][0], "Für dieses Feature muss die Erweiterung <i>hofff/contao-htaccess</i> installiert und aktiv sein.<br/><br/>" . $GLOBALS['TL_LANG']['tl_page']['useDomainSpecificRobotsTxt_htaccessInstalled'][1]); | ||
|
||
$GLOBALS['TL_LANG']['tl_page']['robotsTxtAddAbsoluteSitemapPath'] = array("Absoluten Sitemap Pfad zu robots.txt hinzufügen", "Den absoluten Pfad der Sitemap zur robots.txt hinzufügen."); | ||
|
||
$GLOBALS['TL_LANG']['tl_page']['robotsTxtContentImport'] = array("Default robots.txt importieren", "Die default robots.txt importieren (überschreibt vorhandene Daten)."); |
6 changes: 4 additions & 2 deletions
6
CT_ROOT/system/modules/hofff_robots-txt-editor/languages/en/default.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<?php | ||
|
||
$GLOBALS['TL_LANG']['ERR']['no_robotstxt_default'] = "There is no <b>" . FILE_ROBOTS_TXT_DEFAULT . "</b> in your Contao root.<br/>This file should be created initially when you installed the extension.<br/><br/>The import was aborted.<br/><br/>Please install the extension again."; | ||
$GLOBALS['TL_LANG']['ERR']['robotstxt_not_updated'] = "The <b>" . FILE_ROBOTS_TXT . "</b> has not been recreated (possibly, the access to the file is locked)."; | ||
$GLOBALS['TL_LANG']['ERR']['robotstxt_not_updated'] = "The " . FILE_ROBOTS_TXT . " file has not been recreated (possibly, the access to the file is locked)."; | ||
|
||
$GLOBALS['TL_LANG']['MSC']['robotstxt_updated'] = "The <b>" . FILE_ROBOTS_TXT . "</b> has been recreated."; | ||
$GLOBALS['TL_LANG']['MSC']['robotstxt_updated'] = "The " . FILE_ROBOTS_TXT . " file has been recreated."; | ||
|
||
$GLOBALS['TL_LANG']['MSC']['DomainSpecificRobotsTxt_cleared'] = "The page alias has been changed, so the old domain specific robots.txt was deleted."; |
8 changes: 6 additions & 2 deletions
8
CT_ROOT/system/modules/hofff_robots-txt-editor/languages/en/tl_page.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.