| @@ -5,65 +5,59 @@ | ||
| 5 | 5 | * @package Powerkit |
| 6 | 6 | * @subpackage Templates |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -// Exit if accessed directly. | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 11 | - exit; | |
| 12 | -} | |
| 13 | - | |
| 14 | 9 | /** |
| 15 | 10 | * Collapsibles |
| 16 | 11 | */ |
| 17 | -add_action( 'init', function () { | |
| 18 | - powerkit_basic_shortcodes_register( array( | |
| 19 | - 'name' => 'collapsibles', | |
| 20 | - 'title' => esc_html__( 'Collapsibles', 'powerkit' ), | |
| 21 | - 'priority' => 50, | |
| 22 | - 'base' => 'powerkit_collapsibles', | |
| 23 | - 'autoregister' => true, | |
| 24 | - 'fields' => array( | |
| 25 | - array( | |
| 26 | - 'type' => 'section', | |
| 27 | - 'label' => esc_html__( 'Content', 'powerkit' ), | |
| 28 | - ), | |
| 29 | - array( | |
| 30 | - 'type' => 'repeater', | |
| 31 | - 'base' => 'powerkit_collapsible', | |
| 32 | - 'autoregister' => true, | |
| 33 | - 'label' => esc_html__( 'Collapsibles', 'powerkit' ), | |
| 34 | - 'fields' => array( | |
| 35 | - array( | |
| 36 | - 'type' => 'input', | |
| 37 | - 'name' => 'title', | |
| 38 | - 'label' => esc_html__( 'Title', 'powerkit' ), | |
| 39 | - 'default' => '', | |
| 40 | - 'attrs' => array( | |
| 41 | - 'class' => 'widefat', | |
| 42 | - ), | |
| 12 | +powerkit_basic_shortcodes_register( array( | |
| 13 | + 'name' => 'collapsibles', | |
| 14 | + 'title' => esc_html__( 'Collapsibles', 'powerkit' ), | |
| 15 | + 'priority' => 50, | |
| 16 | + 'base' => 'powerkit_collapsibles', | |
| 17 | + 'autoregister' => true, | |
| 18 | + 'fields' => array( | |
| 19 | + array( | |
| 20 | + 'type' => 'section', | |
| 21 | + 'label' => esc_html__( 'Content', 'powerkit' ), | |
| 22 | + ), | |
| 23 | + array( | |
| 24 | + 'type' => 'repeater', | |
| 25 | + 'base' => 'powerkit_collapsible', | |
| 26 | + 'autoregister' => true, | |
| 27 | + 'label' => esc_html__( 'Collapsibles', 'powerkit' ), | |
| 28 | + 'fields' => array( | |
| 29 | + array( | |
| 30 | + 'type' => 'input', | |
| 31 | + 'name' => 'title', | |
| 32 | + 'label' => esc_html__( 'Title', 'powerkit' ), | |
| 33 | + 'default' => '', | |
| 34 | + 'attrs' => array( | |
| 35 | + 'class' => 'widefat', | |
| 43 | 36 | ), |
| 44 | - array( | |
| 45 | - 'type' => 'content', | |
| 46 | - 'name' => 'content', | |
| 47 | - 'label' => esc_html__( 'Content', 'powerkit' ), | |
| 48 | - 'default' => '', | |
| 49 | - 'attrs' => array( | |
| 50 | - 'class' => 'widefat', | |
| 51 | - 'rows' => 6, | |
| 52 | - ), | |
| 37 | + ), | |
| 38 | + array( | |
| 39 | + 'type' => 'content', | |
| 40 | + 'name' => 'content', | |
| 41 | + 'label' => esc_html__( 'Content', 'powerkit' ), | |
| 42 | + 'default' => '', | |
| 43 | + 'attrs' => array( | |
| 44 | + 'class' => 'widefat', | |
| 45 | + 'rows' => 6, | |
| 53 | 46 | ), |
| 54 | - array( | |
| 55 | - 'type' => 'checkbox', | |
| 56 | - 'name' => 'opened', | |
| 57 | - 'label' => esc_html__( 'Opened', 'powerkit' ), | |
| 58 | - 'default' => false, | |
| 59 | - ), | |
| 60 | 47 | ), |
| 48 | + array( | |
| 49 | + 'type' => 'checkbox', | |
| 50 | + 'name' => 'opened', | |
| 51 | + 'label' => esc_html__( 'Opened', 'powerkit' ), | |
| 52 | + 'default' => false, | |
| 53 | + ), | |
| 61 | 54 | ), |
| 62 | 55 | ), |
| 63 | - ) ); | |
| 64 | -}); | |
| 56 | + ), | |
| 57 | +) ); | |
| 65 | 58 | |
| 59 | + | |
| 66 | 60 | /** |
| 67 | 61 | * Collapsibles Shortcode |
| 68 | 62 | * |
| 69 | 63 | * @param array $output Shortcode HTML. |
| @@ -114,13 +108,13 @@ | ||
| 114 | 108 | </div> |
| 115 | 109 | </div> |
| 116 | 110 | </div> |
| 117 | 111 | ', |
| 118 | - esc_attr( $item_id ), | |
| 119 | - wp_kses( $atts['title'], 'post' ), | |
| 112 | + $item_id, | |
| 113 | + $atts['title'], | |
| 120 | 114 | ( 'true' === $atts['opened'] ) ? 'display:block;' : 'display:none;', |
| 121 | 115 | ( 'true' === $atts['opened'] ) ? 'expanded' : '', |
| 122 | - wp_kses( do_shortcode( $content ), 'post' ), | |
| 116 | + do_shortcode( $content ) | |
| 123 | 117 | ); |
| 124 | 118 | |
| 125 | 119 | return $output; |
| 126 | 120 | } |