Plugin Directory

Changeset 3486633


Ignore:
Timestamp:
03/19/2026 03:42:53 PM (13 days ago)
Author:
clonable
Message:

Deploy clonable 2.9.7 from Git tag 2.9.7

Location:
clonable
Files:
136 added
15 edited

Legend:

Unmodified
Added
Removed
  • clonable/trunk/clonable-wp.php

    r3486465 r3486633  
    55Description: Official plugin for improving your clones made with Clonable.
    66Plugin URI: https://kb.clonable.net/en/introduction/getting-started/wordpress#de-clonable-plug-in-downloaden
    7 Version: 2.9.6
     7Version: 2.9.7
    88Author: Clonable BV
    99Author URI: https://www.clonable.net
     
    126126
    127127define('CLONABLE_NAME', 'Clonable');
    128 define('CLONABLE_VERSION', '2.9.6');
     128define('CLONABLE_VERSION', '2.9.7');
    129129
    130130if (defined('WP_CLI') && WP_CLI) {
     
    225225            {
    226226                $domain = ClonableConfig::current_clonable_domain();
    227                 if ($domain === ClonableCOnfig::ORIGINAL_SHOP) {
     227                if ($domain === ClonableConfig::ORIGINAL_SHOP) {
    228228                    return $_SERVER['host'] ?? ''; // return the standard host
    229229                }
  • clonable/trunk/objects/ClonableConfig.php

    r3452753 r3486633  
    7676     * @return string|null
    7777     */
    78     public static function get_clone_id_by_current_url(): ?string {
     78    public static function get_clone_id_by_current_url(): ?string
     79    {
    7980        $clones = self::get_clones();
    8081        if (empty($clones)) {
     
    8485        $host_header = $_SERVER['HTTP_X_FORWARDED_HOST'] ?? ($_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? ''));
    8586        $sanitized_host = str_replace('www.', '', $host_header);
    86        
     87
    8788        // Get all clones for this domain.
    8889        $domain_matches = [];
     
    9798        }
    9899
    99         if (count($domain_matches) === 1) {
     100        if (count($domain_matches) === 1 && empty($domain_matches[0]['subfolder_clone'])) {
    100101            return $domain_matches[0]['id'];
    101102        }
  • clonable/trunk/readme-da_DK.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    39 
    40 v2.9.4
     42 
     43v2.9.4 
    4144Support for locally set languages in Clonable Language Switcher
    4245
  • clonable/trunk/readme-de_DE.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
    40 v2.9.4
     43v2.9.4 
    4144Support for locally set languages in Clonable Language Switcher
    4245
  • clonable/trunk/readme-es_ES.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
  • clonable/trunk/readme-fr_FR.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
  • clonable/trunk/readme-it_IT.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
  • clonable/trunk/readme-nb_NO.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
  • clonable/trunk/readme-nl_NL.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
  • clonable/trunk/readme-sv_SE.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
  • clonable/trunk/readme.txt

    r3486465 r3486633  
    55Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.6
     7Stable tag: 2.9.7
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
    34 v2.9.6
     34v2.9.7
     35WooCommerce email translation improvements for WC block checkout
     36
     37v2.9.6
    3538Clonable language switcher improvements
    3639
    37 v2.9.5 
     40v2.9.5
    3841Clonable language switcher improvements
    3942
    40 v2.9.4
     43v2.9.4 
    4144Support for locally set languages in Clonable Language Switcher
    4245
  • clonable/trunk/services/ClonableWooCommerceService.php

    r3467415 r3486633  
    3030            return;
    3131        }
    32        
     32
    3333        $include_woocommerce_analytics = get_option('clonable_woocommerce_analytics_enabled', 'on') === 'on';
    3434        if ($include_woocommerce_analytics) {
    3535            // Add hidden field with the domain. Will get replaced by Clonable automagically to match actual domain.
    3636            add_action('woocommerce_after_order_notes', array($this, 'add_origin_field'));
    37             add_action('woocommerce_checkout_update_order_meta', array($this, 'save_origin_field'));
     37            add_action('woocommerce_checkout_update_order_meta', array($this, 'save_origin_field'), 10, 1);
    3838            add_action('woocommerce_admin_order_data_after_shipping_address', array($this, 'display_order_origin'));
    3939
     
    7777        // Add a hidden field containing the current clone ID for use in woocommerce email translations
    7878        add_action('woocommerce_after_order_notes', array($this, 'add_clone_id_field'), 10, 2);
     79
    7980        // Add the clone ID to the order meta when saving the order   
    8081        add_action('woocommerce_checkout_update_order_meta', array($this, 'save_order_clone_id'));
    8182
     83        // Save clone ID for WooCommerce Blocks checkout (Store API doesn't use $_POST)
     84        add_action('woocommerce_store_api_checkout_order_processed', array($this, 'save_clone_id_for_block_checkout'), 10, 1);
     85
     86        // Save origin for WooCommerce Blocks checkout (Store API doesn't use $_POST)
     87        add_action('woocommerce_store_api_checkout_order_processed', array($this, 'save_origin_field_for_block_checkout'), 20, 1);
     88
    8289        // Support for WooCommerce PDF Invoices & Packing Slips plugin translation
    83         $pdf_translations_enabled = get_option('clonable_woocommerce_enable_pdf_invoice_translation', 'off') === 'on';
     90        $pdf_translations_enabled = get_option('clonable_woocommerce_enable_pdf_invoice_translation', 'off') === 'on';
    8491        if ($this->pdf_invoices_installed() && $pdf_translations_enabled) {
    8592            add_action('plugins_loaded', [$this, 'register_pdf_translation_hooks'], 20, 0);
     
    8794    }
    8895
    89     public function register_pdf_translation_hooks() {
    90         $filter_function_map = [
    91             "wpo_wcpdf_shop_phone_number_settings_text" => "shop_phone_number",
    92             "wpo_wcpdf_shop_email_address_settings_text" => "shop_email_address",
    93             "wpo_wcpdf_shop_name_settings_text" => "shop_name",
    94             "wpo_wcpdf_vat_number_settings_text" => "vat_number",
    95             "wpo_wcpdf_coc_number_settings_text" => "coc_number",
    96             "wpo_wcpdf_shop_address_line_1_settings_text" => "shop_address_line_1",
    97             "wpo_wcpdf_shop_address_line_2_settings_text" => "shop_address_line_2",
    98             "wpo_wcpdf_shop_address_country_settings_text" => "shop_address_country",
    99             "wpo_wcpdf_shop_address_state_settings_text" => "shop_address_state",
    100             "wpo_wcpdf_shop_address_city_settings_text" => "shop_address_city",
    101             "wpo_wcpdf_shop_address_postcode_settings_text" => "shop_address_postcode",
    102         ];
    103 
    104         add_filter('wpo_wcpdf_get_html', function ($html, $document) {
    105             return $this->get_pdf_template_translation($html, $document);
    106         }, 10, 2);
    107 
    108         foreach ($filter_function_map as $hook => $field_name) {
    109             add_filter($hook, function ($text, $document) use ($field_name) {
    110                 return $this->get_pdf_field_replacement($field_name, $text, $document);
    111             }, 10, 2);
    112         }
    113 
    114         // Support different logos per language in PDF documents (use multiple filter names for compatibility)
    115         add_filter('wpo_wcpdf_logo', [$this, 'pdf_logo_url'], 10, 2);
    116         add_filter('wpo_wcpdf_document_logo', [$this, 'pdf_logo_url'], 10, 2);
    117         add_filter('wpo_wcpdf_header_logo', [$this, 'pdf_logo_url'], 10, 2);
    118         add_filter('wpo_wcpdf_template_logo', [$this, 'pdf_logo_url'], 10, 2);
    119 
    120         // logo ID filter
    121         add_filter('wpo_wcpdf_header_logo_id', [$this, 'pdf_logo_id'], 10, 2);
    122     }
     96    public function register_pdf_translation_hooks()
     97    {
     98        $filter_function_map = [
     99            "wpo_wcpdf_shop_phone_number_settings_text" => "shop_phone_number",
     100            "wpo_wcpdf_shop_email_address_settings_text" => "shop_email_address",
     101            "wpo_wcpdf_shop_name_settings_text" => "shop_name",
     102            "wpo_wcpdf_vat_number_settings_text" => "vat_number",
     103            "wpo_wcpdf_coc_number_settings_text" => "coc_number",
     104            "wpo_wcpdf_shop_address_line_1_settings_text" => "shop_address_line_1",
     105            "wpo_wcpdf_shop_address_line_2_settings_text" => "shop_address_line_2",
     106            "wpo_wcpdf_shop_address_country_settings_text" => "shop_address_country",
     107            "wpo_wcpdf_shop_address_state_settings_text" => "shop_address_state",
     108            "wpo_wcpdf_shop_address_city_settings_text" => "shop_address_city",
     109            "wpo_wcpdf_shop_address_postcode_settings_text" => "shop_address_postcode",
     110        ];
     111
     112        add_filter('wpo_wcpdf_get_html', function ($html, $document) {
     113            return $this->get_pdf_template_translation($html, $document);
     114        }, 10, 2);
     115
     116        foreach ($filter_function_map as $hook => $field_name) {
     117            add_filter($hook, function ($text, $document) use ($field_name) {
     118                return $this->get_pdf_field_replacement($field_name, $text, $document);
     119            }, 10, 2);
     120        }
     121
     122        // Support different logos per language in PDF documents (use multiple filter names for compatibility)
     123        add_filter('wpo_wcpdf_logo', [$this, 'pdf_logo_url'], 10, 2);
     124        add_filter('wpo_wcpdf_document_logo', [$this, 'pdf_logo_url'], 10, 2);
     125        add_filter('wpo_wcpdf_header_logo', [$this, 'pdf_logo_url'], 10, 2);
     126        add_filter('wpo_wcpdf_template_logo', [$this, 'pdf_logo_url'], 10, 2);
     127
     128        // logo ID filter
     129        add_filter('wpo_wcpdf_header_logo_id', [$this, 'pdf_logo_id'], 10, 2);
     130    }
    123131
    124132    /**
     
    268276        echo '<input type="hidden" name="clonable_clone_id" value="' . $clone_id . '" />';
    269277    }
     278
    270279
    271280    /**
     
    327336            $order->save();
    328337        }
     338    }
     339
     340    /**
     341     * Save clone ID for orders placed via the WooCommerce Blocks checkout.
     342     * The blocks checkout uses the Store API instead of $_POST, so we determine
     343     * the clone ID server-side from the current request headers.
     344     *
     345     * @param WC_Order $order
     346     */
     347    public function save_clone_id_for_block_checkout($order)
     348    {
     349        // Skip if clone_id was already saved (e.g. classic checkout fallback)
     350        if ($order->get_meta('clonable_clone_id')) {
     351            return;
     352        }
     353        $clone_id = ClonableConfig::get_clone_id_by_current_url();
     354        if ($clone_id) {
     355            $sanitized = sanitize_text_field($clone_id);
     356            $order->update_meta_data('clonable_clone_id', $sanitized);
     357            $order->save();
     358        }
     359    }
     360
     361    /**
     362     * Save order origin for orders placed via the WooCommerce Blocks checkout.
     363     * The blocks checkout uses the Store API instead of $_POST, so we determine
     364     * the origin server-side from the current request headers.
     365     *
     366     * @param WC_Order $order
     367     */
     368    public function save_origin_field_for_block_checkout($order)
     369    {
     370        // Skip if origin was already saved (e.g. classic checkout fallback)
     371        if ($order->get_meta('clonable_origin')) {
     372            return;
     373        }
     374
     375        $origin = null;
     376        //get the origin clone URL based on the current request headers (set by Clonable on the frontend)
     377        if (isset($_SERVER['HTTP_CLONABLE_CLONE_DOMAIN'])) {
     378            $origin = $_SERVER['HTTP_CLONABLE_CLONE_DOMAIN'];
     379            if (isset($_SERVER['HTTP_CLONABLE_CLONE_SUBFOLDER']) && !empty($_SERVER['HTTP_CLONABLE_CLONE_SUBFOLDER'])) {
     380                $origin .= $_SERVER['HTTP_CLONABLE_CLONE_SUBFOLDER'];
     381            }
     382        } else {
     383            // fallback to original shop domain when header not present
     384            $origin = ClonableConfig::ORIGINAL_SHOP;
     385        }
     386
     387        $origin = rtrim($origin, '/'); // remove trailing slash from origin if present
     388
     389        if (!$this->is_valid_origin($origin)) {
     390            return;
     391        }
     392
     393        // save the origin in the order meta
     394        $order->update_meta_data('clonable_origin', $origin);
     395        $order->save();
    329396    }
    330397
     
    437504    private function get_clone_id_from_request(): string
    438505    {
    439         return isset($_POST['clonable_clone_id']) ? (string) $_POST['clonable_clone_id'] : '';
     506        return isset($_POST['clonable_clone_id']) ? (string) $_POST['clonable_clone_id'] : '';
    440507    }
    441508
  • clonable/trunk/services/EmailTranslationsService.php

    r3467415 r3486633  
    55use Clonable\Helpers\Functions;
    66use Clonable\Helpers\TextTranslator;
     7use Clonable\Services\ClonableWooCommerceService;
    78use function is_string;
    89use function trim;
     
    1314}
    1415
    15 class EmailTranslationsService {
     16class EmailTranslationsService
     17{
    1618    private const OPT_ENABLED = 'clonable_email_translations_enabled';
    1719    private const OPT_EXCLUDED = 'clonable_email_translations_excluded_addresses';
    1820    private const OPT_HEADERS_BY_DOMAIN = 'clonable_email_headers_by_domain';
    19 
    20     public function __construct() {
    21         if (!$this->emailTranslationsEnabled()) {
    22             return;
    23         }
    24 
    25         add_filter('wp_mail' ,[$this ,'translateMail'] ,PHP_INT_MAX);
    26         add_filter('wp_mail_from' ,[$this ,'setMailFrom'] ,PHP_INT_MAX);
    27         add_filter('wp_mail_from_name' ,[$this ,'setMailSenderName'] ,PHP_INT_MAX);
    28         add_filter('option_woocommerce_email_header_image' ,[$this ,'setMailHeaderImage'] ,PHP_INT_MAX);
    29         add_action('phpmailer_init' ,[$this ,'override_phpmailer_sender'] ,PHP_INT_MAX);
    30     }
    31 
    32     public function translateMail(array $args): array {
    33         $clone_id = $this->getCloneIdFromRequest();
     21    private $currentOrderId = null;
     22
     23    public function __construct()
     24    {
     25        if (!$this->emailTranslationsEnabled()) {
     26            return;
     27        }
     28
     29        add_filter('wp_mail', [$this, 'translateMail'], 20, 1);
     30        add_filter('wp_mail_from', [$this, 'setMailFrom'], PHP_INT_MAX);
     31        add_filter('wp_mail_from_name', [$this, 'setMailSenderName'], PHP_INT_MAX);
     32        add_filter('option_woocommerce_email_header_image', [$this, 'setMailHeaderImage'], PHP_INT_MAX);
     33        add_action('phpmailer_init', [$this, 'override_phpmailer_sender'], PHP_INT_MAX);
     34
     35        // Capture order ID for use in email translations (in case clone ID is not available in the request, e.g. for async emails)
     36        add_action('woocommerce_after_order_object_save', [$this, 'captureOrderFromSave'], 10, 1);
     37    }
     38
     39    public function captureOrderFromSave($order)
     40    {
     41        if ($order instanceof \WC_Order) {
     42            $order_id = $order->get_id();
     43            $this->currentOrderId = $order_id;
     44        }
     45    }
     46
     47    public function translateMail(array $args): array
     48    {
     49        $clone_id = $this->getCloneIdFromRequest();
     50        if (!$clone_id) {  // no clone ID in $_POST data, so we check if we have a global order ID set by the WooCommerce email hook, and if so, add it to the args for potential use in translation
     51            $order_id = $this->currentOrderId;
     52            // get the clone id from the order meta, if it exists
     53            if (!empty($order_id)) {
     54                $order_clone_id = wc_get_order($order_id)->get_meta('clonable_clone_id', true);
     55                if (!empty($order_clone_id)) {
     56                    $clone_id = $order_clone_id;
     57                }
     58            }
     59        }
     60
    3461        if (empty($clone_id)) {
    3562            return $args;
     
    4269        $hasSubject = isset($args['subject']) && is_string($args['subject']) && $args['subject'] !== '';
    4370        if ($hasSubject) {
    44             $args['subject'] = TextTranslator::translateText($args['subject'] ,$clone_id);
     71            $args['subject'] = TextTranslator::translateText($args['subject'], $clone_id);
    4572        }
    4673
     
    4875        if ($hasMessage) {
    4976            $message         = Functions::minify_html($args['message']);
    50             $args['message'] = TextTranslator::translateText((string) $message ,$clone_id ,false);
     77            $args['message'] = TextTranslator::translateText((string) $message, $clone_id, false);
    5178        }
    5279
     
    76103    }
    77104
    78     public function setMailFrom(string $from): string {
     105    public function setMailFrom(string $from): string
     106    {
    79107        $clone_id = $this->getCloneIdFromRequest();
    80108        if (empty($clone_id)) {
     
    94122    }
    95123
    96     public function setMailSenderName(string $name): string {
     124    public function setMailSenderName(string $name): string
     125    {
    97126        $clone_id = $this->getCloneIdFromRequest();
    98127        if (empty($clone_id)) {
     
    112141    }
    113142
    114     public function setMailHeaderImage(string $image): string {
     143    public function setMailHeaderImage(string $image): string
     144    {
    115145        $clone_id = $this->getCloneIdFromRequest();
    116146        if (empty($clone_id)) {
     
    136166     * @param \PHPMailer PHPMailer instance
    137167     */
    138     public function override_phpmailer_sender($php_mailer) {
     168    public function override_phpmailer_sender($php_mailer)
     169    {
    139170        $from_name  = $this->setMailSenderName($php_mailer->FromName);
    140171        $from_email = $this->setMailFrom($php_mailer->From);
     
    162193
    163194                try {
    164                     $php_mailer->addReplyTo($reply_to_address ,$from_name);
     195                    $php_mailer->addReplyTo($reply_to_address, $from_name);
    165196                } catch (\Exception $e) {
    166197                    // Ignore invalid email address
     
    173204    }
    174205
    175     private function getCloneIdFromRequest(): ?string {
     206    private function getCloneIdFromRequest(): ?string
     207    {
    176208        return isset($_POST['clonable_clone_id']) ? (string) $_POST['clonable_clone_id'] : null;
    177209    }
    178210
    179     private function emailTranslationsEnabled(): bool {
    180         return get_option(self::OPT_ENABLED ,'on') === 'on';
    181     }
    182 
    183     private function getHeadersByDomain(): array {
    184         $raw     = get_option(self::OPT_HEADERS_BY_DOMAIN ,'[]');
    185         $decoded = json_decode((string) $raw ,true);
     211    private function emailTranslationsEnabled(): bool
     212    {
     213        return get_option(self::OPT_ENABLED, 'on') === 'on';
     214    }
     215
     216    private function getHeadersByDomain(): array
     217    {
     218        $raw     = get_option(self::OPT_HEADERS_BY_DOMAIN, '[]');
     219        $decoded = json_decode((string) $raw, true);
    186220
    187221        return is_array($decoded) ? $decoded : [];
    188222    }
    189223
    190     private function getHeaderInfoForClone(?string $clone_id): ?array {
     224    private function getHeaderInfoForClone(?string $clone_id): ?array
     225    {
    191226        if (empty($clone_id)) {
    192227            return null;
     
    207242    }
    208243
    209     private function isRecipientExcluded(array $args): bool {
    210         $option = get_option(self::OPT_EXCLUDED ,'');
     244    private function isRecipientExcluded(array $args): bool
     245    {
     246        $option = get_option(self::OPT_EXCLUDED, '');
    211247        if (!is_string($option) || $option === '') {
    212248            return false;
     
    222258
    223259        if (is_string($to) && $to !== '') {
    224             $recipients = preg_split('/[\s,;]+/' ,$to ,- 1 ,PREG_SPLIT_NO_EMPTY) ?: [];
     260            $recipients = preg_split('/[\s,;]+/', $to, -1, PREG_SPLIT_NO_EMPTY) ?: [];
    225261        } elseif (is_array($to)) {
    226262            $recipients = $to;
     
    234270            $recipientLower = Functions::lower($recipient);
    235271            foreach ($excluded as $needle) {
    236                 if ($needle !== '' && strpos($recipientLower ,$needle) !== false) {
     272                if ($needle !== '' && strpos($recipientLower, $needle) !== false) {
    237273                    return true;
    238274                }
     
    243279    }
    244280
    245     private function parseLowercasedList(string $value): array {
    246         $parts = preg_split('/[\s,;]+/' ,$value ,- 1 ,PREG_SPLIT_NO_EMPTY) ?: [];
     281    private function parseLowercasedList(string $value): array
     282    {
     283        $parts = preg_split('/[\s,;]+/', $value, -1, PREG_SPLIT_NO_EMPTY) ?: [];
    247284        $out   = [];
    248285
  • clonable/trunk/traits/PluginCheck.php

    r3455196 r3486633  
    3434    }   
    3535
     36    /**
     37     * Check if the Clonable Advanced plugin is installed
     38     * @return bool
     39     */
     40    public function clonable_advanced_installed() {
     41        return $this->check_plugin_by_file('clonable-advanced/clonable-advanced.php');
     42    }
     43
    3644    /**
    3745     * Check if the WooCommerce Multi Currency plugin is installed
  • clonable/trunk/views/EmailTranslationsView.php

    r3452753 r3486633  
    77use Clonable\models\EmailTranslations;
    88use Clonable\Objects\ClonableConfig;
     9use Clonable\Traits\PluginCheck;
    910
    1011class EmailTranslationsView implements ViewInterface
    1112{
    1213    use Forms;
     14    use PluginCheck;
    1315
    1416    public function render(): void
     
    2628    {
    2729        echo '<p style="max-width: 75%">Configure the email translation settings used by Clonable.</p>';
     30        /* if clonable advanced is installed, generate warning if the email translations are enabled */
     31        if ($this->clonable_advanced_installed() && $this->emailTranslationsEnabled()) {
     32            echo '<p class="warning" style="max-width: 75%; color: red; padding:10px; display:inline-block; border:1px solid red; margin:0;"><strong>Warning</strong> - Woocommerce email translations are enabled, but the Clonable Advanced module also seems to be used.<br>Be aware of potential conflicts regarding Woocommerce Email translations.</p>';
     33        }
     34    }
     35
     36    public function emailTranslationsEnabled()
     37    {
     38        return get_option('clonable_email_translations_enabled', 'off') === 'on';
    2839    }
    2940
     
    255266            Configure order PDF fields for specific clone domains.
    256267            Domains are fixed and based on the Allowed Origins list.
    257             <br/>
     268            <br />
    258269            Leave the fields empty to use the same PDF fields for the
    259270            translated version, as the default version.
Note: See TracChangeset for help on using the changeset viewer.