Plugin Directory

Changeset 3387552


Ignore:
Timestamp:
10/31/2025 09:51:05 AM (5 months ago)
Author:
smartling
Message:

Update to v 4.4.1

Location:
smartling-connector/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • smartling-connector/trunk/inc/Smartling/Helpers/ContentHelper.php

    r3077564 r3387552  
    108108    }
    109109
     110    /**
     111     * @throws EntityNotFoundException
     112     */
    110113    public function readTargetContent(SubmissionEntity $submission): Entity
    111114    {
  • smartling-connector/trunk/inc/Smartling/Helpers/TestRunHelper.php

    r2644986 r3387552  
    33namespace Smartling\Helpers;
    44
     5use Smartling\DbAl\WordpressContentEntities\PostEntityStd;
     6use Smartling\Exception\EntityNotFoundException;
    57use Smartling\Exception\SmartlingTestRunCheckFailedException;
    68use Smartling\Models\GutenbergBlock;
     
    1012{
    1113    public const TEST_RUN_BLOG_ID_SETTING_NAME = 'smartling_TestRunBlogId';
    12     private SiteHelper $siteHelper;
    13     private GutenbergBlockHelper $gutenbergBlockHelper;
    1414
    15     public function __construct(SiteHelper $siteHelper, GutenbergBlockHelper $gutenbergBlockHelper)
    16     {
    17         $this->siteHelper = $siteHelper;
    18         $this->gutenbergBlockHelper = $gutenbergBlockHelper;
     15    public function __construct(
     16        private ContentHelper $contentHelper,
     17        private GutenbergBlockHelper $gutenbergBlockHelper,
     18    ) {
    1919    }
    2020
     
    2626    public function checkDownloadedSubmission(SubmissionEntity $submission): void
    2727    {
    28         $original = $this->siteHelper->withBlog($submission->getSourceBlogId(), function () use ($submission) {
    29             return get_post($submission->getSourceId());
    30         });
    31         if (!$original instanceof \WP_Post) {
    32             throw new SmartlingTestRunCheckFailedException("Unable to get source post while checking test run download blogId={$submission->getSourceBlogId()}, postId={$submission->getSourceId()}");
     28        try {
     29            $original = $this->contentHelper->readSourceContent($submission);
     30        } catch (EntityNotFoundException) {
     31            throw new SmartlingTestRunCheckFailedException("Unable to get source content while checking test run download blogId={$submission->getSourceBlogId()}, postId={$submission->getSourceId()}");
    3332        }
    34         $target = $this->siteHelper->withBlog($submission->getTargetBlogId(), function () use ($submission) {
    35             return get_post($submission->getTargetId());
    36         });
    37         if (!$target instanceof \WP_Post) {
    38             throw new SmartlingTestRunCheckFailedException("Unable to get target post while checking test run download blogId={$submission->getTargetBlogId()}, postId={$submission->getTargetId()}");
     33        try {
     34            $target = $this->contentHelper->readTargetContent($submission);
     35        } catch (EntityNotFoundException) {
     36            throw new SmartlingTestRunCheckFailedException("Unable to get target content while checking test run download blogId={$submission->getTargetBlogId()}, postId={$submission->getTargetId()}");
    3937        }
    40         $sourceBlocks = $this->gutenbergBlockHelper->getPostContentBlocks($original->post_content);
    41         $targetBlocks = $this->gutenbergBlockHelper->getPostContentBlocks($target->post_content);
    42         if (count($sourceBlocks) !== count($targetBlocks)) {
    43             throw new SmartlingTestRunCheckFailedException("Source and target block count does not match");
     38        if ($original instanceof PostEntityStd && $target instanceof PostEntityStd) {
     39            $sourceBlocks = $this->gutenbergBlockHelper->getPostContentBlocks($original->post_content);
     40            $targetBlocks = $this->gutenbergBlockHelper->getPostContentBlocks($target->post_content);
     41            if (count($sourceBlocks) !== count($targetBlocks)) {
     42                throw new SmartlingTestRunCheckFailedException("Source and target block count does not match");
     43            }
     44            $this->assertBlockStructureSame($sourceBlocks, $targetBlocks);
    4445        }
    45         $this->assertBlockStructureSame($sourceBlocks, $targetBlocks);
    4646    }
    4747
  • smartling-connector/trunk/inc/Smartling/WP/View/TestRun.php

    r2862047 r3387552  
    101101if ($viewData->getNew() + $viewData->getInProgress() === 0) {
    102102    echo '<p>Test run has completed. You should now review the translated blog to check if strings everywhere are replaced with pseudo translations.</p>';
    103     if ($viewData->getTestBlogId() !== null) {
    104         echo sprintf('<form method="post" action="%s"><input type="hidden" name="action" value="%s" /><input type="submit" class="button action" value="Clear Test Run flag from blog" /><br />(to allow regular translations to be applied.)</form>', get_admin_url(null, 'admin.php?page=' . $this::SLUG), $this::ACTION_CLEAR_FLAG);
    105     }
    106103} else {
    107     echo '<p>Test run is in progress. When there are no pending submissions, you should review the translated blog.';
     104    echo '<p>Test run is in progress. When there are no pending submissions, you should review the translated blog.</p>';
     105}
     106if ($viewData->getTestBlogId() !== null) {
     107    echo sprintf('<form method="post" action="%s"><input type="hidden" name="action" value="%s" /><input type="submit" class="button action" value="Clear Test Run flag from blog" /><br />(to allow regular translations to be applied.)</form>', get_admin_url(null, 'admin.php?page=' . $this::SLUG), $this::ACTION_CLEAR_FLAG);
    108108}
    109109}
  • smartling-connector/trunk/inc/config/services.yml

    r3351155 r3387552  
    322322    class: Smartling\Helpers\TestRunHelper
    323323    arguments:
    324       - "@site.helper"
     324      - "@content.helper"
    325325      - "@helper.gutenberg"
    326326
  • smartling-connector/trunk/readme.txt

    r3380258 r3387552  
    11=== Smartling Connector ===
    22Contributors: smartling
    3 Tags: translation, localization, localisation, translate, multilingual, smartling, internationalization, internationalisation, automation, international
     3Tags: translation, localization, multilingual, internationalization, smartling
    44Requires at least: 5.5
    55Tested up to: 6.6.2
    66Requires PHP: 8.0
    7 Stable tag: 4.4.0
     7Stable tag: 4.4.1
    88License: GPLv2 or later
    99
     
    6363
    6464== Changelog ==
     65= 4.4.1 =
     66* Added possibility to clear the test run flag regardless of the test run status
     67* Fixed test run erroneously flagging taxonomy submissions as failed
     68
    6569= 4.4.0 =
    6670* Added support for the Elementor Loop Carousel element
  • smartling-connector/trunk/smartling-connector.php

    r3380258 r3387552  
    1212 * Plugin URI:        https://www.smartling.com/products/automate/integrations/wordpress/
    1313 * Description:       Integrate your WordPress site with Smartling to upload your content and download translations.
    14  * Version:           4.4.0
     14 * Version:           4.4.1
    1515 * Author:            Smartling
    1616 * Author URI:        https://www.smartling.com
Note: See TracChangeset for help on using the changeset viewer.