Changeset 3338937
- Timestamp:
- 08/04/2025 12:01:08 PM (8 months ago)
- Location:
- smartling-connector/trunk
- Files:
-
- 23 edited
-
inc/Smartling/Base/SmartlingCore.php (modified) (1 diff)
-
inc/Smartling/Base/SmartlingCoreTrait.php (modified) (3 diffs)
-
inc/Smartling/Base/SmartlingEntityAbstract.php (modified) (1 diff)
-
inc/Smartling/DbAl/WordpressContentEntities/EntityAbstract.php (modified) (1 diff)
-
inc/Smartling/DbAl/WordpressContentEntities/PostEntityStd.php (modified) (1 diff)
-
inc/Smartling/DbAl/WordpressContentEntities/TaxonomyEntityStd.php (modified) (1 diff)
-
inc/Smartling/DbAl/WordpressContentEntities/WidgetEntity.php (modified) (1 diff)
-
inc/Smartling/Extensions/Acf/AcfDynamicSupport.php (modified) (14 diffs)
-
inc/Smartling/Extensions/AcfOptionPages/AcfOptionEntity.php (modified) (1 diff)
-
inc/Smartling/Helpers/DetectChangesHelper.php (modified) (3 diffs)
-
inc/Smartling/Helpers/WordpressFunctionProxyHelper.php (modified) (1 diff)
-
inc/Smartling/Processors/ContentEntitiesIOFactory.php (modified) (3 diffs)
-
inc/Smartling/Services/BlogRemovalHandler.php (modified) (4 diffs)
-
inc/Smartling/Settings/ConfigurationProfileEntity.php (modified) (3 diffs)
-
inc/Smartling/Settings/SettingsManager.php (modified) (1 diff)
-
inc/Smartling/WP/Controller/BulkSubmitController.php (modified) (3 diffs)
-
inc/Smartling/WP/Controller/ConfigurationProfileFormController.php (modified) (1 diff)
-
inc/Smartling/WP/Controller/PostBasedWidgetControllerStd.php (modified) (1 diff)
-
inc/Smartling/WP/Table/BulkSubmitTableWidget.php (modified) (5 diffs)
-
inc/Smartling/WP/View/ConfigurationProfileForm.php (modified) (4 diffs)
-
inc/config/services.yml (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
smartling-connector.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
smartling-connector/trunk/inc/Smartling/Base/SmartlingCore.php
r3077564 r3338937 39 39 parent::__construct(); 40 40 41 add_action(ExportedAPI::ACTION_SMARTLING_CLONE_CONTENT, [$this, 'cloneContent']);42 add_action(ExportedAPI::ACTION_SMARTLING_PREPARE_SUBMISSION_UPLOAD, [$this, 'prepareUpload']);43 add_action(ExportedAPI::ACTION_SMARTLING_SEND_FOR_TRANSLATION, [$this, 'sendForTranslation']);44 add_action(ExportedAPI::ACTION_SMARTLING_DOWNLOAD_TRANSLATION, [$this, 'downloadTranslationBySubmission',]);45 add_action(ExportedAPI::ACTION_SMARTLING_REGENERATE_THUMBNAILS, [$this, 'regenerateTargetThumbnailsBySubmission']);46 add_filter(ExportedAPI::FILTER_SMARTLING_PREPARE_TARGET_CONTENT, [$this, 'prepareTargetContent']);47 add_action(ExportedAPI::ACTION_SMARTLING_SYNC_MEDIA_ATTACHMENT, [$this, 'syncAttachment']);41 $this->wpProxy->add_action(ExportedAPI::ACTION_SMARTLING_CLONE_CONTENT, [$this, 'cloneContent']); 42 $this->wpProxy->add_action(ExportedAPI::ACTION_SMARTLING_PREPARE_SUBMISSION_UPLOAD, [$this, 'prepareUpload']); 43 $this->wpProxy->add_action(ExportedAPI::ACTION_SMARTLING_SEND_FOR_TRANSLATION, [$this, 'sendForTranslation']); 44 $this->wpProxy->add_action(ExportedAPI::ACTION_SMARTLING_DOWNLOAD_TRANSLATION, [$this, 'downloadTranslationBySubmission',]); 45 $this->wpProxy->add_action(ExportedAPI::ACTION_SMARTLING_REGENERATE_THUMBNAILS, [$this, 'regenerateTargetThumbnailsBySubmission']); 46 $this->wpProxy->add_filter(ExportedAPI::FILTER_SMARTLING_PREPARE_TARGET_CONTENT, [$this, 'prepareTargetContent']); 47 $this->wpProxy->add_action(ExportedAPI::ACTION_SMARTLING_SYNC_MEDIA_ATTACHMENT, [$this, 'syncAttachment']); 48 48 } 49 49 -
smartling-connector/trunk/inc/Smartling/Base/SmartlingCoreTrait.php
r3077564 r3338937 3 3 namespace Smartling\Base; 4 4 5 use Smartling\DbAl\WordpressContentEntities\Entity; 5 6 use Smartling\DbAl\WordpressContentEntities\EntityWithPostStatus; 6 7 use Smartling\DbAl\WordpressContentEntities\EntityAbstract; … … 66 67 $unfilteredSourceData = $this->readSourceContentWithMetadataAsArray($submission); 67 68 68 $filteredData = $ submission->isCloned() ? $unfilteredSourceData : $this->getFieldsFilter()->removeIgnoringFields($submission, $unfilteredSourceData);69 $filteredData = $this->filterData($targetContent, $submission, $unfilteredSourceData); 69 70 70 unset ($filteredData['entity']['ID'], $filteredData['entity']['term_id'], $filteredData['entity']['id']); 71 72 if (array_key_exists('entity', $filteredData) && 73 $targetContent instanceof EntityAbstract && 74 ArrayHelper::notEmpty($filteredData['entity']) 75 ) { 76 foreach ($filteredData['entity'] as $k => $v) { 77 $targetContent->{$k} = apply_filters(ExportedAPI::FILTER_SMARTLING_METADATA_FIELD_PROCESS, $k, $v, $submission); 71 if ($targetContent instanceof EntityAbstract) { 72 foreach ($filteredData['entity'] ?? [] as $k => $v) { 73 $targetContent->{$k} = $this->wpProxy->apply_filters(ExportedAPI::FILTER_SMARTLING_METADATA_FIELD_PROCESS, $k, $v, $submission); 78 74 } 79 75 } … … 119 115 return $submission; 120 116 } 117 118 private function filterData(Entity $target, SubmissionEntity $submission, array $unfilteredSourceData): array 119 { 120 if ($submission->isCloned()) { 121 if ($target instanceof EntityAbstract) { 122 foreach ($target->getNonCloneableFields() as $field) { 123 unset($unfilteredSourceData['entity'][$field]); 124 } 125 } 126 $result = $unfilteredSourceData; 127 } else { 128 $result = $this->getFieldsFilter()->removeIgnoringFields($submission, $unfilteredSourceData); 129 } 130 131 unset ($result['entity']['ID'], $result['entity']['term_id'], $result['entity']['id']); 132 133 return $result; 134 } 121 135 } -
smartling-connector/trunk/inc/Smartling/Base/SmartlingEntityAbstract.php
r3077564 r3338937 101 101 } 102 102 103 /** 104 * @param bool $addVirtualColumns 105 * 106 * @return array 107 */ 108 public function toArray($addVirtualColumns = true) 103 public function toArray(bool $addVirtualColumns = true): array 109 104 { 110 105 $arr = $this->stateFields; -
smartling-connector/trunk/inc/Smartling/DbAl/WordpressContentEntities/EntityAbstract.php
r3025850 r3338937 219 219 * @return string[] 220 220 */ 221 abstract p rotectedfunction getNonCloneableFields(): array;221 abstract public function getNonCloneableFields(): array; 222 222 223 223 public function forInsert(): static -
smartling-connector/trunk/inc/Smartling/DbAl/WordpressContentEntities/PostEntityStd.php
r3289052 r3338937 117 117 } 118 118 119 p rotectedfunction getNonCloneableFields(): array119 public function getNonCloneableFields(): array 120 120 { 121 121 return [ -
smartling-connector/trunk/inc/Smartling/DbAl/WordpressContentEntities/TaxonomyEntityStd.php
r3025850 r3338937 291 291 } 292 292 293 p rotectedfunction getNonCloneableFields(): array293 public function getNonCloneableFields(): array 294 294 { 295 295 return [ -
smartling-connector/trunk/inc/Smartling/DbAl/WordpressContentEntities/WidgetEntity.php
r3025850 r3338937 189 189 * @return array 190 190 */ 191 p rotectedfunction getNonCloneableFields(): array191 public function getNonCloneableFields(): array 192 192 { 193 193 return [$this->getPrimaryFieldName()]; -
smartling-connector/trunk/inc/Smartling/Extensions/Acf/AcfDynamicSupport.php
r3333320 r3338937 25 25 use LoggerSafeTrait; 26 26 27 public const POST_TYPE_ACF_FIELD_GROUP = 'acf-field-group'; 27 public const POST_TYPE_FIELD = 'acf-field'; 28 public const POST_TYPE_GROUP = 'acf-field-group'; 28 29 public const REFERENCED_TYPE_NONE = 'none'; 29 30 public const REFERENCED_TYPE_MEDIA = 'media'; … … 70 71 {} 71 72 72 public function addCopyRules(array $rules) { 73 public function addCopyRules(array $rules): void 74 { 73 75 $this->rules['copy'] = $this->arrayHelper->add($this->rules['copy'], $rules); 74 76 } … … 95 97 if ( 96 98 ($profile instanceof ConfigurationProfileEntity) 97 && in_array($profile->get OriginalBlogId()->getBlogId(), $blogs, true)99 && in_array($profile->getSourceLocale()->getBlogId(), $blogs, true) 98 100 ) { 99 $blogsToSearch[] = $profile->get OriginalBlogId()->getBlogId();101 $blogsToSearch[] = $profile->getSourceLocale()->getBlogId(); 100 102 } 101 103 } … … 186 188 $posts = (new \WP_Query( 187 189 [ 188 'post_type' => self::POST_TYPE_ ACF_FIELD_GROUP,190 'post_type' => self::POST_TYPE_GROUP, 189 191 'suppress_filters' => true, 190 192 'posts_per_page' => -1, … … 208 210 $posts = (new \WP_Query( 209 211 [ 210 'post_type' => 'acf-field',212 'post_type' => self::POST_TYPE_FIELD, 211 213 'suppress_filters' => true, 212 214 'posts_per_page' => -1, … … 301 303 private function getLocalDefinitionsOld(): array 302 304 { 303 $acf = null;304 305 $defs = []; 305 306 try { … … 411 412 } 412 413 413 public function syncFieldGroup(SubmissionEntity $submission): void 414 { 414 public function syncAcfData(SubmissionEntity $submission): void 415 { 416 if ($submission->isLocked()) { 417 $this->logger->debug("Submission submissionId={$submission->getId()} is locked, skipping ACF sync"); 418 419 return; 420 } 421 415 422 $context = [ 416 423 'submissionId' => $submission->getId(), … … 422 429 LogContextMixinHelper::addToContext($key, $value); 423 430 } 424 if ( $submission->getContentType() !== self::POST_TYPE_ACF_FIELD_GROUP) {425 $this->getLogger()->error("Trying to sync ACF field group, expected content type: " . self::POST_TYPE_ACF_FIELD_GROUP);431 if (!in_array($submission->getContentType(), $this->getTypes(), true)) { 432 $this->getLogger()->error("Trying to sync {$submission->getContentType()}, expected content types: " . implode(', ', $this->getTypes())); 426 433 427 434 return; … … 430 437 $post = $this->wpProxy->get_post($submission->getSourceId(), ARRAY_A); 431 438 if ($post === null) { 432 $this->getLogger()->error("Trying to sync ACF field group, source post not found");439 $this->getLogger()->error("Trying to sync {$submission->getContentType()}, source post not found"); 433 440 434 441 return; … … 437 444 $array = $this->wpProxy->maybe_unserialize($post['post_content']); 438 445 if (!is_array($array)) { 439 $this->getLogger()->error("Trying to sync ACF field group, post content could not be unserialized, content=\"$post->post_content\"");446 $this->getLogger()->error("Trying to sync {$submission->getContentType()}, post content could not be unserialized, content=\"$post->post_content\""); 440 447 441 448 return; 442 449 } 443 450 444 if (!array_key_exists('location', $array)) { 445 $this->getLogger()->debug("Sync of ACF field group skipped: no location fields"); 446 447 return; 448 } 449 450 foreach ($array['location'] as &$rules) { 451 foreach ($rules as &$rule) { 452 if ($rule['param'] === 'page') { 453 $targetSubmission = $this->submissionManager->findOne([ 454 SubmissionEntity::FIELD_SOURCE_BLOG_ID => $submission->getSourceBlogId(), 455 SubmissionEntity::FIELD_SOURCE_ID => $rule['value'], 456 SubmissionEntity::FIELD_TARGET_BLOG_ID => $submission->getTargetBlogId(), 457 SubmissionEntity::FIELD_CONTENT_TYPE => $this->wpProxy->get_post_types(), 458 ]); 459 if ($targetSubmission === null) { 460 $this->getLogger()->debug("Skip change location page {$rule['operator']} {$rule['value']}: no target submission exists"); 461 continue; 451 if (array_key_exists('location', $array) && is_array($array['location'])) { // Null coalesce doesn't work with references 452 foreach ($array['location'] as &$rules) { 453 foreach ($rules as &$rule) { 454 if ($rule['param'] === 'page') { 455 $targetSubmission = $this->submissionManager->findOne([ 456 SubmissionEntity::FIELD_SOURCE_BLOG_ID => $submission->getSourceBlogId(), 457 SubmissionEntity::FIELD_SOURCE_ID => $rule['value'], 458 SubmissionEntity::FIELD_TARGET_BLOG_ID => $submission->getTargetBlogId(), 459 SubmissionEntity::FIELD_CONTENT_TYPE => $this->wpProxy->get_post_types(), 460 ]); 461 if ($targetSubmission === null) { 462 $this->getLogger()->debug("Skip change location page {$rule['operator']} {$rule['value']}: no target submission exists"); 463 continue; 464 } 465 $rule['value'] = (string)$targetSubmission->getTargetId(); 462 466 } 463 $rule['value'] = (string)$targetSubmission->getTargetId();464 467 } 468 unset($rule); 465 469 } 466 unset($rule); 467 } 468 unset($rules); 470 unset($rules); 471 } 469 472 470 473 $this->siteHelper->withBlog($submission->getTargetBlogId(), function () use ($array, $submission): void { … … 487 490 { 488 491 $this->getLogger()->debug('Checking if ACF presents...'); 489 if ( true === $this->checkAcfTypes()) {492 if ($this->isAcfActive()) { 490 493 $this->getLogger()->debug('ACF detected.'); 491 494 $localDefinitions = $this->getLocalDefinitions(); … … 594 597 $type = $this->definitions[$key]['type'] ?? ''; 595 598 596 switch ($type) { 597 case 'image': 598 case 'image_aspect_ratio_crop': 599 case 'file': 600 case 'gallery': 601 return self::REFERENCED_TYPE_MEDIA; 602 case 'post_object': 603 case 'page_link': 604 case 'relationship': 605 return self::REFERENCED_TYPE_POST; 606 case 'taxonomy': 607 return self::REFERENCED_TYPE_TAXONOMY; 608 } 609 610 return self::REFERENCED_TYPE_NONE; 599 return match ($type) { 600 'image', 'image_aspect_ratio_crop', 'file', 'gallery' => self::REFERENCED_TYPE_MEDIA, 601 'post_object', 'page_link', 'relationship' => self::REFERENCED_TYPE_POST, 602 'taxonomy' => self::REFERENCED_TYPE_TAXONOMY, 603 default => self::REFERENCED_TYPE_NONE, 604 }; 611 605 } 612 606 … … 621 615 622 616 foreach ($data['meta'] as $key => $value) { 623 if (str pos($key, '_') === 0&& in_array($value, $this->rules['copy'], true)) {617 if (str_starts_with($key, '_') && in_array($value, $this->rules['copy'], true)) { 624 618 $realKey = substr($key, 1); 625 619 unset($data['meta'][$realKey], $data['meta'][$key]); … … 692 686 } 693 687 694 p rivate function checkAcfTypes(): bool688 public function isAcfActive(): bool 695 689 { 696 690 $postTypes = $this->getPostTypes(); 697 691 698 return in_array('acf-field', $postTypes, true) && in_array(self::POST_TYPE_ACF_FIELD_GROUP, $postTypes, true); 692 return in_array(self::POST_TYPE_FIELD, $postTypes, true) 693 && in_array(self::POST_TYPE_GROUP, $postTypes, true); 694 } 695 696 /** 697 * @return string[] 698 */ 699 public function getTypes(): array 700 { 701 return [self::POST_TYPE_GROUP]; 699 702 } 700 703 -
smartling-connector/trunk/inc/Smartling/Extensions/AcfOptionPages/AcfOptionEntity.php
r3025850 r3338937 133 133 } 134 134 135 p rotectedfunction getNonCloneableFields(): array135 public function getNonCloneableFields(): array 136 136 { 137 137 return [$this->getPrimaryFieldName()]; -
smartling-connector/trunk/inc/Smartling/Helpers/DetectChangesHelper.php
r3333320 r3338937 26 26 27 27 /** 28 * @param string[] $contentTypes 28 29 * @return SubmissionEntity[] 29 30 */ 30 p rivate function getSubmissions(int $blogId, int $contentId, string $contentType): array31 public function getSubmissions(int $blogId, int $contentId, array $contentTypes): array 31 32 { 32 33 try { … … 34 35 SubmissionEntity::FIELD_SOURCE_ID => $contentId, 35 36 SubmissionEntity::FIELD_SOURCE_BLOG_ID => $blogId, 36 SubmissionEntity::FIELD_CONTENT_TYPE => $contentType ,37 SubmissionEntity::FIELD_CONTENT_TYPE => $contentTypes, 37 38 SubmissionEntity::FIELD_TARGET_BLOG_ID => $this->settingsManager 38 39 ->getProfileTargetBlogIdsByMainBlogId($blogId), … … 105 106 public function detectChanges(int $blogId, int $contentId, string $contentType): void 106 107 { 107 $submissions = $this->getSubmissions($blogId, $contentId, $contentType);108 $submissions = $this->getSubmissions($blogId, $contentId, [$contentType]); 108 109 109 110 if (0 === count($submissions)) { 110 $submissions = $this->getSubmissions($blogId, $contentId, AcfDynamicSupport::POST_TYPE_ACF_FIELD_GROUP); 111 foreach ($submissions as $submission) { 112 $this->getLogger()->debug("Sync field group submissionId={$submission->getId()}"); 113 $this->acfDynamicSupport->syncFieldGroup($submission); 111 foreach ($this->getSubmissions($blogId, $contentId, $this->acfDynamicSupport->getTypes()) as $submission) { 112 $this->getLogger()->debug("Sync ACF submissionId={$submission->getId()}"); 113 $this->acfDynamicSupport->syncAcfData($submission); 114 114 } 115 115 -
smartling-connector/trunk/inc/Smartling/Helpers/WordpressFunctionProxyHelper.php
r3333320 r3338937 16 16 return add_action(...func_get_args()); 17 17 } 18 19 public function add_filter() 20 { 21 return add_filter(...func_get_args()); 22 } 23 18 24 public function get_home_url() 19 25 { -
smartling-connector/trunk/inc/Smartling/Processors/ContentEntitiesIOFactory.php
r2998712 r3338937 4 4 5 5 use Smartling\DbAl\WordpressContentEntities\EntityHandler; 6 use Smartling\DbAl\WordpressContentEntities\PostEntityStd; 6 7 use Smartling\Exception\SmartlingConfigException; 7 8 use Smartling\Exception\SmartlingInvalidFactoryArgumentException; 9 use Smartling\Extensions\Acf\AcfDynamicSupport; 8 10 9 11 class ContentEntitiesIOFactory extends SmartlingFactoryAbstract 10 12 { 11 public function __construct(bool $allowDefault = false, ?object $defaultHandler = null) 12 { 13 public function __construct( 14 private AcfDynamicSupport $acfDynamicSupport, 15 bool $allowDefault = false, 16 ?object $defaultHandler = null, 17 ) { 13 18 parent::__construct($allowDefault, $defaultHandler); 14 19 $this->message = 'Requested entity wrapper for content-type \'%s\' is not registered. Called by: %s'; … … 21 26 public function getMapper(string $contentType): EntityHandler 22 27 { 28 $this->processDynamicMappers(); 23 29 $obj = $this->getHandler($contentType); 24 30 … … 29 35 throw new SmartlingConfigException(self::class . __METHOD__ . ' expected return is ' . EntityHandler::class); 30 36 } 37 38 private function processDynamicMappers(): void 39 { 40 if ($this->acfDynamicSupport->isAcfActive()) { 41 foreach ($this->acfDynamicSupport->getTypes() as $type) { 42 $this->registerHandler($type, new PostEntityStd($type)); 43 } 44 } 45 } 31 46 } -
smartling-connector/trunk/inc/Smartling/Services/BlogRemovalHandler.php
r2946970 r3338937 9 9 use Smartling\Submissions\SubmissionEntity; 10 10 use Smartling\Submissions\SubmissionManager; 11 use Smartling\Vendor\Smartling\AuditLog\Params\CreateRecordParameters; 11 12 use Smartling\WP\WPHookInterface; 12 13 … … 39 40 { 40 41 $submissions = $this->getSubmissions($blogId); 42 $profiles = []; 43 foreach ($this->settingsManager->getEntities() as $profile) { 44 $array = []; 45 foreach ($profile->getTargetLocales() as $locale) { 46 $array[$locale->getBlogId()] = $profile; 47 } 48 $profiles[$profile->getSourceLocale()->getBlogId()] = $array; 49 } 41 50 42 51 if (0 < count($submissions)) { … … 62 71 ) 63 72 ); 73 $profile = $profiles[$submission->getSourceBlogId()][$submission->getTargetBlogId()] ?? null; 74 if ($profile !== null) { 75 $this->apiWrapper->createAuditLogRecord( 76 $profile, 77 CreateRecordParameters::ACTION_TYPE_DELETE, 78 "Blog deletion handler, submissionId={$submission->getId()}, fileUri={$submission->getFileUri()}", 79 [], 80 ); 81 } 64 82 $this->apiWrapper->deleteFile($submission); 65 83 } … … 68 86 69 87 foreach ($this->settingsManager->getEntities() as $profile) { 70 if ($profile->get OriginalBlogId()->getBlogId() === $blogId) {88 if ($profile->getSourceLocale()->getBlogId() === $blogId) { 71 89 $this->settingsManager->deleteProfile($profile->getId()); 72 90 $this->getLogger()->notice("Deleted profile profileId={$profile->getId()} while deleting blogId=$blogId"); -
smartling-connector/trunk/inc/Smartling/Settings/ConfigurationProfileEntity.php
r3212146 r3338937 187 187 } 188 188 189 public function get OriginalBlogId(): Locale189 public function getSourceLocale(): Locale 190 190 { 191 191 return $this->stateFields['original_blog_id'] ?? new Locale(); 192 192 } 193 193 194 public function set Locale(Locale $mainLocale): void194 public function setSourceLocale(Locale $mainLocale): void 195 195 { 196 196 $this->stateFields['original_blog_id'] = $mainLocale; … … 205 205 $locale = new Locale(); 206 206 $locale->setBlogId($blogId); 207 $this->set Locale($locale);207 $this->setSourceLocale($locale); 208 208 } 209 209 … … 399 399 $state = parent::toArray(false); 400 400 401 $state['original_blog_id'] = $this->get OriginalBlogId()->getBlogId();401 $state['original_blog_id'] = $this->getSourceLocale()->getBlogId(); 402 402 403 403 $state['auto_authorize'] = !$state['auto_authorize'] ? 0 : 1; -
smartling-connector/trunk/inc/Smartling/Settings/SettingsManager.php
r3333320 r3338937 296 296 protected function updateLabels(ConfigurationProfileEntity $entity): ConfigurationProfileEntity 297 297 { 298 $mainLocaleBlogId = $entity->get OriginalBlogId()->getBlogId();298 $mainLocaleBlogId = $entity->getSourceLocale()->getBlogId(); 299 299 if (0 < $mainLocaleBlogId) { 300 300 try { 301 $entity->get OriginalBlogId()->setLabel($this->getSiteHelper()301 $entity->getSourceLocale()->setLabel($this->getSiteHelper() 302 302 ->getBlogLabelById($this->getPluginProxy(), $mainLocaleBlogId)); 303 303 } catch (BlogNotFoundException $e) { 304 304 $this->getLogger()->notice("Got {$e->getMessage()}, removing profileId={$entity->getId()}"); 305 $entity->get OriginalBlogId()->setLabel("* deleted blog *");305 $entity->getSourceLocale()->setLabel("* deleted blog *"); 306 306 $this->deleteProfile($entity->getId()); 307 307 } -
smartling-connector/trunk/inc/Smartling/WP/Controller/BulkSubmitController.php
r3077564 r3338937 6 6 use Smartling\DbAl\LocalizationPluginProxyInterface; 7 7 use Smartling\DbAl\UploadQueueManager; 8 use Smartling\Extensions\Acf\AcfDynamicSupport; 8 9 use Smartling\Helpers\ArrayHelper; 9 10 use Smartling\Helpers\Cache; … … 22 23 { 23 24 public function __construct( 25 private AcfDynamicSupport $acfDynamicSupport, 24 26 private ApiWrapperInterface $apiWrapper, 25 27 LocalizationPluginProxyInterface $connector, … … 81 83 $profile = ArrayHelper::first($applicableProfiles); 82 84 $table = new BulkSubmitTableWidget( 85 $this->acfDynamicSupport, 83 86 $this->apiWrapper, 84 87 $this->localizationPluginProxy, -
smartling-connector/trunk/inc/Smartling/WP/Controller/ConfigurationProfileFormController.php
r2821492 r3338937 213 213 $locale->setLabel($this->siteHelper->getBlogLabelById($this->localizationPluginProxy, $defaultBlogId)); 214 214 215 $profile->set Locale($locale);215 $profile->setSourceLocale($locale); 216 216 } 217 217 -
smartling-connector/trunk/inc/Smartling/WP/Controller/PostBasedWidgetControllerStd.php
r3333320 r3338937 612 612 { 613 613 return $this->servedContentType === $postType 614 // acf field groups are a private post typethat needs to be handled615 || $postType === AcfDynamicSupport::POST_TYPE_ACF_FIELD_GROUP;614 // acf underlying posts are of private post types, that needs to be handled 615 || in_array($postType, [AcfDynamicSupport::POST_TYPE_FIELD, AcfDynamicSupport::POST_TYPE_GROUP], true); 616 616 } 617 617 } -
smartling-connector/trunk/inc/Smartling/WP/Table/BulkSubmitTableWidget.php
r3318909 r3338937 13 13 use Smartling\DbAl\UploadQueueManager; 14 14 use Smartling\Exception\BlogNotFoundException; 15 use Smartling\ Helpers\ArrayHelper;15 use Smartling\Extensions\Acf\AcfDynamicSupport; 16 16 use Smartling\Helpers\CommonLogMessagesTrait; 17 17 use Smartling\Helpers\DateTimeHelper; … … 68 68 69 69 public function __construct( 70 private AcfDynamicSupport $acfDynamicSupport, 70 71 private ApiWrapperInterface $apiWrapper, 71 72 protected LocalizationPluginProxyInterface $localizationPluginProxy, … … 81 82 $this->defaultValues[static::CONTENT_TYPE_SELECT_ELEMENT_NAME] = 82 83 array_key_exists('post', $filteredAllowedTypes) ? 'post' : 83 ArrayHelper::first(array_keys($filteredAllowedTypes));84 $filteredAllowedTypes[array_key_first($filteredAllowedTypes)]; 84 85 85 86 parent::__construct($this->_settings); … … 232 233 [$id] = explode('-', $submission); 233 234 $type = $this->getContentTypeFilterValue(); 234 $curBlogId = $this->getProfile()->get OriginalBlogId()->getBlogId();235 $curBlogId = $this->getProfile()->getSourceLocale()->getBlogId(); 235 236 foreach ($locales as $blogId => $blogName) { 236 237 $submissionId = $this->core->prepareForUpload( … … 394 395 } 395 396 $typesFiltered[$value] = $title; 397 } 398 if ($this->acfDynamicSupport->isAcfActive()) { 399 $typesFiltered[AcfDynamicSupport::POST_TYPE_FIELD] = 'ACF Fields'; 400 $typesFiltered[AcfDynamicSupport::POST_TYPE_GROUP] = 'ACF Field Groups'; 396 401 } 397 402 -
smartling-connector/trunk/inc/Smartling/WP/View/ConfigurationProfileForm.php
r3212146 r3338937 433 433 $tagOptions = ['prompt' => __('Please select source locale', $domain)]; 434 434 $options = HtmlTagGeneratorHelper::renderSelectOptions( 435 $profile->get OriginalBlogId()->getBlogId(),435 $profile->getSourceLocale()->getBlogId(), 436 436 $locales, 437 437 $tagOptions … … 448 448 <p> 449 449 <?= __('Site source language is: ', $domain) ?> 450 <strong><?= $profile->get OriginalBlogId()->getLabel() ?></strong>450 <strong><?= $profile->getSourceLocale()->getLabel() ?></strong> 451 451 </p> 452 452 <p> … … 457 457 'select', 458 458 HtmlTagGeneratorHelper::renderSelectOptions( 459 $profile->get OriginalBlogId()->getBlogId(),459 $profile->getSourceLocale()->getBlogId(), 460 460 $locales 461 461 ), … … 474 474 $targetLocales = $profile->getTargetLocales(); 475 475 foreach ($locales as $blogId => $label) { 476 if ($blogId === $profile->get OriginalBlogId()476 if ($blogId === $profile->getSourceLocale() 477 477 ->getBlogId() 478 478 ) { -
smartling-connector/trunk/inc/config/services.yml
r3335327 r3338937 210 210 factory.contentIO: 211 211 class: Smartling\Processors\ContentEntitiesIOFactory 212 arguments: 213 - "@acf.dynamic.support" 212 214 213 215 manager.content.external: … … 416 418 class: Smartling\WP\Controller\BulkSubmitController 417 419 arguments: 420 - "@acf.dynamic.support" 418 421 - "@api.wrapper.with.retries" 419 422 - "@multilang.proxy" -
smartling-connector/trunk/readme.txt
r3335327 r3338937 5 5 Tested up to: 6.6.2 6 6 Requires PHP: 8.0 7 Stable tag: 4. 1.07 Stable tag: 4.2.0 8 8 License: GPLv2 or later 9 9 … … 63 63 64 64 == Changelog == 65 = 4.2.0 = 66 * Fixed cloned items having the same guid field 67 65 68 = 4.1.0 = 66 69 * Fixed navigation menu item parent relations after translation -
smartling-connector/trunk/smartling-connector.php
r3335327 r3338937 12 12 * Plugin URI: https://www.smartling.com/products/automate/integrations/wordpress/ 13 13 * Description: Integrate your WordPress site with Smartling to upload your content and download translations. 14 * Version: 4. 1.014 * Version: 4.2.0 15 15 * Author: Smartling 16 16 * Author URI: https://www.smartling.com
Note: See TracChangeset
for help on using the changeset viewer.