PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.1
Elementor Website Builder – more than just a page builder v3.30.1
4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 All 456 releases
← All changes | modules/ai/module.php +49 -2 4.3.3 → 3.30.1 View file →
@@ -4,8 +4,9 @@
4 4 use Elementor\Controls_Manager;
5 5 use Elementor\Core\Base\Module as BaseModule;
6 6 use Elementor\Core\Common\Modules\Connect\Module as ConnectModule;
7 7 use Elementor\Element_Base;
8 +use Elementor\Modules\Ai\Feature_Intro\Product_Image_Unification_Intro;
8 9 use Elementor\Plugin;
9 10 use Elementor\Core\Utils\Collection;
10 11 use Elementor\Modules\Ai\Connect\Ai;
11 12 use Elementor\User;
@@ -27,8 +28,10 @@
27 28 self::HISTORY_TYPE_CODE,
28 29 self::HISTORY_TYPE_IMAGE,
29 30 self::HISTORY_TYPE_BLOCK,
30 31 ];
32 + const MIN_PAGES_FOR_CREATE_WITH_AI_BANNER = 10;
33 +
31 34 public function get_name() {
32 35 return 'ai';
33 36 }
34 37
@@ -45,8 +48,10 @@
45 48 if ( ! $this->is_ai_enabled() ) {
46 49 return;
47 50 }
48 51
52 + add_filter( 'elementor/core/admin/homescreen', [ $this, 'add_create_with_ai_banner_to_homescreen' ] );
53 +
49 54 add_action( 'elementor/connect/apps/register', function ( ConnectModule $connect_module ) {
50 55 $connect_module->register_app( 'ai', Ai::get_class_name() );
51 56 } );
52 57
@@ -119,8 +124,9 @@
119 124 add_action( 'admin_init', [ $this, 'enqueue_ai_products_page_scripts' ] );
120 125 add_action( 'current_screen', [ $this, 'enqueue_ai_single_product_page_scripts' ] );
121 126 add_action( 'wp_ajax_elementor-ai-get-product-images', [ $this, 'get_product_images_ajax' ] );
122 127 add_action( 'wp_ajax_elementor-ai-set-product-images', [ $this, 'set_product_images_ajax' ] );
128 + Product_Image_Unification_Intro::add_hooks();
123 129 }
124 130 }
125 131
126 132 add_action( 'enqueue_block_editor_assets', function() {
@@ -1105,10 +1111,8 @@
1105 1111 ];
1106 1112 }
1107 1113
1108 1114 public function ajax_ai_upload_image( $data ) {
1109 - $this->verify_upload_permissions( $data );
1110 -
1111 1115 if ( empty( $data['image'] ) ) {
1112 1116 throw new \Exception( 'Missing image data' );
1113 1117 }
1114 1118
@@ -1543,6 +1547,49 @@
1543 1547 }
1544 1548
1545 1549 $product->set_gallery_image_ids( $gallery_image_ids );
1546 1550 $product->save();
1551 + }
1552 +
1553 + private function should_display_create_with_ai_banner() {
1554 + $elementor_pages = new \WP_Query( [
1555 + 'post_type' => 'page',
1556 + 'post_status' => 'publish',
1557 + 'fields' => 'ids',
1558 + 'posts_per_page' => self::MIN_PAGES_FOR_CREATE_WITH_AI_BANNER + 1,
1559 + ] );
1560 +
1561 + if ( $elementor_pages->post_count > self::MIN_PAGES_FOR_CREATE_WITH_AI_BANNER ) {
1562 + return false;
1563 + }
1564 +
1565 + if ( Utils::is_custom_kit_applied() ) {
1566 + return false;
1567 + }
1568 +
1569 + return true;
1570 + }
1571 +
1572 + private function get_create_with_ai_banner_data() {
1573 + return [
1574 + 'title' => 'Create and launch your site faster with AI',
1575 + 'description' => 'Share your vision with our AI Chat and watch as it becomes a brief, sitemap, and wireframes in minutes:',
1576 + 'input_placeholder' => 'Start describing the site you want to create...',
1577 + 'button_title' => 'Create with AI',
1578 + 'button_cta_url' => 'http://planner.elementor.com/chat.html',
1579 + 'background_image' => ELEMENTOR_ASSETS_URL . 'images/app/ai/ai-site-creator-homepage-bg.svg',
1580 + 'utm_source' => 'editor-home',
1581 + 'utm_medium' => 'wp-dash',
1582 + 'utm_campaign' => 'generate-with-ai',
1583 + ];
1584 + }
1585 +
1586 + public function add_create_with_ai_banner_to_homescreen( $home_screen_data ) {
1587 + if ( $this->should_display_create_with_ai_banner() ) {
1588 + $home_screen_data['create_with_ai'] = $this->get_create_with_ai_banner_data();
1589 + } else {
1590 + $home_screen_data['create_with_ai'] = null;
1591 + }
1592 +
1593 + return $home_screen_data;
1547 1594 }
1548 1595 }