You are here

function _geshifilter_clear_filter_cache in GeSHi Filter for syntax highlighting 7

Same name and namespace in other branches
  1. 5.2 geshifilter.admin.inc \_geshifilter_clear_filter_cache()
  2. 6 geshifilter.admin.inc \_geshifilter_clear_filter_cache()

Helper function for clearing the appropriate filter cache entries.

2 calls to _geshifilter_clear_filter_cache()
geshifilter_admin_general_settings_submit in ./geshifilter.admin.inc
Submit function for admin settings.
geshifilter_admin_per_language_settings_submit in ./geshifilter.admin.inc
Submit function for per language settings.

File

./geshifilter.admin.inc, line 560

Code

function _geshifilter_clear_filter_cache() {
  $message = FALSE;
  global $user;

  // Iterate over text formats and clear the ones GeSHi filter is active in.
  foreach (filter_formats($user) as $format => $input_format) {

    // Get the filters in this text format
    $filters = filter_list_format($format);

    // look if GeSHi is enabled in this text format
    if (isset($filters['geshifilter/0'])) {
      cache_clear_all($format . ':', 'cache_filter', TRUE);
      $message = TRUE;
    }
  }

  // Clear the geshifilter entries in the cache_filter table,
  // created by geshifilter_geshi_process().
  cache_clear_all('geshifilter:', 'cache_filter', TRUE);

  // Show a message that the filter cache was cleared.
  if ($message) {
    drupal_set_message(t('GeSHi filter cleared the filter cache for the appropriate text formats.'));
  }
}