| @@ 230-247 (lines=18) @@ | ||
| 227 | * |
|
| 228 | * @return array associative array of link url and title |
|
| 229 | */ |
|
| 230 | public static function &planetParseLinks($text) |
|
| 231 | { |
|
| 232 | $myts = \MyTextSanitizer::getInstance(); |
|
| 233 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
|
| 234 | $links = []; |
|
| 235 | if (count($link_array) > 0) { |
|
| 236 | foreach ($link_array as $link) { |
|
| 237 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
|
| 238 | if (empty($url)) { |
|
| 239 | continue; |
|
| 240 | } |
|
| 241 | //if(empty($title)) $title = $url; |
|
| 242 | $links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)]; |
|
| 243 | } |
|
| 244 | } |
|
| 245 | ||
| 246 | return $links; |
|
| 247 | } |
|
| 248 | ||
| 249 | /** |
|
| 250 | * @param $pagename |
|
| @@ 221-238 (lines=18) @@ | ||
| 218 | * |
|
| 219 | * @return array associative array of link url and title |
|
| 220 | */ |
|
| 221 | function &planetParseLinks($text) |
|
| 222 | { |
|
| 223 | $myts = \MyTextSanitizer::getInstance(); |
|
| 224 | $link_array = preg_split("/(\r\n|\r|\n)( *)/", $text); |
|
| 225 | $links = []; |
|
| 226 | if (count($link_array) > 0) { |
|
| 227 | foreach ($link_array as $link) { |
|
| 228 | @list($url, $title) = array_map('trim', preg_split('/ /', $link, 2)); |
|
| 229 | if (empty($url)) { |
|
| 230 | continue; |
|
| 231 | } |
|
| 232 | //if(empty($title)) $title = $url; |
|
| 233 | $links[] = ['url' => $url, 'title' => $myts->htmlSpecialChars($title)]; |
|
| 234 | } |
|
| 235 | } |
|
| 236 | ||
| 237 | return $links; |
|
| 238 | } |
|
| 239 | ||
| 240 | /** |
|
| 241 | * @param $pagename |
|