You are here

function _pathologic_do_src in Pathologic 6.2

Same name and namespace in other branches
  1. 5 pathologic.module \_pathologic_do_src()
  2. 6 pathologic.module \_pathologic_do_src()

Return a formatted SRC attribute.

You might think SRC attributes will always be disk files instead of Drupal paths, but that's not always the case - paths to files processed by Imagecache point to non-existant files the first time, at which time they go through the standard menu router to be caught and handled by Imagecache. preg_replace_callback() callback function.

1 string reference to '_pathologic_do_src'
pathologic_filter in ./pathologic.module
Implementation of hook_filter().

File

./pathologic.module, line 151
Pathologic text filter for Drupal.

Code

function _pathologic_do_src($matches) {
  if (file_exists($matches[2])) {
    global $base_url;
    return "src=\"{$base_url}/{$matches[2]}\"";
  }
  return 'src="' . _pathologic_url($matches[2], isset($matches[4]) ? $matches[4] : NULL) . '"';
}