integrations
7 years ago
class-strong-form.php
7 years ago
class-strong-log.php
7 years ago
class-strong-mail.php
7 years ago
class-strong-templates.php
7 years ago
class-strong-testimonials-order.php
7 years ago
class-strong-testimonials-privacy.php
7 years ago
class-strong-testimonials-render.php
7 years ago
class-strong-testimonials-shortcode-average.php
7 years ago
class-strong-testimonials-shortcode-count.php
7 years ago
class-strong-testimonials-shortcode.php
7 years ago
class-strong-view-display.php
7 years ago
class-strong-view-form.php
7 years ago
class-strong-view-slideshow.php
7 years ago
class-strong-view.php
7 years ago
class-walker-strong-category-checklist-front.php
7 years ago
deprecated.php
7 years ago
filters.php
7 years ago
functions-activation.php
7 years ago
functions-content.php
7 years ago
functions-image.php
7 years ago
functions-rating.php
7 years ago
functions-template-form.php
7 years ago
functions-template.php
7 years ago
functions-views.php
7 years ago
functions.php
7 years ago
l10n-polylang.php
7 years ago
l10n-wpml.php
7 years ago
post-types.php
7 years ago
retro.php
7 years ago
scripts.php
7 years ago
widget2.php
7 years ago
filters.php
171 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Filters |
| 4 | */ |
| 5 | |
| 6 | /** |
| 7 | * Remove whitespace between tags. Helps prevent double wpautop in plugins |
| 8 | * like Posts For Pages and Custom Content Shortcode. |
| 9 | * |
| 10 | * @param $html |
| 11 | * |
| 12 | * @since 2.3 |
| 13 | * |
| 14 | * @return mixed |
| 15 | */ |
| 16 | function wpmtst_remove_whitespace( $html ) { |
| 17 | $options = get_option( 'wpmtst_options' ); |
| 18 | if ( $options['remove_whitespace'] ) { |
| 19 | $html = preg_replace( '~>\s+<~', '><', $html ); |
| 20 | } |
| 21 | |
| 22 | return $html; |
| 23 | } |
| 24 | add_filter( 'strong_view_html', 'wpmtst_remove_whitespace' ); |
| 25 | add_filter( 'strong_view_form_html', 'wpmtst_remove_whitespace' ); |
| 26 | |
| 27 | |
| 28 | /** |
| 29 | * Content filters. |
| 30 | * |
| 31 | * @since 2.33.0 Moved to `init` action. |
| 32 | */ |
| 33 | function wpmtst_content_filters() { |
| 34 | add_filter( 'wpmtst_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 ); |
| 35 | add_filter( 'wpmtst_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 ); |
| 36 | add_filter( 'wpmtst_the_content', 'wptexturize' ); |
| 37 | add_filter( 'wpmtst_the_content', 'wpautop' ); |
| 38 | add_filter( 'wpmtst_the_content', 'shortcode_unautop' ); |
| 39 | add_filter( 'wpmtst_the_content', 'prepend_attachment' ); |
| 40 | add_filter( 'wpmtst_the_content', 'wp_make_content_images_responsive' ); |
| 41 | add_filter( 'wpmtst_the_content', 'do_shortcode', 11 ); |
| 42 | add_filter( 'wpmtst_the_content', 'convert_smilies', 20 ); |
| 43 | |
| 44 | add_filter( 'wpmtst_the_excerpt', 'wptexturize' ); |
| 45 | add_filter( 'wpmtst_the_excerpt', 'convert_smilies' ); |
| 46 | add_filter( 'wpmtst_the_excerpt', 'convert_chars' ); |
| 47 | add_filter( 'wpmtst_the_excerpt', 'wpautop' ); |
| 48 | add_filter( 'wpmtst_the_excerpt', 'shortcode_unautop' ); |
| 49 | add_filter( 'wpmtst_the_excerpt', 'do_shortcode', 11 ); |
| 50 | add_filter( 'wpmtst_the_excerpt', 'convert_smilies', 20 ); |
| 51 | } |
| 52 | add_action( 'init', 'wpmtst_content_filters' ); |
| 53 | |
| 54 | function wpmtst_add_allowed_tags( $tags ) { |
| 55 | |
| 56 | // iframe |
| 57 | $tags['iframe'] = array( |
| 58 | 'src' => true, |
| 59 | 'height' => true, |
| 60 | 'width' => true, |
| 61 | 'frameborder' => true, |
| 62 | 'allowfullscreen' => true, |
| 63 | 'style' => true, |
| 64 | 'data-*' => true, |
| 65 | 'hidden' => true, |
| 66 | ); |
| 67 | // form fields - input |
| 68 | $tags['input'] = array( |
| 69 | 'class' => true, |
| 70 | 'id' => true, |
| 71 | 'name' => true, |
| 72 | 'value' => true, |
| 73 | 'type' => true, |
| 74 | 'placeholder' => true, |
| 75 | 'required' => true, |
| 76 | 'checked' => true, |
| 77 | 'title' => true, |
| 78 | 'style' => true, |
| 79 | 'data-*' => true, |
| 80 | 'hidden' => true, |
| 81 | ); |
| 82 | // textarea |
| 83 | $tags['textarea'] = array( |
| 84 | 'class' => true, |
| 85 | 'id' => true, |
| 86 | 'name' => true, |
| 87 | 'value' => true, |
| 88 | 'type' => true, |
| 89 | 'placeholder' => true, |
| 90 | 'required' => true, |
| 91 | 'style' => true, |
| 92 | 'data-*' => true, |
| 93 | 'hidden' => true, |
| 94 | ); |
| 95 | // select |
| 96 | $tags['select'] = array( |
| 97 | 'class' => true, |
| 98 | 'id' => true, |
| 99 | 'name' => true, |
| 100 | 'value' => true, |
| 101 | 'type' => true, |
| 102 | 'style' => true, |
| 103 | 'data-*' => true, |
| 104 | 'hidden' => true, |
| 105 | ); |
| 106 | // select options |
| 107 | $tags['option'] = array( |
| 108 | 'selected' => true, |
| 109 | 'class' => true, |
| 110 | 'id' => true, |
| 111 | 'name' => true, |
| 112 | 'value' => true, |
| 113 | 'style' => true, |
| 114 | 'data-*' => true, |
| 115 | 'hidden' => true, |
| 116 | ); |
| 117 | $tags['optgroup'] = array( |
| 118 | 'class' => true, |
| 119 | 'id' => true, |
| 120 | 'name' => true, |
| 121 | 'value' => true, |
| 122 | 'label' => true, |
| 123 | 'style' => true, |
| 124 | 'data-*' => true, |
| 125 | 'hidden' => true, |
| 126 | ); |
| 127 | $tags['source'] = array( |
| 128 | 'type' => true, |
| 129 | 'src' => true, |
| 130 | ); |
| 131 | |
| 132 | $tags['span']['hidden'] = true; |
| 133 | |
| 134 | $tags['img']['srcset'] = true; |
| 135 | $tags['img']['sizes'] = true; |
| 136 | |
| 137 | $tags['div']['data-*'] = true; |
| 138 | |
| 139 | $tags['noscript'] = array(); |
| 140 | |
| 141 | $tags['style'] = array( |
| 142 | 'types' => true, |
| 143 | ); |
| 144 | |
| 145 | return $tags; |
| 146 | } |
| 147 | add_filter( 'wp_kses_allowed_html', 'wpmtst_add_allowed_tags' ); |
| 148 | |
| 149 | |
| 150 | function wpmtst_safe_style_css( $styles ) { |
| 151 | $styles[] = 'display'; |
| 152 | return $styles; |
| 153 | } |
| 154 | add_filter( 'safe_style_css', 'wpmtst_safe_style_css' ); |
| 155 | |
| 156 | |
| 157 | /** |
| 158 | * Change single testimonial slug. |
| 159 | */ |
| 160 | add_filter( 'wpmtst_post_type', 'wpmtst_change_testimonial_slug' ); |
| 161 | function wpmtst_change_testimonial_slug( $args ) { |
| 162 | |
| 163 | $options = get_option( 'wpmtst_options' ); |
| 164 | |
| 165 | if ( isset( $options['single_testimonial_slug'] ) && $options['single_testimonial_slug'] != '' ) { |
| 166 | $args['rewrite']['slug'] = $options['single_testimonial_slug']; |
| 167 | } |
| 168 | |
| 169 | return $args; |
| 170 | } |
| 171 |