diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-25 03:04:13 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-25 03:04:13 +0000 |
commit | c6d9c07b69d3eeb8faa0399e735847c27a317767 (patch) | |
tree | 6a98eddfcf32f51915ffa709c79315e543b51fb8 | |
parent | 6e9eb5451ca3863af797710a9937c88972fcbf83 (diff) | |
download | brdo-c6d9c07b69d3eeb8faa0399e735847c27a317767.tar.gz brdo-c6d9c07b69d3eeb8faa0399e735847c27a317767.tar.bz2 |
#446518 follow-up by sun: Removed logic branch in check_markup() for string being NULL.
-rw-r--r-- | modules/filter/filter.module | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/modules/filter/filter.module b/modules/filter/filter.module index 32398ee6d..aaf2ac7a0 100644 --- a/modules/filter/filter.module +++ b/modules/filter/filter.module @@ -434,45 +434,40 @@ function filter_list_format($format) { * elsewhere to avoid duplicate cache lookups and storage. */ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $langcode = '', $cache = TRUE) { - if (isset($text)) { - $format = filter_resolve_format($format); - - // Check for a cached version of this piece of text. - $cache_id = $format . ':' . $langcode . ':' . md5($text); - if ($cache && $cached = cache_get($cache_id, 'cache_filter')) { - return $cached->data; - } + $format = filter_resolve_format($format); - // Convert all Windows and Mac newlines to a single newline, - // so filters only need to deal with one possibility. - $text = str_replace(array("\r\n", "\r"), "\n", $text); + // Check for a cached version of this piece of text. + $cache_id = $format . ':' . $langcode . ':' . md5($text); + if ($cache && $cached = cache_get($cache_id, 'cache_filter')) { + return $cached->data; + } - // Get a complete list of filters, ordered properly. - $filters = filter_list_format($format); + // Convert all Windows and Mac newlines to a single newline, so filters only + // need to deal with one possibility. + $text = str_replace(array("\r\n", "\r"), "\n", $text); - // Give filters the chance to escape HTML-like data such as code or formulas. - foreach ($filters as $filter) { - $filter_info = module_invoke($filter->module, 'filter_info'); - if (isset($filter_info[$filter->name]['prepare callback']) && function_exists($filter_info[$filter->name]['prepare callback'])) { - $text = call_user_func($filter_info[$filter->name]['prepare callback'], $text, $format, $langcode, $cache_id); - } - } + // Get a complete list of filters, ordered properly. + $filters = filter_list_format($format); - // Perform filtering. - foreach ($filters as $filter) { - $filter_info = module_invoke($filter->module, 'filter_info'); - if (isset($filter_info[$filter->name]['process callback']) && function_exists($filter_info[$filter->name]['process callback'])) { - $text = call_user_func($filter_info[$filter->name]['process callback'], $text, $format, $langcode, $cache_id); - } + // Give filters the chance to escape HTML-like data such as code or formulas. + foreach ($filters as $filter) { + $filter_info = module_invoke($filter->module, 'filter_info'); + if (isset($filter_info[$filter->name]['prepare callback']) && function_exists($filter_info[$filter->name]['prepare callback'])) { + $text = call_user_func($filter_info[$filter->name]['prepare callback'], $text, $format, $langcode, $cache_id); } + } - // Store in cache with a minimum expiration time of 1 day. - if ($cache && filter_format_allowcache($format)) { - cache_set($cache_id, $text, 'cache_filter', REQUEST_TIME + (60 * 60 * 24)); + // Perform filtering. + foreach ($filters as $filter) { + $filter_info = module_invoke($filter->module, 'filter_info'); + if (isset($filter_info[$filter->name]['process callback']) && function_exists($filter_info[$filter->name]['process callback'])) { + $text = call_user_func($filter_info[$filter->name]['process callback'], $text, $format, $langcode, $cache_id); } } - else { - $text = t('n/a'); + + // Store in cache with a minimum expiration time of 1 day. + if ($cache && filter_format_allowcache($format)) { + cache_set($cache_id, $text, 'cache_filter', REQUEST_TIME + (60 * 60 * 24)); } return $text; |