render_iframe_view(); exit; } } /** * Strings used by js/generator-modern.js. Not HTML-escaped because they are also shown with alert(); * the script escapes them itself where it inserts them into HTML. * * @return array */ private function get_js_i18n() { return array( 'title' => __( 'affiliate-toolkit - Shortcode Generator', 'affiliate-toolkit-starter' ), 'close' => __( 'Close', 'affiliate-toolkit-starter' ), 'insert' => __( 'Insert', 'affiliate-toolkit-starter' ), 'update' => __( 'Update Preview', 'affiliate-toolkit-starter' ), 'copy' => __( 'Copy to Clipboard', 'affiliate-toolkit-starter' ), 'loading' => __( 'Loading...', 'affiliate-toolkit-starter' ), 'error' => __( 'An error occurred', 'affiliate-toolkit-starter' ), 'selectOutputType' => __( 'Please select an output type.', 'affiliate-toolkit-starter' ), 'editProduct' => __( 'Edit product', 'affiliate-toolkit-starter' ), 'editList' => __( 'Edit list', 'affiliate-toolkit-starter' ), 'noProductsFound' => __( 'No products found', 'affiliate-toolkit-starter' ), 'noListsFound' => __( 'No lists found', 'affiliate-toolkit-starter' ), 'searchError' => __( 'Search failed:', 'affiliate-toolkit-starter' ), 'enterKeyword' => __( 'Please enter a search keyword.', 'affiliate-toolkit-starter' ), 'searchingExternal' => __( 'Searching shop products...', 'affiliate-toolkit-starter' ), 'import' => __( 'Import', 'affiliate-toolkit-starter' ), 'importing' => __( 'Importing...', 'affiliate-toolkit-starter' ), 'imported' => __( 'Imported!', 'affiliate-toolkit-starter' ), 'noNonce' => __( 'Error: no security token found. Please reload the page. If the problem persists, please clear your browser cache.', 'affiliate-toolkit-starter' ), 'importError' => __( 'Import failed:', 'affiliate-toolkit-starter' ), 'importNoId' => __( 'Import failed: no product ID received.', 'affiliate-toolkit-starter' ), 'invalidResponse' => __( 'Invalid response from the server. See the browser console for details.', 'affiliate-toolkit-starter' ), 'seeConsole' => __( 'See the browser console for details.', 'affiliate-toolkit-starter' ), 'enterListName' => __( 'Please enter a list name.', 'affiliate-toolkit-starter' ), 'selectShop' => __( 'Please select a shop.', 'affiliate-toolkit-starter' ), 'creatingList' => __( 'Creating list...', 'affiliate-toolkit-starter' ), 'listCreated' => __( 'List created!', 'affiliate-toolkit-starter' ), 'createListError' => __( 'Failed to create list:', 'affiliate-toolkit-starter' ), 'createListNoId' => __( 'Failed to create list: no list ID received.', 'affiliate-toolkit-starter' ), 'copied' => __( 'Copied!', 'affiliate-toolkit-starter' ), ); } /** * Render clean iframe view without WordPress admin chrome */ private function render_iframe_view() { // Enqueue WordPress admin styles wp_enqueue_style( 'common' ); wp_enqueue_style( 'forms' ); wp_enqueue_style( 'buttons' ); // Enqueue our plugin assets wp_enqueue_style( 'atkp-modern-generator', plugins_url( 'css/generator-modern.css', ATKP_PLUGIN_FILE ), array(), ATKP_UPDATE_VERSION ); wp_enqueue_script( 'atkp-modern-generator', plugins_url( 'js/generator-modern.js', ATKP_PLUGIN_FILE ), array( 'jquery' ), ATKP_UPDATE_VERSION, true ); wp_localize_script( 'atkp-modern-generator', 'atkpGenerator', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'atkp-generator-nonce' ), 'isThickbox' => true, 'i18n' => $this->get_js_i18n(), ) ); ?> >