function _pathologic_do_src in Pathologic 5
Same name and namespace in other branches
- 6 pathologic.module \_pathologic_do_src()
- 6.2 pathologic.module \_pathologic_do_src()
preg_replace_callback() callback function. Okay. If we have a local SRC attribute, there are two possibilities.
One, the more likely one, is that we're referencing a file that physically exists on the disk. In which case the SRC path should be passed along as is.
Two, the less likely but still possible one, is that we're referencing a Drupal path, in which case we should treat it like an HREF path and run it through url().
So let's check to see if the file actually exists. If it does, assume the former; if not, assume the latter and run it through url().
1 string reference to '_pathologic_do_src'
- pathologic_filter in ./
pathologic.module - Implementation of hook_filter().
File
- ./
pathologic.module, line 146
Code
function _pathologic_do_src($matches) {
if (file_exists($matches[1])) {
global $base_url;
return "src=\"{$base_url}/{$matches[1]}\"";
}
return 'src="' . _pathologic_url($matches[1]) . '"';
}