PluginProbe
Elementor Website Builder – more than just a page builder / 3.31.4
Elementor Website Builder – more than just a page builder v3.31.4
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 +37 -159 4.1.03.31.4 View file →
@@ -7,15 +7,13 @@
7 7 use Elementor\Core\Base\App;
8 8 use Elementor\Core\Upgrade\Manager as Upgrade_Manager;
9 9 use Elementor\Core\Utils\Assets_Config_Provider;
10 10 use Elementor\Core\Utils\Collection;
11 -use Elementor\Modules\FloatingButtons\Module as Floating_Buttons_Module;
12 11 use Elementor\Plugin;
13 12 use Elementor\Settings;
14 13 use Elementor\User;
15 14 use Elementor\Utils;
16 15 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() {
@@ -195,11 +165,13 @@
195 165 * @since 1.0.0
196 166 * @access public
197 167 */
198 168 public function enqueue_styles() {
169 + $direction_suffix = is_rtl() ? '-rtl' : '';
170 +
199 171 wp_register_style(
200 172 'elementor-admin',
201 - $this->get_css_assets_url( 'admin' ),
173 + $this->get_css_assets_url( 'admin' . $direction_suffix ),
202 174 [
203 175 'elementor-common',
204 176 ],
205 177 ELEMENTOR_VERSION
@@ -401,10 +373,10 @@
401 373 */
402 374 public function plugin_row_meta( $plugin_meta, $plugin_file ) {
403 375 if ( ELEMENTOR_PLUGIN_BASE === $plugin_file ) {
404 376 $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>',
377 + '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>',
378 + '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 379 ];
408 380
409 381 $plugin_meta = array_merge( $plugin_meta, $row_meta );
410 382 }
@@ -508,9 +480,9 @@
508 480 ?>
509 481 <div class="e-overview__header">
510 482 <?php if ( $show_versions ) { ?>
511 483 <div class="e-overview__logo">
512 - <div class="e-logo-wrapper"><i class="eicon-elementor-circle"></i></div>
484 + <div class="e-logo-wrapper"><i class="eicon-elementor"></i></div>
513 485 </div>
514 486 <div class="e-overview__versions">
515 487 <span class="e-overview__version"><?php echo esc_html__( 'Elementor', 'elementor' ); ?> v<?php echo ELEMENTOR_VERSION; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
516 488 <?php
@@ -537,9 +509,9 @@
537 509 * Displays the Elementor dashboard widget - recently edited section.
538 510 * Fired by `elementor_dashboard_overview_widget` function.
539 511 *
540 512 * @param array $args
541 - * @param bool $show_heading
513 + * @param bool $show_heading
542 514 *
543 515 * @return void
544 516 * @since 3.12.0
545 517 */
@@ -573,9 +545,9 @@
573 545 /**
574 546 * Displays the Elementor dashboard widget - news and updates section.
575 547 * Fired by `elementor_dashboard_overview_widget` function.
576 548 *
577 - * @param int $limit_feed
549 + * @param int $limit_feed
578 550 * @param bool $show_heading
579 551 *
580 552 * @return void
581 553 * @since 3.12.0
@@ -750,78 +722,8 @@
750 722
751 723 die;
752 724 }
753 725
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 - /**
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 726 private function get_allowed_fields_for_role() {
825 727 $allowed_fields = [
826 728 'post_title',
827 729 'post_content',
@@ -1023,10 +925,8 @@
1023 925 add_action( 'wp_dashboard_setup', [ $this, 'register_dashboard_widgets' ] );
1024 926
1025 927 // Admin Actions
1026 928 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 929
1030 930 add_action( 'current_screen', [ $this, 'init_new_template' ] );
1031 931 add_action( 'current_screen', [ $this, 'init_floating_elements' ] );
1032 932 add_action( 'current_screen', [ $this, 'init_beta_tester' ] );
@@ -1105,11 +1005,9 @@
1105 1005 } )->all();
1106 1006 }
1107 1007
1108 1008 private function maybe_enqueue_hints() {
1109 - $plugin_slug = 'image-optimization';
1110 -
1111 - if ( ! Hints::should_display_hint( $plugin_slug ) ) {
1009 + if ( ! Hints::should_display_hint( 'image-optimization' ) ) {
1112 1010 return;
1113 1011 }
1114 1012
1115 1013 wp_register_script(
@@ -1119,48 +1017,16 @@
1119 1017 ELEMENTOR_VERSION,
1120 1018 true
1121 1019 );
1122 1020
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 );
1021 + $content = sprintf("%1\$s <a class='e-btn-1' href='%2\$s' target='_blank'>%3\$s</a>!",
1022 + __( 'Optimize your images to enhance site performance by using Image Optimizer.', 'elementor' ),
1023 + Hints::get_plugin_action_url( 'image-optimization' ),
1024 + ( Hints::is_plugin_installed( 'image-optimization' ) ? __( 'Activate', 'elementor' ) : __( 'Install', 'elementor' ) ) . ' ' . __( 'Image Optimizer', 'elementor' )
1025 + );
1126 1026
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 Optimizer 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 Optimizer.', '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 1027 $dismissible = 'image_optimizer_hint';
1153 1028
1154 - $title = esc_html__( 'Speed up your website with Image Optimizer', '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 1029 wp_localize_script( 'media-hints', 'elementorAdminHints', [
1164 1030 'mediaHint' => [
1165 1031 'display' => true,
1166 1032 'type' => 'info',
@@ -1166,13 +1032,13 @@
1166 1032 'type' => 'info',
1167 1033 'content' => $content,
1168 1034 'icon' => true,
1169 1035 'dismissible' => $dismissible,
1170 - 'dismiss' => esc_attr__( 'Dismiss this notice.', 'elementor' ),
1036 + 'dismiss' => __( 'Dismiss this notice.', 'elementor' ),
1171 1037 'button_event' => $dismissible,
1172 1038 'button_data' => base64_encode(
1173 1039 wp_json_encode( [
1174 - 'action_url' => $button_url,
1040 + 'action_url' => Hints::get_plugin_action_url( 'image-optimization' ),
1175 1041 ] ),
1176 1042 ),
1177 1043 ],
1178 1044 ] );
@@ -1190,12 +1056,16 @@
1190 1056 if ( ! current_user_can( 'install_plugins' ) ) {
1191 1057 return;
1192 1058 }
1193 1059
1060 + if ( empty( $request['source'] ) ) {
1061 + return;
1062 + }
1063 +
1194 1064 $campaign_data = [
1195 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1196 - 'source' => sanitize_key( $request['source'] ?? '' ),
1197 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1065 + 'source' => sanitize_key( $request['source'] ),
1066 + 'campaign' => 'ally-plg',
1067 + 'medium' => 'wp-dash',
1198 1068 ];
1199 1069
1200 1070 set_transient( 'elementor_ea11y_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1201 1071 }
@@ -1204,12 +1074,16 @@
1204 1074 if ( ! current_user_can( 'install_plugins' ) ) {
1205 1075 return;
1206 1076 }
1207 1077
1078 + if ( empty( $request['source'] ) ) {
1079 + return;
1080 + }
1081 +
1208 1082 $campaign_data = [
1209 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1210 - 'source' => sanitize_key( $request['source'] ?? '' ),
1211 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1083 + 'source' => sanitize_key( $request['source'] ),
1084 + 'campaign' => 'io-plg',
1085 + 'medium' => 'wp-dash',
1212 1086 ];
1213 1087
1214 1088 set_transient( 'elementor_image_optimization_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1215 1089 }
@@ -1218,12 +1092,16 @@
1218 1092 if ( ! current_user_can( 'install_plugins' ) ) {
1219 1093 return;
1220 1094 }
1221 1095
1096 + if ( empty( $request['source'] ) ) {
1097 + return;
1098 + }
1099 +
1222 1100 $campaign_data = [
1223 - 'campaign' => sanitize_key( $request['campaign'] ?? '' ),
1224 - 'source' => sanitize_key( $request['source'] ?? '' ),
1225 - 'medium' => sanitize_key( $request['medium'] ?? '' ),
1101 + 'source' => sanitize_key( $request['source'] ),
1102 + 'campaign' => 'sm-plg',
1103 + 'medium' => 'wp-dash',
1226 1104 ];
1227 1105
1228 1106 set_transient( 'elementor_site_mailer_campaign', $campaign_data, 30 * DAY_IN_SECONDS );
1229 1107 }