| @@ -318,8 +318,12 @@ | ||
| 318 | 318 | 'wdkit-editor-js', |
| 319 | 319 | 'wdkitData', |
| 320 | 320 | array( |
| 321 | 321 | 'ajax_url' => admin_url( 'admin-ajax.php' ), |
| 322 | + // Mirrors the PHP side's WP_DEBUG gate on its own import timing/diagnostic | |
| 323 | + // error_log() calls, so the JS import flow's console diagnostics follow the | |
| 324 | + // same convention instead of always printing in every visitor's console. | |
| 325 | + 'debug' => (bool) ( defined( 'WP_DEBUG' ) && WP_DEBUG ), | |
| 322 | 326 | 'WDKIT_URL' => WDKIT_URL, |
| 323 | 327 | 'WDKIT_ASSETS' => WDKIT_ASSETS, |
| 324 | 328 | 'wdkit_server_url' => WDKIT_SERVER_SITE_URL, |
| 325 | 329 | 'wdkit_site_api_url' => WDKIT_SERVER_API_URL, |
| @@ -325,8 +329,23 @@ | ||
| 325 | 329 | 'wdkit_site_api_url' => WDKIT_SERVER_API_URL, |
| 326 | 330 | 'wdkit_wp_version' => get_bloginfo( 'version' ), |
| 327 | 331 | 'home_url' => esc_url( home_url( '/' ) ), |
| 328 | 332 | 'kit_nonce' => wp_create_nonce( 'wdkit_nonce' ), |
| 333 | + | |
| 334 | + /* Kit Import engine switch. 'yes' => the wizard drives the PHP runner in four | |
| 335 | + * stage calls; anything else => it falls back to its original ~25-call | |
| 336 | + * orchestration, which is still fully present. Flip with the | |
| 337 | + * `wdkit_use_php_runner` filter. | |
| 338 | + * | |
| 339 | + * Deliberately 'yes'/'no' rather than a boolean. wp_localize_script() casts | |
| 340 | + * booleans to "1" and "", and while "" is falsy in JS, relying on that is the | |
| 341 | + * same PHP/JS truthiness trap that bites elsewhere in the importer — a switch | |
| 342 | + * that silently failed to switch OFF would be the worst outcome for a | |
| 343 | + * rollback path. An explicit string compares the same in both languages. | |
| 344 | + * | |
| 345 | + * Fully qualified: this file is namespaced, and an unqualified reference here | |
| 346 | + * resolved to wdkit\WdKit_enqueue\Wdkit_Import_Wizard and fatalled. */ | |
| 347 | + 'use_php_runner' => ( class_exists( '\\Wdkit_Import_Wizard' ) && \Wdkit_Import_Wizard::is_enabled() ) ? 'yes' : 'no', | |
| 329 | 348 | 'post_id' => get_the_ID(), |
| 330 | 349 | 'post_type' => get_post_type(), |
| 331 | 350 | 'text_domain' => WDKIT_TEXT_DOMAIN, |
| 332 | 351 | 'use_editor' => $this->wdkit_use_editor(), |