return$delta==1;// No caching for the PHP evaluator.
case'description':
switch($delta){
case0:
returnt('Allows you to restrict if users can post HTML and which tags to filter out.');
case1:
returnt('Runs a piece of PHP code. The usage of this filter should be restricted to administrators only!');
case2:
returnt('Converts line breaks into HTML (i.e. <br> and <p> tags).');
default:
return;
}
case'process':
switch($delta){
case0:
return_filter_html($text,$format);
case1:
returndrupal_eval($text);
case2:
return_filter_autop($text);
default:
return$text;
}
case'settings':
switch($delta){
case0:
return_filter_html_settings($format);
default:
return;
}
default:
return$text;
}
}
/**
* Settings for the HTML filter.
*/
function_filter_html_settings($format){
$group=form_radios(t('Filter HTML tags'),"filter_html_$format",variable_get("filter_html_$format",FILTER_HTML_STRIP),array(FILTER_HTML_STRIP=>t('Strip tags'),FILTER_HTML_ESCAPE=>t('Escape tags')),t('How to deal with HTML tags in user-contributed content. If set to "Strip tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
$group.=form_textfield(t('Allowed HTML tags'),"allowed_html_$format",variable_get("allowed_html_$format",'<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'),60,255,t('If "Strip tags" is selected, optionally specify tags which should not be stripped. Javascript event attributes are always stripped.'));
$group.=form_checkbox(t('Display HTML help'),"filter_html_help_$format",1,variable_get("filter_html_help_$format",1),t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
$group.=form_radios(t('HTML style attributes'),"filter_style_$format",variable_get("filter_style_$format",FILTER_STYLE_STRIP),array(FILTER_STYLE_ALLOW=>t('Allowed'),FILTER_STYLE_STRIP=>t('Removed')),t('If "Strip tags" is selected, you can choose whether "STYLE" attributes are allowed or removed from input.'));
$group.=form_checkbox(t('Spam link deterrent'),"filter_html_nofollow_$format",1,variable_get("filter_html_nofollow_$format",FALSE),t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
$output.=form_group(t('HTML filter'),$group);
return$output;
}
/**
* HTML filter. Provides filtering of input into accepted HTML.
return$delta==1;// No caching for the PHP evaluator.
case'description':
switch($delta){
case0:
returnt('Allows you to restrict if users can post HTML and which tags to filter out.');
case1:
returnt('Runs a piece of PHP code. The usage of this filter should be restricted to administrators only!');
case2:
returnt('Converts line breaks into HTML (i.e. <br> and <p> tags).');
default:
return;
}
case'process':
switch($delta){
case0:
return_filter_html($text,$format);
case1:
returndrupal_eval($text);
case2:
return_filter_autop($text);
default:
return$text;
}
case'settings':
switch($delta){
case0:
return_filter_html_settings($format);
default:
return;
}
default:
return$text;
}
}
/**
* Settings for the HTML filter.
*/
function_filter_html_settings($format){
$group=form_radios(t('Filter HTML tags'),"filter_html_$format",variable_get("filter_html_$format",FILTER_HTML_STRIP),array(FILTER_HTML_STRIP=>t('Strip tags'),FILTER_HTML_ESCAPE=>t('Escape tags')),t('How to deal with HTML tags in user-contributed content. If set to "Strip tags", dangerous tags are removed (see below). If set to "Escape tags", all HTML is escaped and presented as it was typed.'));
$group.=form_textfield(t('Allowed HTML tags'),"allowed_html_$format",variable_get("allowed_html_$format",'<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>'),60,255,t('If "Strip tags" is selected, optionally specify tags which should not be stripped. Javascript event attributes are always stripped.'));
$group.=form_checkbox(t('Display HTML help'),"filter_html_help_$format",1,variable_get("filter_html_help_$format",1),t('If enabled, Drupal will display some basic HTML help in the long filter tips.'));
$group.=form_radios(t('HTML style attributes'),"filter_style_$format",variable_get("filter_style_$format",FILTER_STYLE_STRIP),array(FILTER_STYLE_ALLOW=>t('Allowed'),FILTER_STYLE_STRIP=>t('Removed')),t('If "Strip tags" is selected, you can choose whether "STYLE" attributes are allowed or removed from input.'));
$group.=form_checkbox(t('Spam link deterrent'),"filter_html_nofollow_$format",1,variable_get("filter_html_nofollow_$format",FALSE),t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'));
$output.=form_group(t('HTML filter'),$group);
return$output;
}
/**
* HTML filter. Provides filtering of input into accepted HTML.