Permalink
Browse files

Extend wfx_allowed_simple_tags()

Extend to allow ‘style’ tag on span and a when using ‘textnolinks’ or ‘text’ parameters.
  • Loading branch information...
Jonnyauk committed May 30, 2018
1 parent 49536a7 commit 3b742e60c76ca7b04adbc59d574bd9d6a198d508
Showing with 24 additions and 4 deletions.
  1. +17 −0 functions.php
  2. +7 −4 wf-includes/wf-data-management.php
@@ -497,6 +497,23 @@
* - headings => Just headings, nothing else = h1, h2, h3, h4, h5, h6
* @return [array] Allowed tags
*/
/**
* Returns array of limited HTML tags to be used with kses or similar.
* You shouldn't use wp_kses() much - it can be a-little intensive!
* However, sometimes we need it to clean user input to only allow certain tags so there is no funny business!
*
* @since 2.3
* @version 2.6
*
* @param [string] $type Required - Type of tags to return text/simple/headings [text]
* - text => Sutable for wrapping inside your own block level elements - a, br, span, b, strong, i, sup, sub
* - textnolinks => Similar to 'text' param, but no links. Sutable for wrapping inside your own block level elements - br, span, b, strong, i, sup, sub
* - simple => Similar to 'text' param, much more limited, no links or text styling tags = span (only class and ID allowed), br
* - headings => Just headings, nothing else = h1, h2, h3, h4, h5, h6
* @return [array] Allowed tags
*/
if ( !function_exists( 'wfx_allowed_simple_tags' ) ) : function wfx_allowed_simple_tags($input) {
global $wfx_data_manage; return $wfx_data_manage->allowed_simple_tags($input);
} endif;
@@ -426,7 +426,7 @@ function wf_allowed_tags(){
* @param [string] $type Required - Type of tags to return text/simple/headings [text]
* - text => Sutable for wrapping inside your own block level elements - a, br, span, b, strong, i, sup, sub
* - textnolinks => Similar to 'text' param, but no links. Sutable for wrapping inside your own block level elements - br, span, b, strong, i, sup, sub
* - simple => Similar to 'text' param, much more limited, no links or text styling tags = span, br
* - simple => Similar to 'text' param, much more limited, no links or text styling tags = span (only class and ID allowed), br
* - headings => Just headings, nothing else = h1, h2, h3, h4, h5, h6
* @return [array] Allowed tags
*/
@@ -507,7 +507,8 @@ function wf_allowed_simple_tags( $input='text' ) {
$output = array(
'span' => array(
'class'=>array(),
'id'=>array()
'id'=>array(),
'style'=>array()
),
'br' => array(),
'b' => array(),
@@ -527,11 +528,13 @@ function wf_allowed_simple_tags( $input='text' ) {
'href'=> array(),
'title'=> array(),
'class'=>array(),
'id'=>array()
'id'=>array(),
'style'=>array()
),
'span' => array(
'class'=>array(),
'id'=>array()
'id'=>array(),
'style'=>array()
),
'br' => array(),
'b' => array(),

0 comments on commit 3b742e6

Please sign in to comment.