# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: \trunk\wp-includes
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
|
|
|
301 | 301 | $link = false; |
302 | 302 | |
303 | 303 | $post = get_post( $post ); |
| 304 | |
| 305 | if ( empty( $post ) ) |
| 306 | return null; |
304 | 307 | |
305 | 308 | if ( $wp_rewrite->using_permalinks() && ( $post->post_parent > 0 ) && ( $post->post_parent != $post->ID ) ) { |
306 | 309 | $parent = get_post($post->post_parent); |
307 | | if ( 'page' == $parent->post_type ) |
308 | | $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front |
309 | | else |
310 | | $parentlink = get_permalink( $post->post_parent ); |
| 310 | |
| 311 | if ( ! empty( $parent ) ) { |
| 312 | |
| 313 | if ( 'page' == $parent->post_type ) |
| 314 | $parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front |
| 315 | else |
| 316 | $parentlink = get_permalink( $post->post_parent ); |
311 | 317 | |
312 | | if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') ) |
313 | | $name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker |
314 | | else |
315 | | $name = $post->post_name; |
| 318 | if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') ) |
| 319 | $name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker |
| 320 | else |
| 321 | $name = $post->post_name; |
316 | 322 | |
317 | | if ( strpos($parentlink, '?') === false ) |
318 | | $link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' ); |
| 323 | if ( strpos($parentlink, '?') === false ) |
| 324 | $link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' ); |
319 | 325 | |
320 | | if ( ! $leavename ) |
321 | | $link = str_replace( '%postname%', $name, $link ); |
| 326 | if ( ! $leavename ) |
| 327 | $link = str_replace( '%postname%', $name, $link ); |
| 328 | |
| 329 | } |
| 330 | |
322 | 331 | } |
323 | 332 | |
324 | 333 | if ( ! $link ) |