From 61845090ed288af7842ed6ead75e754c76d6183f Mon Sep 17 00:00:00 2001 From: "renan.saddam" Date: Thu, 29 Oct 2009 01:31:55 -0200 Subject: [PATCH] Changing variable name to make consistency between others methods. --- cake/libs/view/helpers/text.php | 37 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/cake/libs/view/helpers/text.php b/cake/libs/view/helpers/text.php index 477c6de4f..6159c4962 100644 --- a/cake/libs/view/helpers/text.php +++ b/cake/libs/view/helpers/text.php @@ -110,56 +110,55 @@ class TextHelper extends AppHelper { * strings like http:// and ftp://. * * @param string $text Text to add links to - * @param array $htmlOptions Array of HTML options. + * @param array $options Array of HTML options. * @return string The text with links * @access public */ - function autoLinkUrls($text, $htmlOptions = array()) { - $options = 'array('; - foreach ($htmlOptions as $option => $value) { + function autoLinkUrls($text, $options = array()) { + $linkOptions = 'array('; + foreach ($options as $option => $value) { $value = var_export($value, true); - $options .= "'$option' => $value, "; + $linkOptions .= "'$option' => $value, "; } - $options .= ')'; + $linkOptions .= ')'; $text = preg_replace_callback('#(?)((?:http|https|ftp|nntp)://[^ <]+)#i', create_function('$matches', - '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text); + '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $linkOptions . ');'), $text); return preg_replace_callback('#(?)(?tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $options . ');'), $text); + create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $linkOptions . ');'), $text); } /** * Adds email links ( $value, "; + $linkOptions .= "'$option' => $value, "; } - $options .= ')'; + $linkOptions .= ')'; return preg_replace_callback('#([_A-Za-z0-9+-]+(?:\.[_A-Za-z0-9+-]+)*@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)#', - create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "mailto:" . $matches[0],' . $options . ');'), $text); + create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "mailto:" . $matches[0],' . $linkOptions . ');'), $text); } /** * Convert all links and email adresses to HTML links. * * @param string $text Text - * @param array $htmlOptions Array of HTML options. + * @param array $options Array of HTML options. * @return string The text with links * @access public */ - function autoLink($text, $htmlOptions = array()) { - return $this->autoLinkEmails($this->autoLinkUrls($text, $htmlOptions), $htmlOptions); + function autoLink($text, $options = array()) { + return $this->autoLinkEmails($this->autoLinkUrls($text, $options), $options); } /**