true, 'class' => true, 'style' => true, 'title' => true, 'role' => true, 'hidden' => true, 'tabindex' => true, 'aria-label' => true, 'aria-hidden' => true, 'aria-haspopup' => true, 'aria-expanded' => true, 'aria-selected' => true, 'aria-current' => true, 'data-*' => true, 'data-no-translation' => true, 'translate' => true, 'dir' => true, ); $svg = array( 'fill' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true ); $allowed = wp_kses_allowed_html( 'post' ); foreach ( array( 'a', 'span', 'div', 'ul', 'li', 'nav', 'small', 'strong', 'button', 'label' ) as $tag ) { $allowed[ $tag ] = array_merge( isset( $allowed[ $tag ] ) ? $allowed[ $tag ] : array(), $common ); } $allowed['a'] = array_merge( $allowed['a'], array( 'href' => true, 'hreflang' => true, 'lang' => true, 'rel' => true, 'target' => true ) ); $allowed['button'] = array_merge( $allowed['button'], array( 'type' => true ) ); $allowed['label'] = array_merge( $allowed['label'], array( 'for' => true ) ); $allowed['form'] = array_merge( $common, array( 'method' => true, 'action' => true, 'autocomplete' => true ) ); $allowed['input'] = array_merge( $common, array( 'type' => true, 'name' => true, 'value' => true, 'placeholder' => true ) ); $allowed['select'] = array_merge( $common, array( 'name' => true ) ); $allowed['option'] = array( 'value' => true, 'selected' => true ); $allowed['svg'] = array_merge( $common, $svg, array( 'viewbox' => true, 'xmlns' => true, 'width' => true, 'height' => true ) ); $allowed['path'] = array_merge( $svg, array( 'd' => true ) ); $allowed['circle'] = array_merge( $svg, array( 'cx' => true, 'cy' => true, 'r' => true ) ); $allowed['rect'] = array_merge( $svg, array( 'x' => true, 'y' => true, 'width' => true, 'height' => true, 'rx' => true ) ); // Imágenes de WordPress/WooCommerce con sus tamaños adaptables, y el precio de WooCommerce. $allowed['img'] = array_merge( isset( $allowed['img'] ) ? $allowed['img'] : array(), $common, array( 'src' => true, 'srcset' => true, 'sizes' => true, 'alt' => true, 'width' => true, 'height' => true, 'loading' => true, 'decoding' => true, 'fetchpriority' => true ) ); $allowed['bdi'] = $common; return $allowed; } /** * Escapa el HTML que devuelve un shortcode. * * @param string $html HTML generado por las funciones del tema. * @return string */ function gstore_shortcodes_kses( $html ) { return wp_kses( (string) $html, gstore_shortcodes_allowed_html() ); } // Solo con el tema GStore activo: los shortcodes usan sus funciones y sus textos. add_action( 'after_setup_theme', function () { if ( ! function_exists( 'gstore_t' ) || ! function_exists( 'gstore_part_search' ) ) { return; } require __DIR__ . '/includes/home-blocks.php'; require __DIR__ . '/includes/header-parts.php'; }, 20 ); add_action( 'admin_notices', function () { if ( function_exists( 'gstore_t' ) || ! current_user_can( 'switch_themes' ) ) { return; } echo '
GStore Shortcodes: ' . esc_html__( 'this plugin only works with the GStore theme active.', 'gstore-shortcodes' ) . '