Changeset 3015517
- Timestamp:
- 12/29/2023 01:43:29 PM (2 years ago)
- Location:
- polylang-supertext/trunk
- Files:
-
- 6 edited
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
-
src/Supertext/Backend/CallbackHandler.php (modified) (3 diffs)
-
src/Supertext/Helper/Constant.php (modified) (1 diff)
-
src/Supertext/TextAccessors/AbstractPluginCustomFieldsTextAccessor.php (modified) (1 diff)
-
src/Supertext/TextAccessors/CustomFieldsTextAccessor.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
polylang-supertext/trunk/plugin.php
r3003613 r3015517 7 7 Domain Path: /resources/languages 8 8 Author: Supertext AG 9 Version: 4.2 29 Version: 4.23 10 10 Author URI: http://www.supertext.ch 11 11 License: GPLv2 or later 12 12 */ 13 13 14 define('SUPERTEXT_PLUGIN_VERSION', '4.2 2');14 define('SUPERTEXT_PLUGIN_VERSION', '4.23'); 15 15 define('SUPERTEXT_PLUGIN_REVISION', 49); 16 16 define('SUPERTEXT_BASE_PATH', __DIR__); -
polylang-supertext/trunk/readme.txt
r3003613 r3015517 110 110 == Changelog == 111 111 112 = 4.23 = 113 * Add additional filters and actions to allow other plugins to hook into when the translation is written back (sttr_post_meta_translation for applying filter on translated post meta value, sttr_writeback_target_content for applying filter on target content, sttr_finish_target_post_writeback for running action after the target post write back) 114 112 115 = 4.22 = 113 116 * Allow service type IDs greater than 5 in the settings -
polylang-supertext/trunk/src/Supertext/Backend/CallbackHandler.php
r2711564 r3015517 105 105 106 106 foreach ($writeBack->getSourcePostIds() as $sourcePostId) { 107 if ('translation' == $orderType) {107 if ('translation' == $orderType) { 108 108 $targetPostId = $this->library->getMultilang()->getPostInLanguage($sourcePostId, $writeBack->getTargetLanguageCode()); 109 109 } else { … … 134 134 135 135 $this->contentProvider->saveContentMetaData($targetPost, $writeBackMeta->getContentMetaData()); 136 $this->contentProvider->saveContentData($targetPost, $contentData[$sourcePostId]); 136 137 $targetContent = apply_filters(Constant::FILTER_WRITEBACK_TARGET_CONTENT, $contentData[$sourcePostId], $sourcePostId, $targetPostId, $this->library->getMultilang()); 138 139 $this->contentProvider->saveContentData($targetPost, $targetContent); 137 140 138 141 if (isset($workflowSettings['publishOnCallback']) && $workflowSettings['publishOnCallback']) { … … 142 145 // Now finally save that post and flush cache 143 146 wp_update_post($targetPost); 147 148 // Let other plugins finish any additional writeback work needed on the target post 149 do_action(Constant::ACTION_FINISH_TARGET_POST_WRITEBACK, $targetContent, $targetPostId, $sourcePostId, $this->library->getMultilang()); 144 150 145 151 // All good, set translation flag false -
polylang-supertext/trunk/src/Supertext/Helper/Constant.php
r2911219 r3015517 130 130 */ 131 131 const FILTER_TRANSLATABLE_BLOCK_ATTRIBUTES = 'sttr_translatable_block_attributes'; 132 /** 133 * @var string tag filter for custom fields / post meta translation. 134 */ 135 const FILTER_POST_META_TRANSLATION = 'sttr_post_meta_translation'; 136 /** 137 * @var string tag filter for target texts. 138 */ 139 const FILTER_WRITEBACK_TARGET_CONTENT = 'sttr_writeback_target_content'; 140 /** 141 * @var string tag action when finishing writing back translation into target post. 142 */ 143 const ACTION_FINISH_TARGET_POST_WRITEBACK = 'sttr_finish_target_post_writeback'; 132 144 } -
polylang-supertext/trunk/src/Supertext/TextAccessors/AbstractPluginCustomFieldsTextAccessor.php
r2611600 r3015517 143 143 } 144 144 145 update_post_meta($post->ID, $id, $value); 145 $multiLang = $this->library->getMultilang(); 146 $targetLanguage = $multiLang->getPostLanguage($post->ID); 147 $filteredValue = apply_filters(Constant::FILTER_POST_META_TRANSLATION, $value, $id, $targetLanguage, $multiLang); 148 149 update_post_meta($post->ID, $id, $filteredValue); 146 150 } 147 151 } -
polylang-supertext/trunk/src/Supertext/TextAccessors/CustomFieldsTextAccessor.php
r2520480 r3015517 103 103 $decodedContent = html_entity_decode($text, ENT_COMPAT | ENT_HTML401, 'UTF-8'); 104 104 $decodedContent = $this->textProcessor->replaceShortcodeNodes($decodedContent); 105 update_post_meta($post->ID, $id, $decodedContent); 105 106 $multiLang = $this->library->getMultilang(); 107 $targetLanguage = $multiLang->getPostLanguage($post->ID); 108 $filteredValue = apply_filters(Constant::FILTER_POST_META_TRANSLATION, $value, $id, $targetLanguage, $multiLang); 109 110 update_post_meta($post->ID, $id, $filteredValue); 106 111 } 107 112 }
Note: See TracChangeset
for help on using the changeset viewer.