' . t("The filter module allows administrators to configure text input formats for use on your site. An input format defines the HTML tags, codes, and other input allowed in both content and comments, and is a key feature in guarding against potentially damaging input from malicious users. Two input formats included by default are Filtered HTML (which allows only an administrator-approved subset of HTML tags) and Full HTML (which allows the full set of HTML tags). Additional input formats may be created by an administrator.") . '

'; $output .= '

' . t('Each input format uses filters to manipulate text, and most input formats apply several different filters to text in a specific order. Each filter is designed for a specific purpose, and generally either adds, removes or transforms elements within user-entered text before it is displayed. A filter does not change the actual content of a post, but instead, modifies it temporarily before it is displayed. A filter may remove unapproved HTML tags, for instance, while another automatically adds HTML to make links referenced in text clickable.') . '

'; $output .= '

' . t('Users with access to more than one input format can use the Input format fieldset to choose between available input formats when creating or editing multi-line content. Administrators determine the input formats available to each user role, select a default input format, and control the order of formats listed in the Input format fieldset.') . '

'; $output .= '

' . t('For more information, see the online handbook entry for Filter module.', array('@filter' => 'http://drupal.org/handbook/modules/filter/')) . '

'; return $output; case 'admin/settings/filters': $output = '

' . t('Use the list below to review the input formats available to each user role, to select a default input format, and to control the order of formats listed in the Input format fieldset. (The Input format fieldset is displayed below textareas when users with access to more than one input format create multi-line content.) The input format selected as Default is available to all users and, unless another format is selected, is applied to all content. All input formats are available to users in roles with the "administer filters" permission.') . '

'; $output .= '

' . t('Since input formats, if available, are presented in the same order as the list below, it may be helpful to arrange the formats in descending order of your preference for their use. To change the order of an input format, grab a drag-and-drop handle under the Name column and drag to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the Save changes button at the bottom of the page.') . '

'; return $output; case 'admin/settings/filters/%': return '

' . t('Every filter performs one particular change on the user input, for example stripping out malicious HTML or making URLs clickable. Choose which filters you want to apply to text in this input format. If you notice some filters are causing conflicts in the output, you can rearrange them.', array('@rearrange' => url('admin/settings/filters/' . $arg[3] . '/order'))) . '

'; case 'admin/settings/filters/%/configure': return '

' . t('If you cannot find the settings for a certain filter, make sure you have enabled it on the edit tab first.', array('@url' => url('admin/settings/filters/' . $arg[3]))) . '

'; case 'admin/settings/filters/%/order': $output = '

' . t('Because of the flexible filtering system, you might encounter a situation where one filter prevents another from doing its job. For example: a word in an URL gets converted into a glossary term, before the URL can be converted to a clickable link. When this happens, rearrange the order of the filters.') . '

'; $output .= '

' . t("Filters are executed from top-to-bottom. To change the order of the filters, modify the values in the Weight column or grab a drag-and-drop handle under the Name column and drag filters to new locations in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the Save configuration button at the bottom of the page.") . '

'; return $output; } } /** * Implementation of hook_theme() */ function filter_theme() { return array( 'filter_admin_overview' => array( 'arguments' => array('form' => NULL), 'file' => 'filter.admin.inc', ), 'filter_admin_order' => array( 'arguments' => array('form' => NULL), 'file' => 'filter.admin.inc', ), 'filter_tips' => array( 'arguments' => array('tips' => NULL, 'long' => FALSE, 'extra' => ''), 'file' => 'filter.pages.inc', ), 'filter_tips_more_info' => array( 'arguments' => array(), ), ); } /** * Implementation of hook_menu(). */ function filter_menu() { $items['admin/settings/filters'] = array( 'title' => 'Input formats', 'description' => 'Configure how content input by users is filtered, including allowed HTML tags. Also allows enabling of module-provided filters.', 'page callback' => 'drupal_get_form', 'page arguments' => array('filter_admin_overview'), 'access arguments' => array('administer filters'), ); $items['admin/settings/filters/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/settings/filters/add'] = array( 'title' => 'Add input format', 'page callback' => 'filter_admin_format_page', 'access arguments' => array('administer filters'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, ); $items['admin/settings/filters/delete'] = array( 'title' => 'Delete input format', 'page callback' => 'drupal_get_form', 'page arguments' => array('filter_admin_delete'), 'access arguments' => array('administer filters'), 'type' => MENU_CALLBACK, ); $items['filter/tips'] = array( 'title' => 'Compose tips', 'page callback' => 'filter_tips_long', 'access callback' => TRUE, 'type' => MENU_SUGGESTED_ITEM, ); $items['admin/settings/filters/%filter_format'] = array( 'type' => MENU_CALLBACK, 'title callback' => 'filter_admin_format_title', 'title arguments' => array(3), 'page callback' => 'filter_admin_format_page', 'page arguments' => array(3), 'access arguments' => array('administer filters'), ); $items['admin/settings/filters/%filter_format/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0, ); $items['admin/settings/filters/%filter_format/configure'] = array( 'title' => 'Configure', 'page callback' => 'filter_admin_configure_page', 'page arguments' => array(3), 'access arguments' => array('administer filters'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, ); $items['admin/settings/filters/%filter_format/order'] = array( 'title' => 'Rearrange', 'page callback' => 'filter_admin_order_page', 'page arguments' => array(3), 'access arguments' => array('administer filters'), 'type' => MENU_LOCAL_TASK, 'weight' => 2, ); return $items; } function filter_format_load($arg) { return filter_formats($arg); } /** * Display a filter format form title. */ function filter_admin_format_title($format) { return $format->name; } /** * Implementation of hook_perm(). */ function filter_perm() { return array( 'administer filters' => t('Manage input formats and filters, and select which roles may use them. %warning', array('%warning' => t('Warning: Give to trusted roles only; this permission has security implications.'))), ); } /** * Implementation of hook_cron(). * * Expire outdated filter cache entries */ function filter_cron() { cache_clear_all(NULL, 'cache_filter'); } /** * Implementation of hook_filter_tips(). */ function filter_filter_tips($delta, $format, $long = FALSE) { global $base_url; switch ($delta) { case 0: if ($allowed_html = variable_get("allowed_html_$format", '