PluginProbe
Elementor Website Builder – more than just a page builder / 3.31.2
Elementor Website Builder – more than just a page builder v3.31.2
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 | modules/floating-buttons/module.php +54 -32 4.2.23.31.2 View file →
@@ -2,21 +2,22 @@
2 2
3 3 namespace Elementor\Modules\FloatingButtons;
4 4
5 5 use Elementor\Controls_Manager;
6 +use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 7 use Elementor\Core\Base\Document;
7 8 use Elementor\Core\Base\Module as BaseModule;
8 9 use Elementor\Core\Documents_Manager;
10 +use Elementor\Core\Experiments\Manager;
9 11 use Elementor\Modules\FloatingButtons\Base\Widget_Floating_Bars_Base;
12 +use Elementor\Modules\FloatingButtons\AdminMenuItems\Floating_Buttons_Empty_View_Menu_Item;
13 +use Elementor\Modules\FloatingButtons\AdminMenuItems\Floating_Buttons_Menu_Item;
10 14 use Elementor\Modules\FloatingButtons\Base\Widget_Contact_Button_Base;
11 -use Elementor\Modules\FloatingButtons\Classes\Action\Action_Handler;
12 15 use Elementor\Modules\FloatingButtons\Control\Hover_Animation_Floating_Buttons;
13 16 use Elementor\Modules\FloatingButtons\Documents\Floating_Buttons;
14 17 use Elementor\Plugin;
15 18 use Elementor\TemplateLibrary\Source_Local;
16 19 use Elementor\Utils as ElementorUtils;
17 -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
18 -use Elementor\Modules\FloatingButtons\AdminMenuItems\Editor_One_Floating_Elements_Menu;
19 20
20 21 if ( ! defined( 'ABSPATH' ) ) {
21 22 exit; // Exit if accessed directly.
22 23 }
@@ -57,10 +58,16 @@
57 58 'Floating_Bars_Var_1',
58 59 ];
59 60 }
60 61
61 - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) {
62 - $menu_data_provider->register_menu( new Editor_One_Floating_Elements_Menu() );
62 + private function register_admin_menu_legacy( Admin_Menu_Manager $admin_menu ) {
63 + $menu_args = $this->get_contact_menu_args();
64 + $function = $menu_args['function'];
65 + if ( is_callable( $function ) ) {
66 + $admin_menu->register( $menu_args['menu_slug'], new Floating_Buttons_Empty_View_Menu_Item( $function ) );
67 + } else {
68 + $admin_menu->register( $menu_args['menu_slug'], new Floating_Buttons_Menu_Item() );
69 + };
63 70 }
64 71
65 72 public function __construct() {
66 73 parent::__construct();
@@ -92,16 +99,8 @@
92 99 $this->flush_permalinks_on_elementor_version_change();
93 100 }
94 101 });
95 102
96 - add_filter( 'elementor/editor-one/menu/elementor_post_types', function ( array $elementor_post_types ): array {
97 - $elementor_post_types[ static::CPT_FLOATING_BUTTONS ] = [
98 - 'menu_slug' => 'elementor-editor-templates',
99 - 'child_slug' => 'edit.php?post_type=e-floating-buttons',
100 - ];
101 - return $elementor_post_types;
102 - } );
103 -
104 103 add_action( 'wp_ajax_elementor_send_clicks', [ $this, 'handle_click_tracking' ] );
105 104 add_action( 'wp_ajax_nopriv_elementor_send_clicks', [ $this, 'handle_click_tracking' ] );
106 105
107 106 add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] );
@@ -152,11 +151,11 @@
152 151
153 152 return $is_top_bar_active;
154 153 }, 10, 2 );
155 154
156 - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
157 - $this->register_editor_one_menu( $menu_data_provider );
158 - } );
155 + add_action( 'elementor/admin/menu/register', function( Admin_Menu_Manager $admin_menu ) {
156 + $this->register_admin_menu_legacy( $admin_menu );
157 + }, Source_Local::ADMIN_MENU_PRIORITY + 20 );
159 158
160 159 add_action( 'elementor/admin/localize_settings', function ( array $settings ) {
161 160 return $this->admin_localize_settings( $settings );
162 161 } );
@@ -171,14 +170,46 @@
171 170 return $cpts;
172 171 } );
173 172
174 173 add_action( 'admin_init', function () {
175 - $action = sanitize_text_field( filter_input( INPUT_GET, 'action' ) );
174 + $action = filter_input( INPUT_GET, 'action' );
175 + $menu_args = $this->get_contact_menu_args();
176 176
177 - if ( $action ) {
178 - $menu_args = $this->get_contact_menu_args();
179 - $action_handler = new Action_Handler( $action, $menu_args );
180 - $action_handler->process_action();
177 + switch ( $action ) {
178 + case 'remove_from_entire_site':
179 + $post = filter_input( INPUT_GET, 'post', FILTER_VALIDATE_INT );
180 + check_admin_referer( 'remove_from_entire_site_' . $post );
181 + delete_post_meta( $post, '_elementor_conditions' );
182 +
183 + wp_redirect( $menu_args['menu_slug'] );
184 + exit;
185 + case 'set_as_entire_site':
186 + $post = filter_input( INPUT_GET, 'post', FILTER_VALIDATE_INT );
187 + check_admin_referer( 'set_as_entire_site_' . $post );
188 +
189 + $posts = get_posts( [
190 + 'post_type' => static::CPT_FLOATING_BUTTONS,
191 + 'posts_per_page' => -1,
192 + 'post_status' => 'publish',
193 + 'fields' => 'ids',
194 + 'no_found_rows' => true,
195 + 'update_post_term_cache' => false,
196 + 'update_post_meta_cache' => false,
197 + 'meta_query' => Floating_Buttons::get_meta_query_for_floating_buttons(
198 + Floating_Buttons::get_floating_element_type( $post )
199 + ),
200 + ] );
201 +
202 + foreach ( $posts as $post_id ) {
203 + delete_post_meta( $post_id, '_elementor_conditions' );
204 + }
205 +
206 + update_post_meta( $post, '_elementor_conditions', [ 'include/general' ] );
207 +
208 + wp_redirect( $menu_args['menu_slug'] );
209 + exit;
210 + default:
211 + break;
181 212 }
182 213 } );
183 214
184 215 add_action( 'manage_' . static::CPT_FLOATING_BUTTONS . '_posts_columns', function( $posts_columns ) {
@@ -237,9 +268,9 @@
237 268 if ( ! isset( $posts_to_update[ $post_id ] ) ) {
238 269 $starting_clicks = (int) get_post_meta( $post_id, static::META_CLICK_TRACKING, true );
239 270 $posts_to_update[ $post_id ] = $starting_clicks ? $starting_clicks : 0;
240 271 }
241 - ++$posts_to_update[ $post_id ];
272 + $posts_to_update[ $post_id ]++;
242 273 }
243 274
244 275 foreach ( $posts_to_update as $post_id => $clicks ) {
245 276 if ( self::CPT_FLOATING_BUTTONS !== get_post_type( $post_id ) ) {
@@ -392,18 +423,9 @@
392 423 'labels' => $labels,
393 424 'public' => true,
394 425 'show_in_menu' => 'edit.php?post_type=elementor_library&tabs_group=library',
395 426 'show_in_nav_menus' => false,
396 - 'capabilities' => [
397 - 'edit_post' => 'manage_options',
398 - 'read_post' => 'manage_options',
399 - 'delete_post' => 'manage_options',
400 - 'edit_posts' => 'manage_options',
401 - 'edit_others_posts' => 'manage_options',
402 - 'publish_posts' => 'manage_options',
403 - 'read_private_posts' => 'manage_options',
404 - 'create_posts' => 'manage_options',
405 - ],
427 + 'capability_type' => 'post',
406 428 'taxonomies' => [ Source_Local::TAXONOMY_TYPE_SLUG ],
407 429 'show_in_rest' => true,
408 430 'supports' => [
409 431 'title',