class-css-blocks-base-slot.php
1 year ago
class-css-blocks-export-selected-slot.php
1 year ago
class-css-blocks-export-single-slot.php
1 year ago
class-css-blocks-target-slot.php
1 year ago
class-premium-option-wrapper.php
1 year ago
class-premium-slot.php
1 year ago
class-slot-render-utility.php
1 year ago
class-slot-render-utility.php
70 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 | ); |
| 48 | |
| 49 | public static function Render($contentCallback) |
| 50 | { |
| 51 | add_filter('safe_style_css', function ($styles) { |
| 52 | if (!in_array('display', $styles)) { |
| 53 | $styles[] = 'display'; |
| 54 | } |
| 55 | |
| 56 | return $styles; |
| 57 | }); |
| 58 | ob_start(); |
| 59 | ($contentCallback)(); |
| 60 | $content = ob_get_clean(); |
| 61 | echo wp_kses( |
| 62 | $content, |
| 63 | array_merge( |
| 64 | wp_kses_allowed_html('post'), |
| 65 | self::$AllowedHTML |
| 66 | ) |
| 67 | ); |
| 68 | } |
| 69 | } |
| 70 |