made some improvements ( adding title and support cyrillic )
-
Made some update to optionally choose a title for the anchor like:
WP => https://www.ads-software.com | This is the title
and improved regex to support cyrillic words like:
ОртоЦентр => https://www.ads-software.com | This is the title
made following change in linkify-text.php
if(strpos($link, "|")){ $alttext = str_replace("|", "",substr($link, strpos($link, "|"))); $new_text = '<a class="linkified" href="' . esc_url( substr($link, 0, strpos($link, "|")) ) . '" title="'.str_replace("|", "", $alttext).'">\1</a>'; $new_text = apply_filters( 'c2c_linkify_text_linked_text', $new_text, $old_text, substr($link, 0, strpos($link, "|")) ); }else { $new_text = '<a class="linkified" href="' . esc_url( $link ) . '">\1</a>'; $new_text = apply_filters( 'c2c_linkify_text_linked_text', $new_text, $old_text, $link ); } $s = '~<[^>]*>(*SKIP)(*F)|\b(\p{L}*'.preg_quote($old_text,'~').'\p{L}*)\b~ui'; $text = preg_replace($s, $new_text, $text);
- The topic ‘made some improvements ( adding title and support cyrillic )’ is closed to new replies.