diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index f864cb3..030270e 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -276,7 +276,7 @@ function filter_formats(UserInterface $account = NULL) { */ function filter_formats_reset() { cache()->deleteTags(array('filter_formats' => TRUE)); - drupal_static_reset('filter_formats'); + drupal_static_reset('check_markup'); } /** @@ -419,17 +419,6 @@ function filter_fallback_format() { } /** - * Returns the title of the fallback text format. - * - * @return string - * The title of the fallback text format. - */ -function filter_fallback_format_title() { - $fallback_format = entity_load('filter_format', filter_fallback_format()); - return filter_admin_format_title($fallback_format); -} - -/** * Checks if the text in a certain text format is allowed to be cached. * * This function can be used to check whether the result of the filtering @@ -482,13 +471,20 @@ function filter_format_allowcache($format_id) { * @ingroup sanitization */ function check_markup($text, $format_id = NULL, $langcode = '', $cache = FALSE, $filter_types_to_skip = array()) { + $formats = &drupal_static(__FUNCTION__, array()); if (!isset($format_id)) { $format_id = filter_fallback_format(); } - // If the requested text format does not exist, the text cannot be filtered. - if (!$format = entity_load('filter_format', $format_id)) { - watchdog('filter', 'Missing text format: %format.', array('%format' => $format_id), WATCHDOG_ALERT); - return ''; + if (!isset($formats[$format_id])) { + // If the requested text format does not exist, the text cannot be filtered. + if (!$format = entity_load('filter_format', $format_id)) { + watchdog('filter', 'Missing text format: %format.', array('%format' => $format_id), WATCHDOG_ALERT); + return ''; + } + $formats[$format_id] = $format; + } + else { + $format = $formats[$format_id]; } // Prevent FILTER_TYPE_HTML_RESTRICTOR from being skipped.