Skip to content

Commit

Permalink
Merge branch '64242' into 3176
Browse files Browse the repository at this point in the history
  • Loading branch information
rudlinkon committed Jul 29, 2024
2 parents 6389c70 + 5239fad commit 281f4e8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
5 changes: 4 additions & 1 deletion includes/Traits/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// Exit if accessed directly

use Essential_Addons_Elementor\Classes\Elements_Manager;
use Essential_Addons_Elementor\Classes\Helper as HelperClass;
use Essential_Addons_Elementor\Classes\WPDeveloper_Notice;
use PriyoMukul\WPNotice\Notices;
Expand Down Expand Up @@ -1615,7 +1616,9 @@ public function admin_enqueue_scripts( $hook ) {
'label' => __( 'Upgrade to PRO', 'essential-addons-for-elementor-lite' ),
'url' => 'https://essential-addons.com/upgrade-ea-pro'
]
]
],
'el_disabled_elements' => get_option( 'elementor_disabled_elements', [] ),
'replace_widget_old2new' => Elements_Manager::replace_widget_name()
];

wp_localize_script( 'eael-admin-dashboard', 'localize', array(
Expand Down
19 changes: 17 additions & 2 deletions includes/Traits/Ajax_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Essential_Addons_Elementor\Traits;

use Automattic\WooCommerce\Utilities\OrderUtil;
use Essential_Addons_Elementor\Classes\Elements_Manager;
use Essential_Addons_Elementor\Classes\Helper as HelperClass;
use Essential_Addons_Elementor\Template\Woocommerce\Checkout\Woo_Checkout_Helper;
use Essential_Addons_Elementor\Traits\Template_Query;
Expand Down Expand Up @@ -1043,11 +1044,25 @@ public function save_settings() {
}

if ( ! empty( $settings['elements'] ) ) {
$defaults = array_fill_keys( array_keys( array_merge( $this->registered_elements, $this->registered_extensions ) ), false );
$elements = array_merge( $defaults, array_fill_keys( array_keys( array_intersect_key( $settings, $defaults ) ), true ) );
$defaults = array_fill_keys( array_keys( array_merge( $this->registered_elements, $this->registered_extensions ) ), false );
$elements = array_merge( $defaults, array_fill_keys( array_keys( array_intersect_key( $settings, $defaults ) ), true ) );
$el_disable = get_option( 'elementor_disabled_elements', [] );
$new_disable = [];

foreach ( $el_disable as $element ) {
$el_new_name = Elements_Manager::replace_widget_name();
$el_new_name = $el_new_name[ $element ] ?? $element;
$el_new_name = substr( $el_new_name, 5 );
if ( in_array( $el_new_name, $elements ) && $elements[ $el_new_name ] === true ) {
continue;
}

$new_disable[] = $element;
}

// update new settings
$updated = update_option( 'eael_save_settings', $elements );
update_option( 'elementor_disabled_elements', $new_disable );

// clear assets files
$this->empty_dir( EAEL_ASSET_PATH );
Expand Down
Loading

0 comments on commit 281f4e8

Please sign in to comment.