| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( '-1' ); |
| 4 |
} |
| 5 |
|
| 6 |
if ( ! function_exists( 'pixcodes_shortcode_modal_allowed_html' ) ) { |
| 7 |
function pixcodes_shortcode_modal_allowed_html() { |
| 8 |
$allowed_html = wp_kses_allowed_html( 'post' ); |
| 9 |
|
| 10 |
$allowed_html['button'] = array( |
| 11 |
'type' => true, |
| 12 |
'class' => true, |
| 13 |
); |
| 14 |
$allowed_html['form'] = array( |
| 15 |
'id' => true, |
| 16 |
); |
| 17 |
$allowed_html['fieldset'] = array(); |
| 18 |
$allowed_html['input'] = array( |
| 19 |
'type' => true, |
| 20 |
'id' => true, |
| 21 |
'name' => true, |
| 22 |
'class' => true, |
| 23 |
'value' => true, |
| 24 |
'rows' => true, |
| 25 |
'placeholder' => true, |
| 26 |
'checked' => true, |
| 27 |
'multiple' => true, |
| 28 |
); |
| 29 |
$allowed_html['div']['data-tab'] = true; |
| 30 |
$allowed_html['li']['data-index'] = true; |
| 31 |
$allowed_html['select'] = array( |
| 32 |
'type' => true, |
| 33 |
'name' => true, |
| 34 |
'class' => true, |
| 35 |
'id' => true, |
| 36 |
'multiple' => true, |
| 37 |
'value' => true, |
| 38 |
'data-options' => true, |
| 39 |
); |
| 40 |
$allowed_html['option'] = array( |
| 41 |
'value' => true, |
| 42 |
'selected' => true, |
| 43 |
); |
| 44 |
$allowed_html['textarea'] = array( |
| 45 |
'type' => true, |
| 46 |
'name' => true, |
| 47 |
'class' => true, |
| 48 |
'id' => true, |
| 49 |
'rows' => true, |
| 50 |
'placeholder' => true, |
| 51 |
); |
| 52 |
|
| 53 |
return $allowed_html; |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
if ( ! function_exists( 'pixcodes_frontend_allowed_html' ) ) { |
| 58 |
function pixcodes_frontend_allowed_html() { |
| 59 |
$allowed_html = wp_kses_allowed_html( 'post' ); |
| 60 |
|
| 61 |
$allowed_html['div']['data-slidertransition'] = true; |
| 62 |
$allowed_html['div']['data-arrows'] = true; |
| 63 |
$allowed_html['div']['data-bullets'] = true; |
| 64 |
$allowed_html['div']['data-autoheight'] = true; |
| 65 |
$allowed_html['div']['data-value'] = true; |
| 66 |
$allowed_html['title'] = array(); |
| 67 |
$allowed_html['icon'] = array(); |
| 68 |
$allowed_html['body'] = array(); |
| 69 |
$allowed_html['meta'] = array( |
| 70 |
'itemprop' => true, |
| 71 |
'content' => true, |
| 72 |
); |
| 73 |
|
| 74 |
return $allowed_html; |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
if (!function_exists('wpgrade_remove_spaces_around_shortcodes')) { |
| 79 |
|
| 80 |
function wpgrade_remove_spaces_around_shortcodes( $content ) { |
| 81 |
$array = array( |
| 82 |
'<p>[' => '[', |
| 83 |
']</p>' => ']', |
| 84 |
']<br />' => ']' |
| 85 |
); |
| 86 |
|
| 87 |
$content = strtr( $content, $array ); |
| 88 |
|
| 89 |
return $content; |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
if (!function_exists('wpgrade_parse_shortcode_content')) { |
| 94 |
|
| 95 |
function wpgrade_parse_shortcode_content( $content ) { |
| 96 |
|
| 97 |
/* Parse nested shortcodes and add formatting. */ |
| 98 |
$content = trim( do_shortcode( shortcode_unautop( $content ) ) ); |
| 99 |
|
| 100 |
/* Remove '' from the start of the string. */ |
| 101 |
if ( substr( $content, 0, 4 ) == '' ) |
| 102 |
$content = substr( $content, 4 ); |
| 103 |
|
| 104 |
/* Remove '' from the end of the string. */ |
| 105 |
if ( substr( $content, -3, 3 ) == '' ) |
| 106 |
$content = substr( $content, 0, -3 ); |
| 107 |
|
| 108 |
/* Remove any instances of ''. */ |
| 109 |
$content = str_replace( array( '<p></p>' ), '', $content ); |
| 110 |
$content = str_replace( array( '<p> </p>' ), '', $content ); |
| 111 |
$content = str_replace( array( '<p> </p>' ), '', $content ); |
| 112 |
|
| 113 |
return $content; |
| 114 |
} |
| 115 |
} |
| 116 |
|