Plugin Directory

Changeset 3452798


Ignore:
Timestamp:
02/03/2026 11:18:39 AM (5 weeks ago)
Author:
memsource
Message:

Version 4.7.8

Location:
memsource-connector/trunk
Files:
39 edited

Legend:

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

    r3437807 r3452798  
    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.7
     7Version: 4.7.8
    88Text Domain: memsource
    99Domain Path: /locale
     
    1818
    1919define('MEMSOURCE_PLUGIN_PATH', dirname(__FILE__));
    20 define('MEMSOURCE_PLUGIN_VERSION', '4.7.7');
     20define('MEMSOURCE_PLUGIN_VERSION', '4.7.8');
    2121define('MEMSOURCE_PLUGIN_DIR_URL', plugin_dir_url(__FILE__));
    2222define('MEMSOURCE_PLUGIN_REQUIERED_PHP_VERSION', '7.4');
  • memsource-connector/trunk/readme.txt

    r3437807 r3452798  
    3333== Changelog ==
    3434
     35= 4.7.8 =
     36*Release Date - 3 Feb 2026*
     37
     38* Fixed shortcode encoding and enabled registration of shortcodes with numerical values.
     39* Fixed bug related repeated attributes in custom blocks.
     40
    3541= 4.7.7 =
    3642*Release Date - 12 Jan 2026*
  • memsource-connector/trunk/src/Controller/ContentController.php

    r3056870 r3452798  
    2121    ];
    2222
    23     /** @var \wpdb */
    24     private $wpdb;
    25 
    26     /** @var OptionsService */
    27     private $optionsService;
    28 
    29     /** @var AuthService */
    30     private $authService;
     23    private \wpdb $wpdb;
     24    private OptionsService $optionsService;
     25    private AuthService $authService;
     26    private DatabaseService $databaseService;
     27    private MetaDao $metaDao;
    3128
    3229    /** @var array|IContentService[] */
    33     private $contentServices = [];
    34 
    35     /** @var DatabaseService */
    36     private $databaseService;
    37 
    38     /** @var MetaDao */
    39     private $metaDao;
     30    private array $contentServices = [];
    4031
    4132    public function __construct(
  • memsource-connector/trunk/src/Controller/UserController.php

    r2870027 r3452798  
    1010class UserController
    1111{
    12     /** @var OptionsService */
    13     private $optionsService;
    14 
    15     /** @var AuthService */
    16     private $authService;
    17 
    18     /** @var LanguageService */
    19     private $languageService;
     12    private OptionsService $optionsService;
     13    private AuthService $authService;
     14    private LanguageService $languageService;
    2015
    2116    public function __construct(
  • memsource-connector/trunk/src/Dao/AbstractDao.php

    r2870027 r3452798  
    77class AbstractDao
    88{
    9     /** @var wpdb */
    10     protected $wpdb;
     9    protected wpdb $wpdb;
    1110
    1211    public function __construct()
  • memsource-connector/trunk/src/Dao/ContentSettingsDao.php

    r2870027 r3452798  
    88class ContentSettingsDao extends AbstractDao
    99{
    10     /** @var string */
    11     private $contentSettings;
     10    private string $contentSettings;
    1211
    1312    public function __construct()
  • memsource-connector/trunk/src/Dao/MetaDao.php

    r2870027 r3452798  
    77class MetaDao extends AbstractDao
    88{
    9     /** @var string */
    10     private $postmeta;
     9    private ?string $postmeta;
    1110
    12     /** @var string */
    13     private $termmeta;
     11    private ?string $termmeta;
    1412
    1513    public function __construct()
  • memsource-connector/trunk/src/Dto/ContentSettingsDto.php

    r2870027 r3452798  
    55final class ContentSettingsDto extends AbstractDto
    66{
    7     protected $id;
    8     protected $hash;
    9     protected $contentId;
    10     protected $contentType;
    11     protected $send;
     7    protected string $id;
     8    protected string $hash;
     9    protected string $contentId;
     10    protected string $contentType;
     11    protected string $send;
    1212
    1313    public function getId(): string
  • memsource-connector/trunk/src/Dto/MetaKeyDto.php

    r2870027 r3452798  
    1111    public const TYPE_TERM = 'term';
    1212
    13     protected $id;
    14     protected $name;
    15     protected $value;
    16     protected $type;
     13    protected string $id;
     14    protected string $name;
     15    protected string $value;
     16    protected string $type;
    1717
    1818    public function getId(): string
  • memsource-connector/trunk/src/Page/AdvancedPage.php

    r3426034 r3452798  
    88class AdvancedPage extends AbstractPage
    99{
    10     /** @var OptionsService */
    11     private $optionsService;
     10    private OptionsService $optionsService;
    1211
    1312    public function __construct(OptionsService $optionsService)
     
    2120    }
    2221
    23     public function renderPage()
     22    public function renderPage() // phpcs:ignore
    2423    {
    2524        ?>
     
    122121
    123122            <?php
    124                 $pathFromRequest = htmlspecialchars($_GET['path'] ?? '');
    125                 if (!isset($_GET['error'])) {
    126                     $pathFromRequest = '';
    127                 }
     123            $pathFromRequest = '';
     124            if (isset($_GET['error']) && isset($_GET['path'])) {
     125                $pathFromRequest = sanitize_text_field(
     126                    wp_unslash($_GET['path'])
     127                );
     128            }
    128129            ?>
    129130            <input type="checkbox" id="logFilePathToggle" name="logFilePathToggle"
    130                 <?php echo(!empty($this->optionsService->getLogFilePath()) || !empty($pathFromRequest) ? " checked" : "") ?>
    131                 onchange="if (document.getElementById('logFilePathSection').style.display === 'none') {document.getElementById('logFilePathSection').style.display = '';} else {document.getElementById('logFilePathSection').style.display = 'none';}">
    132             <?php $tooltip = 'By default, the logs are stored in the plugin folder. You can override this behavior by setting the path to a custom folder (folder must exist and must be writable).'; ?>
    133             <label for="logFilePathToggle" class="memsource-tooltip" title="<?php _e($tooltip, 'memsource'); ?>"><?php _e('Save logs to a custom folder', 'memsource'); ?></label>
     131                    <?php echo !empty($this->optionsService->getLogFilePath()) || !empty($pathFromRequest) ? " checked" : "" ?>
     132                    onchange="if (document.getElementById('logFilePathSection').style.display === 'none') {document.getElementById('logFilePathSection').style.display = '';} else {document.getElementById('logFilePathSection').style.display = 'none';}">
     133            <?php
     134            $tooltip = __(
     135                'By default, the logs are stored in the plugin folder. You can override this behavior by setting the path to a custom folder (folder must exist and must be writable).',
     136                'memsource'
     137            );
     138            ?> <label for="logFilePathToggle" class="memsource-tooltip"
     139                        title="<?php echo esc_attr($tooltip); ?>"><?php _e('Save logs to a custom folder', 'memsource'); ?></label>
    134140            <div class="memsource-space-small"></div>
    135141
    136             <div id="logFilePathSection" <?php if (empty($this->optionsService->getLogFilePath()) && empty($pathFromRequest)) { ?>style="display: none;"<?php } ?>>
     142            <div id="logFilePathSection"
     143                <?php if (empty($this->optionsService->getLogFilePath()) && empty($pathFromRequest)) {
     144                    ?>style="display: none;"<?php
     145                } ?>>
    137146                <label for="logFilePath"><?php _e('Path to a custom folder where logs will be saved:', 'memsource'); ?></label>
    138                 <input id="logFilePath" type="text" name="logFilePath" size="60" value="<?php echo empty($pathFromRequest) ? $this->optionsService->getLogFilePath() : $pathFromRequest; ?>"/>
     147                <input id="logFilePath" type="text" name="logFilePath" size="60"
     148                        value="<?php echo empty($pathFromRequest) ? $this->optionsService->getLogFilePath() : $pathFromRequest; ?>"/>
    139149            </div>
    140150
     
    144154                        <?php
    145155                        if ($_GET['error'] === LogUtils::ERROR_LOG_PATH_NOT_WRITABLE) {
    146                             echo sprintf(__('Provided folder \'%s\' is not writable', 'memsource'), $pathFromRequest);
     156                            /* translators: %s: path to the log folder */
     157                            echo sprintf(__('Provided folder \'%s\' is not writable', 'memsource'), esc_html($pathFromRequest));
    147158                        } elseif ($_GET['error'] === LogUtils::ERROR_LOG_PATH_NOT_DIRECTORY) {
    148                             echo sprintf(__('Provided folder \'%s\' does not exist', 'memsource'), $pathFromRequest);
     159                            /* translators: %s: path to the log folder */
     160                            echo sprintf(__('Provided folder \'%s\' does not exist', 'memsource'), esc_html($pathFromRequest));
    149161                        } elseif ($_GET['error'] === LogUtils::ERROR_RELATIVE_PATH_NOT_ALLOWED) {
    150162                            _e('Relative path is not allowed, use absolute path instead', 'memsource');
  • memsource-connector/trunk/src/Page/BlockPage.php

    r3056870 r3452798  
    77class BlockPage extends AbstractPage
    88{
    9     /** @var BlockService */
    10     private $blockService;
     9    private BlockService $blockService;
    1110
    1211    public function __construct(BlockService $blockService)
  • memsource-connector/trunk/src/Page/ConnectorPage.php

    r3056870 r3452798  
    99class ConnectorPage extends AbstractPage
    1010{
    11     /** @var OptionsService */
    12     private $optionsService;
    13 
    14     /** @var TranslationWorkflowService */
    15     private $translationWorkflowService;
    16 
    17     /** @var AcfPlugin */
    18     private $acfPlugin;
     11    private OptionsService $optionsService;
     12    private TranslationWorkflowService $translationWorkflowService;
     13    private AcfPlugin $acfPlugin;
    1914
    2015    public function __construct(OptionsService $optionsService, TranslationWorkflowService $translationWorkflowService, AcfPlugin $acfPlugin)
  • memsource-connector/trunk/src/Page/CustomFieldsPage.php

    r3056870 r3452798  
    1111    private const PAGE_SIZE = 50;
    1212
    13     /** @var CustomFieldsSettingsService */
    14     private $customFieldsSettingsService;
    15 
    16     /** @var MetaDao */
    17     private $metaDao;
     13    private CustomFieldsSettingsService $customFieldsSettingsService;
     14    private MetaDao $metaDao;
    1815
    1916    public function __construct(CustomFieldsSettingsService $customFieldsSettingsService, MetaDao $metaDao)
  • memsource-connector/trunk/src/Page/LanguageMappingPage.php

    r3056870 r3452798  
    1111    private const MENU_SLUG = 'memsource-connector-language-mapping';
    1212
    13     /** @var DatabaseService */
    14     private $databaseService;
    15 
    16     /** @var ITranslationPlugin */
    17     private $translationPlugin;
     13    private DatabaseService $databaseService;
     14    private ITranslationPlugin $translationPlugin;
    1815
    1916    public function __construct(DatabaseService $databaseService, ITranslationPlugin $translationPlugin)
  • memsource-connector/trunk/src/Page/ShortcodePage.php

    r3056870 r3452798  
    77class ShortcodePage extends AbstractPage
    88{
    9     private $shortcodeService;
     9    private ShortcodeService $shortcodeService;
    1010
    1111    public function __construct(ShortcodeService $shortcodeService)
     
    2626                var shortCode = jQuery('#shortCode').val();
    2727                var attributes = jQuery('#attributes').val();
    28                 if (!/^[a-zA-Z_-]+$/.test(shortCode)) {
    29                     alert('<?php _e('Invalid shortcode. Please make sure it contains only letters, underscores and hyphens.', 'memsource'); ?>');
     28                if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(shortCode)) {
     29                    alert('Invalid shortcode. Please start with a letter; subsequent characters may include letters, numbers, underscores, and hyphens.');
    3030                }
    3131                else if (attributes && !/^[a-zA-Z0-9_,-]+$/.test(attributes)) {
  • memsource-connector/trunk/src/Parser/BlockParser.php

    r3437807 r3452798  
    1313    private const MEMSOURCE_BLOCK_COMMENT = 'MEMSOURCE_BLOCK_COMMENT';
    1414
    15     /** @var ArrayUtils */
    16     private $arrayUtils;
    17 
    18     /** @var AuthUtils */
    19     private $authUtils;
    20 
    21     /** @var BlockService */
    22     private $blockService;
    23 
    24     /** @var string */
    25     private $content;
     15    private ArrayUtils $arrayUtils;
     16    private AuthUtils $authUtils;
     17    private BlockService $blockService;
     18    private string $content;
    2619
    2720    public function __construct(ArrayUtils $arrayUtils, AuthUtils $authUtils, BlockService $blockService)
     
    10194        $value = $this->encodeValueForRegex($value);
    10295
    103         $pattern = '/(<!-- wp:' .
     96        // Try two regex variants to find the attribute value inside the block comment
     97        $patterns = [
     98            // Variant 1: direct string value right after the attribute
     99            '/(<!-- wp:' .
    104100            preg_quote($block, '/') .
    105101            '.*?"' .
    106102            preg_quote($attribute, '/') .
    107             '":.*?")(' .
     103            '"\s*:\s*\")(' .
    108104            $value .
    109             ')(".*?-->)/smi';
    110 
    111         $token = $this->authUtils->generateRandomToken();
     105            ')(".*?-->)/smi',
     106
     107            // Variant 2: attribute appears earlier, value appears later
     108            '/(<!-- wp:' .
     109            preg_quote($block, '/') .
     110            '.*?"' .
     111            preg_quote($attribute, '/') .
     112            '":.*?\")(' .
     113            $value .
     114            ')(".*?-->)/smi',
     115        ];
     116
    112117        $replaced = false;
    113 
    114         try {
    115             preg_match($pattern, $this->content, $matches);
    116         } catch (\Throwable $exception) {
    117             LogUtils::error('Failed processing regex', $exception);
    118             LogUtils::debug('Extracting text from block, failed to match regex for', [
    119                 'block' => $block,
    120                 'attribute' => $attribute,
    121                 'isValueScalar' => $isValueScalar,
    122             ]);
    123         }
    124 
    125         if (isset($matches[2]) && !$this->isHtmlUrl($matches[2])) {
    126             $lastKey = key(array_slice($matches, -1, 1, true));
    127             $replacement = '${1}' . $this->quoteReplacement(
    128                 '--><div class="memsource-block-start memsource-id-' . $token . '"></div>' .
    129                 json_decode('"' . $matches[2] . '"') .
    130                 '<div class="memsource-block-end memsource-id-' . $token . '"></div><!--' . $matches[$lastKey]
    131             );
    132 
    133             $this->content = preg_replace($pattern, $replacement, $this->content, 1, $replaced);
     118        $matches = [];
     119
     120        foreach ($patterns as $pattern) {
     121            try {
     122                preg_match($pattern, $this->content, $matches);
     123            } catch (\Throwable $exception) {
     124                LogUtils::error('Failed processing regex', $exception);
     125                continue;
     126            }
     127
     128            if (isset($matches[2]) && !$this->isHtmlUrl($matches[2])) {
     129                $token = $this->authUtils->generateRandomToken();
     130                $lastKey = key(array_slice($matches, -1, 1, true));
     131                $replacement = '${1}' . $this->quoteReplacement(
     132                    '--><div class="memsource-block-start memsource-id-' . $token . '"></div>' .
     133                    json_decode('"' . $matches[2] . '"') .
     134                    '<div class="memsource-block-end memsource-id-' . $token . '"></div><!--' . $matches[$lastKey]
     135                );
     136
     137                $this->content = preg_replace($pattern, $replacement, $this->content, 1, $replaced);
     138                if ($replaced) {
     139                    break;
     140                }
     141            }
    134142        }
    135143
  • memsource-connector/trunk/src/Parser/ParserResult.php

    r2643752 r3452798  
    55class ParserResult
    66{
    7     /** @var string */
    8     private $transformationResult;
    9 
    10     /** @var array */
    11     private $placeholders;
    12 
    13     /** @var string */
    14     private $preparedToStore;
     7    private string $transformationResult;
     8    private string $preparedToStore;
     9    private array $placeholders; // phpcs:ignore
    1510
    1611    public function __construct(string $transformationResult = '', array $placeholders = [], string $preparedToStore = '')
  • memsource-connector/trunk/src/Parser/ShortcodeParser.php

    r3056870 r3452798  
    1212    private const SHORTCODE_WRAPPING_POST_CONTENT = 'memsource_body';
    1313
    14     /** @var AuthUtils */
    15     private $authUtils;
    16 
    17     /** @var PlaceholderService */
    18     private $placeholderService;
     14    private AuthUtils $authUtils;
     15    private PlaceholderService $placeholderService;
    1916
    2017    public function __construct(AuthUtils $authUtils, PlaceholderService $placeholderService)
     
    4037
    4138        $result = "";
    42         $shortcodePostponeCount = [];
    4339        $placeholders = [];
     40        $noChangeCounter = 0;
    4441
    4542        // load WpBakery shortcodes so that function strip_shortcodes() works properly
     
    5350        // post contains both shortcodes and plain text on the top level
    5451        $contentWithoutShortcodes = wp_strip_all_tags(strip_shortcodes($content));
    55         if (! empty(trim($contentWithoutShortcodes)) && $content !== $contentWithoutShortcodes) {
     52        if (!empty(trim($contentWithoutShortcodes)) && $content !== $contentWithoutShortcodes) {
    5653            $content = '[' . self::SHORTCODE_WRAPPING_POST_CONTENT . ']' . $content . '[/' . self::SHORTCODE_WRAPPING_POST_CONTENT . ']';
    5754            $availableShortcodes[] = [
     
    6663        }
    6764
    68         while (!empty($availableShortcodes)) {
    69             foreach ($availableShortcodes as $shortcodeKey => $shortcodeObject) {
     65        $shortcodeList = $availableShortcodes;
     66        while ($shortcodeList) {
     67            $madeProgress = false;
     68            foreach ($shortcodeList as $shortcodeKey => $shortcodeObject) {
    7069                $shortcode = $shortcodeObject['tag'];
     70                if (!$this->contentHasShortcodeTag($content, $shortcode)) {
     71                    unset($availableShortcodes[$shortcodeKey]);
     72                    continue;
     73                }
    7174
    7275                // 1) non-pair tags: [shortcode attribute="text"]
     
    8790                                } else {
    8891                                    $content = $newContent;
     92                                    $madeProgress = true;
    8993                                }
    9094                                $result .= '<div id="' . $attributeWithId . '" class="memsource-attribute">' .
    9195                                    $extractedText .
    92                                     '<div class="memsource-attribute-end" data-delimiter="' . $delimiter . '"></div>' .
     96                                    '<div class="memsource-attribute-end" data-delimiter="' . htmlspecialchars($delimiter, ENT_QUOTES) . '"></div>' .
    9397                                    '</div>';
    9498                            }
     
    98102
    99103                // 2) pair tags: [shortcode]text[/shortcode]
    100                 if (! isset($shortcodeObject['ignore_body']) || ! $shortcodeObject['ignore_body']) {
     104                if (!isset($shortcodeObject['ignore_body']) || !$shortcodeObject['ignore_body']) {
    101105                    $parsedShortcode = true;
    102106                    while ($parsedShortcode) {
     
    105109                            $attributes = preg_replace("|]$|", "", $parsedShortcode[0]);
    106110                            $extractedText = $parsedShortcode[1];
    107                             // shortcode contains another (nested) shortcode - process them first, postpone the current one
    108                             if ($extractedText !== strip_shortcodes($extractedText)) {
    109                                 if (isset($shortcodePostponeCount[$shortcodeKey])) {
    110                                     $shortcodePostponeCount[$shortcodeKey]++;
    111                                 } else {
    112                                     $shortcodePostponeCount[$shortcodeKey] = 1;
    113                                 }
    114                                 if ($shortcodePostponeCount[$shortcodeKey] < self::SHORTCODE_MAX_NESTED_LEVEL) {
    115                                     continue 2;
    116                                 } else {
    117                                     error_log("Too many nested available_shortcodes detected, skipping for [$shortcode]");
    118                                 }
     111                            // shortcode contains another nested shortcode pair - process them first, postpone the current one
     112                            if ($this->containsNestedPairShortcodes($extractedText, $shortcodeList)) {
     113                                continue 2;
    119114                            }
    120115                            $shortcodeWithId = $shortcode . ':' . $this->authUtils->generateRandomToken();
     
    130125                            } else {
    131126                                $content = $newContent;
     127                                $madeProgress = true;
    132128                            }
    133129                            // detect Base64 encoded content in fusion_code tag, decode and mark it in end:tag
     
    147143                    }
    148144                }
    149                 unset($availableShortcodes[$shortcodeKey]);
     145            }
     146            if ($madeProgress) {
     147                $noChangeCounter = 0;
     148            } else {
     149                $noChangeCounter++;
     150                if ($noChangeCounter >= self::SHORTCODE_MAX_NESTED_LEVEL) {
     151                    break;
     152                }
    150153            }
    151154        }
     
    260263                    $uniqueId = $match[2];
    261264                    $delimiter = '"';
    262                     if (sizeof($match) >= 5) {
    263                         $delimiter = $match[5];
     265                    if (sizeof($match) >= 5 && !empty($match[5])) {
     266                        $delimiter = html_entity_decode($match[5], ENT_QUOTES);
    264267                    }
    265268                    $translatedText = html_entity_decode($match[3]);
     
    280283        return $storedContent;
    281284    }
     285
     286    /**
     287     * Parse text for any pairs of any shortcodes in given array.
     288     *
     289     * Sample input:
     290     *   $content = '[tag id="1"]text[/tag]';
     291     *   $shortCodeName = 'tag';
     292     * Output:
     293     *   true
     294     *
     295     * @param string $text Post, page or any other content.
     296     * @param array $availableShortcodes Array of all available shortcodes.
     297     * @return bool Returns boolean if text contains pair of any available shortcodes
     298     */
     299    private function containsNestedPairShortcodes(string $text, array $availableShortcodes): bool
     300    {
     301        foreach ($availableShortcodes as $shortcode) {
     302            $tag = preg_quote($shortcode['tag'], '#');
     303            // pair shortcode pattern: [tag ...] ... [/tag]
     304            if (preg_match("#\\[{$tag}(\\s+[^\\]]*\\]|\\])(.*?)\\[/{$tag}\\]#sm", $text)) {
     305                return true;
     306            }
     307        }
     308        return false;
     309    }
     310
     311    /**
     312     * Parse content for shortcode tag and returns boolean.
     313     *
     314     * Sample input:
     315     *   $content = '[tag id="1"]text[/tag]';
     316     *   $tag = 'tag';
     317     * Output:
     318     *   true
     319     *
     320     * @param string $content Post, page or any other content.
     321     * @param string $tag Tag of shortcode.
     322     * @return bool Returns boolean text contains given shortcode tag
     323     */
     324    private function contentHasShortcodeTag(string $content, string $tag): bool
     325    {
     326        $pattern = '/' . get_shortcode_regex([$tag]) . '/s';
     327        return (bool) preg_match($pattern, $content);
     328    }
    282329}
  • memsource-connector/trunk/src/Registry/AppRegistry.php

    r2870027 r3452798  
    5555class AppRegistry
    5656{
    57     /** @var OptionsService */
    58     private $optionsService;
    59 
    60     /** @var MigrateService */
    61     private $migrateService;
    62 
    63     /** @var DatabaseService */
    64     private $databaseService;
    65 
    66     /** @var LanguageService */
    67     private $languageService;
    68 
    69     /** @var FilterService */
    70     private $filterService;
    71 
    72     /** @var ShortcodeService */
    73     private $shortcodeService;
    74 
    75     /** @var TranslationWorkflowService */
    76     private $translationWorkflowService;
    77 
    78     /** @var TransformService */
    79     private $transformService;
    80 
    81     /** @var BlockService */
    82     private $blockService;
    83 
    84     /** @var CustomFieldsDecodeService */
    85     private $customFieldsDecodeService;
    86 
    87     /** @var CustomFieldsService */
    88     private $customFieldsService;
    89 
    90     /** @var ITranslationPlugin */
    91     private $translationPlugin;
    92 
    93     /** @var UserController */
    94     private $userController;
    95 
    96     /** @var ContentController */
    97     private $contentController;
    98 
    99     /** @var BlockPage */
    100     private $blockPage;
    101 
    102     /** @var ConnectorPage */
    103     private $connectorPage;
    104 
    105     /** @var CustomFieldsPage */
    106     private $customFieldsPage;
    107 
    108     /** @var AdvancedPage */
    109     private $advancedPage;
    110 
    111     /** @var LanguageMappingPage */
    112     private $languageMappingPage;
    113 
    114     /** @var ShortcodePage */
    115     private $shortcodePage;
    116 
    117     /** @var MetaDao */
    118     private $metaDao;
     57    private OptionsService $optionsService;
     58    private MigrateService $migrateService;
     59    private DatabaseService $databaseService;
     60    private LanguageService $languageService;
     61    private FilterService $filterService;
     62    private ShortcodeService $shortcodeService;
     63    private TranslationWorkflowService $translationWorkflowService;
     64    private TransformService $transformService;
     65    private BlockService $blockService;
     66    private CustomFieldsDecodeService $customFieldsDecodeService;
     67    private CustomFieldsService $customFieldsService;
     68    private ITranslationPlugin $translationPlugin;
     69    private UserController $userController;
     70    private ContentController $contentController;
     71    private BlockPage $blockPage;
     72    private ConnectorPage $connectorPage;
     73    private CustomFieldsPage $customFieldsPage;
     74    private AdvancedPage $advancedPage;
     75    private LanguageMappingPage $languageMappingPage;
     76    private ShortcodePage $shortcodePage;
     77    private MetaDao $metaDao;
    11978
    12079    public function __construct()
  • memsource-connector/trunk/src/Service/AuthService.php

    r3056870 r3452798  
    77class AuthService
    88{
    9     /** @var OptionsService */
    10     private $optionsService;
    11 
    12     /** @var ITranslationPlugin */
    13     private $translationPlugin;
     9    private OptionsService $optionsService;
     10    private ITranslationPlugin $translationPlugin;
    1411
    1512    public function __construct(OptionsService $optionsService, ITranslationPlugin $translationPlugin)
  • memsource-connector/trunk/src/Service/BlockService.php

    r3056870 r3452798  
    1313    private const MAX_EXPANSIONS = 100;
    1414
    15     private $predefinedBlocks = [];
    16     private $installedBlocks = [];
    17     private $customBlocks = [];
    18     private $allBlocks = [];
    19 
    20     private $initialized = false;
     15    private array $predefinedBlocks = []; // phpcs:ignore
     16    private array $installedBlocks = []; // phpcs:ignore
     17    private array $customBlocks = []; // phpcs:ignore
     18    private array $allBlocks = []; // phpcs:ignore
     19    private bool $initialized = false;
    2120
    2221    /**
  • memsource-connector/trunk/src/Service/Content/AbstractContentService.php

    r2870027 r3452798  
    1111abstract class AbstractContentService
    1212{
    13     /** @var LanguageService */
    14     protected $languageService;
    15 
    16     /** @var ITranslationPlugin */
    17     protected $translationPlugin;
    18 
    19     /** @var TransformService */
    20     protected $transformService;
    21 
    22     /** @var CustomFieldsDecodeService */
    23     protected $customFieldsDecodeService;
     13    protected LanguageService $languageService;
     14    protected ITranslationPlugin $translationPlugin;
     15    protected TransformService $transformService;
     16    protected CustomFieldsDecodeService $customFieldsDecodeService;
    2417
    2518    public function __construct(
  • memsource-connector/trunk/src/Service/Content/AbstractPostService.php

    r3056870 r3452798  
    2121abstract class AbstractPostService extends AbstractContentService implements IContentService
    2222{
    23     /** @var OptionsService */
    24     protected $optionsService;
    25 
    26     /** @var FilterService */
    27     private $filterService;
    28 
    29     /** @var CustomFieldsService */
    30     private $customFieldsService;
    31 
    32     /** @var TranslationWorkflowService */
    33     private $translationWorkflowService;
    34 
    35     /** @var MetaDao */
    36     private $metaDao;
     23    protected OptionsService $optionsService;
     24
     25    private FilterService $filterService;
     26    private CustomFieldsService $customFieldsService;
     27    private TranslationWorkflowService $translationWorkflowService;
     28    private MetaDao $metaDao;
    3729
    3830    public function __construct(
  • memsource-connector/trunk/src/Service/Content/CustomTypeTrait.php

    r2870027 r3452798  
    55trait CustomTypeTrait
    66{
    7     /** @var string */
    8     protected $label;
    9 
    10     /** @var string */
    11     protected $type;
     7    protected string $label;
     8    protected string $type;
    129
    1310    public function setType(string $type)
  • memsource-connector/trunk/src/Service/CustomFields/CustomFieldsDecodeService.php

    r2870027 r3452798  
    99class CustomFieldsDecodeService
    1010{
    11     /** @var AcfPlugin */
    12     private $acfPlugin;
    13 
    14     /** @var ElementorPlugin */
    15     private $elementorPlugin;
    16 
    17     /** @var SeoPlugin */
    18     private $seoPlugin;
     11    private AcfPlugin $acfPlugin;
     12    private ElementorPlugin $elementorPlugin;
     13    private SeoPlugin $seoPlugin;
    1914
    2015    public function __construct(
  • memsource-connector/trunk/src/Service/CustomFields/CustomFieldsEncodeService.php

    r3056870 r3452798  
    1616    private const RESULT_PLACEHOLDERS = 'placeholders';
    1717
    18     /** @var AcfPlugin */
    19     private $acfPlugin;
    20 
    21     /** @var ElementorPlugin */
    22     private $elementorPlugin;
    23 
    24     /** @var SeoPlugin */
    25     private $seoPlugin;
    26 
    27     /** @var AuthUtils */
    28     private $authUtils;
    29 
    30     /** @var PlaceholderService */
    31     private $placeholderService;
    32 
    33     /** @var CustomFieldsSettingsService */
    34     private $customFieldsSettingsService;
    35 
    36     /** @var CustomFieldsService */
    37     private $customFieldsService;
    38 
    39     /** @var MetaDao */
    40     private $metaDao;
     18    private AcfPlugin $acfPlugin;
     19    private ElementorPlugin $elementorPlugin;
     20    private SeoPlugin $seoPlugin;
     21    private AuthUtils $authUtils;
     22    private PlaceholderService $placeholderService;
     23    private CustomFieldsSettingsService $customFieldsSettingsService;
     24    private CustomFieldsService $customFieldsService;
     25    private MetaDao $metaDao;
    4126
    4227    public function __construct(
  • memsource-connector/trunk/src/Service/CustomFields/CustomFieldsService.php

    r3056870 r3452798  
    1111class CustomFieldsService
    1212{
    13     /** @var SeoPlugin */
    14     private $seoPlugin;
    15 
    16     /** @var TranslationWorkflowService */
    17     private $translationWorkflowService;
    18 
    19     /** @var CustomFieldsSettingsService */
    20     private $customFieldsSettingsService;
    21 
    22     /** @var MetaDao */
    23     private $metaDao;
     13    private SeoPlugin $seoPlugin;
     14    private TranslationWorkflowService $translationWorkflowService;
     15    private CustomFieldsSettingsService $customFieldsSettingsService;
     16    private MetaDao $metaDao;
    2417
    2518    public function __construct(
  • memsource-connector/trunk/src/Service/CustomFields/CustomFieldsSettingsService.php

    r2870027 r3452798  
    88class CustomFieldsSettingsService
    99{
    10     /** @var ContentSettingsDao */
    11     private $contentSettingsDao;
     10    private ContentSettingsDao $contentSettingsDao;
    1211
    1312    public function __construct(ContentSettingsDao $contentSettingsDao)
  • memsource-connector/trunk/src/Service/FilterService.php

    r2870027 r3452798  
    1010class FilterService
    1111{
    12     /** @var ITranslationPlugin */
    13     private $translationPlugin;
     12    private ITranslationPlugin $translationPlugin;
    1413
    1514    public function __construct(ITranslationPlugin $translationPlugin)
  • memsource-connector/trunk/src/Service/LanguageService.php

    r2870027 r3452798  
    77class LanguageService
    88{
    9     /** @var DatabaseService */
    10     private $databaseService;
     9    private DatabaseService $databaseService;
    1110
    12     /** @var ITranslationPlugin */
    13     private $translationPlugin;
     11    private ITranslationPlugin $translationPlugin;
    1412
    1513    public function __construct(DatabaseService $databaseService, ITranslationPlugin $translationPlugin)
  • memsource-connector/trunk/src/Service/Migrate/MigrateService.php

    r2870027 r3452798  
    77class MigrateService
    88{
    9     /**
    10      * @var SchemaService
    11      */
    12     private $schemaService;
    13 
    14     /**
    15      * @var UpdateService
    16      */
    17     private $updateService;
    18 
    19     /**
    20      * @var OptionsService
    21      */
    22     private $optionsService;
     9    private SchemaService $schemaService;
     10    private UpdateService $updateService;
     11    private OptionsService $optionsService;
    2312
    2413    public function __construct(SchemaService $schemaService, UpdateService $updateService, OptionsService $optionsService)
  • memsource-connector/trunk/src/Service/Migrate/UpdateService.php

    r3056870 r3452798  
    88class UpdateService
    99{
    10     private static $versionHistory = ['2.0'];
     10    /** @var string[] */
     11    private static array $versionHistory = ['2.0'];
    1112
    1213    public function updateDatabase($lastVersion)
  • memsource-connector/trunk/src/Service/OptionsService.php

    r3056870 r3452798  
    1717    public const OPTION_OFF = 'off';
    1818
    19     private $restNamespace = 'memsource/v1/connector';
    20 
    21     private $optionVersion = 'memsource_version';
    22     private $optionDbVersion = 'memsource_db_version';
    23     private $optionDebugMode = 'memsource_debug_mode';
    24     private $optionToken = 'memsource_token';
    25     private $optionAdminUser = 'memsource_admin_user';
    26     private $optionListStatus = 'memsource_list_status';
    27     private $optionInsertStatus = 'memsource_insert_status';
    28     private $optionUrlRewrite = 'memsource_url_rewrite';
    29     private $optionCopyPermalink = 'memsource_copy_permalink';
    30     private $optionTranslationWorkflow = 'memsource_translation_workflow';
    31     private $optionAutomationWidgetId = 'memsource_automation_widget_id';
    32     private $optionSourceLanguage = 'memsource_source_language';
    33     private $optionTargetLanguages = 'memsource_target_languages';
    34     private $optionMultilingualPlugin = 'memsource_multilingual_plugin';
    35     private $optionLogFilePath = 'memsource_log_file_path';
     19    private string $restNamespace = 'memsource/v1/connector';
     20
     21    private string $optionVersion = 'memsource_version';
     22    private string $optionDbVersion = 'memsource_db_version';
     23    private string $optionDebugMode = 'memsource_debug_mode';
     24    private string $optionToken = 'memsource_token';
     25    private string $optionAdminUser = 'memsource_admin_user';
     26    private string $optionListStatus = 'memsource_list_status';
     27    private string $optionInsertStatus = 'memsource_insert_status';
     28    private string $optionUrlRewrite = 'memsource_url_rewrite';
     29    private string $optionCopyPermalink = 'memsource_copy_permalink';
     30    private string $optionTranslationWorkflow = 'memsource_translation_workflow';
     31    private string $optionAutomationWidgetId = 'memsource_automation_widget_id';
     32    private string $optionSourceLanguage = 'memsource_source_language';
     33    private string $optionTargetLanguages = 'memsource_target_languages';
     34    private string $optionMultilingualPlugin = 'memsource_multilingual_plugin';
     35    private string $optionLogFilePath = 'memsource_log_file_path';
    3636
    3737    /**
  • memsource-connector/trunk/src/Service/PlaceholderService.php

    r3275856 r3452798  
    77class PlaceholderService
    88{
    9     /** @var AuthUtils */
    10     private $authUtils;
     9    private AuthUtils $authUtils;
    1110
    1211    public function __construct(AuthUtils $authUtils)
  • memsource-connector/trunk/src/Service/ShortcodeService.php

    r3056870 r3452798  
    99class ShortcodeService
    1010{
    11     private $shortcodeCache = [];
    12     private $shortcodeTypes = [];
     11    private array $shortcodeCache = []; // phpcs:ignore
     12    private array $shortcodeTypes = []; // phpcs:ignore
    1313
    1414    public function init()
  • memsource-connector/trunk/src/Service/TransformService.php

    r3411119 r3452798  
    2626    public const RESULT_EXCERPT = 'EXCERPT';
    2727
    28     /** @var ShortcodeService */
    29     private $shortcodeService;
    30 
    31     /** @var ShortCodeParser */
    32     private $shortcodeParser;
    33 
    34     /** @var BlockParser */
    35     private $blockParser;
    36 
    37     /** @var ElementorPlugin */
    38     private $elementorPlugin;
    39 
    40     /** @var CustomFieldsDecodeService */
    41     private $customFieldsDecodeService;
    42 
    43     /** @var CustomFieldsEncodeService */
    44     private $customFieldsEncodeService;
    45 
    46     /** @var AuthUtils */
    47     private $authUtils;
    48 
    49     /** @var PlaceholderService */
    50     private $placeholderService;
    51 
    52     /** @var ExcerptParser */
    53     private $excerptParser;
     28    private ShortcodeService $shortcodeService;
     29    private ShortCodeParser $shortcodeParser;
     30    private BlockParser $blockParser;
     31    private ElementorPlugin $elementorPlugin;
     32    private CustomFieldsDecodeService $customFieldsDecodeService;
     33    private CustomFieldsEncodeService $customFieldsEncodeService;
     34    private AuthUtils $authUtils;
     35    private PlaceholderService $placeholderService;
     36    private ExcerptParser $excerptParser;
    5437
    5538    public function __construct(
  • memsource-connector/trunk/src/Service/TranslationPlugin/TranslationPluginProvider.php

    r2870027 r3452798  
    99    private const DEFAULT_TRANSLATION_PLUGIN = '';
    1010
    11     /** @var OptionsService */
    12     private $optionsService;
    13 
    14     /** @var ITranslationPlugin[] */
    15     private $translationPlugins = [];
     11    private OptionsService $optionsService;
     12    private array $translationPlugins = []; // phpcs:ignore
    1613
    1714    public function __construct(OptionsService $optionsService)
  • memsource-connector/trunk/src/Service/TranslationWorkflowService.php

    r3067665 r3452798  
    1616    public const FIELD_NAME_TARGET_LANGUAGES = 'field-name-target-languages';
    1717
    18     /** @var OptionsService */
    19     private $optionsService;
     18    private OptionsService $optionsService;
     19    private ?bool $customFieldExists = null;
     20    private ITranslationPlugin $translationPlugin;
    2021
    21     /** @var array|null */
    22     private $options = null;
    23 
    24     /** @var bool|null */
    25     private $customFieldExists = null;
    26 
    27     /** @var ITranslationPlugin */
    28     private $translationPlugin;
     22    private ?array $options = null; // phpcs:ignore
    2923
    3024    public function __construct(OptionsService $optionsService, ITranslationPlugin $translationPlugin)
     
    196190        global $acf;
    197191        global $shortcode_tags; // phpcs:ignore
    198         return isset($acf) || isset($shortcode_tags['acf']);
     192        return isset($acf) || isset($shortcode_tags['acf']); // phpcs:ignore
    199193    }
    200194}
  • memsource-connector/trunk/src/Utils/LogUtils.php

    r3056870 r3452798  
    1313    public const LOG_EMAIL_RECIPIENT = 'integrations@phrase.com';
    1414
     15    public const ERROR_LOG_PATH_NOT_WRITABLE = 'LOG_PATH_NOT_WRITABLE';
     16    public const ERROR_LOG_PATH_NOT_DIRECTORY = 'LOG_PATH_NOT_DIRECTORY';
     17    public const ERROR_RELATIVE_PATH_NOT_ALLOWED = 'RELATIVE_PATH_NOT_ALLOWED';
     18
    1519    private const DEBUG = 'DEBUG';
    1620    private const INFO = 'INFO';
     
    2125    private const SIZE_MB = 1048576;
    2226    private const SIZE_GB = 1073741824;
    23 
    24     const ERROR_LOG_PATH_NOT_WRITABLE = 'LOG_PATH_NOT_WRITABLE';
    25     const ERROR_LOG_PATH_NOT_DIRECTORY = 'LOG_PATH_NOT_DIRECTORY';
    26     const ERROR_RELATIVE_PATH_NOT_ALLOWED = 'RELATIVE_PATH_NOT_ALLOWED';
    2727
    2828    public static function getLogFilePath(): string
Note: See TracChangeset for help on using the changeset viewer.