PluginProbe
Elementor Website Builder – more than just a page builder / 3.25.2
Elementor Website Builder – more than just a page builder v3.25.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 4.1.0-dev2 4.0.8 All 454 releases
← All changes | core/admin/admin.php +57 -211 4.3.13.25.2 View file →
@@ -2,20 +2,19 @@
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 16 use Elementor\Core\Utils\Hints;
17 -use Elementor\Core\DocumentTypes\Page;
18 17
19 18 if ( ! defined( 'ABSPATH' ) ) {
20 19 exit; // Exit if accessed directly.
21 20 }
@@ -38,36 +37,8 @@
38 37 return 'admin';
39 38 }
40 39
41 40 /**
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 41 * @since 2.2.0
71 42 * @access public
72 43 */
73 44 public function maybe_redirect_to_getting_started() {
@@ -195,11 +166,13 @@
195 166 * @since 1.0.0
196 167 * @access public
197 168 */
198 169 public function enqueue_styles() {
170 + $direction_suffix = is_rtl() ? '-rtl' : '';
171 +
199 172 wp_register_style(
200 173 'elementor-admin',
201 - $this->get_css_assets_url( 'admin' ),
174 + $this->get_css_assets_url( 'admin' . $direction_suffix ),
202 175 [
203 176 'elementor-common',
204 177 ],
205 178 ELEMENTOR_VERSION
@@ -242,10 +215,10 @@
242 215 <div id="elementor-switch-mode">
243 216 <input id="elementor-switch-mode-input" type="hidden" name="_elementor_post_mode" value="<?php echo esc_attr( $document->is_built_with_elementor() ); ?>" />
244 217 <button id="elementor-switch-mode-button" type="button" class="button button-primary button-hero">
245 218 <span class="elementor-switch-mode-on">
246 - <i class="eicon-wordpress" aria-hidden="true"></i>
247 - <?php echo esc_html__( 'Edit with WordPress', 'elementor' ); ?>
219 + <i class="eicon-arrow-<?php echo ( is_rtl() ) ? 'right' : 'left'; ?>" aria-hidden="true"></i>
220 + <?php echo esc_html__( 'Back to WordPress Editor', 'elementor' ); ?>
248 221 </span>
249 222 <span class="elementor-switch-mode-off">
250 223 <i class="eicon-elementor-square" aria-hidden="true"></i>
251 224 <?php echo esc_html__( 'Edit with Elementor', 'elementor' ); ?>
@@ -373,9 +346,9 @@
373 346 array_unshift( $links, $settings_link );
374 347
375 348 $go_pro_text = esc_html__( 'Get Elementor Pro', 'elementor' );
376 349 if ( Utils::is_sale_time() ) {
377 - $go_pro_text = esc_html__( 'Sale! Upgrade Now', 'elementor' );
350 + $go_pro_text = esc_html__( 'Discounted Upgrades Now!', 'elementor' );
378 351 }
379 352
380 353 $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 354
@@ -401,10 +374,10 @@
401 374 */
402 375 public function plugin_row_meta( $plugin_meta, $plugin_file ) {
403 376 if ( ELEMENTOR_PLUGIN_BASE === $plugin_file ) {
404 377 $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>',
378 + '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>',
379 + '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 380 ];
408 381
409 382 $plugin_meta = array_merge( $plugin_meta, $row_meta );
410 383 }
@@ -427,13 +400,8 @@
427 400 * @return string The content that will be printed.
428 401 */
429 402 public function admin_footer_text( $footer_text ) {
430 403 $current_screen = get_current_screen();
431 -
432 - if ( $current_screen && str_ends_with( $current_screen->id, 'elementor-mcp' ) ) {
433 - return $footer_text;
434 - }
435 -
436 404 $is_elementor_screen = ( $current_screen && false !== strpos( $current_screen->id, 'elementor' ) );
437 405
438 406 if ( $is_elementor_screen ) {
439 407 $footer_text = sprintf(
@@ -513,9 +481,9 @@
513 481 ?>
514 482 <div class="e-overview__header">
515 483 <?php if ( $show_versions ) { ?>
516 484 <div class="e-overview__logo">
517 - <div class="e-logo-wrapper"><i class="eicon-elementor-circle"></i></div>
485 + <div class="e-logo-wrapper"><i class="eicon-elementor"></i></div>
518 486 </div>
519 487 <div class="e-overview__versions">
520 488 <span class="e-overview__version"><?php echo esc_html__( 'Elementor', 'elementor' ); ?> v<?php echo ELEMENTOR_VERSION; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
521 489 <?php
@@ -542,9 +510,9 @@
542 510 * Displays the Elementor dashboard widget - recently edited section.
543 511 * Fired by `elementor_dashboard_overview_widget` function.
544 512 *
545 513 * @param array $args
546 - * @param bool $show_heading
514 + * @param bool $show_heading
547 515 *
548 516 * @return void
549 517 * @since 3.12.0
550 518 */
@@ -578,9 +546,9 @@
578 546 /**
579 547 * Displays the Elementor dashboard widget - news and updates section.
580 548 * Fired by `elementor_dashboard_overview_widget` function.
581 549 *
582 - * @param int $limit_feed
550 + * @param int $limit_feed
583 551 * @param bool $show_heading
584 552 *
585 553 * @return void
586 554 * @since 3.12.0
@@ -656,12 +624,21 @@
656 624 ],
657 625 ];
658 626
659 627 $additions_actions = [];
660 - $additions_actions['ai'] = [
661 - 'title' => esc_html__( 'Build Smart with AI', 'elementor' ),
662 - 'link' => 'https://go.elementor.com/overview-widget-ai/',
663 - ];
628 +
629 + if ( User::get_introduction_meta( 'ai_get_started' ) ) {
630 + $additions_actions['ai-library'] = [
631 + 'title' => esc_html__( 'AI Prompts Library', 'elementor' ),
632 + 'link' => 'https://go.elementor.com/overview-ai-prompts-library/',
633 + ];
634 + } else {
635 + $additions_actions['ai'] = [
636 + 'title' => esc_html__( 'Build Smart with AI', 'elementor' ),
637 + 'link' => 'https://go.elementor.com/overview-widget-ai/',
638 + ];
639 + }
640 +
664 641 $additions_actions['go-pro'] = [
665 642 'title' => esc_html__( 'Upgrade', 'elementor' ),
666 643 'link' => 'https://go.elementor.com/go-pro-wp-overview-widget/',
667 644 ];
@@ -723,10 +700,8 @@
723 700 }
724 701
725 702 $post_data = Utils::get_super_global_value( $_GET, 'post_data' ) ?? [];
726 703
727 - $post_data = $this->filter_post_data( $post_data );
728 -
729 704 /**
730 705 * Create new post meta data.
731 706 *
732 707 * Filters the meta data of any new post created.
@@ -750,115 +725,14 @@
750 725 if ( is_wp_error( $document ) ) {
751 726 wp_die( $document ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
752 727 }
753 728
754 - wp_safe_redirect( $document->get_edit_url() );
729 + wp_redirect( $document->get_edit_url() );
755 730
756 731 die;
757 732 }
758 733
759 - public function admin_action_site_settings_redirect() {
760 - check_admin_referer( 'elementor_action_site_settings_redirect' );
761 -
762 - if ( ! current_user_can( 'edit_theme_options' ) ) {
763 - wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'elementor' ) );
764 - }
765 -
766 - $active_tab = filter_input( INPUT_GET, 'active-tab', FILTER_SANITIZE_ENCODED );
767 -
768 - $site_settings_url_config = Page::get_site_settings_url_config( $active_tab );
769 -
770 - if ( empty( $site_settings_url_config['url'] ) ) {
771 - wp_die( esc_html__( 'Unable to create or access Site Settings page.', 'elementor' ) );
772 - }
773 -
774 - wp_safe_redirect( $site_settings_url_config['url'] );
775 -
776 - die;
777 - }
778 -
779 734 /**
780 - * Admin action edit website.
781 - *
782 - * Redirects to the homepage edit URL if it exists and is built with Elementor,
783 - * otherwise redirects to create a new page.
784 - *
785 - * Fired by `admin_action_elementor_edit_website` action.
786 - *
787 - * @since 3.x.x
788 - * @access public
789 - */
790 - public function admin_action_edit_website_redirect() {
791 - check_admin_referer( 'elementor_action_edit_website' );
792 -
793 - if ( ! User::is_current_user_can_edit_post_type( 'page' ) ) {
794 - wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'elementor' ) );
795 - }
796 -
797 - $homepage_id = $this->get_homepage_id();
798 - $edit_url = $this->get_edit_website_url( $homepage_id );
799 -
800 - wp_safe_redirect( $edit_url );
801 -
802 - die;
803 - }
804 -
805 - private function get_homepage_id(): ?int {
806 - if ( get_option( 'show_on_front' ) !== 'page' ) {
807 - return null;
808 - }
809 -
810 - $homepage_id = get_option( 'page_on_front' );
811 -
812 - return $homepage_id ? (int) $homepage_id : null;
813 - }
814 -
815 - private function get_edit_website_url( ?int $homepage_id ): string {
816 - if ( ! $homepage_id ) {
817 - return Plugin::$instance->documents->get_create_new_post_url( 'page' );
818 - }
819 -
820 - $document = Plugin::$instance->documents->get( $homepage_id );
821 -
822 - if ( ! $document || ! $document->is_built_with_elementor() ) {
823 - return Plugin::$instance->documents->get_create_new_post_url( 'page' );
824 - }
825 -
826 - return $document->get_edit_url();
827 - }
828 -
829 - private function get_allowed_fields_for_role() {
830 - $allowed_fields = [
831 - 'post_title',
832 - 'post_content',
833 - 'post_excerpt',
834 - 'post_category',
835 - 'post_type',
836 - 'tags_input',
837 - ];
838 -
839 - if ( current_user_can( 'publish_posts' ) ) {
840 - $allowed_fields[] = 'post_status';
841 - }
842 -
843 - if ( current_user_can( 'edit_others_posts' ) ) {
844 - $allowed_fields[] = 'post_author';
845 - }
846 -
847 - return $allowed_fields;
848 - }
849 -
850 - private function filter_post_data( $post_data ) {
851 - $allowed_fields = $this->get_allowed_fields_for_role();
852 - return array_filter(
853 - $post_data,
854 - function( $key ) use ( $allowed_fields ) {
855 - return in_array( $key, $allowed_fields, true );
856 - },
857 - ARRAY_FILTER_USE_KEY
858 - );
859 - }
860 - /**
861 735 * @since 2.3.0
862 736 * @access public
863 737 */
864 738 public function add_new_template_template() {
@@ -869,9 +743,9 @@
869 743 Plugin::$instance->common->add_template( ELEMENTOR_PATH . 'includes/admin-templates/new-floating-elements.php' );
870 744 }
871 745
872 746 public function enqueue_new_floating_elements_scripts() {
873 - $suffix = Utils::is_script_debug() ? '' : '.min';
747 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
874 748
875 749 wp_enqueue_script(
876 750 'elementor-floating-elements-modal',
877 751 ELEMENTOR_ASSETS_URL . 'js/floating-elements-modal' . $suffix . '.js',
@@ -886,9 +760,9 @@
886 760 /**
887 761 * @access public
888 762 */
889 763 public function enqueue_new_template_scripts() {
890 - $suffix = Utils::is_script_debug() ? '' : '.min';
764 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
891 765
892 766 wp_enqueue_script(
893 767 'elementor-new-template',
894 768 ELEMENTOR_ASSETS_URL . 'js/new-template' . $suffix . '.js',
@@ -911,9 +785,9 @@
911 785 /**
912 786 * @access public
913 787 */
914 788 public function enqueue_beta_tester_scripts() {
915 - $suffix = Utils::is_script_debug() ? '' : '.min';
789 + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
916 790
917 791 wp_enqueue_script(
918 792 'elementor-beta-tester',
919 793 ELEMENTOR_ASSETS_URL . 'js/beta-tester' . $suffix . '.js',
@@ -1028,10 +902,8 @@
1028 902 add_action( 'wp_dashboard_setup', [ $this, 'register_dashboard_widgets' ] );
1029 903
1030 904 // Admin Actions
1031 905 add_action( 'admin_action_elementor_new_post', [ $this, 'admin_action_new_post' ] );
1032 - add_action( 'admin_action_elementor_site_settings_redirect', [ $this, 'admin_action_site_settings_redirect' ] );
1033 - add_action( 'admin_action_elementor_edit_website_redirect', [ $this, 'admin_action_edit_website_redirect' ] );
1034 906
1035 907 add_action( 'current_screen', [ $this, 'init_new_template' ] );
1036 908 add_action( 'current_screen', [ $this, 'init_floating_elements' ] );
1037 909 add_action( 'current_screen', [ $this, 'init_beta_tester' ] );
@@ -1110,11 +982,9 @@
1110 982 } )->all();
1111 983 }
1112 984
1113 985 private function maybe_enqueue_hints() {
1114 - $plugin_slug = 'image-optimization';
1115 -
1116 - if ( ! Hints::should_display_hint( $plugin_slug ) ) {
986 + if ( ! Hints::should_display_hint( 'image-optimization' ) ) {
1117 987 return;
1118 988 }
1119 989
1120 990 wp_register_script(
@@ -1124,48 +994,16 @@
1124 994 ELEMENTOR_VERSION,
1125 995 true
1126 996 );
1127 997
1128 - $one_subscription = Hints::is_plugin_connected_to_one_subscription();
1129 - $is_installed = Hints::is_plugin_installed( $plugin_slug );
1130 - $is_active = Hints::is_plugin_active( $plugin_slug );
998 + $content = sprintf("%1\$s <a class='e-btn-1' href='%2\$s' target='_blank'>%3\$s</a>!",
999 + __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
1000 + Hints::get_plugin_action_url( 'image-optimization' ),
1001 + ( Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate', 'elementor' ) : __( 'Install', 'elementor' ) ) . ' ' . __( 'Image Optimizer', 'elementor' )
1002 + );
1131 1003
1132 - if ( $is_active ) {
1133 - return;
1134 - }
1135 -
1136 - if ( $one_subscription ) {
1137 - if ( ! $is_installed ) {
1138 - $description = esc_html__( 'Automatically optimize images to improve site speed and performance. Included with your ONE subscription.', 'elementor' );
1139 - $button_text = esc_html__( 'Install now', 'elementor' );
1140 - $button_url = Hints::get_plugin_install_url( $plugin_slug );
1141 - } elseif ( ! $is_active ) {
1142 - $description = esc_html__( 'Image Optimization is installed and included in your ONE subscription. Activate it to optimize images and improve site performance.', 'elementor' );
1143 - $button_text = esc_html__( 'Activate now', 'elementor' );
1144 - $button_url = Hints::get_plugin_activate_url( $plugin_slug );
1145 - }
1146 - } else {
1147 - $description = esc_html__( 'Optimize your images to enhance site performance by using Image Optimization.', 'elementor' );
1148 - if ( ! $is_installed ) {
1149 - $button_text = esc_html__( 'Install now', 'elementor' );
1150 - $button_url = Hints::get_plugin_install_url( $plugin_slug );
1151 - } elseif ( ! $is_active ) {
1152 - $button_text = esc_html__( 'Activate now', 'elementor' );
1153 - $button_url = Hints::get_plugin_activate_url( $plugin_slug );
1154 - }
1155 - }
1156 -
1157 1004 $dismissible = 'image_optimizer_hint';
1158 1005
1159 - $title = esc_html__( 'Speed up your website with Image Optimization', 'elementor' );
1160 - $content = sprintf(
1161 - "<strong>%1\$s</strong><br>%2\$s <a class='e-btn-1' href='%3\$s' target='_blank'>%4\$s</a>!",
1162 - $title,
1163 - $description,
1164 - $button_url,
1165 - $button_text
1166 - );
1167 -
1168 1006 wp_localize_script( 'media-hints', 'elementorAdminHints', [
1169 1007 'mediaHint' => [
1170 1008 'display' => true,
1171 1009 'type' => 'info',
@@ -1171,13 +1009,13 @@
1171 1009 'type' => 'info',
1172 1010 'content' => $content,
1173 1011 'icon' => true,
1174 1012 'dismissible' => $dismissible,
1175 - 'dismiss' => esc_attr__( 'Dismiss this notice.', 'elementor' ),
1013 + 'dismiss' => __( 'Dismiss this notice.', 'elementor' ),
1176 1014 'button_event' => $dismissible,
1177 1015 'button_data' => base64_encode(
1178 - wp_json_encode( [
1179 - 'action_url' => $button_url,
1016 + json_encode( [
1017 + 'action_url' => Hints::get_plugin_action_url( 'image-optimization' ),
1180 1018 ] ),
1181 1019 ),
1182 1020 ],
1183 1021 ] );
@@ -1186,35 +1024,43 @@
1186 1024 }
1187 1025
1188 1026 public function register_ajax_hints( $ajax_manager ) {
1189 1027 $ajax_manager->register_ajax_action( 'elementor_image_optimization_campaign', [ $this, 'ajax_set_image_optimization_campaign' ] );
1190 - $ajax_manager->register_ajax_action( 'elementor_core_ally_campaign', [ $this, 'ajax_ally_campaign' ] );
1028 + $ajax_manager->register_ajax_action( 'elementor_core_site_mailer_campaign', [ $this, 'ajax_site_mailer_campaign' ] );
1191 1029 }
1192 1030
1193 - public function ajax_ally_campaign( $request ) {
1031 + public function ajax_set_image_optimization_campaign( $request ) {
1194 1032 if ( ! current_user_can( 'install_plugins' ) ) {
1195 1033 return;
1196 1034 }
1197 1035
1036 + if ( empty( $request['source'] ) ) {
1037 + return;
1038 + }
1039 +
1198 1040 $campaign_data = [
1199 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1200 - 'source' => sanitize_key( $request['source'] ?? '' ),
1201 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1041 + 'source' => sanitize_key( $request['source'] ),
1042 + 'campaign' => 'io-plg',
1043 + 'medium' => 'wp-dash',
1202 1044 ];
1203 1045
1204 - set_transient( 'elementor_ea11y_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1046 + set_transient( 'elementor_image_optimization_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1205 1047 }
1206 1048
1207 - public function ajax_set_image_optimization_campaign( $request ) {
1049 + public function ajax_site_mailer_campaign( $request ) {
1208 1050 if ( ! current_user_can( 'install_plugins' ) ) {
1209 1051 return;
1210 1052 }
1211 1053
1054 + if ( empty( $request['source'] ) ) {
1055 + return;
1056 + }
1057 +
1212 1058 $campaign_data = [
1213 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1214 - 'source' => sanitize_key( $request['source'] ?? '' ),
1215 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1059 + 'source' => sanitize_key( $request['source'] ),
1060 + 'campaign' => 'sm-plg',
1061 + 'medium' => 'wp-dash',
1216 1062 ];
1217 1063
1218 - set_transient( 'elementor_image_optimization_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1064 + set_transient( 'elementor_site_mailer_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1219 1065 }
1220 1066 }