Changeset 2711564
- Timestamp:
- 04/19/2022 12:50:49 PM (4 years ago)
- Location:
- polylang-supertext/trunk
- Files:
-
- 5 edited
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
src/Supertext/Api/WriteBack.php (modified) (1 diff)
-
src/Supertext/Backend/CallbackHandler.php (modified) (1 diff)
-
src/Supertext/TextAccessors/PostTextAccessor.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
polylang-supertext/trunk/plugin.php
r2675218 r2711564 7 7 Domain Path: /resources/languages 8 8 Author: Supertext AG 9 Version: 4. 099 Version: 4.11 10 10 Author URI: http://www.supertext.ch 11 11 License: GPLv2 or later 12 12 */ 13 13 14 define('SUPERTEXT_PLUGIN_VERSION', '4. 09');14 define('SUPERTEXT_PLUGIN_VERSION', '4.11'); 15 15 define('SUPERTEXT_PLUGIN_REVISION', 46); 16 16 define('SUPERTEXT_BASE_PATH', __DIR__); -
polylang-supertext/trunk/readme.txt
r2675218 r2711564 110 110 == Changelog == 111 111 112 = 4.11 = 113 * Skip checking for translated post IDs for proofreading orders 114 115 = 4.10 = 116 * Use Wordpress standard functions to serialize Gutenberg blocks. 117 112 118 = 4.09 = 113 119 * Add basic support for ACF Gutenberg blocks that contain text in the data object. -
polylang-supertext/trunk/src/Supertext/Api/WriteBack.php
r2520480 r2711564 58 58 { 59 59 $sourcePostIds = $this->getSourcePostIds(); 60 $orderType = $this->getOrderType(); 60 61 61 62 $referenceData = hex2bin(Constant::REFERENCE_BITMASK); 62 63 foreach ($sourcePostIds as $sourcePostId) { 63 $targetPostId = $this->library->getMultilang()->getPostInLanguage($sourcePostId, $this->getTargetLanguageCode()); 64 if('translation' == $orderType) { 65 $targetPostId = $this->library->getMultilang()->getPostInLanguage($sourcePostId, $this->getTargetLanguageCode()); 66 } else { 67 $targetPostId = $sourcePostId; 68 } 64 69 $writeBackMeta = $this->getWriteBackMeta($targetPostId); 65 70 $referenceHash = $writeBackMeta->getReferenceHash(); -
polylang-supertext/trunk/src/Supertext/Backend/CallbackHandler.php
r2520480 r2711564 102 102 $errors = array(); 103 103 $contentData = $writeBack->getContentData(); 104 $orderType = $writeBack->getOrderType(); 104 105 105 106 foreach ($writeBack->getSourcePostIds() as $sourcePostId) { 106 $targetPostId = $this->library->getMultilang()->getPostInLanguage($sourcePostId, $writeBack->getTargetLanguageCode()); 107 if('translation' == $orderType) { 108 $targetPostId = $this->library->getMultilang()->getPostInLanguage($sourcePostId, $writeBack->getTargetLanguageCode()); 109 } else { 110 $targetPostId = $sourcePostId; 111 } 107 112 108 113 if ($targetPostId == null) { -
polylang-supertext/trunk/src/Supertext/TextAccessors/PostTextAccessor.php
r2520480 r2711564 122 122 123 123 if (isset($texts['post_content_block_attributes'])) { 124 $ decodedContent = $this->setTranslatableBlockAttributes($texts['post_content_block_attributes'], parse_blocks($decodedContent), $decodedContent);125 }126 124 $newBlocks = $this->setTranslatableBlockAttributes($texts['post_content_block_attributes'], parse_blocks($decodedContent)); 125 $decodedContent = serialize_blocks($newBlocks); 126 } 127 127 $post->post_content = $this->textProcessor->replaceShortcodeNodes($decodedContent); 128 128 } … … 180 180 } 181 181 182 $blockAttributesTexts[$key] = $ value;182 $blockAttributesTexts[$key] = $this->textProcessor->replaceShortcodes($value); 183 183 } 184 184 … … 186 186 } 187 187 188 private function setTranslatableBlockAttributes($blockAttributes, $blocks , $content)189 { 190 $new Content = $content;188 private function setTranslatableBlockAttributes($blockAttributes, $blocks) 189 { 190 $newBlocks = array(); 191 191 192 192 foreach ($blocks as $index => $block) { 193 193 if (!isset($blockAttributes[$index])) { 194 continue; 195 } 196 197 $blockName = str_replace('/', '\/', str_replace('core/', '', $block['blockName'])); 194 array_push($newBlocks, $block); 195 continue; 196 } 198 197 199 198 if (isset($blockAttributes[$index]['inner-blocks'])) { 200 $ newContent = $this->setTranslatableBlockAttributes($blockAttributes[$index]['inner-blocks'], $block['innerBlocks'], $newContent);199 $block['innerBlocks'] = $this->setTranslatableBlockAttributes($blockAttributes[$index]['inner-blocks'], $block['innerBlocks']); 201 200 } 202 201 203 202 foreach ($blockAttributes[$index]['attrs'] as $key => $value) { 204 $ oldValue = $block['attrs'][$key];205 $regex = "/(<!--\s*wp:$blockName\s*{.*\"$key\"\s*:\s*)\"$oldValue\"/";206 $newContent = preg_replace($regex, "$1\"$value\"", $newContent); 207 }208 } 209 210 return $new Content;203 $block['attrs'][$key] = $this->textProcessor->replaceShortcodeNodes($value); 204 } 205 206 array_push($newBlocks, $block); 207 } 208 209 return $newBlocks; 211 210 } 212 211 }
Note: See TracChangeset
for help on using the changeset viewer.