$mt_ready ) ); } /** * Errors in plain words (assets/errors.js) and where "Contact the developer" leads. * Filter blocklingo_support_url changes the link (a support page, a mailto: link). */ public static function errors_script(): void { wp_register_script( 'blocklingo-errors', BLOCKLINGO_URL . 'assets/errors.js', array( 'wp-i18n' ), BLOCKLINGO_VERSION, true ); self::translations( 'blocklingo-errors' ); $support = array( 'url' => (string) apply_filters( 'blocklingo_support_url', 'https://alexdenysiuk.com/' ), 'version' => BLOCKLINGO_VERSION, 'wp' => get_bloginfo( 'version' ), 'php' => PHP_VERSION, ); wp_add_inline_script( 'blocklingo-errors', 'window.blocklingoSupport = ' . wp_json_encode( $support ) . ';', 'before' ); } /** Translations of a script's strings (languages/blocklingo--.json). */ public static function translations( string $handle ): void { wp_set_script_translations( $handle, 'blocklingo', BLOCKLINGO_DIR . 'languages' ); } }