mirror of
https://github.com/proelements/proelements.git
synced 2026-04-05 20:13:47 +00:00
v3.34.0
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace ElementorPro\Modules\Woocommerce\ImportExportCustomization;
|
||||
|
||||
use Elementor\App\Modules\ImportExportCustomization\Runners\Revert\Revert_Runner_Base;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Woocommerce_Settings_Revert extends Revert_Runner_Base {
|
||||
|
||||
public static function get_name(): string {
|
||||
return 'woocommerce-settings';
|
||||
}
|
||||
|
||||
public function should_revert( array $data ): bool {
|
||||
return isset( $data['runners'][ static::get_name() ] );
|
||||
}
|
||||
|
||||
public function revert( array $data ) {
|
||||
$runner_data = $data['runners'][ static::get_name() ];
|
||||
|
||||
$previous_pages = $runner_data['previous_pages'] ?? [];
|
||||
|
||||
foreach ( $previous_pages as $key => $value ) {
|
||||
update_option( $key, $value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace ElementorPro\Modules\Woocommerce\ImportExportCustomization;
|
||||
|
||||
use Elementor\App\Modules\ImportExportCustomization\Runners\Import\Import_Runner_Base;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
class Woocommerce_Settings extends Import_Runner_Base {
|
||||
|
||||
const KEYS_TO_IMPORT = [
|
||||
'woocommerce_cart_page_id',
|
||||
'woocommerce_checkout_page_id',
|
||||
'woocommerce_myaccount_page_id',
|
||||
'woocommerce_terms_page_id',
|
||||
'elementor_woocommerce_purchase_summary_page_id',
|
||||
'woocommerce_shop_page_id',
|
||||
];
|
||||
|
||||
private $old_values = [];
|
||||
private $imported_pages = [];
|
||||
|
||||
public static function get_name(): string {
|
||||
return 'woocommerce-settings';
|
||||
}
|
||||
|
||||
public function should_import( array $data ) {
|
||||
return (
|
||||
isset( $data['include'] ) &&
|
||||
in_array( 'settings', $data['include'], true ) &&
|
||||
! empty( $data['site_settings']['settings'] )
|
||||
);
|
||||
}
|
||||
|
||||
public function import( array $data, array $imported_data ) {
|
||||
$new_site_settings = $data['site_settings']['settings'];
|
||||
|
||||
$pages = $imported_data['content']['page']['succeed'] ?? [];
|
||||
|
||||
$imported = false;
|
||||
|
||||
foreach ( self::KEYS_TO_IMPORT as $key ) {
|
||||
$value = $new_site_settings[ $key ] ?? null;
|
||||
if ( isset( $pages[ $value ] ) ) {
|
||||
$page = $pages[ $value ];
|
||||
|
||||
$this->old_values[ $key ] = get_option( $key );
|
||||
$update_result = update_option( $key, $page );
|
||||
if ( $update_result ) {
|
||||
$this->imported_pages[ $key ] = $page;
|
||||
$imported = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [ static::get_name() => $imported ];
|
||||
}
|
||||
|
||||
public function get_import_session_metadata(): array {
|
||||
return [
|
||||
'previous_pages' => $this->old_values,
|
||||
'imported_pages' => $this->imported_pages,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ use ElementorPro\Modules\Woocommerce\Widgets\Products as Products_Widget;
|
||||
use Elementor\Icons_Manager;
|
||||
use ElementorPro\Modules\LoopBuilder\Module as LoopBuilderModule;
|
||||
use ElementorPro\License\API;
|
||||
use Elementor\App\Modules\ImportExportCustomization\Processes\Import;
|
||||
use Elementor\App\Modules\ImportExportCustomization\Processes\Revert;
|
||||
use ElementorPro\Modules\Woocommerce\ImportExportCustomization\Woocommerce_Settings;
|
||||
use ElementorPro\Modules\Woocommerce\ImportExportCustomization\Woocommerce_Settings_Revert;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
@@ -1360,9 +1364,20 @@ class Module extends Module_Base {
|
||||
return Plugin::elementor()->preview->is_preview_mode() || is_preview();
|
||||
}
|
||||
|
||||
public function register_import_runner( Import $import ) {
|
||||
$import->register( new Woocommerce_Settings() );
|
||||
}
|
||||
|
||||
public function register_revert_runner( Revert $revert ) {
|
||||
$revert->register( new Woocommerce_Settings_Revert() );
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
add_action( 'elementor/import-export-customization/import-kit', [ $this, 'register_import_runner' ] );
|
||||
add_action( 'elementor/import-export-customization/revert-kit', [ $this, 'register_revert_runner' ] );
|
||||
|
||||
add_action( 'elementor/kit/register_tabs', [ $this, 'init_site_settings' ], 1, 40 );
|
||||
$this->add_update_kit_settings_hooks();
|
||||
|
||||
|
||||
@@ -62,16 +62,16 @@ class Archive_Description extends Base_Widget {
|
||||
'label' => esc_html__( 'Alignment', 'elementor-pro' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-pro' ),
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-pro' ),
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
'justify' => [
|
||||
@@ -79,6 +79,11 @@ class Archive_Description extends Base_Widget {
|
||||
'icon' => 'eicon-text-align-justify',
|
||||
],
|
||||
],
|
||||
'classes' => 'elementor-control-start-end',
|
||||
'selectors_dictionary' => [
|
||||
'left' => is_rtl() ? 'end' : 'start',
|
||||
'right' => is_rtl() ? 'start' : 'end',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
|
||||
@@ -90,19 +90,24 @@ class Breadcrumb extends Base_Widget {
|
||||
'label' => esc_html__( 'Alignment', 'elementor-pro' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-pro' ),
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-pro' ),
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'classes' => 'elementor-control-start-end',
|
||||
'selectors_dictionary' => [
|
||||
'left' => is_rtl() ? 'end' : 'start',
|
||||
'right' => is_rtl() ? 'start' : 'end',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .woocommerce-breadcrumb' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
|
||||
@@ -72,19 +72,24 @@ class Product_Price extends Base_Widget {
|
||||
'label' => esc_html__( 'Alignment', 'elementor-pro' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-pro' ),
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-pro' ),
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'classes' => 'elementor-control-start-end',
|
||||
'selectors_dictionary' => [
|
||||
'left' => is_rtl() ? 'end' : 'start',
|
||||
'right' => is_rtl() ? 'start' : 'end',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
|
||||
@@ -169,19 +169,24 @@ class Product_Related extends Products_Base {
|
||||
'label' => esc_html__( 'Text Align', 'elementor-pro' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-pro' ),
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-pro' ),
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'classes' => 'elementor-control-start-end',
|
||||
'selectors_dictionary' => [
|
||||
'left' => is_rtl() ? 'end' : 'start',
|
||||
'right' => is_rtl() ? 'start' : 'end',
|
||||
],
|
||||
'selectors' => [
|
||||
'.woocommerce {{WRAPPER}}.elementor-wc-products .products > h2' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
|
||||
@@ -56,16 +56,16 @@ class Product_Short_Description extends Base_Widget {
|
||||
'label' => esc_html__( 'Alignment', 'elementor-pro' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-pro' ),
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-pro' ),
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
'justify' => [
|
||||
@@ -73,6 +73,11 @@ class Product_Short_Description extends Base_Widget {
|
||||
'icon' => 'eicon-text-align-justify',
|
||||
],
|
||||
],
|
||||
'classes' => 'elementor-control-start-end',
|
||||
'selectors_dictionary' => [
|
||||
'left' => is_rtl() ? 'end' : 'start',
|
||||
'right' => is_rtl() ? 'start' : 'end',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
|
||||
@@ -156,19 +156,24 @@ class Product_Upsell extends Products_Base {
|
||||
'label' => esc_html__( 'Text Align', 'elementor-pro' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'options' => [
|
||||
'left' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-pro' ),
|
||||
'start' => [
|
||||
'title' => esc_html__( 'Start', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'right' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-pro' ),
|
||||
'end' => [
|
||||
'title' => esc_html__( 'End', 'elementor-pro' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'classes' => 'elementor-control-start-end',
|
||||
'selectors_dictionary' => [
|
||||
'left' => is_rtl() ? 'end' : 'start',
|
||||
'right' => is_rtl() ? 'start' : 'end',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}}.elementor-wc-products .products > h2' => 'text-align: {{VALUE}}',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user