base || 'settings_page_imagify-network' === $current_screen->base ) ) { wp_enqueue_script( 'imagify-js-chart' ); wp_enqueue_script( 'imagify-js-event-move' ); wp_enqueue_script( 'imagify-js-twentytwenty' ); wp_enqueue_script( 'imagify-js-options' ); wp_enqueue_style( 'imagify-css-twentytwenty' ); $options_data = get_imagify_localize_script_translations( 'options' ); wp_localize_script( 'imagify-js-options', 'imagifyOptions', $options_data ); } /** * Scripts loaded in /wp-admin/upload.php and post.php */ if ( isset( $current_screen ) && ( 'upload' === $current_screen->base || 'post' === $current_screen->base ) ) { $upload_data = get_imagify_localize_script_translations( 'upload' ); wp_localize_script( 'imagify-js-upload', 'imagifyUpload', $upload_data ); wp_enqueue_script( 'imagify-js-chart' ); wp_enqueue_script( 'imagify-js-upload' ); } /** * Scripts loaded in: * /wp-admin/post.php (for attachment post type) * /wp-admin/upload.php (for attachments list) * */ if ( isset( $current_screen ) && ( ('post' === $current_screen->base && 'attachment' === $current_screen->post_type ) || 'upload' === $current_screen->base ) ) { wp_localize_script( 'imagify-js-twentytwenty', 'imagifyTTT', get_imagify_localize_script_translations( 'twentytwenty' ) ); wp_enqueue_script( 'imagify-js-chart' ); wp_enqueue_script( 'imagify-js-event-move' ); wp_enqueue_script( 'imagify-js-twentytwenty' ); wp_enqueue_style( 'imagify-css-twentytwenty' ); } /** * Scripts loaded in /wp-admin/upload.php?page=imagify-bulk-optimization */ if ( isset( $current_screen ) && 'media_page_imagify-bulk-optimization' === $current_screen->base ) { wp_enqueue_script( 'heartbeat' ); $bulk_data = get_imagify_localize_script_translations( 'bulk' ); $bulk_data['heartbeat_id'] = 'update_bulk_data'; $bulk_data['ajax_action'] = 'imagify_get_unoptimized_attachment_ids'; $bulk_data['ajax_context'] = 'wp'; wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data ); wp_enqueue_script( 'imagify-js-chart' ); wp_enqueue_script( 'imagify-js-async' ); wp_enqueue_script( 'imagify-js-bulk' ); } } /** * Add Intercom on Options page an Bulk Optimization * * @since 1.0 */ add_action( 'admin_footer-media_page_imagify-bulk-optimization', '_imagify_admin_print_intercom' ); add_action( 'admin_footer-settings_page_imagify', '_imagify_admin_print_intercom' ); function _imagify_admin_print_intercom() { $user = get_imagify_user(); if ( ! imagify_valid_key() || empty( $user->is_intercom ) ) { return; } ?> base && 'attachment' === $current_screen->post_type ) { wp_dequeue_script( 'yoast-seo' ); wp_deregister_script( 'yoast-seo' ); } }