Changeset 3495157
- Timestamp:
- 03/31/2026 05:59:38 AM (3 days ago)
- Location:
- dashi
- Files:
-
- 4 edited
- 23 copied
-
tags/3.4.8 (copied) (copied from dashi/trunk)
-
tags/3.4.8/classes/Notation.php (copied) (copied from dashi/trunk/classes/Notation.php)
-
tags/3.4.8/classes/NotationCf7WarningAcknowledger.php (copied) (copied from dashi/trunk/classes/NotationCf7WarningAcknowledger.php)
-
tags/3.4.8/classes/NotationDomain.php (copied) (copied from dashi/trunk/classes/NotationDomain.php)
-
tags/3.4.8/classes/NotationDomainValidator.php (copied) (copied from dashi/trunk/classes/NotationDomainValidator.php)
-
tags/3.4.8/classes/NotationHeavey.php (copied) (copied from dashi/trunk/classes/NotationHeavey.php)
-
tags/3.4.8/classes/Option.php (copied) (copied from dashi/trunk/classes/Option.php)
-
tags/3.4.8/classes/Posttype/Base.php (copied) (copied from dashi/trunk/classes/Posttype/Base.php)
-
tags/3.4.8/classes/Posttype/Csv.php (copied) (copied from dashi/trunk/classes/Posttype/Csv.php)
-
tags/3.4.8/classes/Posttype/CustomFields.php (copied) (copied from dashi/trunk/classes/Posttype/CustomFields.php)
-
tags/3.4.8/classes/Posttype/CustomFieldsCategories.php (copied) (copied from dashi/trunk/classes/Posttype/CustomFieldsCategories.php)
-
tags/3.4.8/classes/Posttype/DeferredTranslation.php (copied) (copied from dashi/trunk/classes/Posttype/DeferredTranslation.php)
-
tags/3.4.8/classes/Posttype/Option.php (copied) (copied from dashi/trunk/classes/Posttype/Option.php)
-
tags/3.4.8/classes/Posttype/Posttype.php (copied) (copied from dashi/trunk/classes/Posttype/Posttype.php)
-
tags/3.4.8/classes/Posttype/Preview.php (modified) (4 diffs)
-
tags/3.4.8/dashi.php (copied) (copied from dashi/trunk/dashi.php) (1 diff)
-
tags/3.4.8/languages/dashi-ja.mo (copied) (copied from dashi/trunk/languages/dashi-ja.mo)
-
tags/3.4.8/languages/dashi-ja.po (copied) (copied from dashi/trunk/languages/dashi-ja.po)
-
tags/3.4.8/posttype/Editablehelp.php (copied) (copied from dashi/trunk/posttype/Editablehelp.php)
-
tags/3.4.8/posttype/Pagepart.php (copied) (copied from dashi/trunk/posttype/Pagepart.php)
-
tags/3.4.8/readme.txt (copied) (copied from dashi/trunk/readme.txt) (2 diffs)
-
tags/3.4.8/vendor/composer/autoload_classmap.php (copied) (copied from dashi/trunk/vendor/composer/autoload_classmap.php)
-
tags/3.4.8/vendor/composer/autoload_static.php (copied) (copied from dashi/trunk/vendor/composer/autoload_static.php)
-
tags/3.4.8/vendor/composer/installed.php (copied) (copied from dashi/trunk/vendor/composer/installed.php)
-
trunk/classes/Posttype/Preview.php (modified) (4 diffs)
-
trunk/dashi.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dashi/tags/3.4.8/classes/Posttype/Preview.php
r3477375 r3495157 6 6 class Preview 7 7 { 8 /** 9 * プレビュー保存時の値をフィールド型に応じて整形 10 * 11 * @param string $post_meta 12 * @param mixed $value 13 * @param string|bool $class 14 * @return mixed 15 */ 16 private static function sanitizePreviewMetaValue($post_meta, $value, $class) 17 { 18 if (is_array($value)) 19 { 20 return array_map( 21 static function ($item) use ($post_meta, $class) 22 { 23 return self::sanitizePreviewMetaValue($post_meta, $item, $class); 24 }, 25 $value 26 ); 27 } 28 29 if (! is_string($value)) 30 { 31 return $value; 32 } 33 34 $value = wp_unslash($value); 35 36 if (! $class || ! method_exists($class, 'getFlatCustomFields')) 37 { 38 return sanitize_text_field($value); 39 } 40 41 $flat_fields = $class::getFlatCustomFields(); 42 $field = isset($flat_fields[$post_meta]) && is_array($flat_fields[$post_meta]) 43 ? $flat_fields[$post_meta] 44 : []; 45 $field_type = isset($field['type']) ? (string) $field['type'] : ''; 46 47 if (in_array($field_type, ['textarea', 'wysiwyg'], true)) 48 { 49 return $value; 50 } 51 52 return sanitize_text_field($value); 53 } 54 8 55 /** 9 56 * forge … … 99 146 { 100 147 global $wpdb; 101 102 148 if (wp_is_post_revision($post_id)) 103 149 { … … 128 174 $vals = is_array($post_val) ? $post_val : $post_scalar; 129 175 if ($vals === null || $vals === false || $vals === '') continue; 130 if (is_string($vals)) 131 { 132 $vals = sanitize_text_field(wp_unslash($vals)); 133 } 176 $vals = self::sanitizePreviewMetaValue($post_meta, $vals, $class); 134 177 if (is_array($vals) && $post_meta != 'google_map') 135 178 { 136 179 foreach ($vals as $v) 137 180 { 138 add_metadata('post', $post_id, $post_meta, sanitize_text_field(wp_unslash((string) $v)));181 add_metadata('post', $post_id, $post_meta, $v); 139 182 } 140 183 } … … 146 189 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- 既存互換のカスタムフック名。 147 190 do_action('save_preview_postmeta', $post_id); 191 148 192 } 149 193 } -
dashi/tags/3.4.8/dashi.php
r3486974 r3495157 7 7 Text Domain: dashi 8 8 Domain Path: /languages/ 9 Version: 3.4. 79 Version: 3.4.8 10 10 Author URI: http://www.jidaikobo.com/ 11 11 thx: https://github.com/trentrichardson/jQuery-Timepicker-Addon/tree/master/src -
dashi/tags/3.4.8/readme.txt
r3486974 r3495157 4 4 Tags: custom field, custom post type 5 5 Tested up to: 6.9 6 Stable tag: 3.4. 76 Stable tag: 3.4.8 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 42 42 43 43 == Changelog == 44 45 = 3.4.8 = 46 fix: preserve textarea and wysiwyg values in preview revisions 44 47 45 48 = 3.4.7 = -
dashi/trunk/classes/Posttype/Preview.php
r3477375 r3495157 6 6 class Preview 7 7 { 8 /** 9 * プレビュー保存時の値をフィールド型に応じて整形 10 * 11 * @param string $post_meta 12 * @param mixed $value 13 * @param string|bool $class 14 * @return mixed 15 */ 16 private static function sanitizePreviewMetaValue($post_meta, $value, $class) 17 { 18 if (is_array($value)) 19 { 20 return array_map( 21 static function ($item) use ($post_meta, $class) 22 { 23 return self::sanitizePreviewMetaValue($post_meta, $item, $class); 24 }, 25 $value 26 ); 27 } 28 29 if (! is_string($value)) 30 { 31 return $value; 32 } 33 34 $value = wp_unslash($value); 35 36 if (! $class || ! method_exists($class, 'getFlatCustomFields')) 37 { 38 return sanitize_text_field($value); 39 } 40 41 $flat_fields = $class::getFlatCustomFields(); 42 $field = isset($flat_fields[$post_meta]) && is_array($flat_fields[$post_meta]) 43 ? $flat_fields[$post_meta] 44 : []; 45 $field_type = isset($field['type']) ? (string) $field['type'] : ''; 46 47 if (in_array($field_type, ['textarea', 'wysiwyg'], true)) 48 { 49 return $value; 50 } 51 52 return sanitize_text_field($value); 53 } 54 8 55 /** 9 56 * forge … … 99 146 { 100 147 global $wpdb; 101 102 148 if (wp_is_post_revision($post_id)) 103 149 { … … 128 174 $vals = is_array($post_val) ? $post_val : $post_scalar; 129 175 if ($vals === null || $vals === false || $vals === '') continue; 130 if (is_string($vals)) 131 { 132 $vals = sanitize_text_field(wp_unslash($vals)); 133 } 176 $vals = self::sanitizePreviewMetaValue($post_meta, $vals, $class); 134 177 if (is_array($vals) && $post_meta != 'google_map') 135 178 { 136 179 foreach ($vals as $v) 137 180 { 138 add_metadata('post', $post_id, $post_meta, sanitize_text_field(wp_unslash((string) $v)));181 add_metadata('post', $post_id, $post_meta, $v); 139 182 } 140 183 } … … 146 189 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- 既存互換のカスタムフック名。 147 190 do_action('save_preview_postmeta', $post_id); 191 148 192 } 149 193 } -
dashi/trunk/dashi.php
r3486974 r3495157 7 7 Text Domain: dashi 8 8 Domain Path: /languages/ 9 Version: 3.4. 79 Version: 3.4.8 10 10 Author URI: http://www.jidaikobo.com/ 11 11 thx: https://github.com/trentrichardson/jQuery-Timepicker-Addon/tree/master/src -
dashi/trunk/readme.txt
r3486974 r3495157 4 4 Tags: custom field, custom post type 5 5 Tested up to: 6.9 6 Stable tag: 3.4. 76 Stable tag: 3.4.8 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 42 42 43 43 == Changelog == 44 45 = 3.4.8 = 46 fix: preserve textarea and wysiwyg values in preview revisions 44 47 45 48 = 3.4.7 =
Note: See TracChangeset
for help on using the changeset viewer.