| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* This is the col template output |
| 8 |
* |
| 9 |
* Variables available: |
| 10 |
* |
| 11 |
* - $content is the content between the [col]$content[/col] tags –– if you want inner shortcodes to run, use do_shortcode |
| 12 |
* |
| 13 |
* - $size (int) The size of the columnsset by user as attribute in [col size="6"] |
| 14 |
* |
| 15 |
* - $classes (array) The CSS classes array and the result of the `gridable_column_class` filter, so we encourage you to use it |
| 16 |
* |
| 17 |
* - $class (string) The string representing the `class=""` attribute |
| 18 |
* |
| 19 |
* - $atts (array) All the shortcode attributes are stored in this array as key -> value |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
do_action( 'gridable_before_column_render' ); ?> |
| 24 |
<div class="<?php echo esc_attr( $class ); ?>" <?php echo wp_kses_data( $this->sanitize_attribute_fragment( apply_filters( 'gridable_column_attributes', '', $atts, $content ) ) ); ?>> |
| 25 |
<?php |
| 26 |
do_action( 'gridable_before_column_content_render', $atts ); |
| 27 |
|
| 28 |
$gridable_column_content = apply_filters( 'gridable_the_column_content', $content, $atts ); |
| 29 |
|
| 30 |
if ( apply_filters( 'gridable_render_shortcodes_in_column', true, $content, $atts ) ) { |
| 31 |
$gridable_column_content = do_shortcode( $gridable_column_content ); |
| 32 |
} |
| 33 |
|
| 34 |
/* |
| 35 |
* Print the column content as it comes out of the shortcodes. |
| 36 |
* |
| 37 |
* This is post content that WordPress already sanitized on save (wp_filter_post_kses runs |
| 38 |
* for every user without the `unfiltered_html` capability) and that we are printing inside |
| 39 |
* `the_content`. Running wp_kses_post() over the *rendered* result strips elements themes |
| 40 |
* legitimately emit -- `<style>`, `<iframe>`, `<svg>`, `<form>` -- and because kses keeps the |
| 41 |
* inner text of a stripped tag, a theme's inline gallery CSS ends up rendered as visible page |
| 42 |
* text. See https://github.com/pixelgrade/gridable/issues/119. |
| 43 |
* |
| 44 |
* Sites that want the extra pass can opt back in through the filter below. |
| 45 |
*/ |
| 46 |
if ( apply_filters( 'gridable_sanitize_rendered_content', false, 'col', $atts ) ) { |
| 47 |
$gridable_column_content = wp_kses_post( $gridable_column_content ); |
| 48 |
} |
| 49 |
|
| 50 |
echo $gridable_column_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already-sanitized post content; see the note above. |
| 51 |
|
| 52 |
do_action( 'gridable_after_column_content_render' ); ?> |
| 53 |
</div> |
| 54 |
<?php |
| 55 |
do_action( 'gridable_after_column_render' ); |
| 56 |
|