' . __( '« Return to plugins', 'substack-importer' ) . ''; if ( ! is_plugin_active( 'wordpress-importer/wordpress-importer.php' ) && current_user_can( 'activate_plugins' ) ) { wp_die( sprintf( $error_msg, 'WordPress Importer' ) . '
' . $plugins_link ); } } function substack_importer_init() { require __DIR__ . '/vendor/autoload.php'; load_plugin_textdomain( 'substack-importer' ); $importer = new Importer_Admin(); // Register the Ajax action that handles fetching additional post data through the Substack API add_action( 'wp_ajax_substack_progress', array( $importer, 'progress' ) ); if ( ! defined( 'WP_LOAD_IMPORTERS' ) ) { return; } register_importer( 'substack', 'Substack', __( 'Import content from a Substack newsletter', 'substack-importer' ), array( $importer, 'run', ) ); if ( isset( $_GET['import'] ) && 'substack' === $_GET['import'] ) { wp_enqueue_script( 'substack-index-js', plugins_url( '/js/index.js', __FILE__ ) ); wp_enqueue_style( 'substack-index-css', plugins_url( '/css/index.css', __FILE__ ) ); } } add_action( 'admin_init', 'substack_importer_init' );