t('WYSIWYG Filter')); } else if ($op == 'description') { if ($delta == 0) { return t('Allows you to restrict whether users can post HTML and which tags and attributes per HTML tag to filter out.'); } } else if ($op == 'settings') { if ($delta == 0) { module_load_include('inc', 'wysiwyg_filter', 'wysiwyg_filter.admin'); return wysiwyg_filter_settings_filter($format); } } else if ($op == 'process') { if ($delta == 0) { module_load_include('inc', 'wysiwyg_filter', 'wysiwyg_filter.pages'); return wysiwyg_filter_process($text, $format); } } else { return $text; } } /** * Implementation of hook_filter_tips(). */ function wysiwyg_filter_filter_tips($delta, $format, $long = FALSE) { if ($delta == 0) { // Load common functions. module_load_include('inc', 'wysiwyg_filter'); $filter_options = wysiwyg_filter_get_filter_options($format); $tips = array(); if (!empty($filter_options['valid_elements'])) { $tags = array(); foreach (array_keys($filter_options['valid_elements']) as $tag) { $tags[] = '<'. $tag .'>'; } $tips[] = t('Allowed HTML tags: @tags', array('@tags' => implode(' ', $tags))); } if (!empty($filter_options['style_properties'])) { $tips[] = t('Allowed Style properties: @properties', array('@properties' => implode(', ', array_keys($filter_options['style_properties'])))); } if (!empty($tips)) { return implode('
', $tips); } } } /** * Implementation of wysiwyg_editor_settings_alter(). */ function wysiwyg_filter_wysiwyg_editor_settings_alter(&$settings, $context) { // Provide the valid_elements option to TinyMCE editors, only if the WYSIWYG // Filter is enabled in the input format related to the current given context. if ($context['profile']->editor == 'tinymce' && ($valid_elements = variable_get('wysiwyg_filter_valid_elements_raw_'. $context['profile']->format, ''))) { if (isset($context['profile']->format) && ($filters = filter_list_format($context['profile']->format)) && !empty($filters['wysiwyg_filter/0'])) { $settings['valid_elements'] = preg_replace('#\s+#', '', $valid_elements); } } } /** * Implementation of hook_input_formats_variables(). */ function wysiwyg_filter_input_formats_variables($delta) { $variables = array(); switch ($delta) { case 0: $variables['wysiwyg_filter_valid_elements_parsed'] = t('Valid elements parsed'); break; } return $variables; }