elementor
1 year ago
logs
1 month ago
strong-testimonials-beaver-block
1 year ago
submodules
8 months ago
class-strong-gutemberg.php
1 year ago
class-strong-log.php
1 year ago
class-strong-mail.php
1 year ago
class-strong-testimonials-average-shortcode.php
1 year ago
class-strong-testimonials-count-shortcode.php
1 year ago
class-strong-testimonials-defaults.php
1 month ago
class-strong-testimonials-form.php
1 month ago
class-strong-testimonials-order.php
1 year ago
class-strong-testimonials-privacy.php
1 year ago
class-strong-testimonials-render.php
1 month ago
class-strong-testimonials-templates.php
1 year ago
class-strong-testimonials-view-shortcode.php
1 week ago
class-strong-testimonials-view-widget.php
1 year ago
class-strong-view-display.php
1 day ago
class-strong-view-form.php
1 day ago
class-strong-view-slideshow.php
1 day ago
class-strong-view.php
1 day ago
class-walker-strong-category-checklist-front.php
1 year ago
deprecated.php
1 year ago
filters.php
1 month ago
functions-activation.php
1 month ago
functions-content.php
11 months ago
functions-image.php
5 months ago
functions-rating.php
1 year ago
functions-template-form.php
1 week ago
functions-template.php
4 months ago
functions-views.php
1 year ago
functions.php
1 month ago
l10n-polylang.php
1 year ago
l10n-wpml.php
1 year ago
post-types.php
1 week ago
retro.php
1 year ago
scripts.php
1 month ago
filters.php
197 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 | $saved_value = isset( $options['remove_whitespace'] ) ? (bool) $options['remove_whitespace'] : true; |
| 19 | if ( apply_filters( 'wpmtst_remove_whitespace_enabled', $saved_value ) ) { |
| 20 | $html = preg_replace( '~>\s+<~', '><', $html ); |
| 21 | } |
| 22 | |
| 23 | return $html; |
| 24 | } |
| 25 | add_filter( 'strong_view_html', 'wpmtst_remove_whitespace' ); |
| 26 | add_filter( 'strong_view_form_html', 'wpmtst_remove_whitespace' ); |
| 27 | |
| 28 | /** |
| 29 | * Content filters. |
| 30 | * |
| 31 | * @since 2.33.0 Moved to `init` action. |
| 32 | */ |
| 33 | function wpmtst_content_filters() { |
| 34 | |
| 35 | add_filter( 'wpmtst_the_content', array( $GLOBALS['wp_embed'], 'run_shortcode' ), 8 ); |
| 36 | add_filter( 'wpmtst_the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 ); |
| 37 | add_filter( 'wpmtst_the_content', 'wptexturize' ); |
| 38 | add_filter( 'wpmtst_the_content', 'wpautop' ); |
| 39 | add_filter( 'wpmtst_the_content', 'shortcode_unautop' ); |
| 40 | add_filter( 'wpmtst_the_content', 'prepend_attachment' ); |
| 41 | |
| 42 | if ( version_compare( get_bloginfo( 'version' ), '5.5', '>=' ) ) { |
| 43 | add_filter( 'wpmtst_the_content', 'wp_filter_content_tags' ); |
| 44 | } else { |
| 45 | add_filter( 'wpmtst_the_content', 'wp_make_content_images_responsive' ); |
| 46 | } |
| 47 | |
| 48 | add_filter( 'wpmtst_the_content', 'convert_smilies', 20 ); |
| 49 | |
| 50 | add_filter( 'wpmtst_the_excerpt', 'wptexturize' ); |
| 51 | add_filter( 'wpmtst_the_excerpt', 'convert_smilies' ); |
| 52 | add_filter( 'wpmtst_the_excerpt', 'convert_chars' ); |
| 53 | add_filter( 'wpmtst_the_excerpt', 'wpautop' ); |
| 54 | add_filter( 'wpmtst_the_excerpt', 'shortcode_unautop' ); |
| 55 | add_filter( 'wpmtst_the_excerpt', 'convert_smilies', 20 ); |
| 56 | } |
| 57 | add_action( 'init', 'wpmtst_content_filters' ); |
| 58 | |
| 59 | function wpmtst_add_allowed_tags( $tags ) { |
| 60 | |
| 61 | // iframe |
| 62 | $tags['iframe'] = array( |
| 63 | 'src' => true, |
| 64 | 'height' => true, |
| 65 | 'width' => true, |
| 66 | 'frameborder' => true, |
| 67 | 'allowfullscreen' => true, |
| 68 | 'style' => true, |
| 69 | 'data-*' => true, |
| 70 | 'hidden' => true, |
| 71 | ); |
| 72 | // form fields - input |
| 73 | $tags['input'] = array( |
| 74 | 'class' => true, |
| 75 | 'id' => true, |
| 76 | 'name' => true, |
| 77 | 'value' => true, |
| 78 | 'type' => true, |
| 79 | 'placeholder' => true, |
| 80 | 'required' => true, |
| 81 | 'checked' => true, |
| 82 | 'title' => true, |
| 83 | 'style' => true, |
| 84 | 'data-*' => true, |
| 85 | 'hidden' => true, |
| 86 | ); |
| 87 | // textarea |
| 88 | $tags['textarea'] = array( |
| 89 | 'class' => true, |
| 90 | 'id' => true, |
| 91 | 'name' => true, |
| 92 | 'value' => true, |
| 93 | 'type' => true, |
| 94 | 'placeholder' => true, |
| 95 | 'required' => true, |
| 96 | 'style' => true, |
| 97 | 'data-*' => true, |
| 98 | 'hidden' => true, |
| 99 | ); |
| 100 | // select |
| 101 | $tags['select'] = array( |
| 102 | 'class' => true, |
| 103 | 'id' => true, |
| 104 | 'name' => true, |
| 105 | 'value' => true, |
| 106 | 'type' => true, |
| 107 | 'style' => true, |
| 108 | 'data-*' => true, |
| 109 | 'hidden' => true, |
| 110 | ); |
| 111 | // select options |
| 112 | $tags['option'] = array( |
| 113 | 'selected' => true, |
| 114 | 'class' => true, |
| 115 | 'id' => true, |
| 116 | 'name' => true, |
| 117 | 'value' => true, |
| 118 | 'style' => true, |
| 119 | 'data-*' => true, |
| 120 | 'hidden' => true, |
| 121 | ); |
| 122 | $tags['optgroup'] = array( |
| 123 | 'class' => true, |
| 124 | 'id' => true, |
| 125 | 'name' => true, |
| 126 | 'value' => true, |
| 127 | 'label' => true, |
| 128 | 'style' => true, |
| 129 | 'data-*' => true, |
| 130 | 'hidden' => true, |
| 131 | ); |
| 132 | $tags['source'] = array( |
| 133 | 'type' => true, |
| 134 | 'src' => true, |
| 135 | ); |
| 136 | |
| 137 | $tags['span']['hidden'] = true; |
| 138 | |
| 139 | $tags['img']['srcset'] = true; |
| 140 | $tags['img']['sizes'] = true; |
| 141 | |
| 142 | $tags['div']['data-*'] = true; |
| 143 | |
| 144 | $tags['noscript'] = array(); |
| 145 | |
| 146 | $tags['style'] = array( |
| 147 | 'types' => true, |
| 148 | ); |
| 149 | |
| 150 | return $tags; |
| 151 | } |
| 152 | add_filter( 'wp_kses_allowed_html', 'wpmtst_add_allowed_tags' ); |
| 153 | |
| 154 | |
| 155 | function wpmtst_safe_style_css( $styles ) { |
| 156 | $styles[] = 'display'; |
| 157 | return $styles; |
| 158 | } |
| 159 | add_filter( 'safe_style_css', 'wpmtst_safe_style_css' ); |
| 160 | |
| 161 | |
| 162 | /** |
| 163 | * Change single testimonial slug. |
| 164 | */ |
| 165 | add_filter( 'wpmtst_post_type', 'wpmtst_change_testimonial_slug' ); |
| 166 | function wpmtst_change_testimonial_slug( $args ) { |
| 167 | |
| 168 | $options = get_option( 'wpmtst_options' ); |
| 169 | $saved_slug = isset( $options['single_testimonial_slug'] ) ? $options['single_testimonial_slug'] : ''; |
| 170 | $slug = apply_filters( 'wpmtst_single_testimonial_slug', $saved_slug ); |
| 171 | |
| 172 | if ( '' !== $slug ) { |
| 173 | $args['rewrite']['slug'] = $slug; |
| 174 | } |
| 175 | |
| 176 | return $args; |
| 177 | } |
| 178 | |
| 179 | |
| 180 | /** |
| 181 | * Disable custom post url |
| 182 | */ |
| 183 | add_filter( 'wpmtst_post_type', 'wpmtst_disable_permalink', 999 ); |
| 184 | function wpmtst_disable_permalink( $args ) { |
| 185 | |
| 186 | $options = get_option( 'wpmtst_options' ); |
| 187 | $saved_value = isset( $options['disable_rewrite'] ) && $options['disable_rewrite']; |
| 188 | $disable_rewrite = apply_filters( 'wpmtst_disable_rewrite', $saved_value ); |
| 189 | |
| 190 | if ( $disable_rewrite ) { |
| 191 | $args['rewrite'] = false; |
| 192 | $args['public'] = false; |
| 193 | } |
| 194 | |
| 195 | return $args; |
| 196 | } |
| 197 |