Skip to content

Instantly share code, notes, and snippets.

@Juribiyan
Created March 22, 2016 04:58
Show Gist options
  • Save Juribiyan/3a2be6e7d4b2d06a0d31 to your computer and use it in GitHub Desktop.
Save Juribiyan/3a2be6e7d4b2d06a0d31 to your computer and use it in GitHub Desktop.
function smiley_callback($matches) {
$src = FALSE;
foreach(array('.gif','.png') as $extension) {
if(file_exists(KU_ROOTDIR.KU_SMILEDIR.$matches[1].$extension)) {
$src = KU_WEBPATH.'/'.KU_SMILEDIR.$matches[1].$extension;
break;
}
}
$return = ($src) ? '<img style="vertical-align: middle;" src="'.$src.'" />': ':'.$matches[1].':';
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment