Changeset 3453810
- Timestamp:
- 02/04/2026 01:09:50 PM (2 months ago)
- Location:
- ringier-bus/trunk
- Files:
-
- 6 edited
-
CHANGELOG.md (modified) (1 diff)
-
README.md (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
ringier-bus.php (modified) (2 diffs)
-
src/Core/Bus/ArticleEvent.php (modified) (2 diffs)
-
src/Core/Utils.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ringier-bus/trunk/CHANGELOG.md
r3449331 r3453810 13 13 * (dependency) Fully remove Guzzle/Symfony dependencies 14 14 * (dependency) Fully remove Timber/Twig 15 16 17 ## [3.5.2] - 2026-02-04 ## 18 19 ### Changed ### 20 * (code) Refactored `getOgArticlePublishedDate` and `getOgArticleModifiedDate` to use native `WP_Post` properties instead of Yoast SEO Indexables. This ensures the API uses the database "Source of Truth" and avoids data cross-contamination when posts share slugs with historical attachments. 21 * (code) Hardened `Utils::formatDate` to handle null or "zeroed" database timestamps (`0000-00-00 00:00:00`), ensuring strict RFC3339 compliance. 15 22 16 23 -
ringier-bus/trunk/README.md
r3449331 r3453810 7 7 **Requires at least:** 6.0 8 8 **Tested up to:** 6.9 9 **Stable tag:** 3.5. 19 **Stable tag:** 3.5.2 10 10 **Requires PHP:** 8.1 11 11 **License:** GPLv2 or later -
ringier-bus/trunk/readme.txt
r3449331 r3453810 4 4 Requires at least: 6.0 5 5 Tested up to: 6.9 6 Stable tag: 3.5. 16 Stable tag: 3.5.2 7 7 Requires PHP: 8.1 8 8 License: GPLv2 or later … … 161 161 162 162 == Changelog == 163 164 ### [3.5.2] - 2026-02-04 ### 165 166 #### Changed #### 167 * (code) Refactored `getOgArticlePublishedDate` and `getOgArticleModifiedDate` to use native `WP_Post` properties instead of Yoast SEO Indexables. This ensures the API uses the database "Source of Truth" and avoids data cross-contamination when posts share slugs with historical attachments. 168 * (code) Hardened `Utils::formatDate` to handle null or "zeroed" database timestamps (`0000-00-00 00:00:00`), ensuring strict RFC3339 compliance. 169 163 170 164 171 ### [3.5.1] - 2026-01-29 ### -
ringier-bus/trunk/ringier-bus.php
r3449331 r3453810 11 11 * Plugin URI: https://github.com/RingierIMU/mkt-plugin-wordpress-bus 12 12 * Description: A plugin to push events to Ringier CDE via the BUS API whenever an article is created, updated or deleted 13 * Version: 3.5. 113 * Version: 3.5.2 14 14 * Requires at least: 6.0 15 15 * Author: Ringier SA, Wasseem Khayrattee … … 50 50 */ 51 51 define('RINGIER_BUS_DS', DIRECTORY_SEPARATOR); 52 define('RINGIER_BUS_PLUGIN_VERSION', '3.5. 1');52 define('RINGIER_BUS_PLUGIN_VERSION', '3.5.2'); 53 53 define('RINGIER_BUS_PLUGIN_MINIMUM_WP_VERSION', '6.0'); 54 54 define('RINGIER_BUS_PLUGIN_DIR_URL', plugin_dir_url(__FILE__)); //has trailing slash at end -
ringier-bus/trunk/src/Core/Bus/ArticleEvent.php
r3321163 r3453810 774 774 * @return string 775 775 */ 776 private function getOgArticleModifiedDate(int $post_ID, \WP_Post $post) 777 { 778 if (class_exists('YoastSEO') && (is_object(YoastSEO()))) { 779 return YoastSEO()->meta->for_post($post_ID)->open_graph_article_modified_time; 780 } 781 782 return Utils::formatDate($post->post_modified_gmt); 776 private function getOgArticleModifiedDate(int $post_ID, \WP_Post $post): string 777 { 778 // Ensure we have a valid GMT modified date; fallback to local modified if GMT is empty 779 $date = !empty($post->post_modified_gmt) && $post->post_modified_gmt !== '0000-00-00 00:00:00' 780 ? $post->post_modified_gmt 781 : $post->post_modified; 782 783 return Utils::formatDate($date); 783 784 } 784 785 … … 792 793 * @return string 793 794 */ 794 private function getOgArticlePublishedDate(int $post_ID, \WP_Post $post) 795 { 796 if (class_exists('YoastSEO') && (is_object(YoastSEO()))) { 797 return YoastSEO()->meta->for_post($post_ID)->open_graph_article_published_time; 798 } 799 800 return Utils::formatDate($post->post_date_gmt); 795 private function getOgArticlePublishedDate(int $post_ID, \WP_Post $post): string 796 { 797 // Ensure we have a valid GMT date; fallback to local date if GMT is empty 798 $date = !empty($post->post_date_gmt) && $post->post_date_gmt !== '0000-00-00 00:00:00' 799 ? $post->post_date_gmt 800 : $post->post_date; 801 802 return Utils::formatDate($date); 801 803 } 802 804 -
ringier-bus/trunk/src/Core/Utils.php
r3447091 r3453810 441 441 * @return string 442 442 */ 443 public static function formatDate($date, $format = \DATE_RFC3339): string 444 { 443 public static function formatDate($date, string $format = \DATE_RFC3339): string 444 { 445 // Handle empty or null inputs immediately 446 if (empty($date) || $date === '0000-00-00 00:00:00') { 447 return ''; 448 } 449 445 450 $immutable_date = \date_create_immutable_from_format('Y-m-d H:i:s', $date, new \DateTimeZone('UTC')); 446 451 447 452 if (!$immutable_date) { 448 return $date; 453 // Try a generic parse as a final fallback before giving up 454 try { 455 $immutable_date = new \DateTimeImmutable($date, new \DateTimeZone('UTC')); 456 } catch (\Exception $e) { 457 return $date; 458 } 449 459 } 450 460
Note: See TracChangeset
for help on using the changeset viewer.