You are here

function shortcode_list_all_enabled in Shortcode 7.2

Returns only enabled ShortCodes for a specified input format.

1 call to shortcode_list_all_enabled()
_shortcode_filter_tips in ./shortcode.module
Implements callback_filter_tips().

File

./shortcode.module, line 30
Provides ShortCodes filter framework and API (like WP ShortCodes)

Code

function shortcode_list_all_enabled($format, $reset = FALSE) {
  if (is_string($format)) {
    $format = filter_format_load($format);
  }
  $shortcodes_enabled =& drupal_static(__FUNCTION__, array());
  if (isset($shortcodes_enabled[$format->format]) && !$reset) {
    return $shortcodes_enabled[$format->format];
  }
  $shortcodes_enabled[$format->format] = array();
  $shortcodes = shortcode_list_all($reset);
  $filters = filter_list_format($format->format);
  if (empty($filters['shortcode'])) {
    return array();
  }

  // Run through all Shortcodes defined.
  foreach ($filters['shortcode']->settings as $name => $enabled) {
    if ($enabled && !empty($shortcodes[$name])) {
      $shortcodes_enabled[$format->format][$name] = $shortcodes[$name];
    }
  }
  return $shortcodes_enabled[$format->format];
}