'separators', 'title' => esc_html__( 'Separators', 'powerkit' ), 'priority' => 10, 'base' => 'powerkit_separator', 'autoregister' => true, 'fields' => array( array( 'type' => 'section', 'label' => esc_html__( 'Options', 'powerkit' ), ), array( 'type' => 'radio', 'name' => 'style', 'label' => esc_html__( 'Style', 'powerkit' ), 'style' => 'vertical', 'default' => 'solid', 'options' => array( 'solid' => esc_html__( 'Solid', 'powerkit' ), 'double' => esc_html__( 'Double', 'powerkit' ), 'dotted' => esc_html__( 'Dotted', 'powerkit' ), 'dashed' => esc_html__( 'Dashed', 'powerkit' ), 'blank' => esc_html__( 'Blank (empty space)', 'powerkit' ), ), ), array( 'type' => 'input', 'name' => 'height', 'label' => esc_html__( 'Height', 'powerkit' ), 'default' => '', 'suffix' => ' px', ), ), ) ); }); /** * Separator Shortcode * * @param array $output Shortcode HTML. * @param array $atts User defined attributes in shortcode tag. * @param string $content Shorcode tag content. * @return string Shortcode result HTML. */ function powerkit_basic_shortcodes_separator( $output, $atts, $content ) { // Allowed CSS border-style keywords. The list is wider than the options the // radio field offers, so a hand-written style="groove" keeps working. Any // other value drops the declaration, which is how a browser already treats // an invalid one. $allowed_styles = array( 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset' ); if ( 'blank' === $atts['style'] ) { $inl_css = sprintf( 'style="height: %dpx;"', absint( $atts['height'] ) ); } else { $border_style = in_array( $atts['style'], $allowed_styles, true ) ? sprintf( ' border-bottom-style: %s;', $atts['style'] ) : ''; $inl_css = sprintf( 'style="border-bottom-width: %dpx;%s"', absint( $atts['height'] ), $border_style ); } $output = sprintf( '