You are here

function htmlpurifier_get_info in HTML Purifier 7.2

Return a list of all htmlpurifier_info provided by modules.

2 calls to htmlpurifier_get_info()
_htmlpurifier_get_config in ./htmlpurifier.module
Returns the HTMLPurifier_Config object corresponding to a text format.
_htmlpurifier_settings in ./htmlpurifier.module
Generates a settings form for configuring HTML Purifier.

File

./htmlpurifier.module, line 278
Implements HTML Purifier as a Drupal filter.

Code

function htmlpurifier_get_info() {
  $infos =& drupal_static(__FUNCTION__, array());
  if (empty($infos)) {
    foreach (module_implements('htmlpurifier_info') as $module) {
      $info = module_invoke($module, 'htmlpurifier_info');
      if (isset($info) && is_array($info)) {

        // Assign the name of the module implementing the htmlpurifier_info and ensure
        // default values.
        foreach (array_keys($info) as $name) {
          $info[$name]['module'] = $module;
          $info[$name] += array(
            'htmlpurifier_help' => TRUE,
            'htmlpurifier_filter_tips' => 'HTML tags will be transformed to conform to HTML standards.',
            'description' => '',
            'allowed' => TRUE,
            'settings' => array(
              'AutoFormat.AutoParagraph' => TRUE,
              'AutoFormat.Linkify' => TRUE,
              'HTML.Doctype' => 'XHTML 1.0 Transitional',
              'Core.AggressivelyFixLt' => TRUE,
              'Cache.DefinitionImpl' => 'Drupal',
            ),
            'weight' => 0,
          );

          // SERVER_NAME is more reliable than HTTP_HOST
          if (!empty($_SERVER['SERVER_NAME'])) {
            $info[$name]['settings'] += array(
              'URI.Host' => $_SERVER['SERVER_NAME'],
            );
          }

          // Define the language direction
          if (defined('LANGUAGE_RTL') && $GLOBALS['language']->direction === LANGUAGE_RTL) {
            $info[$name]['settings'] += array(
              'Attr.DefaultTextDir' => 'rtl',
            );
          }
        }
        $infos = array_merge($infos, $info);
      }
    }

    // Allow modules to alter htmlpurifier_info definitions.
    drupal_alter('htmlpurifier_info', $infos);
  }
  return $infos;
}