Skip to content
This repository
Browse code

Changing variable name to make consistency between others methods.

  • Loading branch information...
commit 61845090ed288af7842ed6ead75e754c76d6183f 1 parent e7074c1
Renan Gonçalves authored October 29, 2009

Showing 1 changed file with 18 additions and 19 deletions. Show diff stats Hide diff stats

  1. 37  cake/libs/view/helpers/text.php
37  cake/libs/view/helpers/text.php
@@ -110,56 +110,55 @@ function stripLinks($text) {
110 110
  * strings like http:// and ftp://.
111 111
  *
112 112
  * @param string $text Text to add links to
113  
- * @param array $htmlOptions Array of HTML options.
  113
+ * @param array $options Array of HTML options.
114 114
  * @return string The text with links
115 115
  * @access public
116 116
  */
117  
-	function autoLinkUrls($text, $htmlOptions = array()) {
118  
-		$options = 'array(';
119  
-		foreach ($htmlOptions as $option => $value) {
  117
+	function autoLinkUrls($text, $options = array()) {
  118
+		$linkOptions = 'array(';
  119
+		foreach ($options as $option => $value) {
120 120
 			$value = var_export($value, true);
121  
-			$options .= "'$option' => $value, ";
  121
+			$linkOptions .= "'$option' => $value, ";
122 122
 		}
123  
-		$options .= ')';
  123
+		$linkOptions .= ')';
124 124
 
125 125
 		$text = preg_replace_callback('#(?<!href="|">)((?:http|https|ftp|nntp)://[^ <]+)#i', create_function('$matches',
126  
-			'$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $options . ');'), $text);
  126
+			'$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], $matches[0],' . $linkOptions . ');'), $text);
127 127
 
128 128
 		return preg_replace_callback('#(?<!href="|">)(?<!http://|https://|ftp://|nntp://)(www\.[^\n\%\ <]+[^<\n\%\,\.\ <])(?<!\))#i',
129  
-			create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $options . ');'), $text);
  129
+			create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "http://" . strtolower($matches[0]),' . $linkOptions . ');'), $text);
130 130
 	}
131 131
 
132 132
 /**
133 133
  * Adds email links (<a href="mailto:....) to a given text.
134 134
  *
135 135
  * @param string $text Text
136  
- * @param array $htmlOptions Array of HTML options.
  136
+ * @param array $options Array of HTML options.
137 137
  * @return string The text with links
138 138
  * @access public
139 139
  */
140  
-	function autoLinkEmails($text, $htmlOptions = array()) {
141  
-		$options = 'array(';
142  
-
143  
-		foreach ($htmlOptions as $option => $value) {
  140
+	function autoLinkEmails($text, $options = array()) {
  141
+		$linkOptions = 'array(';
  142
+		foreach ($options as $option => $value) {
144 143
 			$value = var_export($value, true);
145  
-			$options .= "'$option' => $value, ";
  144
+			$linkOptions .= "'$option' => $value, ";
146 145
 		}
147  
-		$options .= ')';
  146
+		$linkOptions .= ')';
148 147
 
149 148
 		return preg_replace_callback('#([_A-Za-z0-9+-]+(?:\.[_A-Za-z0-9+-]+)*@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)#',
150  
-						create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "mailto:" . $matches[0],' . $options . ');'), $text);
  149
+						create_function('$matches', '$Html = new HtmlHelper(); $Html->tags = $Html->loadConfig(); return $Html->link($matches[0], "mailto:" . $matches[0],' . $linkOptions . ');'), $text);
151 150
 	}
152 151
 
153 152
 /**
154 153
  * Convert all links and email adresses to HTML links.
155 154
  *
156 155
  * @param string $text Text
157  
- * @param array $htmlOptions Array of HTML options.
  156
+ * @param array $options Array of HTML options.
158 157
  * @return string The text with links
159 158
  * @access public
160 159
  */
161  
-	function autoLink($text, $htmlOptions = array()) {
162  
-		return $this->autoLinkEmails($this->autoLinkUrls($text, $htmlOptions), $htmlOptions);
  160
+	function autoLink($text, $options = array()) {
  161
+		return $this->autoLinkEmails($this->autoLinkUrls($text, $options), $options);
163 162
 	}
164 163
 
165 164
 /**

0 notes on commit 6184509

Please sign in to comment.
Something went wrong with that request. Please try again.