Browse Source

Umstellung auf static method

master 4.0.0
Carsten Götzinger 4 years ago
parent
commit
9f40e2f9d7
  1. 20
      src/Resources/contao/classes/AeoJavaScript.php
  2. 4
      src/Resources/contao/util/AeoFrontendUtil.php

20
src/Resources/contao/classes/AeoJavaScript.php

@ -36,12 +36,6 @@ namespace cgoIT\aeo;
class AeoJavaScript
{
/**
* Current object instance (Singleton)
* @var Cache
*/
protected static $objInstance;
/**
* Template
* @var string
@ -59,7 +53,7 @@ class AeoJavaScript
*/
final private function __clone() {}
public function getContent($folder, $rot13 = true) {
public static function getContent($folder, $rot13 = true) {
$Template = new \FrontendTemplate(self::$strTemplate);
$Template->rot13 = $rot13;
$Template->folder = $folder;
@ -67,18 +61,6 @@ class AeoJavaScript
$Template->tooltip_js_off = $GLOBALS['TL_LANG']['aeo']['tooltip_no_js'];
return $Template->parse();
}
/**
* Instantiate a new cache object and return it (Factory)
* @return Cache
*/
public static function getInstance() {
if (!is_object(self::$objInstance)) {
self::$objInstance = new self();
}
return self::$objInstance;
}
}
?>

4
src/Resources/contao/util/AeoFrontendUtil.php

@ -80,7 +80,6 @@ class AeoFrontendUtil extends \Frontend {
protected $aeo;
protected $aeoUtil;
protected $aeoJavaScript;
/**
* Initialize the object
@ -92,7 +91,6 @@ class AeoFrontendUtil extends \Frontend {
if (TL_MODE == 'FE') {
global $objPage;
$this->aeoUtil = new AeoUtil();
$this->aeoJavaScript = AeoJavaScript::getInstance();
if ($GLOBALS['TL_CONFIG']['aeo_replace_standard_obfuscation'] === true) {
$this->use_rot_13 = $GLOBALS['TL_CONFIG']['aeo_use_rot_13'];
@ -498,7 +496,7 @@ class Aeo extends \System {
}
function dropJS() {
$strContentJs = $this->aeoJavaScript->getContent(str_replace("/", "\/", $this->folder), $this->rot13);
$strContentJs = AeoJavaScript::getContent(str_replace("/", "\/", $this->folder), $this->rot13);
$strContentJs = "\n<script type=\"text/javascript\">\n$strContentJs\n</script>\n";
return $strContentJs;
}

Loading…
Cancel
Save