Revert "Merge branch 'cleanmaster' into modules"

This reverts commit d0ff5260f7, reversing
changes made to 67d0101dbe.
This commit is contained in:
Etienne Roudeix
2013-12-20 11:16:42 +01:00
parent d0ff5260f7
commit b3ac365b45
332 changed files with 3575 additions and 4787 deletions

View File

@@ -138,4 +138,4 @@ class TlogDestinationFile extends AbstractTlogDestination
$this->fh = false;
}
}
}

View File

@@ -25,29 +25,27 @@ namespace Thelia\Log\Destination;
use Thelia\Log\AbstractTlogDestination;
class TlogDestinationJavascriptConsole extends AbstractTlogDestination
{
public function getTitle()
{
return "Browser's Javascript console";
}
class TlogDestinationJavascriptConsole extends AbstractTlogDestination {
public function getDescription()
{
return "The Thelia logs are displayed in your browser's Javascript console.";
}
public function getTitle() {
return "Browser's Javascript console";
}
public function write(&$res)
{
$content = '<script>try {'."\n";
public function getDescription() {
return "The Thelia logs are displayed in your browser's Javascript console.";
}
foreach ($this->_logs as $line) {
$content .= "console.log('".str_replace("'", "\\'", str_replace(array("\r\n", "\r", "\n"), '\\n', $line))."');\n";
}
public function write(&$res) {
$content .= '} catch (ex) { alert("Les logs Thelia ne peuvent être affichés dans la console javascript:" + ex); }</script>'."\n";
$content = '<script>try {'."\n";
if (preg_match("|</body>|i", $res))
$res = preg_replace("|</body>|i", "$content</html>", $res);
foreach($this->_logs as $line) {
$content .= "console.log('".str_replace("'", "\\'", str_replace(array("\r\n", "\r", "\n"), '\\n', $line))."');\n";
}
$content .= '} catch(ex) { alert("Les logs Thelia ne peuvent être affichés dans la console javascript:" + ex); }</script>'."\n";
if (preg_match("|</body>|i", $res))
$res = preg_replace("|</body>|i", "$content</html>", $res);
}
}
}

View File

@@ -26,88 +26,86 @@ namespace Thelia\Log\Destination;
use Thelia\Log\AbstractTlogDestination;
use Thelia\Log\TlogDestinationConfig;
class TlogDestinationPopup extends AbstractTlogDestination
{
// Nom des variables de configuration
// ----------------------------------
const VAR_POPUP_WIDTH = "tlog_destinationpopup_width";
const VALEUR_POPUP_WIDTH_DEFAUT = "600";
class TlogDestinationPopup extends AbstractTlogDestination {
const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height";
const VALEUR_POPUP_HEIGHT_DEFAUT = "600";
// Nom des variables de configuration
// ----------------------------------
const VAR_POPUP_WIDTH = "tlog_destinationpopup_width";
const VALEUR_POPUP_WIDTH_DEFAUT = "600";
const VAR_POPUP_TPL = "tlog_destinationpopup_template";
// Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php
const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl";
const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height";
const VALEUR_POPUP_HEIGHT_DEFAUT = "600";
public function getTitle()
{
return "Javascript popup window";
}
const VAR_POPUP_TPL = "tlog_destinationpopup_template";
// Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php
const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl";
public function getDescription()
{
return "Display logs in a popup window, separate from the main window .";
}
public function getTitle() {
return "Javascript popup window";
}
public function getConfigs()
{
return array(
new TlogDestinationConfig(
self::VAR_POPUP_TPL,
"Popup windows template",
"Put #LOGTEXT in the template text where you want to display logs..",
file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT),
TlogDestinationConfig::TYPE_TEXTAREA
),
new TlogDestinationConfig(
self::VAR_POPUP_HEIGHT,
"Height of the popup window",
"In pixels",
self::VALEUR_POPUP_HEIGHT_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
),
new TlogDestinationConfig(
self::VAR_POPUP_WIDTH,
"Width of the popup window",
"In pixels",
self::VALEUR_POPUP_WIDTH_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
)
);
}
public function getDescription() {
return "Display logs in a popup window, separate from the main window .";
}
public function write(&$res)
{
$content = ""; $count = 1;
public function getConfigs() {
return array(
new TlogDestinationConfig(
self::VAR_POPUP_TPL,
"Popup windows template",
"Put #LOGTEXT in the template text where you want to display logs..",
file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT),
TlogDestinationConfig::TYPE_TEXTAREA
),
new TlogDestinationConfig(
self::VAR_POPUP_HEIGHT,
"Height of the popup window",
"In pixels",
self::VALEUR_POPUP_HEIGHT_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
),
new TlogDestinationConfig(
self::VAR_POPUP_WIDTH,
"Width of the popup window",
"In pixels",
self::VALEUR_POPUP_WIDTH_DEFAUT,
TlogDestinationConfig::TYPE_TEXTFIELD
)
);
}
foreach ($this->_logs as $line) {
$content .= "<div class=\"".($count++ % 2 ? "paire" : "impaire")."\">".htmlspecialchars($line)."</div>";
}
public function write(&$res) {
$tpl = $this->getConfig(self::VAR_POPUP_TPL);
$content = ""; $count = 1;
$tpl = str_replace('#LOGTEXT', $content, $tpl);
$tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl);
foreach($this->_logs as $line) {
$content .= "<div class=\"".($count++ % 2 ? "paire" : "impaire")."\">".htmlspecialchars($line)."</div>";
}
$wop = sprintf('
<script>
_thelia_console = window.open("","thelia_console","width=%s,height=%s,resizable,scrollbars=yes");
if (_thelia_console == null) {
alert("The log popup window could not be opened. Please disable your popup blocker for this site.");
} else {
_thelia_console.document.write("%s");
_thelia_console.document.close();
}
</script>',
$this->getConfig(self::VAR_POPUP_WIDTH),
$this->getConfig(self::VAR_POPUP_HEIGHT),
str_replace('"', '\\"', $tpl)
);
$tpl = $this->getConfig(self::VAR_POPUP_TPL);
if (preg_match("|</body>|i", $res))
$res = preg_replace("|</body>|i", "$wop\n</body>", $res);
else
$res .= $wop;
$tpl = str_replace('#LOGTEXT', $content, $tpl);
$tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl);
$wop = sprintf('
<script>
_thelia_console = window.open("","thelia_console","width=%s,height=%s,resizable,scrollbars=yes");
if (_thelia_console == null) {
alert("The log popup window could not be opened. Please disable your popup blocker for this site.");
}
else {
_thelia_console.document.write("%s");
_thelia_console.document.close();
}
</script>',
$this->getConfig(self::VAR_POPUP_WIDTH),
$this->getConfig(self::VAR_POPUP_HEIGHT),
str_replace('"', '\\"', $tpl)
);
if (preg_match("|</body>|i", $res))
$res = preg_replace("|</body>|i", "$wop\n</body>", $res);
else
$res .= $wop;
}
}