diff --git a/AeoHybrid.php b/AeoHybrid.php index 58261d4..7c0e067 100644 --- a/AeoHybrid.php +++ b/AeoHybrid.php @@ -194,7 +194,7 @@ class AeoHybrid extends \Hybrid /** * Template variables */ - $this->import('String'); + $this->import('StringUtil'); $this->Template->action = $this->getIndexFreeRequest(); $this->Template->n = $this->Input->get('n'); $this->Template->d = $this->Input->get('d'); @@ -220,11 +220,11 @@ class AeoHybrid extends \Hybrid } if ($this->Input->post('p')) { - $email .= $this->String->decodeEntities(base64_decode($this->String->decodeEntities($this->Input->post('p')))); + $email .= $this->StringUtil->decodeEntities(base64_decode($this->StringUtil->decodeEntities($this->Input->post('p')))); } $this->Template->isHuman = true; - $this->Template->success = sprintf($GLOBALS['TL_LANG']['aeo']['success'], $this->String->encodeEmail($email), $this->String->encodeEmail(preg_replace('/\?.*$/', '', $email))); + $this->Template->success = sprintf($GLOBALS['TL_LANG']['aeo']['success'], $this->StringUtil->encodeEmail($email), $this->StringUtil->encodeEmail(preg_replace('/\?.*$/', '', $email))); if (!headers_sent()) { header('HTTP/1.1 303 See Other'); diff --git a/config/config.php b/config/config.php index 3ff270e..4caa057 100644 --- a/config/config.php +++ b/config/config.php @@ -28,6 +28,11 @@ * @filesource */ +// Backwards compatibility for Contao < 3.5.1 +if (!class_exists('StringUtil') && class_exists('String')) { + class_alias('String', 'StringUtil'); +} + /** * Hooks */ diff --git a/util/AeoFrontendUtil.php b/util/AeoFrontendUtil.php index 0061e83..b880982 100644 --- a/util/AeoFrontendUtil.php +++ b/util/AeoFrontendUtil.php @@ -191,14 +191,14 @@ class AeoFrontendUtil extends \Frontend { if (TL_MODE == 'FE' && $this->replace_standard_obfuscation && $objPage2->id != $redirectPageId) { $strContent = $this->aeoReplaceInsertTags($strContent); - $this->import('String'); + $this->import('StringUtil'); // erst alle Mailadresse decodieren (Verschleierung von Contao rückgänging machen) $intOffset = 0; $arrNoAeoAreas = $this->aeo->getNoAeoAreas($strContent); while (preg_match('/(&#[x]?\w+;)+/i', $strContent, $arrEmail, PREG_OFFSET_CAPTURE, $intOffset)) { if ($this->aeo->isEnabled($arrEmail[0][1], $arrNoAeoAreas)) { - $strDecodedMail = $this->String->decodeEntities($arrEmail[0][0]); + $strDecodedMail = $this->StringUtil->decodeEntities($arrEmail[0][0]); if (preg_match('/mailto:'.REGEXP_EMAIL.'/i', $strDecodedMail)) { // erst alle verlinkten eMail-Adressen entschleiern $strContent = $this->aeo->str_replace($arrEmail[0][0], $strDecodedMail, $strContent, $arrEmail[0][1]); @@ -281,17 +281,17 @@ class AeoFrontendUtil extends \Frontend { continue; } - $this->import('String'); + $this->import('StringUtil'); if ($GLOBALS['TL_CONFIG']['aeo_replace_standard_obfuscation'] === true && $this->aeo->isEnabled($position, $arrNoAeoAreas)) { // AEO aktiv und Bereich nicht auf deaktiviert gestellt - $strValue = $this->aeo->obfuscateSingle($this->String->decodeEntities($arrTag[1]), $objPage->id, $arrTag[2]); + $strValue = $this->aeo->obfuscateSingle($this->StringUtil->decodeEntities($arrTag[1]), $objPage->id, $arrTag[2]); $strContent = $this->aeo->str_replace($arrTags[0][0], $strValue, $strContent, $position); $intOffset += strlen($strValue); } else { // AEO nicht aktiv oder Bereich auf deaktiviert gestellt - $strEmail = $this->String->encodeEmail($this->String->decodeEntities($arrTag[1])); - $strValue = '' . $this->String->encodeEmail(preg_replace('/\?.*$/', '', $strEmail)) . ''; + $strEmail = $this->StringUtil->encodeEmail($this->StringUtil->decodeEntities($arrTag[1])); + $strValue = '' . $this->StringUtil->encodeEmail(preg_replace('/\?.*$/', '', $strEmail)) . ''; $strContent = $this->aeo->str_replace($arrTags[0][0], $strValue, $strContent, $position); $intOffset += strlen($strValue); } @@ -402,8 +402,8 @@ class Aeo extends \System { // passendes CSS hinzufügen $strLink .= $this->obfuscateWithMethod($arrEmail[0], $method, true, 0, 0).'@'.$strDomain.'.'.$strTld; } else { - $this->import('String'); - $strLink .= $this->String->encodeEmail($email); + $this->import('StringUtil'); + $strLink .= $this->StringUtil->encodeEmail($email); } $strLink .= ''; return $this->createSpecialEntities($strLink);