web/wp-includes/post-template.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    24  * @uses $post
    24  * @uses $post
    25  *
    25  *
    26  * @return int
    26  * @return int
    27  */
    27  */
    28 function get_the_ID() {
    28 function get_the_ID() {
    29 	global $post;
    29 	return get_post()->ID;
    30 	return $post->ID;
       
    31 }
    30 }
    32 
    31 
    33 /**
    32 /**
    34  * Display or retrieve the current post title with optional content.
    33  * Display or retrieve the current post title with optional content.
    35  *
    34  *
    95  * will be displayed before the post title. If the post is private, then
    94  * will be displayed before the post title. If the post is private, then
    96  * "Private" will be located before the post title.
    95  * "Private" will be located before the post title.
    97  *
    96  *
    98  * @since 0.71
    97  * @since 0.71
    99  *
    98  *
   100  * @param int $id Optional. Post ID.
    99  * @param mixed $post Optional. Post ID or object.
   101  * @return string
   100  * @return string
   102  */
   101  */
   103 function get_the_title( $id = 0 ) {
   102 function get_the_title( $post = 0 ) {
   104 	$post = &get_post($id);
   103 	$post = get_post( $post );
   105 
   104 
   106 	$title = isset($post->post_title) ? $post->post_title : '';
   105 	$title = isset( $post->post_title ) ? $post->post_title : '';
   107 	$id = isset($post->ID) ? $post->ID : (int) $id;
   106 	$id = isset( $post->ID ) ? $post->ID : 0;
   108 
   107 
   109 	if ( !is_admin() ) {
   108 	if ( ! is_admin() ) {
   110 		if ( !empty($post->post_password) ) {
   109 		if ( ! empty( $post->post_password ) ) {
   111 			$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
   110 			$protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ) );
   112 			$title = sprintf($protected_title_format, $title);
   111 			$title = sprintf( $protected_title_format, $title );
   113 		} else if ( isset($post->post_status) && 'private' == $post->post_status ) {
   112 		} else if ( isset( $post->post_status ) && 'private' == $post->post_status ) {
   114 			$private_title_format = apply_filters('private_title_format', __('Private: %s'));
   113 			$private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ) );
   115 			$title = sprintf($private_title_format, $title);
   114 			$title = sprintf( $private_title_format, $title );
   116 		}
   115 		}
   117 	}
   116 	}
       
   117 
   118 	return apply_filters( 'the_title', $title, $id );
   118 	return apply_filters( 'the_title', $title, $id );
   119 }
   119 }
   120 
   120 
   121 /**
   121 /**
   122  * Display the Post Global Unique Identifier (guid).
   122  * Display the Post Global Unique Identifier (guid).
   146  *
   146  *
   147  * @param int $id Optional. Post ID.
   147  * @param int $id Optional. Post ID.
   148  * @return string
   148  * @return string
   149  */
   149  */
   150 function get_the_guid( $id = 0 ) {
   150 function get_the_guid( $id = 0 ) {
   151 	$post = &get_post($id);
   151 	$post = get_post($id);
   152 
   152 
   153 	return apply_filters('get_the_guid', $post->guid);
   153 	return apply_filters('get_the_guid', $post->guid);
   154 }
   154 }
   155 
   155 
   156 /**
   156 /**
   175  *
   175  *
   176  * @param string $more_link_text Optional. Content for when there is more text.
   176  * @param string $more_link_text Optional. Content for when there is more text.
   177  * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
   177  * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
   178  * @return string
   178  * @return string
   179  */
   179  */
   180 function get_the_content($more_link_text = null, $stripteaser = false) {
   180 function get_the_content( $more_link_text = null, $stripteaser = false ) {
   181 	global $post, $more, $page, $pages, $multipage, $preview;
   181 	global $more, $page, $pages, $multipage, $preview;
       
   182 
       
   183 	$post = get_post();
   182 
   184 
   183 	if ( null === $more_link_text )
   185 	if ( null === $more_link_text )
   184 		$more_link_text = __( '(more...)' );
   186 		$more_link_text = __( '(more...)' );
   185 
   187 
   186 	$output = '';
   188 	$output = '';
   187 	$hasTeaser = false;
   189 	$hasTeaser = false;
   188 
   190 
   189 	// If post password required and it doesn't match the cookie.
   191 	// If post password required and it doesn't match the cookie.
   190 	if ( post_password_required($post) )
   192 	if ( post_password_required() )
   191 		return get_the_password_form();
   193 		return get_the_password_form();
   192 
   194 
   193 	if ( $page > count($pages) ) // if the requested page doesn't exist
   195 	if ( $page > count($pages) ) // if the requested page doesn't exist
   194 		$page = count($pages); // give them the highest numbered page that DOES exist
   196 		$page = count($pages); // give them the highest numbered page that DOES exist
   195 
   197 
   229  * Preview fix for javascript bug with foreign languages
   231  * Preview fix for javascript bug with foreign languages
   230  *
   232  *
   231  * @since 3.1.0
   233  * @since 3.1.0
   232  * @access private
   234  * @access private
   233  * @param array $match Match array from preg_replace_callback
   235  * @param array $match Match array from preg_replace_callback
   234  * @returns string
   236  * @return string
   235  */
   237  */
   236 function _convert_urlencoded_to_entities( $match ) {
   238 function _convert_urlencoded_to_entities( $match ) {
   237 	return '&#' . base_convert( $match[1], 16, 10 ) . ';';
   239 	return '&#' . base_convert( $match[1], 16, 10 ) . ';';
   238 }
   240 }
   239 
   241 
   257  */
   259  */
   258 function get_the_excerpt( $deprecated = '' ) {
   260 function get_the_excerpt( $deprecated = '' ) {
   259 	if ( !empty( $deprecated ) )
   261 	if ( !empty( $deprecated ) )
   260 		_deprecated_argument( __FUNCTION__, '2.3' );
   262 		_deprecated_argument( __FUNCTION__, '2.3' );
   261 
   263 
   262 	global $post;
   264 	$post = get_post();
   263 	$output = $post->post_excerpt;
   265 
   264 	if ( post_password_required($post) ) {
   266 	if ( post_password_required() ) {
   265 		$output = __('There is no excerpt because this is a protected post.');
   267 		return __( 'There is no excerpt because this is a protected post.' );
   266 		return $output;
   268 	}
   267 	}
   269 
   268 
   270 	return apply_filters( 'get_the_excerpt', $post->post_excerpt );
   269 	return apply_filters('get_the_excerpt', $output);
       
   270 }
   271 }
   271 
   272 
   272 /**
   273 /**
   273  * Whether post has excerpt.
   274  * Whether post has excerpt.
   274  *
   275  *
   276  *
   277  *
   277  * @param int $id Optional. Post ID.
   278  * @param int $id Optional. Post ID.
   278  * @return bool
   279  * @return bool
   279  */
   280  */
   280 function has_excerpt( $id = 0 ) {
   281 function has_excerpt( $id = 0 ) {
   281 	$post = &get_post( $id );
   282 	$post = get_post( $id );
   282 	return ( !empty( $post->post_excerpt ) );
   283 	return ( !empty( $post->post_excerpt ) );
   283 }
   284 }
   284 
   285 
   285 /**
   286 /**
   286  * Display the classes for the post div.
   287  * Display the classes for the post div.
   319 
   320 
   320 	if ( empty($post) )
   321 	if ( empty($post) )
   321 		return $classes;
   322 		return $classes;
   322 
   323 
   323 	$classes[] = 'post-' . $post->ID;
   324 	$classes[] = 'post-' . $post->ID;
   324 	$classes[] = $post->post_type;
   325 	if ( ! is_admin() )
       
   326 		$classes[] = $post->post_type;
   325 	$classes[] = 'type-' . $post->post_type;
   327 	$classes[] = 'type-' . $post->post_type;
   326 	$classes[] = 'status-' . $post->post_status;
   328 	$classes[] = 'status-' . $post->post_status;
   327 
   329 
   328 	// Post Format
   330 	// Post Format
   329 	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
   331 	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
   425 	if ( is_single() ) {
   427 	if ( is_single() ) {
   426 		$post_id = $wp_query->get_queried_object_id();
   428 		$post_id = $wp_query->get_queried_object_id();
   427 		$post = $wp_query->get_queried_object();
   429 		$post = $wp_query->get_queried_object();
   428 
   430 
   429 		$classes[] = 'single';
   431 		$classes[] = 'single';
   430 		$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
   432 		if ( isset( $post->post_type ) ) {
   431 		$classes[] = 'postid-' . $post_id;
   433 			$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
   432 
   434 			$classes[] = 'postid-' . $post_id;
   433 		// Post Format
   435 
   434 		if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
   436 			// Post Format
   435 			$post_format = get_post_format( $post->ID );
   437 			if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
   436 
   438 				$post_format = get_post_format( $post->ID );
   437 			if ( $post_format && !is_wp_error($post_format) )
   439 
   438 				$classes[] = 'single-format-' . sanitize_html_class( $post_format );
   440 				if ( $post_format && !is_wp_error($post_format) )
   439 			else
   441 					$classes[] = 'single-format-' . sanitize_html_class( $post_format );
   440 				$classes[] = 'single-format-standard';
   442 				else
       
   443 					$classes[] = 'single-format-standard';
       
   444 			}
   441 		}
   445 		}
   442 
   446 
   443 		if ( is_attachment() ) {
   447 		if ( is_attachment() ) {
   444 			$mime_type = get_post_mime_type($post_id);
   448 			$mime_type = get_post_mime_type($post_id);
   445 			$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
   449 			$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
   451 			$classes[] = 'post-type-archive';
   455 			$classes[] = 'post-type-archive';
   452 			$classes[] = 'post-type-archive-' . sanitize_html_class( get_query_var( 'post_type' ) );
   456 			$classes[] = 'post-type-archive-' . sanitize_html_class( get_query_var( 'post_type' ) );
   453 		} else if ( is_author() ) {
   457 		} else if ( is_author() ) {
   454 			$author = $wp_query->get_queried_object();
   458 			$author = $wp_query->get_queried_object();
   455 			$classes[] = 'author';
   459 			$classes[] = 'author';
   456 			$classes[] = 'author-' . sanitize_html_class( $author->user_nicename , $author->ID );
   460 			if ( isset( $author->user_nicename ) ) {
   457 			$classes[] = 'author-' . $author->ID;
   461 				$classes[] = 'author-' . sanitize_html_class( $author->user_nicename, $author->ID );
       
   462 				$classes[] = 'author-' . $author->ID;
       
   463 			}
   458 		} elseif ( is_category() ) {
   464 		} elseif ( is_category() ) {
   459 			$cat = $wp_query->get_queried_object();
   465 			$cat = $wp_query->get_queried_object();
   460 			$classes[] = 'category';
   466 			$classes[] = 'category';
   461 			$classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id );
   467 			if ( isset( $cat->term_id ) ) {
   462 			$classes[] = 'category-' . $cat->term_id;
   468 				$classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id );
       
   469 				$classes[] = 'category-' . $cat->term_id;
       
   470 			}
   463 		} elseif ( is_tag() ) {
   471 		} elseif ( is_tag() ) {
   464 			$tags = $wp_query->get_queried_object();
   472 			$tags = $wp_query->get_queried_object();
   465 			$classes[] = 'tag';
   473 			$classes[] = 'tag';
   466 			$classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
   474 			if ( isset( $tags->term_id ) ) {
   467 			$classes[] = 'tag-' . $tags->term_id;
   475 				$classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
       
   476 				$classes[] = 'tag-' . $tags->term_id;
       
   477 			}
   468 		} elseif ( is_tax() ) {
   478 		} elseif ( is_tax() ) {
   469 			$term = $wp_query->get_queried_object();
   479 			$term = $wp_query->get_queried_object();
   470 			$classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
   480 			if ( isset( $term->term_id ) ) {
   471 			$classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id );
   481 				$classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
   472 			$classes[] = 'term-' . $term->term_id;
   482 				$classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id );
       
   483 				$classes[] = 'term-' . $term->term_id;
       
   484 			}
   473 		}
   485 		}
   474 	} elseif ( is_page() ) {
   486 	} elseif ( is_page() ) {
   475 		$classes[] = 'page';
   487 		$classes[] = 'page';
   476 
   488 
   477 		$page_id = $wp_query->get_queried_object_id();
   489 		$page_id = $wp_query->get_queried_object_id();
   478 
   490 
   479 		$post = get_page($page_id);
   491 		$post = get_post($page_id);
   480 
   492 
   481 		$classes[] = 'page-id-' . $page_id;
   493 		$classes[] = 'page-id-' . $page_id;
   482 
   494 
   483 		if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status = 'publish' LIMIT 1", $page_id) ) )
   495 		if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status = 'publish' LIMIT 1", $page_id) ) )
   484 			$classes[] = 'page-parent';
   496 			$classes[] = 'page-parent';
   496 	}
   508 	}
   497 
   509 
   498 	if ( is_user_logged_in() )
   510 	if ( is_user_logged_in() )
   499 		$classes[] = 'logged-in';
   511 		$classes[] = 'logged-in';
   500 
   512 
   501 	if ( is_admin_bar_showing() )
   513 	if ( is_admin_bar_showing() ) {
   502 		$classes[] = 'admin-bar';
   514 		$classes[] = 'admin-bar';
       
   515 		$classes[] = 'no-customize-support';
       
   516 	}
   503 
   517 
   504 	if ( get_theme_mod( 'background_color' ) || get_background_image() )
   518 	if ( get_theme_mod( 'background_color' ) || get_background_image() )
   505 		$classes[] = 'custom-background';
   519 		$classes[] = 'custom-background';
   506 
   520 
   507 	$page = $wp_query->get( 'page' );
   521 	$page = $wp_query->get( 'page' );
   570 	}
   584 	}
   571 
   585 
   572 	$hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
   586 	$hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
   573 
   587 
   574 	return ! $wp_hasher->CheckPassword( $post->post_password, $hash );
   588 	return ! $wp_hasher->CheckPassword( $post->post_password, $hash );
   575 }
       
   576 
       
   577 /**
       
   578  * Display "sticky" CSS class, if a post is sticky.
       
   579  *
       
   580  * @since 2.7.0
       
   581  *
       
   582  * @param int $post_id An optional post ID.
       
   583  */
       
   584 function sticky_class( $post_id = null ) {
       
   585 	if ( !is_sticky($post_id) )
       
   586 		return;
       
   587 
       
   588 	echo " sticky";
       
   589 }
   589 }
   590 
   590 
   591 /**
   591 /**
   592  * Page Template Functions for usage in Themes
   592  * Page Template Functions for usage in Themes
   593  *
   593  *
   690  *
   690  *
   691  * @param int $i Page number.
   691  * @param int $i Page number.
   692  * @return string Link.
   692  * @return string Link.
   693  */
   693  */
   694 function _wp_link_page( $i ) {
   694 function _wp_link_page( $i ) {
   695 	global $post, $wp_rewrite;
   695 	global $wp_rewrite;
       
   696 	$post = get_post();
   696 
   697 
   697 	if ( 1 == $i ) {
   698 	if ( 1 == $i ) {
   698 		$url = get_permalink();
   699 		$url = get_permalink();
   699 	} else {
   700 	} else {
   700 		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
   701 		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
   879  * </ul>
   880  * </ul>
   880  *
   881  *
   881  * @since 2.7.0
   882  * @since 2.7.0
   882  *
   883  *
   883  * @param array|string $args
   884  * @param array|string $args
       
   885  * @return string html menu
   884  */
   886  */
   885 function wp_page_menu( $args = array() ) {
   887 function wp_page_menu( $args = array() ) {
   886 	$defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
   888 	$defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
   887 	$args = wp_parse_args( $args, $defaults );
   889 	$args = wp_parse_args( $args, $defaults );
   888 	$args = apply_filters( 'wp_page_menu_args', $args );
   890 	$args = apply_filters( 'wp_page_menu_args', $args );
   943 		$walker = new Walker_Page;
   945 		$walker = new Walker_Page;
   944 	else
   946 	else
   945 		$walker = $r['walker'];
   947 		$walker = $r['walker'];
   946 
   948 
   947 	$args = array($pages, $depth, $r, $current_page);
   949 	$args = array($pages, $depth, $r, $current_page);
   948 	return call_user_func_array(array(&$walker, 'walk'), $args);
   950 	return call_user_func_array(array($walker, 'walk'), $args);
   949 }
   951 }
   950 
   952 
   951 /**
   953 /**
   952  * Retrieve HTML dropdown (select) content for page list.
   954  * Retrieve HTML dropdown (select) content for page list.
   953  *
   955  *
   960 	if ( empty($args[2]['walker']) ) // the user's options are the third parameter
   962 	if ( empty($args[2]['walker']) ) // the user's options are the third parameter
   961 		$walker = new Walker_PageDropdown;
   963 		$walker = new Walker_PageDropdown;
   962 	else
   964 	else
   963 		$walker = $args[2]['walker'];
   965 		$walker = $args[2]['walker'];
   964 
   966 
   965 	return call_user_func_array(array(&$walker, 'walk'), $args);
   967 	return call_user_func_array(array($walker, 'walk'), $args);
   966 }
   968 }
   967 
   969 
   968 /**
   970 /**
   969  * Create HTML list of pages.
   971  * Create HTML list of pages.
   970  *
   972  *
   992 	 * @see Walker::start_lvl()
   994 	 * @see Walker::start_lvl()
   993 	 * @since 2.1.0
   995 	 * @since 2.1.0
   994 	 *
   996 	 *
   995 	 * @param string $output Passed by reference. Used to append additional content.
   997 	 * @param string $output Passed by reference. Used to append additional content.
   996 	 * @param int $depth Depth of page. Used for padding.
   998 	 * @param int $depth Depth of page. Used for padding.
       
   999 	 * @param array $args
   997 	 */
  1000 	 */
   998 	function start_lvl( &$output, $depth = 0, $args = array() ) {
  1001 	function start_lvl( &$output, $depth = 0, $args = array() ) {
   999 		$indent = str_repeat("\t", $depth);
  1002 		$indent = str_repeat("\t", $depth);
  1000 		$output .= "\n$indent<ul class='children'>\n";
  1003 		$output .= "\n$indent<ul class='children'>\n";
  1001 	}
  1004 	}
  1004 	 * @see Walker::end_lvl()
  1007 	 * @see Walker::end_lvl()
  1005 	 * @since 2.1.0
  1008 	 * @since 2.1.0
  1006 	 *
  1009 	 *
  1007 	 * @param string $output Passed by reference. Used to append additional content.
  1010 	 * @param string $output Passed by reference. Used to append additional content.
  1008 	 * @param int $depth Depth of page. Used for padding.
  1011 	 * @param int $depth Depth of page. Used for padding.
       
  1012 	 * @param array $args
  1009 	 */
  1013 	 */
  1010 	function end_lvl( &$output, $depth = 0, $args = array() ) {
  1014 	function end_lvl( &$output, $depth = 0, $args = array() ) {
  1011 		$indent = str_repeat("\t", $depth);
  1015 		$indent = str_repeat("\t", $depth);
  1012 		$output .= "$indent</ul>\n";
  1016 		$output .= "$indent</ul>\n";
  1013 	}
  1017 	}
  1029 			$indent = '';
  1033 			$indent = '';
  1030 
  1034 
  1031 		extract($args, EXTR_SKIP);
  1035 		extract($args, EXTR_SKIP);
  1032 		$css_class = array('page_item', 'page-item-'.$page->ID);
  1036 		$css_class = array('page_item', 'page-item-'.$page->ID);
  1033 		if ( !empty($current_page) ) {
  1037 		if ( !empty($current_page) ) {
  1034 			$_current_page = get_page( $current_page );
  1038 			$_current_page = get_post( $current_page );
  1035 			_get_post_ancestors($_current_page);
  1039 			if ( in_array( $page->ID, $_current_page->ancestors ) )
  1036 			if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
       
  1037 				$css_class[] = 'current_page_ancestor';
  1040 				$css_class[] = 'current_page_ancestor';
  1038 			if ( $page->ID == $current_page )
  1041 			if ( $page->ID == $current_page )
  1039 				$css_class[] = 'current_page_item';
  1042 				$css_class[] = 'current_page_item';
  1040 			elseif ( $_current_page && $page->ID == $_current_page->post_parent )
  1043 			elseif ( $_current_page && $page->ID == $_current_page->post_parent )
  1041 				$css_class[] = 'current_page_parent';
  1044 				$css_class[] = 'current_page_parent';
  1062 	 * @since 2.1.0
  1065 	 * @since 2.1.0
  1063 	 *
  1066 	 *
  1064 	 * @param string $output Passed by reference. Used to append additional content.
  1067 	 * @param string $output Passed by reference. Used to append additional content.
  1065 	 * @param object $page Page data object. Not used.
  1068 	 * @param object $page Page data object. Not used.
  1066 	 * @param int $depth Depth of page. Not Used.
  1069 	 * @param int $depth Depth of page. Not Used.
       
  1070 	 * @param array $args
  1067 	 */
  1071 	 */
  1068 	function end_el( &$output, $page, $depth = 0, $args = array() ) {
  1072 	function end_el( &$output, $page, $depth = 0, $args = array() ) {
  1069 		$output .= "</li>\n";
  1073 		$output .= "</li>\n";
  1070 	}
  1074 	}
  1071 
  1075 
  1100 	 *
  1104 	 *
  1101 	 * @param string $output Passed by reference. Used to append additional content.
  1105 	 * @param string $output Passed by reference. Used to append additional content.
  1102 	 * @param object $page Page data object.
  1106 	 * @param object $page Page data object.
  1103 	 * @param int $depth Depth of page in reference to parent pages. Used for padding.
  1107 	 * @param int $depth Depth of page in reference to parent pages. Used for padding.
  1104 	 * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
  1108 	 * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
       
  1109 	 * @param int $id
  1105 	 */
  1110 	 */
  1106 	function start_el(&$output, $page, $depth, $args, $id = 0) {
  1111 	function start_el(&$output, $page, $depth, $args, $id = 0) {
  1107 		$pad = str_repeat('&nbsp;', $depth * 3);
  1112 		$pad = str_repeat('&nbsp;', $depth * 3);
  1108 
  1113 
  1109 		$output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
  1114 		$output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
  1148  *
  1153  *
  1149  * @param int $id Optional. Post ID.
  1154  * @param int $id Optional. Post ID.
  1150  * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
  1155  * @param string $size Optional, default is 'thumbnail'. Size of image, either array or string.
  1151  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
  1156  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
  1152  * @param bool $icon Optional, default is false. Whether to include icon.
  1157  * @param bool $icon Optional, default is false. Whether to include icon.
  1153  * @param string $text Optional, default is false. If string, then will be link text.
  1158  * @param string|bool $text Optional, default is false. If string, then will be link text.
  1154  * @return string HTML content.
  1159  * @return string HTML content.
  1155  */
  1160  */
  1156 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
  1161 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
  1157 	$id = intval( $id );
  1162 	$id = intval( $id );
  1158 	$_post = & get_post( $id );
  1163 	$_post = get_post( $id );
  1159 
  1164 
  1160 	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
  1165 	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
  1161 		return __( 'Missing Attachment' );
  1166 		return __( 'Missing Attachment' );
  1162 
  1167 
  1163 	if ( $permalink )
  1168 	if ( $permalink )
  1186  *
  1191  *
  1187  * @param string $content
  1192  * @param string $content
  1188  * @return string
  1193  * @return string
  1189  */
  1194  */
  1190 function prepend_attachment($content) {
  1195 function prepend_attachment($content) {
  1191 	global $post;
  1196 	$post = get_post();
  1192 
  1197 
  1193 	if ( empty($post->post_type) || $post->post_type != 'attachment' )
  1198 	if ( empty($post->post_type) || $post->post_type != 'attachment' )
  1194 		return $content;
  1199 		return $content;
  1195 
  1200 
  1196 	$p = '<p class="attachment">';
  1201 	$p = '<p class="attachment">';
  1213  * @uses apply_filters() Calls 'the_password_form' filter on output.
  1218  * @uses apply_filters() Calls 'the_password_form' filter on output.
  1214  *
  1219  *
  1215  * @return string HTML content for password form for password protected post.
  1220  * @return string HTML content for password form for password protected post.
  1216  */
  1221  */
  1217 function get_the_password_form() {
  1222 function get_the_password_form() {
  1218 	global $post;
  1223 	$post = get_post();
  1219 	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
  1224 	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
  1220 	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
  1225 	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
  1221 	<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
  1226 	<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
  1222 	<p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" /></p>
  1227 	<p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" /></p>
  1223 </form>
  1228 </form>
  1259 /**
  1264 /**
  1260  * Get the specific template name for a page.
  1265  * Get the specific template name for a page.
  1261  *
  1266  *
  1262  * @since 3.4.0
  1267  * @since 3.4.0
  1263  *
  1268  *
  1264  * @param int $id The page ID to check. Defaults to the current post, when used in the loop.
  1269  * @param int $post_id The page ID to check. Defaults to the current post, when used in the loop.
  1265  * @return string|bool Page template filename. Returns an empty string when the default page template
  1270  * @return string|bool Page template filename. Returns an empty string when the default page template
  1266  * 	is in use. Returns false if the post is not a page.
  1271  * 	is in use. Returns false if the post is not a page.
  1267  */
  1272  */
  1268 function get_page_template_slug( $post_id = null ) {
  1273 function get_page_template_slug( $post_id = null ) {
  1269 	$post = get_post( $post_id );
  1274 	$post = get_post( $post_id );
  1430 	<col style="width: 33%" />
  1435 	<col style="width: 33%" />
  1431 	<col style="width: 33%" />
  1436 	<col style="width: 33%" />
  1432 	<col style="width: 33%" />
  1437 	<col style="width: 33%" />
  1433 <thead>
  1438 <thead>
  1434 <tr>
  1439 <tr>
  1435 	<th scope="col"><?php /* translators: column name in revisons */ _ex( 'Old', 'revisions column name' ); ?></th>
  1440 	<th scope="col"><?php /* translators: column name in revisions */ _ex( 'Old', 'revisions column name' ); ?></th>
  1436 	<th scope="col"><?php /* translators: column name in revisons */ _ex( 'New', 'revisions column name' ); ?></th>
  1441 	<th scope="col"><?php /* translators: column name in revisions */ _ex( 'New', 'revisions column name' ); ?></th>
  1437 	<th scope="col"><?php /* translators: column name in revisons */ _ex( 'Date Created', 'revisions column name' ); ?></th>
  1442 	<th scope="col"><?php /* translators: column name in revisions */ _ex( 'Date Created', 'revisions column name' ); ?></th>
  1438 	<th scope="col"><?php _e( 'Author' ); ?></th>
  1443 	<th scope="col"><?php _e( 'Author' ); ?></th>
  1439 	<th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
  1444 	<th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
  1440 </tr>
  1445 </tr>
  1441 </thead>
  1446 </thead>
  1442 <tbody>
  1447 <tbody>