IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| | 1 | <?php |
| | 2 | |
| | 3 | /** |
| | 4 | * @group date |
| | 5 | * @group datetime |
| | 6 | */ |
| | 7 | class Tests_Date_Get_Permalink extends WP_UnitTestCase { |
| | 8 | |
| | 9 | function tearDown() { |
| | 10 | delete_option( 'permalink_structure' ); |
| | 11 | update_option( 'timezone_string', 'UTC' ); |
| | 12 | date_default_timezone_set( 'UTC' ); |
| | 13 | |
| | 14 | parent::tearDown(); |
| | 15 | } |
| | 16 | |
| | 17 | /** |
| | 18 | * @ticket 48623 |
| | 19 | */ |
| | 20 | public function test_should_return_correct_date_permalink_with_changed_time_zone() { |
| | 21 | $timezone = 'America/Chicago'; |
| | 22 | update_option( 'timezone_string', $timezone ); |
| | 23 | update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%hour%/%minute%/%second%' ); |
| | 24 | date_default_timezone_set( 'UTC' ); |
| | 25 | |
| | 26 | $post_id = self::factory()->post->create( |
| | 27 | array( |
| | 28 | 'post_date' => '2018-07-22 21:13:23', |
| | 29 | 'post_date_gmt' => '2018-07-23 03:13:23', |
| | 30 | ) |
| | 31 | ); |
| | 32 | |
| | 33 | $this->assertEquals( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) ); |
| | 34 | |
| | 35 | date_default_timezone_set( $timezone ); |
| | 36 | $this->assertEquals( 'http://example.org/2018/07/22/21/13/23', get_permalink( $post_id ) ); |
| | 37 | } |
| | 38 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 166 | 166 | $permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename ); |
| 167 | 167 | |
| 168 | 168 | if ( '' != $permalink && ! in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft', 'future' ) ) ) { |
| 169 | | $unixtime = strtotime( $post->post_date ); |
| 170 | 169 | |
| 171 | 170 | $category = ''; |
| 172 | 171 | if ( strpos( $permalink, '%category%' ) !== false ) { |
| … |
… |
|
| 212 | 211 | $author = $authordata->user_nicename; |
| 213 | 212 | } |
| 214 | 213 | |
| 215 | | $date = explode( ' ', gmdate( 'Y m d H i s', $unixtime ) ); |
| | 214 | // This is not an API call because in "sample" mode post might not be real post object. |
| | 215 | $date = explode( ' ', str_replace( array( '-', ':' ), ' ', $post->post_date ) ); |
| | 216 | |
| 216 | 217 | $rewritereplace = |
| 217 | 218 | array( |
| 218 | 219 | $date[0], |