:

is_block_editor() && user_can_richedit() ) || ( function_exists( 'is_gutenberg_page' ) && is_gutenberg_page() ) ); } /** * Utility function that registers a script and/or its associated style if it exists. * * @param string $relpath Path of script/style relative to the bundle directory. * @param array $deps Optional. List of script dependencies. Default []. * * @throws \InvalidArgumentException If the relative path refers to a non-existent file. */ function register_script( string $relpath, array $deps = [] ) { $style_suffix = "/bundle/$relpath.css"; $script_suffix = "/bundle/$relpath.js"; if ( file_exists( ABT_ROOT_PATH . $style_suffix ) ) { wp_register_style( get_handle( $relpath, 'style' ), ABT_ROOT_URI . $style_suffix, $deps['styles'] ?? [], filemtime( ABT_ROOT_PATH . $style_suffix ) ); } if ( file_exists( ABT_ROOT_PATH . $script_suffix ) ) { $handle = get_handle( $relpath, 'script' ); wp_register_script( $handle, ABT_ROOT_URI . $script_suffix, $deps['scripts'] ?? [], filemtime( ABT_ROOT_PATH . $script_suffix ), true ); if ( in_array( 'wp-i18n', $deps['scripts'] ?? [], true ) ) { wp_set_script_translations( $handle, 'academic-bloggers-toolkit', basename( ABT_ROOT_PATH ) . '/languages' ); } } }