Plugin Directory

Changeset 3467415


Ignore:
Timestamp:
02/23/2026 08:54:44 AM (5 weeks ago)
Author:
clonable
Message:

Version 2.9.3

Location:
clonable
Files:
136 added
15 edited

Legend:

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

    r3455196 r3467415  
    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.2
     7Version: 2.9.3
    88Author: Clonable BV
    99Author URI: https://www.clonable.net
    1010License: GPL v2 or later
    1111Requires PHP: 7.0
    12 Tested up to: 6.9
     12Tested up to: 6.9.1
    1313*/
    1414
     
    126126
    127127define('CLONABLE_NAME', 'Clonable');
    128 define('CLONABLE_VERSION', '2.9.2');
     128define('CLONABLE_VERSION', '2.9.3');
    129129
    130130if (defined('WP_CLI') && WP_CLI) {
  • clonable/trunk/controllers/EmailTranslationsController.php

    r3452753 r3467415  
    88use Clonable\Models\EmailTranslations;
    99
    10 class EmailTranslationsController extends Controller {
     10class EmailTranslationsController extends Controller
     11{
    1112    use Validation;
    1213
    1314    private static $instance = null;
    1415
    15     public static function get_instance() {
     16    public static function get_instance()
     17    {
    1618        if (self::$instance === null) {
    1719            self::$instance = new EmailTranslationsController();
     
    2123    }
    2224
    23     private function __construct() {
     25    private function __construct()
     26    {
    2427        // Keep constructor private
    2528        $this->view = new EmailTranslationsView();
    2629    }
    2730
    28     public function validate($request) {
    29         $this->validate_fields($request ,EmailTranslations::$fields);
    30     }
    31 
    32     public function clonable_email_translations_enabled_validate($input) {
    33         return $this->validate_checkbox($input ,'clonable_email_translations_enabled');
    34     }
    35 
    36     public function clonable_email_translations_excluded_addresses_validate($input) {
     31    public function validate($request)
     32    {
     33        $this->validate_fields($request, EmailTranslations::$fields);
     34    }
     35
     36    public function clonable_email_translations_enabled_validate($input)
     37    {
     38        return $this->validate_checkbox($input, 'clonable_email_translations_enabled');
     39    }
     40
     41    public function clonable_woocommerce_enable_pdf_invoice_translation_validate($input)
     42    {
     43        return $this->validate_checkbox($input, 'clonable_woocommerce_enable_pdf_invoice_translation');
     44    }
     45
     46    public function clonable_email_translations_excluded_addresses_validate($input)
     47    {
    3748        if (!is_string($input)) {
    3849            $input = '';
     
    4455        }
    4556
    46         $parts = preg_split('/[\s,;]+/' ,$input ,- 1 ,PREG_SPLIT_NO_EMPTY);
     57        $parts = preg_split('/[\s,;]+/', $input, -1, PREG_SPLIT_NO_EMPTY);
    4758
    4859        $valid   = [];
     
    6374        if (!empty($invalid) && \function_exists('add_settings_error')) {
    6475            add_settings_error(
    65                 'clonable_email_translations_excluded_addresses' ,
    66                 'clonable_invalid_excluded_emails' ,
    67                 'Invalid email address(es): ' . implode(', ' ,$invalid) ,
     76                'clonable_email_translations_excluded_addresses',
     77                'clonable_invalid_excluded_emails',
     78                'Invalid email address(es): ' . implode(', ', $invalid),
    6879                'error'
    6980            );
    7081        }
    7182
    72         return implode(', ' ,$valid);
    73     }
    74 
    75     public function clonable_email_headers_by_domain_validate($input) {
     83        return implode(', ', $valid);
     84    }
     85
     86    public function clonable_email_headers_by_domain_validate($input)
     87    {
    7688        // The UI may submit a JSON string; normalize to array.
    7789        if (is_string($input)) {
    78             $decoded = json_decode(stripslashes($input) ,true);
     90            $decoded = json_decode(stripslashes($input), true);
    7991            if (json_last_error() === JSON_ERROR_NONE) {
    8092                $input = $decoded;
     
    109121                    if (function_exists('add_settings_error')) {
    110122                        add_settings_error(
    111                             'clonable_email_headers_by_domain' ,
    112                             'clonable_invalid_from_address_' . md5($domain) ,
     123                            'clonable_email_headers_by_domain',
     124                            'clonable_invalid_from_address_' . md5($domain),
    113125                            "Invalid From Address for domain '{$domain}': " . $row['from_address']
    114126                        );
     
    123135                    if (function_exists('add_settings_error')) {
    124136                        add_settings_error(
    125                             'clonable_email_headers_by_domain' ,
    126                             'clonable_invalid_reply_to_' . md5($domain) ,
    127                             "Invalid Reply-To Address for domain '{$domain}': " . (string) $row['reply_to'] ,
     137                            'clonable_email_headers_by_domain',
     138                            'clonable_invalid_reply_to_' . md5($domain),
     139                            "Invalid Reply-To Address for domain '{$domain}': " . (string) $row['reply_to'],
    128140                            'error'
    129141                        );
     
    137149                    if (function_exists('add_settings_error')) {
    138150                        add_settings_error(
    139                             'clonable_email_headers_by_domain' ,
    140                             'clonable_invalid_sender_name_' . md5($domain) ,
     151                            'clonable_email_headers_by_domain',
     152                            'clonable_invalid_sender_name_' . md5($domain),
    141153                            "Invalid Sender Name for domain '{$domain}': " . $row['sender_name']
    142154                        );
     
    151163                $sanitized_logo = \function_exists('esc_url_raw')
    152164                    ? esc_url_raw($email_logo)
    153                     : (string) filter_var($email_logo ,FILTER_SANITIZE_URL);
     165                    : (string) filter_var($email_logo, FILTER_SANITIZE_URL);
    154166
    155167                // Check if the URL entered is an image URL
    156                 $path     = parse_url($sanitized_logo ,PHP_URL_PATH);
    157                 $ext      = is_string($path) ? strtolower((string) pathinfo($path ,PATHINFO_EXTENSION)) : '';
    158                 $is_image = in_array($ext ,['png' ,'jpg' ,'jpeg' ,'gif' ,'webp' ,'svg'] ,true);
     168                $path     = parse_url($sanitized_logo, PHP_URL_PATH);
     169                $ext      = is_string($path) ? strtolower((string) pathinfo($path, PATHINFO_EXTENSION)) : '';
     170                $is_image = in_array($ext, ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg'], true);
    159171
    160172                if (!$sanitized_logo || !$is_image) {
     
    162174                    if (\function_exists('add_settings_error')) {
    163175                        add_settings_error(
    164                             'clonable_email_headers_by_domain' ,
    165                             'clonable_invalid_email_logo_' . $domain ,
     176                            'clonable_email_headers_by_domain',
     177                            'clonable_invalid_email_logo_' . $domain,
    166178                            "Invalid Email Logo URL for clone domain '{$domain}': " . ($row['email_logo'] ?? '')
    167179                        );
     
    173185
    174186            $validated_rows[] = [
    175                 'clone_id'     => $clone_id ,
    176                 'domain'       => $domain ,
    177                 'from_address' => $from_address ,
    178                 'reply_to'     => $reply_to ,
    179                 'sender_name'  => $sender_name ,
    180                 'email_logo'   => $email_logo ,
     187                'clone_id'     => $clone_id,
     188                'domain'       => $domain,
     189                'from_address' => $from_address,
     190                'reply_to'     => $reply_to,
     191                'sender_name'  => $sender_name,
     192                'email_logo'   => $email_logo,
    181193            ];
    182194        }
     
    185197    }
    186198
    187     public function clonable_wpo_replacements_by_domain_validate($input) {
     199    public function clonable_wpo_replacements_by_domain_validate($input)
     200    {
    188201        // The UI submits a JSON string via a hidden input; normalize to array.
    189202        if (is_string($input)) {
    190             $decoded = json_decode(stripslashes($input) ,true);
     203            $decoded = json_decode(stripslashes($input), true);
    191204            if (json_last_error() === JSON_ERROR_NONE) {
    192205                $input = $decoded;
     
    230243                    if (function_exists('add_settings_error')) {
    231244                        add_settings_error(
    232                             'clonable_wpo_replacements_by_domain' ,
    233                             'clonable_invalid_shop_email_' . md5($domain) ,
     245                            'clonable_wpo_replacements_by_domain',
     246                            'clonable_invalid_shop_email_' . md5($domain),
    234247                            "Invalid shop email address for domain '$domain': " . $shop_email_address
    235248                        );
     
    240253
    241254            $validated_rows[] = [
    242                 'clone_id'                => $clone_id ,
    243                 'domain'                  => $domain ,
    244                 'shop_phone_number'       => $shop_phone_number ,
    245                 'shop_email_address'      => $shop_email_address ,
    246                 'shop_name'               => $shop_name ,
    247                 'vat_number'              => $vat_number ,
    248                 'coc_number'              => $coc_number ,
    249                 'shop_address_line_1'     => $shop_address_line_1 ,
    250                 'shop_address_line_2'     => $shop_address_line_2 ,
    251                 'shop_address_country'    => $shop_address_country ,
    252                 'shop_address_state'      => $shop_address_state ,
    253                 'shop_address_city'       => $shop_address_city ,
    254                 'shop_address_postcode'   => $shop_address_postcode ,
    255                 'shop_address_additional' => $shop_address_additional ,
     255                'clone_id'                => $clone_id,
     256                'domain'                  => $domain,
     257                'shop_phone_number'       => $shop_phone_number,
     258                'shop_email_address'      => $shop_email_address,
     259                'shop_name'               => $shop_name,
     260                'vat_number'              => $vat_number,
     261                'coc_number'              => $coc_number,
     262                'shop_address_line_1'     => $shop_address_line_1,
     263                'shop_address_line_2'     => $shop_address_line_2,
     264                'shop_address_country'    => $shop_address_country,
     265                'shop_address_state'      => $shop_address_state,
     266                'shop_address_city'       => $shop_address_city,
     267                'shop_address_postcode'   => $shop_address_postcode,
     268                'shop_address_additional' => $shop_address_additional,
    256269            ];
    257270        }
  • clonable/trunk/controllers/WoocommerceController.php

    r3452753 r3467415  
    9191    }
    9292
    93     public function clonable_woocommerce_enable_pdf_invoice_translation_validate($input) {
    94         return $this->validate_checkbox($input, 'clonable_woocommerce_enable_pdf_invoice_translation');
    95     }
    96 
    9793    public function clonable_curcy_currency_override_validate($input)
    9894    {
     
    139135            }
    140136
    141             $domain_part = preg_replace('/^https?:\/\//', '', $row->domain); 
     137            $domain_part = preg_replace('/^https?:\/\//', '', $row->domain);
    142138            $domain_part = explode('/', $domain_part, 2)[0];
    143139
     
    150146                return $old_input;
    151147            }
    152      
     148
    153149            if (!empty($row->billing_country) && !preg_match('/^[A-Z]{2}$/', $row->billing_country)) {
    154150                add_settings_error('clonable_default_country_by_domain', 'err_invalid_billing_country', "Landcode " . esc_html($row->billing_country) . " is niet valide. Gebruik een 2-letter ISO landcode.");
     
    160156                return $old_input;
    161157            }
    162 
    163158        }
    164159
  • clonable/trunk/helpers/TextTranslator.php

    r3455196 r3467415  
    3636        $editorToken = null;
    3737        $timeoutSec = 10;
     38        $max_length = 49152;
    3839
    3940        if ($content === '') {
    4041            throw new \RuntimeException('Content cannot be empty.');
     42        }
     43
     44        if (strlen($content) > $max_length) {
     45            return $content; // Content length exceeds limit, return original content
    4146        }
    4247
     
    133138        $is_html = strip_tags($content) !== $content;
    134139        $text_only = !$is_html;
    135         $max_length = 16384;
     140        $max_length = 49152;
    136141
    137142        // if HTML, minify and clean it first
  • clonable/trunk/readme-da_DK.txt

    r3455196 r3467415  
    33Tags: oversættelser, oversæt, flersproget, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme-de_DE.txt

    r3455196 r3467415  
    33Tags: Übersetzungen, übersetzen, mehrsprachig, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme-es_ES.txt

    r3455196 r3467415  
    33Tags: traducciones, traducir, multilingüe, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme-fr_FR.txt

    r3455196 r3467415  
    33Tags : traductions, traduire, multilingue, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme-it_IT.txt

    r3455196 r3467415  
    33Tags: traduzioni, tradurre, multilingue, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme-nb_NO.txt

    r3455196 r3467415  
    33Tags: oversettelser, oversette, flerspråklig, clonable
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme-nl_NL.txt

    r3455196 r3467415  
    33Tags: vertalingen, vertalen, meertalig, clonable
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versies lager dan 8.0
  • clonable/trunk/readme-sv_SE.txt

    r3455196 r3467415  
    33Tags: översättningar, översätta, flerspråkig, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/readme.txt

    r3455196 r3467415  
    33Tags: translations, translate, multilingual, clonable, seo
    44Requires at least: 5.0
    5 Tested up to: 6.9
     5Tested up to: 6.9.1
    66Requires PHP: 7.2
    7 Stable tag: 2.9.2
     7Stable tag: 2.9.3
    88License: GPL v2 or later
    99
     
    3232
    3333== Changelog ==
     34v2.9.3
     35Problems with default emails when clonable email translations are turned off.
     36
    3437v2.9.2
    3538Bugfix PHP versions lower that 8.0
  • clonable/trunk/services/ClonableWooCommerceService.php

    r3452753 r3467415  
    3030            return;
    3131        }
    32 
     32       
    3333        $include_woocommerce_analytics = get_option('clonable_woocommerce_analytics_enabled', 'on') === 'on';
    3434        if ($include_woocommerce_analytics) {
  • clonable/trunk/services/EmailTranslationsService.php

    r3452753 r3467415  
    1919
    2020    public function __construct() {
     21        if (!$this->emailTranslationsEnabled()) {
     22            return;
     23        }
     24
    2125        add_filter('wp_mail' ,[$this ,'translateMail'] ,PHP_INT_MAX);
    2226        add_filter('wp_mail_from' ,[$this ,'setMailFrom'] ,PHP_INT_MAX);
     
    2832    public function translateMail(array $args): array {
    2933        $clone_id = $this->getCloneIdFromRequest();
    30         if (empty($clone_id) || !$this->emailTranslationsEnabled()) {
     34        if (empty($clone_id)) {
    3135            return $args;
    3236        }
     
    7478    public function setMailFrom(string $from): string {
    7579        $clone_id = $this->getCloneIdFromRequest();
    76         if (empty($clone_id) || !$this->emailTranslationsEnabled()) {
     80        if (empty($clone_id)) {
    7781            return $from;
    7882        }
     
    9296    public function setMailSenderName(string $name): string {
    9397        $clone_id = $this->getCloneIdFromRequest();
    94         if (empty($clone_id) || !$this->emailTranslationsEnabled()) {
     98        if (empty($clone_id)) {
    9599            return $name;
    96100        }
     
    110114    public function setMailHeaderImage(string $image): string {
    111115        $clone_id = $this->getCloneIdFromRequest();
    112         if (empty($clone_id) || !$this->emailTranslationsEnabled()) {
     116        if (empty($clone_id)) {
    113117            return $image;
    114118        }
Note: See TracChangeset for help on using the changeset viewer.