comparison program/lib/Roundcube/rcube_string_replacer.php @ 27:c32b53434b47

more compensation for deprecated empty cases
author Charlie Root
date Sun, 18 Jan 2026 14:20:29 -0500
parents 4681f974d28b
children
comparison
equal deleted inserted replaced
25:bea5a38be938 27:c32b53434b47
89 */ 89 */
90 public function link_callback($matches) 90 public function link_callback($matches)
91 { 91 {
92 $i = -1; 92 $i = -1;
93 $scheme = strtolower($matches[1]); 93 $scheme = strtolower($matches[1]);
94 $url_prefix = '';
95 $prefix = '';
94 96
95 if (preg_match('!^(http|ftp|file)s?://!i', $scheme)) { 97 if (preg_match('!^(http|ftp|file)s?://!i', $scheme)) {
96 $url = $matches[1] . $matches[2]; 98 $url = $matches[1] . $matches[2];
97 } 99 }
98 else if (preg_match("/^({$this->noword}*)(www\.)$/i", $matches[1], $m)) { 100 else if (preg_match("/^({$this->noword}*)(www\.)$/i", $matches[1], $m)) {
207 // properly situation when a bracket is placed at the end 209 // properly situation when a bracket is placed at the end
208 // of the link e.g. "[http://example.com]" 210 // of the link e.g. "[http://example.com]"
209 // Yes, this is not perfect handles correctly only paired characters 211 // Yes, this is not perfect handles correctly only paired characters
210 // but it should work for common cases 212 // but it should work for common cases
211 213
214 $suffix = '';
215
212 if (preg_match('/(\\[|\\])/', $url)) { 216 if (preg_match('/(\\[|\\])/', $url)) {
213 $in = false; 217 $in = false;
214 for ($i=0, $len=strlen($url); $i<$len; $i++) { 218 for ($i=0, $len=strlen($url); $i<$len; $i++) {
215 if ($url[$i] == '[') { 219 if ($url[$i] == '[') {
216 if ($in) 220 if ($in)