Plugin Directory

Changeset 3462384


Ignore:
Timestamp:
02/16/2026 10:25:00 AM (3 weeks ago)
Author:
memsource
Message:

Version 4.7.9

Location:
memsource-connector/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • memsource-connector/trunk/memsource.php

    r3452798 r3462384  
    55Plugin URI: https://support.phrase.com/hc/en-us/articles/5709657294620
    66Description: Localize WordPress websites with the help of professional translation tools: translation memories, terminology bases and quality checkers.
    7 Version: 4.7.8
     7Version: 4.7.9
    88Text Domain: memsource
    99Domain Path: /locale
     
    1818
    1919define('MEMSOURCE_PLUGIN_PATH', dirname(__FILE__));
    20 define('MEMSOURCE_PLUGIN_VERSION', '4.7.8');
     20define('MEMSOURCE_PLUGIN_VERSION', '4.7.9');
    2121define('MEMSOURCE_PLUGIN_DIR_URL', plugin_dir_url(__FILE__));
    2222define('MEMSOURCE_PLUGIN_REQUIERED_PHP_VERSION', '7.4');
  • memsource-connector/trunk/readme.txt

    r3452798 r3462384  
    3333== Changelog ==
    3434
     35= 4.7.9 =
     36*Release Date - 16 Feb 2026*
     37
     38* Improved handling of Elementor data
     39
    3540= 4.7.8 =
    3641*Release Date - 3 Feb 2026*
  • memsource-connector/trunk/src/Service/CustomFields/CustomFieldsDecodeService.php

    r3452798 r3462384  
    8989
    9090                if ($this->elementorPlugin->isElementorDataField($match[2])) {
    91                     $value = $this->elementorPlugin->decodeElementorDataField($value);
     91                    $elementorValue = $match[3];
     92                    if (!$this->elementorPlugin->includesElementorDataField($elementorValue)) {
     93                        preg_match_all($this->getElementorRegex(), $string, $eMatches, PREG_SET_ORDER);
     94                        $elementorValue = $eMatches[0][3];
     95                    }
     96                    $value = $this->elementorPlugin->decodeElementorDataField($elementorValue);
    9297                } elseif ($this->acfPlugin->isAcfEncodedCustomField($value)) {
    9398                    $value = $this->acfPlugin->decodeAcfCustomField($value);
     
    130135        ];
    131136    }
     137
     138    /**
     139     * Return a stricter regex pattern for Elementor data fields
     140     *
     141     * @return string
     142     */
     143    private function getElementorRegex(): string
     144    {
     145        return '/<div data-type="custom_field_v2" data-source-id="(\d+)" data-key="(_elementor_data)"><div id="value">([\s\S]*?<!--_elementor_data_.*?-->)<\/div><\/div>/s';
     146    }
    132147}
  • memsource-connector/trunk/src/Service/ExternalPlugin/ElementorPlugin.php

    r3411119 r3462384  
    1818
    1919    private const ELEMENTOR_RESULT_PATTERN_ENCODE = '<!--_elementor_data_%s-->';
    20     private const ELEMENTOR_RESULT_PATTERN_DECODE = '|.+</div><!--_elementor_data_(.+)-->|sm';
     20    private const ELEMENTOR_RESULT_PATTERN_DECODE = '|<!--_elementor_data_(.+)-->|sm';
    2121
    2222    private const ELEMENTOR_TRANSLATABLE_FIELDS = [
     
    385385        }
    386386    }
     387
     388    public function includesElementorDataField($translations): bool
     389    {
     390        preg_match(self::ELEMENTOR_RESULT_PATTERN_DECODE, $translations, $json);
     391        return $json[1] !== null;
     392    }
    387393}
Note: See TracChangeset for help on using the changeset viewer.