Changeset 36853
- Timestamp:
- 03/05/2016 03:55:33 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r36659 r36853 1303 1303 } else { 1304 1304 // Allow non-published (private, future) to be viewed at a pretty permalink. 1305 $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, urldecode( $permalink ));1305 $view_link = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink ); 1306 1306 } 1307 1307 } … … 1313 1313 1314 1314 if ( false !== $view_link ) { 1315 $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $view_link . "</a>\n"; 1315 $display_link = urldecode( $view_link ); 1316 $return .= '<a id="sample-permalink" href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $display_link . "</a>\n"; 1316 1317 } else { 1317 1318 $return .= '<span id="sample-permalink">' . $permalink . "</span>\n"; -
trunk/tests/phpunit/tests/admin/includesPost.php
r36253 r36853 281 281 $found = get_sample_permalink_html( $p ); 282 282 $this->assertContains( 'href="' . get_option( 'home' ) . '/?p=' . $p . '"', $found ); 283 $this->assertContains( '>' . get_option( 'home' ) . '/?p=' . $p . '<', $found ); 283 284 } 284 285 … … 293 294 294 295 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 295 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo ', 'post_date' => $future_date ) );296 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo-صورة', 'post_date' => $future_date ) ); 296 297 297 298 $found = get_sample_permalink_html( $p ); 298 299 $post = get_post( $p ); 299 300 $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found ); 301 $this->assertContains( '>' . urldecode( $post->post_name ) . '<', $found ); 302 } 303 304 /** 305 * @ticket 35980 306 */ 307 public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_attachment_link_when_pretty_permalinks_are_enabled() { 308 $this->set_permalink_structure( '/%postname%/' ); 309 310 wp_set_current_user( self::$admin_id ); 311 312 $p = self::factory()->attachment->create_object( 'صورة.jpg', 0, array( 313 'post_mime_type' => 'image/jpeg', 314 'post_type' => 'attachment', 315 'post_title' => 'صورة', 316 'post_status' => 'inherit', 317 ) ); 318 319 $found = get_sample_permalink_html( $p ); 320 $post = get_post( $p ); 321 $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found ); 322 $this->assertContains( '>' . urldecode( get_permalink( $post ) ) . '<', $found ); 300 323 } 301 324 … … 310 333 311 334 // Published posts should use published permalink 312 $p = self::factory()->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo ' ) );313 314 $found = get_sample_permalink_html( $p, null, 'new_slug ' );335 $p = self::factory()->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo-صورة' ) ); 336 337 $found = get_sample_permalink_html( $p, null, 'new_slug-صورة' ); 315 338 $post = get_post( $p ); 316 339 $message = 'Published post'; 317 340 $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message ); 341 $this->assertContains( '>new_slug-صورة<', $found, $message ); 318 342 319 343 // Scheduled posts should use published permalink 320 344 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 321 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'bar ', 'post_date' => $future_date ) );322 323 $found = get_sample_permalink_html( $p, null, 'new_slug ' );345 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'bar-صورة', 'post_date' => $future_date ) ); 346 347 $found = get_sample_permalink_html( $p, null, 'new_slug-صورة' ); 324 348 $post = get_post( $p ); 325 349 $message = 'Scheduled post'; 326 350 $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message ); 351 $this->assertContains( '>new_slug-صورة<', $found, $message ); 327 352 328 353 // Draft posts should use preview link 329 $p = self::factory()->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz ' ) );330 331 $found = get_sample_permalink_html( $p, null, 'new_slug ' );354 $p = self::factory()->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz-صورة' ) ); 355 356 $found = get_sample_permalink_html( $p, null, 'new_slug-صورة' ); 332 357 $post = get_post( $p ); 333 358 $message = 'Draft post'; … … 337 362 338 363 $this->assertContains( 'href="' . esc_url( $preview_link ) . '"', $found, $message ); 364 $this->assertContains( '>new_slug-صورة<', $found, $message ); 339 365 } 340 366
Note: See TracChangeset
for help on using the changeset viewer.