PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.0-dev3
Elementor Website Builder – more than just a page builder v3.17.0-dev3
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 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | core/admin/admin.php +36 -324 4.2.23.17.0-dev3 View file →
@@ -2,20 +2,18 @@
2 2 namespace Elementor\Core\Admin;
3 3
4 4 use Elementor\Api;
5 5 use Elementor\Beta_Testers;
6 +use Elementor\Core\Admin\Menu\Main as MainMenu;
6 7 use Elementor\App\Modules\Onboarding\Module as Onboarding_Module;
7 8 use Elementor\Core\Base\App;
8 9 use Elementor\Core\Upgrade\Manager as Upgrade_Manager;
9 10 use Elementor\Core\Utils\Assets_Config_Provider;
10 11 use Elementor\Core\Utils\Collection;
11 -use Elementor\Modules\FloatingButtons\Module as Floating_Buttons_Module;
12 12 use Elementor\Plugin;
13 13 use Elementor\Settings;
14 14 use Elementor\User;
15 15 use Elementor\Utils;
16 -use Elementor\Core\Utils\Hints;
17 -use Elementor\Core\DocumentTypes\Page;
18 16
19 17 if ( ! defined( 'ABSPATH' ) ) {
20 18 exit; // Exit if accessed directly.
21 19 }
@@ -38,36 +36,8 @@
38 36 return 'admin';
39 37 }
40 38
41 39 /**
42 - * Check if current page is an Elementor admin page.
43 - *
44 - * @param \WP_Screen|null $current_screen Optional. Screen object to check. Defaults to current screen.
45 - *
46 - * @return bool Whether current page is an Elementor admin page.
47 - */
48 - public static function is_elementor_admin_page( $current_screen = null ) {
49 - if ( ! $current_screen ) {
50 - $current_screen = get_current_screen();
51 - }
52 -
53 - if ( ! $current_screen ) {
54 - return false;
55 - }
56 -
57 - $screen_id = $current_screen->id ?? '';
58 - $post_type = $current_screen->post_type ?? '';
59 -
60 - $is_elementor_screen = strpos( $screen_id, 'elementor' ) !== false
61 - || strpos( $screen_id, Floating_Buttons_Module::CPT_FLOATING_BUTTONS ) !== false;
62 -
63 - $is_elementor_post_type = strpos( $post_type, 'elementor' ) !== false
64 - || strpos( $post_type, Floating_Buttons_Module::CPT_FLOATING_BUTTONS ) !== false;
65 -
66 - return $is_elementor_screen || $is_elementor_post_type;
67 - }
68 -
69 - /**
70 40 * @since 2.2.0
71 41 * @access public
72 42 */
73 43 public function maybe_redirect_to_getting_started() {
@@ -111,9 +81,9 @@
111 81 ->set_path_resolver( function ( $name ) {
112 82 return ELEMENTOR_ASSETS_PATH . "js/packages/{$name}/{$name}.asset.php";
113 83 } );
114 84
115 - Collection::make( [ 'ui', 'icons', 'query' ] )
85 + Collection::make( [ 'ui', 'icons' ] )
116 86 ->each( function( $package ) use ( $assets_config_provider ) {
117 87 $suffix = Utils::is_script_debug() ? '' : '.min';
118 88 $config = $assets_config_provider->load( $package )->get( $package );
119 89
@@ -179,10 +149,8 @@
179 149 wp_enqueue_script( 'elementor-admin' );
180 150
181 151 wp_set_script_translations( 'elementor-admin', 'elementor' );
182 152
183 - $this->maybe_enqueue_hints();
184 -
185 153 $this->print_config();
186 154 }
187 155
188 156 /**
@@ -195,11 +163,13 @@
195 163 * @since 1.0.0
196 164 * @access public
197 165 */
198 166 public function enqueue_styles() {
167 + $direction_suffix = is_rtl() ? '-rtl' : '';
168 +
199 169 wp_register_style(
200 170 'elementor-admin',
201 - $this->get_css_assets_url( 'admin' ),
171 + $this->get_css_assets_url( 'admin' . $direction_suffix ),
202 172 [
203 173 'elementor-common',
204 174 ],
205 175 ELEMENTOR_VERSION
@@ -371,15 +341,10 @@
371 341 $settings_link = sprintf( '<a href="%1$s">%2$s</a>', admin_url( 'admin.php?page=' . Settings::PAGE_ID ), esc_html__( 'Settings', 'elementor' ) );
372 342
373 343 array_unshift( $links, $settings_link );
374 344
375 - $go_pro_text = esc_html__( 'Get Elementor Pro', 'elementor' );
376 - if ( Utils::is_sale_time() ) {
377 - $go_pro_text = esc_html__( 'Sale! Upgrade Now', 'elementor' );
378 - }
345 + $links['go_pro'] = sprintf( '<a href="%1$s" target="_blank" class="elementor-plugins-gopro">%2$s</a>', 'https://go.elementor.com/go-pro-wp-plugins/', esc_html__( 'Get Elementor Pro', 'elementor' ) );
379 346
380 - $links['go_pro'] = sprintf( '<a href="%1$s" target="_blank" class="elementor-plugins-gopro">%2$s</a>', 'https://go.elementor.com/go-pro-wp-plugins/', $go_pro_text );
381 -
382 347 return $links;
383 348 }
384 349
385 350 /**
@@ -401,10 +366,10 @@
401 366 */
402 367 public function plugin_row_meta( $plugin_meta, $plugin_file ) {
403 368 if ( ELEMENTOR_PLUGIN_BASE === $plugin_file ) {
404 369 $row_meta = [
405 - 'docs' => '<a href="https://go.elementor.com/docs-admin-plugins/" aria-label="' . esc_attr__( 'View Elementor Documentation', 'elementor' ) . '" target="_blank">' . esc_html__( 'Docs & FAQs', 'elementor' ) . '</a>',
406 - 'ideo' => '<a href="https://go.elementor.com/yt-admin-plugins/" aria-label="' . esc_attr__( 'View Elementor Video Tutorials', 'elementor' ) . '" target="_blank">' . esc_html__( 'Video Tutorials', 'elementor' ) . '</a>',
370 + 'docs' => '<a href="https://go.elementor.com/docs-admin-plugins/" aria-label="' . esc_attr( esc_html__( 'View Elementor Documentation', 'elementor' ) ) . '" target="_blank">' . esc_html__( 'Docs & FAQs', 'elementor' ) . '</a>',
371 + 'ideo' => '<a href="https://go.elementor.com/yt-admin-plugins/" aria-label="' . esc_attr( esc_html__( 'View Elementor Video Tutorials', 'elementor' ) ) . '" target="_blank">' . esc_html__( 'Video Tutorials', 'elementor' ) . '</a>',
407 372 ];
408 373
409 374 $plugin_meta = array_merge( $plugin_meta, $row_meta );
410 375 }
@@ -431,9 +396,9 @@
431 396 $is_elementor_screen = ( $current_screen && false !== strpos( $current_screen->id, 'elementor' ) );
432 397
433 398 if ( $is_elementor_screen ) {
434 399 $footer_text = sprintf(
435 - /* translators: 1: Elementor, 2: Link to plugin review */
400 + /* translators: 1: Elementor, 2: Link to plugin review */
436 401 __( 'Enjoyed %1$s? Please leave us a %2$s rating. We really appreciate your support!', 'elementor' ),
437 402 '<strong>' . esc_html__( 'Elementor', 'elementor' ) . '</strong>',
438 403 '<a href="https://go.elementor.com/admin-review/" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
439 404 );
@@ -508,9 +473,9 @@
508 473 ?>
509 474 <div class="e-overview__header">
510 475 <?php if ( $show_versions ) { ?>
511 476 <div class="e-overview__logo">
512 - <div class="e-logo-wrapper"><i class="eicon-elementor-circle"></i></div>
477 + <div class="e-logo-wrapper"><i class="eicon-elementor"></i></div>
513 478 </div>
514 479 <div class="e-overview__versions">
515 480 <span class="e-overview__version"><?php echo esc_html__( 'Elementor', 'elementor' ); ?> v<?php echo ELEMENTOR_VERSION; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
516 481 <?php
@@ -537,9 +502,9 @@
537 502 * Displays the Elementor dashboard widget - recently edited section.
538 503 * Fired by `elementor_dashboard_overview_widget` function.
539 504 *
540 505 * @param array $args
541 - * @param bool $show_heading
506 + * @param bool $show_heading
542 507 *
543 508 * @return void
544 509 * @since 3.12.0
545 510 */
@@ -559,9 +524,9 @@
559 524
560 525 $date = date_i18n( _x( 'M jS', 'Dashboard Overview Widget Recently Date', 'elementor' ), get_the_modified_time( 'U' ) );
561 526 ?>
562 527 <li class="e-overview__post">
563 - <a href="<?php echo esc_url( $document->get_edit_url() ); ?>" class="e-overview__post-link"><?php echo esc_html( get_the_title() ); ?>
528 + <a href="<?php echo esc_attr( $document->get_edit_url() ); ?>" class="e-overview__post-link"><?php echo esc_html( get_the_title() ); ?>
564 529 <span class="dashicons dashicons-edit"></span></a>
565 530 <span><?php echo $date; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>, <?php the_modified_time(); ?></span>
566 531 </li>
567 532 <?php } ?>
@@ -573,9 +538,9 @@
573 538 /**
574 539 * Displays the Elementor dashboard widget - news and updates section.
575 540 * Fired by `elementor_dashboard_overview_widget` function.
576 541 *
577 - * @param int $limit_feed
542 + * @param int $limit_feed
578 543 * @param bool $show_heading
579 544 *
580 545 * @return void
581 546 * @since 3.12.0
@@ -620,9 +585,9 @@
620 585 <div class="e-overview__footer e-divider_top">
621 586 <ul>
622 587 <?php foreach ( self::static_get_dashboard_overview_widget_footer_actions() as $action_id => $action ) { ?>
623 588 <li class="e-overview__<?php echo esc_attr( $action_id ); ?>">
624 - <a href="<?php echo esc_url( $action['link'] ); ?>" target="_blank"><?php echo esc_html( $action['title'] ); ?>
589 + <a href="<?php echo esc_attr( $action['link'] ); ?>" target="_blank"><?php echo esc_html( $action['title'] ); ?>
625 590 <span class="screen-reader-text"><?php echo esc_html__( '(opens in a new window)', 'elementor' ); ?></span>
626 591 <span aria-hidden="true" class="dashicons dashicons-external"></span></a>
627 592 </li>
628 593 <?php } ?>
@@ -650,18 +615,22 @@
650 615 'link' => 'https://go.elementor.com/overview-widget-docs/',
651 616 ],
652 617 ];
653 618
654 - $additions_actions = [];
655 - $additions_actions['ai'] = [
656 - 'title' => esc_html__( 'Build Smart with AI', 'elementor' ),
657 - 'link' => 'https://go.elementor.com/overview-widget-ai/',
619 + $additions_actions = [
620 + 'go-pro' => [
621 + 'title' => esc_html__( 'Upgrade', 'elementor' ),
622 + 'link' => 'https://go.elementor.com/go-pro-wp-overview-widget/',
623 + ],
658 624 ];
659 - $additions_actions['go-pro'] = [
660 - 'title' => esc_html__( 'Upgrade', 'elementor' ),
661 - 'link' => 'https://go.elementor.com/go-pro-wp-overview-widget/',
662 - ];
663 625
626 + if ( ! User::get_introduction_meta( 'ai_get_started' ) ) {
627 + $additions_actions['ai'] = [
628 + 'title' => esc_html__( 'Build Smart with AI', 'elementor' ),
629 + 'link' => 'https://go.elementor.com/overview-widget-ai/',
630 + ];
631 + }
632 +
664 633 /**
665 634 * Dashboard widget footer actions.
666 635 *
667 636 * Filters the additions actions displayed in Elementor dashboard widget.
@@ -718,10 +687,8 @@
718 687 }
719 688
720 689 $post_data = Utils::get_super_global_value( $_GET, 'post_data' ) ?? [];
721 690
722 - $post_data = $this->filter_post_data( $post_data );
723 -
724 691 /**
725 692 * Create new post meta data.
726 693 *
727 694 * Filters the meta data of any new post created.
@@ -745,115 +712,14 @@
745 712 if ( is_wp_error( $document ) ) {
746 713 wp_die( $document ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
747 714 }
748 715
749 - wp_safe_redirect( $document->get_edit_url() );
716 + wp_redirect( $document->get_edit_url() );
750 717
751 718 die;
752 719 }
753 720
754 - public function admin_action_site_settings_redirect() {
755 - check_admin_referer( 'elementor_action_site_settings_redirect' );
756 -
757 - if ( ! current_user_can( 'edit_theme_options' ) ) {
758 - wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'elementor' ) );
759 - }
760 -
761 - $active_tab = filter_input( INPUT_GET, 'active-tab', FILTER_SANITIZE_ENCODED );
762 -
763 - $site_settings_url_config = Page::get_site_settings_url_config( $active_tab );
764 -
765 - if ( empty( $site_settings_url_config['url'] ) ) {
766 - wp_die( esc_html__( 'Unable to create or access Site Settings page.', 'elementor' ) );
767 - }
768 -
769 - wp_safe_redirect( $site_settings_url_config['url'] );
770 -
771 - die;
772 - }
773 -
774 721 /**
775 - * Admin action edit website.
776 - *
777 - * Redirects to the homepage edit URL if it exists and is built with Elementor,
778 - * otherwise redirects to create a new page.
779 - *
780 - * Fired by `admin_action_elementor_edit_website` action.
781 - *
782 - * @since 3.x.x
783 - * @access public
784 - */
785 - public function admin_action_edit_website_redirect() {
786 - check_admin_referer( 'elementor_action_edit_website' );
787 -
788 - if ( ! User::is_current_user_can_edit_post_type( 'page' ) ) {
789 - wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'elementor' ) );
790 - }
791 -
792 - $homepage_id = $this->get_homepage_id();
793 - $edit_url = $this->get_edit_website_url( $homepage_id );
794 -
795 - wp_safe_redirect( $edit_url );
796 -
797 - die;
798 - }
799 -
800 - private function get_homepage_id(): ?int {
801 - if ( get_option( 'show_on_front' ) !== 'page' ) {
802 - return null;
803 - }
804 -
805 - $homepage_id = get_option( 'page_on_front' );
806 -
807 - return $homepage_id ? (int) $homepage_id : null;
808 - }
809 -
810 - private function get_edit_website_url( ?int $homepage_id ): string {
811 - if ( ! $homepage_id ) {
812 - return Plugin::$instance->documents->get_create_new_post_url( 'page' );
813 - }
814 -
815 - $document = Plugin::$instance->documents->get( $homepage_id );
816 -
817 - if ( ! $document || ! $document->is_built_with_elementor() ) {
818 - return Plugin::$instance->documents->get_create_new_post_url( 'page' );
819 - }
820 -
821 - return $document->get_edit_url();
822 - }
823 -
824 - private function get_allowed_fields_for_role() {
825 - $allowed_fields = [
826 - 'post_title',
827 - 'post_content',
828 - 'post_excerpt',
829 - 'post_category',
830 - 'post_type',
831 - 'tags_input',
832 - ];
833 -
834 - if ( current_user_can( 'publish_posts' ) ) {
835 - $allowed_fields[] = 'post_status';
836 - }
837 -
838 - if ( current_user_can( 'edit_others_posts' ) ) {
839 - $allowed_fields[] = 'post_author';
840 - }
841 -
842 - return $allowed_fields;
843 - }
844 -
845 - private function filter_post_data( $post_data ) {
846 - $allowed_fields = $this->get_allowed_fields_for_role();
847 - return array_filter(
848 - $post_data,
849 - function( $key ) use ( $allowed_fields ) {
850 - return in_array( $key, $allowed_fields, true );
851 - },
852 - ARRAY_FILTER_USE_KEY
853 - );
854 - }
855 - /**
856 722 * @since 2.3.0
857 723 * @access public
858 724 */
859 725 public function add_new_template_template() {
@@ -859,31 +725,13 @@
859 725 public function add_new_template_template() {
860 726 Plugin::$instance->common->add_template( ELEMENTOR_PATH . 'includes/admin-templates/new-template.php' );
861 727 }
862 728
863 - public function add_new_floating_elements_template() {
864 - Plugin::$instance->common->add_template( ELEMENTOR_PATH . 'includes/admin-templates/new-floating-elements.php' );
865 - }
866 -
867 - public function enqueue_new_floating_elements_scripts() {
868 - $suffix = Utils::is_script_debug() ? '' : '.min';
869 -
870 - wp_enqueue_script(
871 - 'elementor-floating-elements-modal',
872 - ELEMENTOR_ASSETS_URL . 'js/floating-elements-modal' . $suffix . '.js',
873 - [],
874 - ELEMENTOR_VERSION,
875 - true
876 - );
877 -
878 - wp_set_script_translations( 'elementor-floating-elements-modal', 'elementor' );
879 - }
880 -
881 729 /**
882 730 * @access public
883 731 */
884 732 public function enqueue_new_template_scripts() {
885 - $suffix = Utils::is_script_debug() ? '' : '.min';
733 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
886 734
887 735 wp_enqueue_script(
888 736 'elementor-new-template',
889 737 ELEMENTOR_ASSETS_URL . 'js/new-template' . $suffix . '.js',
@@ -906,9 +754,9 @@
906 754 /**
907 755 * @access public
908 756 */
909 757 public function enqueue_beta_tester_scripts() {
910 - $suffix = Utils::is_script_debug() ? '' : '.min';
758 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
911 759
912 760 wp_enqueue_script(
913 761 'elementor-beta-tester',
914 762 ELEMENTOR_ASSETS_URL . 'js/beta-tester' . $suffix . '.js',
@@ -919,22 +767,8 @@
919 767
920 768 wp_set_script_translations( 'elementor-beta-tester', 'elementor' );
921 769 }
922 770
923 - public function init_floating_elements() {
924 - $screens = [
925 - 'elementor_library_page_e-floating-buttons' => true,
926 - 'edit-e-floating-buttons' => true,
927 - ];
928 -
929 - if ( ! isset( $screens[ get_current_screen()->id ] ) ) {
930 - return;
931 - }
932 -
933 - add_action( 'admin_head', [ $this, 'add_new_floating_elements_template' ] );
934 - add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_new_floating_elements_scripts' ] );
935 - }
936 -
937 771 /**
938 772 * @access public
939 773 */
940 774 public function init_new_template() {
@@ -966,9 +800,9 @@
966 800 </div>
967 801 <div class="e-major-update-warning__message">
968 802 <?php
969 803 printf(
970 - /* translators: %1$s Link open tag, %2$s: Link close tag. */
804 + /* translators: %1$s Link open tag, %2$s: Link close tag. */
971 805 esc_html__( 'The latest update includes some substantial changes across different areas of the plugin. We highly recommend you %1$sbackup your site before upgrading%2$s, and make sure you first update in a staging environment', 'elementor' ),
972 806 '<a href="https://go.elementor.com/wp-dash-update-backup/">',
973 807 '</a>'
974 808 );
@@ -1002,8 +836,12 @@
1002 836
1003 837 $this->add_component( 'feedback', new Feedback() );
1004 838 $this->add_component( 'admin-notices', new Admin_Notices() );
1005 839
840 + if ( Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
841 + $this->register_menu();
842 + }
843 +
1006 844 add_action( 'admin_init', [ $this, 'maybe_redirect_to_getting_started' ] );
1007 845
1008 846 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
1009 847 add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_styles' ] );
@@ -1023,20 +861,15 @@
1023 861 add_action( 'wp_dashboard_setup', [ $this, 'register_dashboard_widgets' ] );
1024 862
1025 863 // Admin Actions
1026 864 add_action( 'admin_action_elementor_new_post', [ $this, 'admin_action_new_post' ] );
1027 - add_action( 'admin_action_elementor_site_settings_redirect', [ $this, 'admin_action_site_settings_redirect' ] );
1028 - add_action( 'admin_action_elementor_edit_website_redirect', [ $this, 'admin_action_edit_website_redirect' ] );
1029 865
1030 866 add_action( 'current_screen', [ $this, 'init_new_template' ] );
1031 - add_action( 'current_screen', [ $this, 'init_floating_elements' ] );
1032 867 add_action( 'current_screen', [ $this, 'init_beta_tester' ] );
1033 868
1034 869 add_action( 'in_plugin_update_message-' . ELEMENTOR_PLUGIN_BASE, function( $plugin_data ) {
1035 870 $this->version_update_warning( ELEMENTOR_VERSION, $plugin_data['new_version'] );
1036 871 } );
1037 -
1038 - add_action( 'elementor/ajax/register_actions', [ $this, 'register_ajax_hints' ] );
1039 872 }
1040 873
1041 874 /**
1042 875 * @since 2.3.0
@@ -1052,10 +885,8 @@
1052 885 'home_url' => home_url(),
1053 886 'settings_url' => Settings::get_url(),
1054 887 'user' => [
1055 888 'introduction' => User::get_introduction_meta(),
1056 - 'restrictions' => Plugin::$instance->role_manager->get_user_restrictions_array(),
1057 - 'is_administrator' => current_user_can( 'manage_options' ),
1058 889 ],
1059 890 'beta_tester' => [
1060 891 'beta_tester_signup' => Beta_Testers::BETA_TESTER_SIGNUP,
1061 892 'has_email' => $beta_tester_email,
@@ -1104,127 +935,8 @@
1104 935 ];
1105 936 } )->all();
1106 937 }
1107 938
1108 - private function maybe_enqueue_hints() {
1109 - $plugin_slug = 'image-optimization';
1110 -
1111 - if ( ! Hints::should_display_hint( $plugin_slug ) ) {
1112 - return;
1113 - }
1114 -
1115 - wp_register_script(
1116 - 'media-hints',
1117 - $this->get_js_assets_url( 'media-hints' ),
1118 - [],
1119 - ELEMENTOR_VERSION,
1120 - true
1121 - );
1122 -
1123 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
1124 - $is_installed = Hints::is_plugin_installed( $plugin_slug );
1125 - $is_active = Hints::is_plugin_active( $plugin_slug );
1126 -
1127 - if ( $is_active ) {
1128 - return;
1129 - }
1130 -
1131 - if ( $one_subscription ) {
1132 - if ( ! $is_installed ) {
1133 - $description = esc_html__( 'Automatically optimize images to improve site speed and performance. Included with your ONE subscription.', 'elementor' );
1134 - $button_text = esc_html__( 'Install now', 'elementor' );
1135 - $button_url = Hints::get_plugin_install_url( $plugin_slug );
1136 - } elseif ( ! $is_active ) {
1137 - $description = esc_html__( 'Image Optimization is installed and included in your ONE subscription. Activate it to optimize images and improve site performance.', 'elementor' );
1138 - $button_text = esc_html__( 'Activate now', 'elementor' );
1139 - $button_url = Hints::get_plugin_activate_url( $plugin_slug );
1140 - }
1141 - } else {
1142 - $description = esc_html__( 'Optimize your images to enhance site performance by using Image Optimization.', 'elementor' );
1143 - if ( ! $is_installed ) {
1144 - $button_text = esc_html__( 'Install now', 'elementor' );
1145 - $button_url = Hints::get_plugin_install_url( $plugin_slug );
1146 - } elseif ( ! $is_active ) {
1147 - $button_text = esc_html__( 'Activate now', 'elementor' );
1148 - $button_url = Hints::get_plugin_activate_url( $plugin_slug );
1149 - }
1150 - }
1151 -
1152 - $dismissible = 'image_optimizer_hint';
1153 -
1154 - $title = esc_html__( 'Speed up your website with Image Optimization', 'elementor' );
1155 - $content = sprintf(
1156 - "<strong>%1\$s</strong><br>%2\$s <a class='e-btn-1' href='%3\$s' target='_blank'>%4\$s</a>!",
1157 - $title,
1158 - $description,
1159 - $button_url,
1160 - $button_text
1161 - );
1162 -
1163 - wp_localize_script( 'media-hints', 'elementorAdminHints', [
1164 - 'mediaHint' => [
1165 - 'display' => true,
1166 - 'type' => 'info',
1167 - 'content' => $content,
1168 - 'icon' => true,
1169 - 'dismissible' => $dismissible,
1170 - 'dismiss' => esc_attr__( 'Dismiss this notice.', 'elementor' ),
1171 - 'button_event' => $dismissible,
1172 - 'button_data' => base64_encode(
1173 - wp_json_encode( [
1174 - 'action_url' => $button_url,
1175 - ] ),
1176 - ),
1177 - ],
1178 - ] );
1179 -
1180 - wp_enqueue_script( 'media-hints' );
1181 - }
1182 -
1183 - public function register_ajax_hints( $ajax_manager ) {
1184 - $ajax_manager->register_ajax_action( 'elementor_image_optimization_campaign', [ $this, 'ajax_set_image_optimization_campaign' ] );
1185 - $ajax_manager->register_ajax_action( 'elementor_core_site_mailer_campaign', [ $this, 'ajax_site_mailer_campaign' ] );
1186 - $ajax_manager->register_ajax_action( 'elementor_core_ally_campaign', [ $this, 'ajax_ally_campaign' ] );
1187 - }
1188 -
1189 - public function ajax_ally_campaign( $request ) {
1190 - if ( ! current_user_can( 'install_plugins' ) ) {
1191 - return;
1192 - }
1193 -
1194 - $campaign_data = [
1195 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1196 - 'source' => sanitize_key( $request['source'] ?? '' ),
1197 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1198 - ];
1199 -
1200 - set_transient( 'elementor_ea11y_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1201 - }
1202 -
1203 - public function ajax_set_image_optimization_campaign( $request ) {
1204 - if ( ! current_user_can( 'install_plugins' ) ) {
1205 - return;
1206 - }
1207 -
1208 - $campaign_data = [
1209 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1210 - 'source' => sanitize_key( $request['source'] ?? '' ),
1211 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1212 - ];
1213 -
1214 - set_transient( 'elementor_image_optimization_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1215 - }
1216 -
1217 - public function ajax_site_mailer_campaign( $request ) {
1218 - if ( ! current_user_can( 'install_plugins' ) ) {
1219 - return;
1220 - }
1221 -
1222 - $campaign_data = [
1223 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1224 - 'source' => sanitize_key( $request['source'] ?? '' ),
1225 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1226 - ];
1227 -
1228 - set_transient( 'elementor_site_mailer_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
939 + private function register_menu() {
940 + $this->menus['main'] = new MainMenu();
1229 941 }
1230 942 }