From ea2febd9a1b66d3f8d09f685f2a95c003d89130f Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Fri, 9 Oct 2015 11:43:28 +0200 Subject: [PATCH] Some methods have been moved to Haste 4.10 --- .gitignore | 5 +- classes/tl_form.php | 7 +- composer.json | 2 +- library/NotificationCenter/Gateway/Base.php | 8 +- library/NotificationCenter/Gateway/File.php | 4 +- .../MessageDraft/EmailMessageDraft.php | 12 +- library/NotificationCenter/Util/String.php | 118 +++++------------- 7 files changed, 53 insertions(+), 103 deletions(-) diff --git a/.gitignore b/.gitignore index 9c6d3c32..bfdce806 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,7 @@ Thumbs.db nbproject/ # Transifex -.tx/ \ No newline at end of file +.tx/ + +# Composer +vendor/ diff --git a/classes/tl_form.php b/classes/tl_form.php index 1fdec747..c34ca78d 100644 --- a/classes/tl_form.php +++ b/classes/tl_form.php @@ -79,12 +79,12 @@ public function generateTokens(array $arrData, array $arrForm, array $arrFiles, $arrTokens['raw_data'] = ''; foreach ($arrData as $k => $v) { - $this->flatten($v, 'form_'.$k, $arrTokens); + \Haste\Util\StringUtil::flatten($v, 'form_'.$k, $arrTokens); $arrTokens['raw_data'] .= (isset($arrLabels[$k]) ? $arrLabels[$k] : ucfirst($k)) . ': ' . (is_array($v) ? implode(', ', $v) : $v) . "\n"; } foreach ($arrForm as $k => $v) { - $this->flatten($v, 'formconfig_'.$k, $arrTokens); + \Haste\Util\StringUtil::flatten($v, 'formconfig_'.$k, $arrTokens); } // Administrator e-mail @@ -104,6 +104,9 @@ public function generateTokens(array $arrData, array $arrForm, array $arrFiles, * @param mixed $varValue * @param string $strKey * @param array $arrData + * + * @deprecated Deprecated since version 1.3.1, to be removed in version 2. + * Use Haste\Util\StringUtil::flatten() instead. */ public function flatten($varValue, $strKey, &$arrData) { diff --git a/composer.json b/composer.json index 8841a668..e8c105f0 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "php":">=5.3.2", "contao/core":"^3.2", "contao-community-alliance/composer-plugin":"2.*", - "codefog/contao-haste":"4.*", + "codefog/contao-haste":"^4.10.0", "terminal42/dcawizard":"2.*" }, "autoload":{ diff --git a/library/NotificationCenter/Gateway/Base.php b/library/NotificationCenter/Gateway/Base.php index 49d450cb..8064eba9 100644 --- a/library/NotificationCenter/Gateway/Base.php +++ b/library/NotificationCenter/Gateway/Base.php @@ -68,18 +68,18 @@ protected function compileRecipients($strRecipients, $arrTokens) } /** - * @deprecated Use String::recursiveReplaceTokensAndTags() + * @deprecated Use \Haste\Util\StringUtil::recursiveReplaceTokensAndTags() */ protected function recursiveReplaceTokensAndTags($strText, $arrTokens, $intTextFlags = 0) { - return String::recursiveReplaceTokensAndTags($strText, $arrTokens, $intTextFlags); + return \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($strText, $arrTokens, $intTextFlags); } /** - * @deprecated Use String::convertToText() + * @deprecated Use \Haste\Util\StringUtil::convertToText() */ protected function convertToText($varValue, $options) { - return String::convertToText($varValue, $options); + return \Haste\Util\StringUtil::convertToText($varValue, $options); } } diff --git a/library/NotificationCenter/Gateway/File.php b/library/NotificationCenter/Gateway/File.php index 8df46146..1bb94b0e 100644 --- a/library/NotificationCenter/Gateway/File.php +++ b/library/NotificationCenter/Gateway/File.php @@ -44,7 +44,7 @@ public function send(Message $objMessage, array $arrTokens, $strLanguage = '') return false; } - $strFileName = String::recursiveReplaceTokensAndTags( + $strFileName = \Haste\Util\StringUtil::recursiveReplaceTokensAndTags( $objLanguage->file_name, $arrTokens, String::NO_TAGS | String::NO_BREAKS @@ -58,7 +58,7 @@ public function send(Message $objMessage, array $arrTokens, $strLanguage = '') } // Preserve all tags here as this is pretty useful in XML :-) - $strContent = String::recursiveReplaceTokensAndTags( + $strContent = \Haste\Util\StringUtil::recursiveReplaceTokensAndTags( $objLanguage->file_content, $arrTokens ); diff --git a/library/NotificationCenter/MessageDraft/EmailMessageDraft.php b/library/NotificationCenter/MessageDraft/EmailMessageDraft.php index 39f6ff87..51514aa3 100644 --- a/library/NotificationCenter/MessageDraft/EmailMessageDraft.php +++ b/library/NotificationCenter/MessageDraft/EmailMessageDraft.php @@ -56,7 +56,7 @@ public function getSenderEmail() { $strSenderAddress = $this->objLanguage->email_sender_address ?: $GLOBALS['TL_ADMIN_EMAIL']; - return String::recursiveReplaceTokensAndTags($strSenderAddress, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); + return \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($strSenderAddress, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); } /** @@ -67,7 +67,7 @@ public function getSenderName() { $strSenderName = $this->objLanguage->email_sender_name ?: $GLOBALS['TL_ADMIN_NAME']; - return String::recursiveReplaceTokensAndTags($strSenderName, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); + return \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($strSenderName, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); } /** @@ -104,7 +104,7 @@ public function getBccRecipientEmails() public function getReplyToEmail() { if ($this->objLanguage->email_replyTo) { - return String::recursiveReplaceTokensAndTags($this->objLanguage->email_replyTo, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); + return \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($this->objLanguage->email_replyTo, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); } return ''; @@ -116,7 +116,7 @@ public function getReplyToEmail() */ public function getSubject() { - return String::recursiveReplaceTokensAndTags($this->objLanguage->email_subject, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); + return \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($this->objLanguage->email_subject, $this->arrTokens, String::NO_TAGS | String::NO_BREAKS); } /** @@ -140,7 +140,7 @@ public function getPriority() public function getTextBody() { $strText = $this->objLanguage->email_text; - $strText = String::recursiveReplaceTokensAndTags($strText, $this->arrTokens, String::NO_TAGS); + $strText = \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($strText, $this->arrTokens, String::NO_TAGS); return \Controller::convertRelativeUrls($strText, '', true); } @@ -159,7 +159,7 @@ public function getHtmlBody() // Prevent parseSimpleTokens from stripping important HTML tags $GLOBALS['TL_CONFIG']['allowedTags'] .= '