Plugin Directory

Changeset 2947778


Ignore:
Timestamp:
08/04/2023 02:54:09 PM (3 years ago)
Author:
memsource
Message:

Version 4.5.0

Location:
memsource-connector/trunk
Files:
5 edited

Legend:

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

    r2932560 r2947778  
    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.4.0
     7Version: 4.5.0
    88Text Domain: memsource
    99Domain Path: /locale
     
    1818
    1919define('MEMSOURCE_PLUGIN_PATH', dirname(__FILE__));
    20 define('MEMSOURCE_PLUGIN_VERSION', '4.4.0');
     20define('MEMSOURCE_PLUGIN_VERSION', '4.5.0');
    2121define('MEMSOURCE_PLUGIN_DIR_URL', plugin_dir_url(__FILE__));
    2222
     
    228228{
    229229    global $appRegistry;
     230    $optionsService = $appRegistry->getOptionsService();
     231
     232    // Post statuses:
    230233    $listStatuses = [];
    231 
    232234    if (isset($_POST['list-status-publish'])) {
    233235        $listStatuses[] = "publish";
     
    236238        $listStatuses[] = "draft";
    237239    }
    238     $appRegistry->getOptionsService()->updateListStatuses($listStatuses);
    239     $appRegistry->getOptionsService()->updateInsertStatus($_POST['insert-status']);
    240 
     240    $optionsService->updateListStatuses($listStatuses);
     241    $optionsService->updateInsertStatus($_POST['insert-status']);
     242
     243    // URL rewrite:
     244    isset($_POST['url-rewrite']) ? $optionsService->enableUrlRewrite() : $optionsService->disableUrlRewrite();
     245
     246    // Translation workflow:
    241247    $translationWorkflowService = $appRegistry->getTranslationWorkflowService();
    242248
  • memsource-connector/trunk/readme.txt

    r2943390 r2947778  
    3333== Changelog ==
    3434
     35= 4.5.0 =
     36*Release Date - 4 Aug 2023*
     37
     38* Added option to keep URLs unchanged during export from Phrase TMS
     39
    3540= 4.4.0 =
    3641*Release Date - 30 Jun 2023*
  • memsource-connector/trunk/src/Page/ConnectorPage.php

    r2870027 r2947778  
    3535        $listStatuses = $this->optionsService->getListStatuses();
    3636        $insertStatus = $this->optionsService->getInsertStatus();
     37        $urlRewrite = $this->optionsService->isUrlRewriteEnabled();
    3738        ?>
    3839        <script>
     
    148149                        <div class="memsource-space-big"></div>
    149150
     151                        <!-- URL rewriting -->
     152
     153                        <div id="url-rewrite-section" class="checkbox-section">
     154                            <strong>
     155                                <?php _e('URL rewriting', 'memsource'); ?>:
     156                            </strong>
     157                            <div class="memsource-space-small"></div>
     158                            <input type="checkbox" id="url-rewrite" name="url-rewrite" value="on" <?php echo $urlRewrite ? 'checked' : ''; ?>/>
     159                            <label
     160                                for="url-rewrite"
     161                                title="<?php _e('URLs or Slugs are not be localised by default, checking this box will enable the ability to localise URLs or Slugs and target copies will have changed URLs based on the WMPL behaviour setup', 'memsource'); ?>"
     162                                class="memsource-tooltip"
     163                            >
     164                                <?php _e('Rewrite URLs when exporting jobs from Phrase TMS', 'memsource'); ?></label>
     165                            <br/>
     166                        </div>
     167                        <div class="memsource-space-big"></div>
     168
    150169                        <!-- Translation workflow -->
    151170
  • memsource-connector/trunk/src/Service/Content/AbstractPostService.php

    r2870027 r2947778  
    202202
    203203        // convert internal links
    204         $content = $this->translationPlugin->convertInternalLinks($content, $language);
     204        if ($this->optionsService->isUrlRewriteEnabled()) {
     205            $content = $this->translationPlugin->convertInternalLinks($content, $language);
     206        }
    205207
    206208        // prevent wp_unslash() called during wp_insert_post()/wp_update_post()
  • memsource-connector/trunk/src/Service/OptionsService.php

    r2870027 r2947778  
    1414    public const MULTILINGUAL_PLUGIN_MLP = 'MultilingualPress';
    1515
     16    public const URL_REWRITE_ON = 'on';
     17    public const URL_REWRITE_OFF = 'off';
     18
    1619    private $restNamespace = 'memsource/v1/connector';
    1720
     
    2326    private $optionListStatus = 'memsource_list_status';
    2427    private $optionInsertStatus = 'memsource_insert_status';
     28    private $optionUrlRewrite = 'memsource_url_rewrite';
    2529    private $optionTranslationWorkflow = 'memsource_translation_workflow';
    2630    private $optionAutomationWidgetId = 'memsource_automation_widget_id';
     
    4246        add_option($this->optionListStatus, 'publish');
    4347        add_option($this->optionInsertStatus, 'publish');
     48        add_option($this->optionUrlRewrite, self::URL_REWRITE_ON);
    4449        add_option($this->optionTranslationWorkflow, '[]');
    4550        add_option($this->optionAutomationWidgetId, null);
     
    141146    }
    142147
     148    public function enableUrlRewrite()
     149    {
     150        update_option($this->optionUrlRewrite, self::URL_REWRITE_ON);
     151    }
     152
     153    public function disableUrlRewrite()
     154    {
     155        update_option($this->optionUrlRewrite, self::URL_REWRITE_OFF);
     156    }
     157
     158    public function isUrlRewriteEnabled(): bool
     159    {
     160        return get_option($this->optionUrlRewrite) !== self::URL_REWRITE_OFF;
     161    }
     162
    143163    public function getAdminUser()
    144164    {
Note: See TracChangeset for help on using the changeset viewer.