| @@ -208,8 +208,9 @@ | ||
| 208 | 208 | return; |
| 209 | 209 | } |
| 210 | 210 | $this->load_required_scripts(); |
| 211 | 211 | $this->localize_vars(); |
| 212 | + $this->unhook_deprecated_wp_callbacks(); | |
| 212 | 213 | |
| 213 | 214 | // Disable loading of Query Monitor in footer. |
| 214 | 215 | add_filter( 'qm/dispatch/html', '__return_false' ); |
| 215 | 216 | |
| @@ -217,8 +218,44 @@ | ||
| 217 | 218 | include_once CARTFLOWS_DIR . 'admin-core/views/onboarding-base.php'; |
| 218 | 219 | } |
| 219 | 220 | |
| 220 | 221 | /** |
| 222 | + * Detach WP core callbacks deprecated in 6.4 from the actions the | |
| 223 | + * standalone onboarding view fires manually (admin_print_styles, admin_head). | |
| 224 | + * | |
| 225 | + * Without this, every onboarding load on WP 6.4+ emits PHP deprecation | |
| 226 | + * notices for print_emoji_styles, wp_admin_bar_header, and | |
| 227 | + * the_block_template_skip_link via _deprecated_function(). | |
| 228 | + * | |
| 229 | + * Centralised here (rather than inline in the view) so the deprecated- | |
| 230 | + * callback list lives in one place and the view stays presentation-only. | |
| 231 | + * | |
| 232 | + * Scoped strictly to the CartFlows onboarding screen — the guard ensures | |
| 233 | + * it cannot affect any other admin page even if called from elsewhere. | |
| 234 | + * | |
| 235 | + * @since x.x.x | |
| 236 | + * @return void | |
| 237 | + */ | |
| 238 | + private function unhook_deprecated_wp_callbacks() { | |
| 239 | + | |
| 240 | + // Hard guard — only run on the CartFlows onboarding screen. | |
| 241 | + if ( empty( $_GET['page'] ) || 'cartflows-onboarding' !== $_GET['page'] ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 242 | + return; | |
| 243 | + } | |
| 244 | + | |
| 245 | + $deprecated_callbacks = array( | |
| 246 | + 'admin_print_styles' => array( 'print_emoji_styles' ), | |
| 247 | + 'admin_head' => array( 'wp_admin_bar_header', 'the_block_template_skip_link' ), | |
| 248 | + ); | |
| 249 | + | |
| 250 | + foreach ( $deprecated_callbacks as $action => $callbacks ) { | |
| 251 | + foreach ( $callbacks as $callback ) { | |
| 252 | + remove_action( $action, $callback ); | |
| 253 | + } | |
| 254 | + } | |
| 255 | + } | |
| 256 | + | |
| 257 | + /** | |
| 221 | 258 | * Load scripts. |
| 222 | 259 | */ |
| 223 | 260 | public function load_required_scripts() { |
| 224 | 261 | $handle = 'wcf-onboarding-app'; |
| @@ -273,32 +310,55 @@ | ||
| 273 | 310 | $vars = array(); |
| 274 | 311 | |
| 275 | 312 | $plugins = array( |
| 276 | 313 | array( |
| 277 | - 'name' => 'WooCommerce', | |
| 278 | - 'slug' => 'woocommerce', | |
| 279 | - 'status' => $this->get_plugin_status( 'woocommerce/woocommerce.php' ), | |
| 314 | + 'name' => 'WooCommerce', | |
| 315 | + 'slug' => 'woocommerce', | |
| 316 | + 'status' => $this->get_plugin_status( 'woocommerce/woocommerce.php' ), | |
| 317 | + 'required' => true, | |
| 318 | + 'description' => __( 'Powers your store — products, cart, and checkout. CartFlows requires it.', 'cartflows' ), | |
| 319 | + 'logo' => 'https://ps.w.org/woocommerce/assets/icon-128x128.png', | |
| 280 | 320 | ), |
| 281 | 321 | array( |
| 282 | - 'name' => 'Cart Abandonment', | |
| 283 | - 'slug' => 'woo-cart-abandonment-recovery', | |
| 284 | - 'status' => $this->get_plugin_status( 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' ), | |
| 322 | + 'name' => 'Cart Abandonment Recovery', | |
| 323 | + 'slug' => 'woo-cart-abandonment-recovery', | |
| 324 | + 'status' => $this->get_plugin_status( 'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' ), | |
| 325 | + 'required' => false, | |
| 326 | + 'description' => __( 'Recovers lost sales with automated follow-up emails.', 'cartflows' ), | |
| 327 | + 'logo' => 'https://ps.w.org/woo-cart-abandonment-recovery/assets/icon-128x128.gif', | |
| 285 | 328 | ), |
| 286 | 329 | array( |
| 287 | - 'name' => 'Modern cart', | |
| 288 | - 'slug' => 'modern-cart', | |
| 289 | - 'status' => $this->get_plugin_status( 'modern-cart/modern-cart.php' ), | |
| 330 | + 'name' => 'Modern Cart', | |
| 331 | + 'slug' => 'modern-cart', | |
| 332 | + 'status' => $this->get_plugin_status( 'modern-cart/modern-cart.php' ), | |
| 333 | + 'required' => false, | |
| 334 | + 'description' => __( 'Adds a fast slide-in cart to your store.', 'cartflows' ), | |
| 335 | + 'logo' => 'https://ps.w.org/modern-cart/assets/icon.svg', | |
| 290 | 336 | ), |
| 291 | 337 | array( |
| 292 | - 'name' => 'WooCommerce Payments', | |
| 293 | - 'slug' => 'woocommerce-payments', | |
| 294 | - 'status' => $this->get_plugin_status( 'woocommerce-payments/woocommerce-payments.php' ), | |
| 338 | + 'name' => 'Power Coupons', | |
| 339 | + 'slug' => 'power-coupons', | |
| 340 | + 'status' => $this->get_plugin_status( 'power-coupons/power-coupons.php' ), | |
| 341 | + 'required' => false, | |
| 342 | + 'description' => __( 'Creates advanced discount coupons and smart offers.', 'cartflows' ), | |
| 343 | + 'logo' => 'https://ps.w.org/power-coupons/assets/icon.svg', | |
| 295 | 344 | ), |
| 296 | 345 | array( |
| 297 | - 'name' => 'Spectra', | |
| 298 | - 'slug' => 'ultimate-addons-for-gutenberg', | |
| 299 | - 'status' => $this->get_plugin_status( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ), | |
| 346 | + 'name' => 'WooCommerce Payments', | |
| 347 | + 'slug' => 'woocommerce-payments', | |
| 348 | + 'status' => $this->get_plugin_status( 'woocommerce-payments/woocommerce-payments.php' ), | |
| 349 | + 'required' => false, | |
| 350 | + 'description' => __( 'Accepts credit cards and other payment methods on your checkout.', 'cartflows' ), | |
| 351 | + 'logo' => 'https://ps.w.org/woocommerce-payments/assets/icon-128x128.png', | |
| 300 | 352 | ), |
| 353 | + array( | |
| 354 | + 'name' => 'Spectra', | |
| 355 | + 'slug' => 'ultimate-addons-for-gutenberg', | |
| 356 | + 'status' => $this->get_plugin_status( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ), | |
| 357 | + 'required' => false, | |
| 358 | + 'description' => __( 'Page builder blocks used by the CartFlows checkout templates.', 'cartflows' ), | |
| 359 | + 'logo' => 'https://ps.w.org/ultimate-addons-for-gutenberg/assets/icon-128x128.gif', | |
| 360 | + ), | |
| 301 | 361 | ); |
| 302 | 362 | |
| 303 | 363 | $installed_plugins = get_plugins(); |
| 304 | 364 | |
| @@ -344,33 +404,46 @@ | ||
| 344 | 404 | |
| 345 | 405 | $current_user = wp_get_current_user(); |
| 346 | 406 | |
| 347 | 407 | $vars = array( |
| 348 | - 'current_user_name' => ! empty( $current_user->user_firstname ) ? $current_user->user_firstname : $current_user->display_name, | |
| 349 | - 'current_user_email' => ! empty( $current_user->user_email ) ? $current_user->user_email : '', | |
| 350 | - 'plugins' => $plugins, | |
| 351 | - 'page_builders' => $page_builders, | |
| 352 | - 'active_page_builder' => OnboardingHelper::get_active_supported_builder( $page_builders ), | |
| 353 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 354 | - 'admin_url' => admin_url( 'admin.php' ), | |
| 355 | - 'admin_base_url' => admin_url(), | |
| 356 | - 'admin_index_url' => admin_url( 'index.php' ), | |
| 357 | - 'default_page_builder' => \Cartflows_Helper::get_common_settings()['default_page_builder'], | |
| 358 | - 'site_logo' => $this->get_site_logo_url(), | |
| 359 | - 'template_import_errors' => array( | |
| 408 | + 'current_user_name' => ! empty( $current_user->user_firstname ) ? $current_user->user_firstname : '', | |
| 409 | + 'current_user_email' => ! empty( $current_user->user_email ) ? $current_user->user_email : '', | |
| 410 | + 'plugins' => $plugins, | |
| 411 | + 'page_builders' => $page_builders, | |
| 412 | + 'active_page_builder' => OnboardingHelper::get_active_supported_builder( $page_builders ), | |
| 413 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 414 | + 'admin_url' => admin_url( 'admin.php' ), | |
| 415 | + 'admin_base_url' => admin_url(), | |
| 416 | + 'admin_index_url' => admin_url( 'index.php' ), | |
| 417 | + 'default_page_builder' => \Cartflows_Helper::get_common_settings()['default_page_builder'], | |
| 418 | + 'site_logo' => $this->get_site_logo_url(), | |
| 419 | + 'templates_url' => CARTFLOWS_TEMPLATES_URL, | |
| 420 | + 'template_import_errors' => array( | |
| 360 | 421 | 'api_errors' => array( |
| 361 | 422 | 'title' => __( 'Oops!! Unexpected error occoured', 'cartflows' ), |
| 362 | 423 | 'msg' => __( 'Import template API call failed. Please reload the page and try again!', 'cartflows' ), |
| 363 | 424 | ), |
| 364 | 425 | ), |
| 365 | - 'is_pro' => _is_cartflows_pro(), | |
| 366 | - 'cf_pro_type' => defined( 'CARTFLOWS_PRO_PLUGIN_TYPE' ) ? CARTFLOWS_PRO_PLUGIN_TYPE : 'free', | |
| 367 | - 'woocommerce_status' => $this->get_plugin_status( 'woocommerce/woocommerce.php' ), | |
| 426 | + 'is_store_checkout_imported' => 'yes' === get_option( '_cartflows_wizard_store_checkout_set', 'no' ), | |
| 427 | + 'is_pro' => _is_cartflows_pro(), | |
| 428 | + 'cf_pro_type' => defined( 'CARTFLOWS_PRO_PLUGIN_TYPE' ) ? CARTFLOWS_PRO_PLUGIN_TYPE : 'free', | |
| 429 | + 'woocommerce_status' => $this->get_plugin_status( 'woocommerce/woocommerce.php' ), | |
| 368 | 430 | ); |
| 369 | 431 | |
| 370 | 432 | $vars = apply_filters( 'cartflows_onboarding_localized_vars', $vars ); |
| 371 | 433 | |
| 372 | 434 | wp_localize_script( 'wcf-onboarding-app', 'cartflows_onboarding', $vars ); |
| 435 | + | |
| 436 | + // Satisfies the @Styles/common contract — UTM helpers read from cartflows_admin. | |
| 437 | + wp_localize_script( | |
| 438 | + 'wcf-onboarding-app', | |
| 439 | + 'cartflows_admin', | |
| 440 | + array( | |
| 441 | + 'utm_defaults' => \Cartflows_Helper::get_utm_defaults(), | |
| 442 | + 'cf_domain_url' => CARTFLOWS_DOMAIN_URL, | |
| 443 | + 'cf_upgrade_to_pro_url' => \Cartflows_Helper::get_upgrade_to_pro_link(), | |
| 444 | + ) | |
| 445 | + ); | |
| 373 | 446 | } |
| 374 | 447 | |
| 375 | 448 | /** |
| 376 | 449 | * Get customizer/site logo URL. |