PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
← All changes | src/TemplateLibrary/TemplateLibraryService.php +10 -6 4.4.2 → 4.4.5 View file →
@@ -67,16 +67,20 @@
67 67
68 68 usort(
69 69 $results,
70 70 function( $a, $b ) {
71 - $pos_a = isset( $a['position'] ) ? (int) $a['position'] : 10;
72 - $pos_b = isset( $b['position'] ) ? (int) $b['position'] : 10;
71 + $date_a = strtotime( (string) ( $a['modified_date'] ?? '' ) );
72 + $date_b = strtotime( (string) ( $b['modified_date'] ?? '' ) );
73 + $date_a = false === $date_a ? 0 : (int) $date_a;
74 + $date_b = false === $date_b ? 0 : (int) $date_b;
75 + $day_a = $date_a > 0 ? date( 'Y-m-d', $date_a ) : '';
76 + $day_b = $date_b > 0 ? date( 'Y-m-d', $date_b ) : '';
73 77
74 - if ( $pos_a === $pos_b ) {
75 - return strcmp( (string) ( $a['name'] ?? '' ), (string) ( $b['name'] ?? '' ) );
78 + if ( $day_a === $day_b ) {
79 + return strnatcasecmp( (string) ( $a['name'] ?? '' ), (string) ( $b['name'] ?? '' ) );
76 80 }
77 81
78 - return $pos_a - $pos_b;
82 + return strcmp( $day_b, $day_a );
79 83 }
80 84 );
81 85
82 86 return $results;
@@ -83,9 +87,9 @@
83 87 }
84 88
85 89 /**
86 90 * Built-in + user-saved templates for the library modal.
87 - * Order: saved (newest first via DB query), then builtin (by position).
91 + * Order: saved (newest first via DB query), then builtin (newest update first, then name).
88 92 *
89 93 * @param string $email_type Email type slug.
90 94 *
91 95 * @return array[]