103 | | foreach ( array( 'Y', 'y', 'o' ) as $year_token ) { |
104 | | $date_format = preg_replace( '/(?<!\\\\)' . $year_token . '/', '%1$s', $date_format ); |
105 | | } |
106 | | foreach ( array( 'F', 'm', 'M', 'n' ) as $month_token ) { |
107 | | $date_format = preg_replace( '/(?<!\\\\)' . $month_token . '/', '%2$s', $date_format ); |
108 | | } |
109 | | foreach ( array( 'j', 'd' ) as $day_token ) { |
110 | | $date_format = preg_replace( '/(?<!\\\\)' . $day_token . '/', '%3$s', $date_format ); |
| 103 | $date_format = preg_replace( '/(?<!\\\\)[Yyo]/', '%1$s', $date_format ); |
| 104 | $date_format = preg_replace( '/(?<!\\\\)[FmMn]/', '%2$s', $date_format ); |
| 105 | $date_format = preg_replace( '/(?<!\\\\)[jd]/', '%3$s', $date_format ); |
| 106 | |
| 107 | // Fallback to ISO date format if year, month, or day are missing from the date format. |
| 108 | if ( 1 !== substr_count( $date_format, '%1$s' ) || 1 !== substr_count( $date_format, '%2$s' ) || 1 !== substr_count( $date_format, '%3$s' ) ) { |
| 109 | $date_format = '%1$s-%2$s-%3$s'; |