| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Ai\Feature_Intro; |
| 3 |
|
| 4 |
use Elementor\Core\Upgrade\Manager as Upgrade_Manager; |
| 5 |
use Elementor\User; |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; // Exit if accessed directly. |
| 9 |
} |
| 10 |
|
| 11 |
class Product_Image_Unification_Intro { |
| 12 |
|
| 13 |
const RELEASE_VERSION = '3.26.0'; |
| 14 |
|
| 15 |
const CURRENT_POINTER_SLUG = 'e-ai-product-image-unification'; |
| 16 |
|
| 17 |
public static function add_hooks() { |
| 18 |
add_action( 'admin_print_footer_scripts', [ __CLASS__, 'product_image_unification_intro_script' ] ); |
| 19 |
} |
| 20 |
|
| 21 |
public static function product_image_unification_intro_script() { |
| 22 |
if ( static::is_dismissed() ) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
$screen = get_current_screen(); |
| 27 |
if ( ! isset( $screen->post_type ) || 'product' !== $screen->post_type ) { |
| 28 |
return; |
| 29 |
} |
| 30 |
|
| 31 |
wp_enqueue_script( 'wp-pointer' ); |
| 32 |
wp_enqueue_style( 'wp-pointer' ); |
| 33 |
|
| 34 |
$pointer_content = '<h3>' . esc_html__( 'New! Unify pack-shots with Elementor AI', 'elementor' ) . '</h3>'; |
| 35 |
$pointer_content .= '<p>' . esc_html__( 'Now you can process images in bulk and standardized the background and ratio - no manual editing required!', 'elementor' ) . '</p>'; |
| 36 |
|
| 37 |
$pointer_content .= sprintf( |
| 38 |
'<p><button style="padding: 0; border: 0"><a class="button button-primary" href="%s" target="_blank">%s</a></button></p>', |
| 39 |
esc_js( 'https://go.elementor.com/wp-dash-unify-images-learn-more/' ), |
| 40 |
esc_html__( 'Learn more', 'elementor' ) |
| 41 |
); |
| 42 |
|
| 43 |
?> |
| 44 |
<script> |
| 45 |
jQuery( document ).ready( function( $ ) { |
| 46 |
setTimeout( function () { |
| 47 |
$( '#bulk-action-selector-top' ).pointer( { |
| 48 |
content: '<?php echo $pointer_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>', |
| 49 |
position: { |
| 50 |
edge: <?php echo is_rtl() ? "'right'" : "'left'"; ?>, |
| 51 |
align: 'center' |
| 52 |
}, |
| 53 |
pointerWidth: 360, |
| 54 |
close: function () { |
| 55 |
elementorCommon.ajax.addRequest( 'introduction_viewed', { |
| 56 |
data: { |
| 57 |
introductionKey: '<?php echo esc_attr( static::CURRENT_POINTER_SLUG ); ?>', |
| 58 |
}, |
| 59 |
} ); |
| 60 |
} |
| 61 |
} ).pointer( 'open' ); |
| 62 |
}, 10 ); |
| 63 |
} ); |
| 64 |
</script> |
| 65 |
<?php |
| 66 |
} |
| 67 |
|
| 68 |
private static function is_dismissed() { |
| 69 |
return User::get_introduction_meta( static::CURRENT_POINTER_SLUG ); |
| 70 |
} |
| 71 |
} |
| 72 |
|