class-css-blocks-base-slot.php
1 week ago
class-css-blocks-export-selected-slot.php
1 week ago
class-css-blocks-export-single-slot.php
1 week ago
class-css-blocks-target-slot.php
1 week ago
class-premium-option-wrapper.php
1 week ago
class-premium-slot.php
1 week ago
class-slot-render-utility.php
1 week ago
class-slot-render-utility.php
86 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SuperbAddons\Components\Slots; |
| 4 | |
| 5 | defined('ABSPATH') || exit(); |
| 6 | |
| 7 | class SlotRenderUtility |
| 8 | { |
| 9 | private static $AllowedHTML = array( |
| 10 | 'div' => array( |
| 11 | 'data-type' => true, |
| 12 | 'class' => array(), |
| 13 | 'id' => array(), |
| 14 | 'style' => array(), |
| 15 | ), |
| 16 | 'select' => array( |
| 17 | 'class' => array(), |
| 18 | 'id' => array(), |
| 19 | 'name' => array(), |
| 20 | 'placeholder' => array(), |
| 21 | 'multiple' => array(), |
| 22 | 'style' => array(), |
| 23 | ), |
| 24 | 'option' => array( |
| 25 | 'value' => array(), |
| 26 | 'selected' => array(), |
| 27 | ), |
| 28 | 'input' => array( |
| 29 | 'class' => array(), |
| 30 | 'id' => array(), |
| 31 | 'name' => array(), |
| 32 | 'type' => array(), |
| 33 | 'value' => array(), |
| 34 | 'checked' => array(), |
| 35 | 'style' => array(), |
| 36 | 'data-action' => true, |
| 37 | ), |
| 38 | 'iframe' => array( |
| 39 | 'class' => array(), |
| 40 | 'src' => array(), |
| 41 | 'loading' => array(), |
| 42 | 'data-src' => true, |
| 43 | 'data-noreload' => true, |
| 44 | 'data-status' => true, |
| 45 | 'data-id' => true, |
| 46 | ), |
| 47 | 'svg' => array( |
| 48 | 'xmlns' => true, |
| 49 | 'width' => true, |
| 50 | 'height' => true, |
| 51 | 'viewbox' => true, |
| 52 | 'fill' => true, |
| 53 | 'class' => array(), |
| 54 | 'aria-hidden' => true, |
| 55 | 'focusable' => true, |
| 56 | ), |
| 57 | 'path' => array( |
| 58 | 'd' => true, |
| 59 | 'fill' => true, |
| 60 | 'fill-rule' => true, |
| 61 | 'clip-rule' => true, |
| 62 | ), |
| 63 | ); |
| 64 | |
| 65 | public static function Render($contentCallback) |
| 66 | { |
| 67 | add_filter('safe_style_css', function ($styles) { |
| 68 | if (!in_array('display', $styles)) { |
| 69 | $styles[] = 'display'; |
| 70 | } |
| 71 | |
| 72 | return $styles; |
| 73 | }); |
| 74 | ob_start(); |
| 75 | ($contentCallback)(); |
| 76 | $content = ob_get_clean(); |
| 77 | echo wp_kses( |
| 78 | $content, |
| 79 | array_merge( |
| 80 | wp_kses_allowed_html('post'), |
| 81 | self::$AllowedHTML |
| 82 | ) |
| 83 | ); |
| 84 | } |
| 85 | } |
| 86 |