You need to save it in the Packages folder hierarchy for ST to pick it
up - you can try Tools -> Developer - New Syntax, paste in the
tmLanguage and save it in the folder ST recommends (Packages/User) as <packagefile>.tmLanguage
, then Tools -> Developer -> New Syntax From <packagefile>
.tmLanguage.
<?php class MyClass { function preg_callback_url ( $matches ) { //var_dump($matches); $url = $matches [ 1 ]. $matches [ 2 ]; $text = '' ; $pos = strpos ( $url , ' ' ); if ( $pos !== FALSE ) { $text = trim ( substr ( $url , $pos + 1 )); $url = substr ( $url , 0 , $pos ); } return '<a href="' . $url . '" rel="nofollow">' .(( $text != '' ) ? $text : $url ). '</a>' ; } function ParseText ( $text ) { return preg_replace_callback ( '/\[(http|https|ftp)(.*?)\]/iS' ,array( & $this , 'preg_callback_url' ), $text ); } } ?>
Comments
Post a Comment