'; $output .= sprintf( '

%s

', __( 'Options available:', 'italystrap' ) ); foreach ( (array) $get_settings as $key => $setting ) { $output .= sprintf( '
  • %s

    Attribute: %s
    Default: %s
    %s

  • ', esc_attr( $setting['name'] ), esc_attr( $setting['id'] ), empty( $setting['default'] ) ? __( 'empty', 'italystrap' ) : esc_attr( $setting['default'] ), wp_kses_post( $setting['desc'] ) ); } $output .= ''; return $output; } add_shortcode( 'display_config', __NAMESPACE__ . '\_display_config' ); /** * This shortcode is only for intarnal use * * @param array $atts Shortcode attributes. * * @return string The shortcode output */ function _display_options( $atts ) { if ( ! isset( $atts['file'] ) ) { return ''; } $file_path = ITALYSTRAP_PLUGIN_PATH . 'admin/config/' . $atts['file'] . '.php'; if ( ! file_exists( $file_path ) ) { return __( 'No file founded', 'italystrap' ); } $get_settings = require( $file_path ); $output = ''; foreach ( $get_settings as $section => $settings ) { $output .= '

    ' . ucfirst( esc_html( $section ) ) . '

    '; $output .= ''; } return $output; } add_shortcode( 'display_options', __NAMESPACE__ . '\_display_options' ); /** * This shortcode is only for intarnal use * * @param array $atts Shortcode attributes. * * @return string The shortcode output */ function _display_example( $atts ) { if ( ! isset( $atts['file'] ) ) { return; } if ( ! file_exists( ITALYSTRAP_PLUGIN_PATH . $atts['file'] . '.md' ) ) { return __( 'No file founded', 'italystrap' ); } static $parsedown = null; if ( ! $parsedown ) { $parsedown = new \Parsedown(); } $get_example = \ItalyStrap\Core\get_file_content( ITALYSTRAP_PLUGIN_PATH . $atts['file'] . '.md' ); return $parsedown->text( $get_example ); } add_shortcode( 'display_example', __NAMESPACE__ . '\_display_example' );