"; } function is_assoc($arr): bool { if (!is_array($arr)) return false; if (array() === $arr) return false; return array_keys($arr) !== range(0, count($arr) - 1); } function set_default_value(array &$array, string $key, $value) { if (!isset($array[$key])) { $array[$key] = $value; } } add_shortcode(ASCIIPLAYER_TAG, 'handle_asciiplayer_code'); function load_scripts() { if (!is_single()) { return; } global $post; if( has_shortcode( $post->post_content, ASCIIPLAYER_TAG ) ) { wp_enqueue_script( 'asciiplayer-adapter-js', plugin_dir_url(__FILE__) . '/asciiplayer/dist/bundle.js', ); wp_enqueue_style( 'asciiplayer-adapter-css', plugin_dir_url(__FILE__) . '/asciiplayer/dist/styles.css', ); } } add_action( 'wp_enqueue_scripts', 'load_scripts' );