@@ 94-108 (lines=15) @@ | ||
91 | return $v; |
|
92 | } |
|
93 | ||
94 | public static function htmlizer($string) |
|
95 | { |
|
96 | $pattern = array( |
|
97 | '/((?:[\w\d]+\:\/\/)?(?:[\w\-\d]+\.)+[\w\-\d]+(?:\/[\w\-\d]+)*(?:\/|\.[\w\-\d]+)?(?:\?[\w\-\d]+\=[\w\-\d]+\&?)?(?:\#[\w\-\d\.]*)?)/', # URL |
|
98 | '/([\w\-\d]+\@[\w\-\d]+\.[\w\-\d]+)/', # email |
|
99 | // '/\S{2}/', # line break |
|
100 | ); |
|
101 | $replace = array( |
|
102 | '<a href="$1">$1</a>', |
|
103 | '<a href="mailto:$1">$1</a>', |
|
104 | // '- $1' |
|
105 | ); |
|
106 | ||
107 | return preg_replace($pattern, $replace, $string); |
|
108 | } |
|
109 | ||
110 | /** |
|
111 | * Assigns a value by reference. The benefit of binding is that values can |
@@ 156-170 (lines=15) @@ | ||
153 | return $this; |
|
154 | } |
|
155 | ||
156 | public static function htmlizer($string) |
|
157 | { |
|
158 | $pattern = array( |
|
159 | '/((?:[\w\d]+\:\/\/)?(?:[\w\-\d]+\.)+[\w\-\d]+(?:\/[\w\-\d]+)*(?:\/|\.[\w\-\d]+)?(?:\?[\w\-\d]+\=[\w\-\d]+\&?)?(?:\#[\w\-\d\.]*)?)/', # URL |
|
160 | '/([\w\-\d]+\@[\w\-\d]+\.[\w\-\d]+)/', # email |
|
161 | // '/\S{2}/', # line break |
|
162 | ); |
|
163 | $replace = array( |
|
164 | '<a href="$1">$1</a>', |
|
165 | '<a href="mailto:$1">$1</a>', |
|
166 | // '- $1' |
|
167 | ); |
|
168 | ||
169 | return preg_replace($pattern, $replace, $string); |
|
170 | } |
|
171 | ||
172 | /** |
|
173 | * Assigns a value by reference. The benefit of binding is that values can |