web/wp-includes/post-template.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
    10 
    10 
    11 /**
    11 /**
    12  * Display the ID of the current item in the WordPress Loop.
    12  * Display the ID of the current item in the WordPress Loop.
    13  *
    13  *
    14  * @since 0.71
    14  * @since 0.71
    15  * @uses $id
       
    16  */
    15  */
    17 function the_ID() {
    16 function the_ID() {
    18 	global $id;
    17 	echo get_the_ID();
    19 	echo $id;
       
    20 }
    18 }
    21 
    19 
    22 /**
    20 /**
    23  * Retrieve the ID of the current item in the WordPress Loop.
    21  * Retrieve the ID of the current item in the WordPress Loop.
    24  *
    22  *
    25  * @since 2.1.0
    23  * @since 2.1.0
    26  * @uses $id
    24  * @uses $post
    27  *
    25  *
    28  * @return unknown
    26  * @return int
    29  */
    27  */
    30 function get_the_ID() {
    28 function get_the_ID() {
    31 	global $id;
    29 	global $post;
    32 	return $id;
    30 	return $post->ID;
    33 }
    31 }
    34 
    32 
    35 /**
    33 /**
    36  * Display or retrieve the current post title with optional content.
    34  * Display or retrieve the current post title with optional content.
    37  *
    35  *
    79 
    77 
    80 	$defaults = array('before' => '', 'after' =>  '', 'echo' => true);
    78 	$defaults = array('before' => '', 'after' =>  '', 'echo' => true);
    81 	$r = wp_parse_args($args, $defaults);
    79 	$r = wp_parse_args($args, $defaults);
    82 	extract( $r, EXTR_SKIP );
    80 	extract( $r, EXTR_SKIP );
    83 
    81 
    84 
       
    85 	$title = $before . $title . $after;
    82 	$title = $before . $title . $after;
    86 	$title = esc_attr(strip_tags($title));
    83 	$title = esc_attr(strip_tags($title));
    87 
    84 
    88 	if ( $echo )
    85 	if ( $echo )
    89 		echo $title;
    86 		echo $title;
   104  * @return string
   101  * @return string
   105  */
   102  */
   106 function get_the_title( $id = 0 ) {
   103 function get_the_title( $id = 0 ) {
   107 	$post = &get_post($id);
   104 	$post = &get_post($id);
   108 
   105 
   109 	$title = $post->post_title;
   106 	$title = isset($post->post_title) ? $post->post_title : '';
       
   107 	$id = isset($post->ID) ? $post->ID : (int) $id;
   110 
   108 
   111 	if ( !is_admin() ) {
   109 	if ( !is_admin() ) {
   112 		if ( !empty($post->post_password) ) {
   110 		if ( !empty($post->post_password) ) {
   113 			$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
   111 			$protected_title_format = apply_filters('protected_title_format', __('Protected: %s'));
   114 			$title = sprintf($protected_title_format, $title);
   112 			$title = sprintf($protected_title_format, $title);
   115 		} else if ( isset($post->post_status) && 'private' == $post->post_status ) {
   113 		} else if ( isset($post->post_status) && 'private' == $post->post_status ) {
   116 			$private_title_format = apply_filters('private_title_format', __('Private: %s'));
   114 			$private_title_format = apply_filters('private_title_format', __('Private: %s'));
   117 			$title = sprintf($private_title_format, $title);
   115 			$title = sprintf($private_title_format, $title);
   118 		}
   116 		}
   119 	}
   117 	}
   120 	return apply_filters( 'the_title', $title, $post->ID );
   118 	return apply_filters( 'the_title', $title, $id );
   121 }
   119 }
   122 
   120 
   123 /**
   121 /**
   124  * Display the Post Global Unique Identifier (guid).
   122  * Display the Post Global Unique Identifier (guid).
   125  *
   123  *
   126  * The guid will appear to be a link, but should not be used as an link to the
   124  * The guid will appear to be a link, but should not be used as an link to the
   127  * post. The reason you should not use it as a link, is because of moving the
   125  * post. The reason you should not use it as a link, is because of moving the
   128  * blog across domains.
   126  * blog across domains.
   129  *
   127  *
       
   128  * Url is escaped to make it xml safe
       
   129  *
   130  * @since 1.5.0
   130  * @since 1.5.0
   131  *
   131  *
   132  * @param int $id Optional. Post ID.
   132  * @param int $id Optional. Post ID.
   133  */
   133  */
   134 function the_guid( $id = 0 ) {
   134 function the_guid( $id = 0 ) {
   135 	echo get_the_guid($id);
   135 	echo esc_url( get_the_guid( $id ) );
   136 }
   136 }
   137 
   137 
   138 /**
   138 /**
   139  * Retrieve the Post Global Unique Identifier (guid).
   139  * Retrieve the Post Global Unique Identifier (guid).
   140  *
   140  *
   157  * Display the post content.
   157  * Display the post content.
   158  *
   158  *
   159  * @since 0.71
   159  * @since 0.71
   160  *
   160  *
   161  * @param string $more_link_text Optional. Content for when there is more text.
   161  * @param string $more_link_text Optional. Content for when there is more text.
   162  * @param string $stripteaser Optional. Teaser content before the more text.
   162  * @param bool $stripteaser Optional. Strip teaser content before the more text. Default is false.
   163  */
   163  */
   164 function the_content($more_link_text = null, $stripteaser = 0) {
   164 function the_content($more_link_text = null, $stripteaser = false) {
   165 	$content = get_the_content($more_link_text, $stripteaser);
   165 	$content = get_the_content($more_link_text, $stripteaser);
   166 	$content = apply_filters('the_content', $content);
   166 	$content = apply_filters('the_content', $content);
   167 	$content = str_replace(']]>', ']]>', $content);
   167 	$content = str_replace(']]>', ']]>', $content);
   168 	echo $content;
   168 	echo $content;
   169 }
   169 }
   172  * Retrieve the post content.
   172  * Retrieve the post content.
   173  *
   173  *
   174  * @since 0.71
   174  * @since 0.71
   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 string $stripteaser Optional. Teaser content before the more text.
   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 = 0) {
   180 function get_the_content($more_link_text = null, $stripteaser = false) {
   181 	global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;
   181 	global $post, $more, $page, $pages, $multipage, $preview;
   182 
   182 
   183 	if ( null === $more_link_text )
   183 	if ( null === $more_link_text )
   184 		$more_link_text = __( '(more...)' );
   184 		$more_link_text = __( '(more...)' );
   185 
   185 
   186 	$output = '';
   186 	$output = '';
   187 	$hasTeaser = false;
   187 	$hasTeaser = false;
   188 
   188 
   189 	// If post password required and it doesn't match the cookie.
   189 	// If post password required and it doesn't match the cookie.
   190 	if ( post_password_required($post) ) {
   190 	if ( post_password_required($post) )
   191 		$output = get_the_password_form();
   191 		return get_the_password_form();
   192 		return $output;
       
   193 	}
       
   194 
   192 
   195 	if ( $page > count($pages) ) // if the requested page doesn't exist
   193 	if ( $page > count($pages) ) // if the requested page doesn't exist
   196 		$page = count($pages); // give them the highest numbered page that DOES exist
   194 		$page = count($pages); // give them the highest numbered page that DOES exist
   197 
   195 
   198 	$content = $pages[$page-1];
   196 	$content = $pages[$page-1];
   204 		$hasTeaser = true;
   202 		$hasTeaser = true;
   205 	} else {
   203 	} else {
   206 		$content = array($content);
   204 		$content = array($content);
   207 	}
   205 	}
   208 	if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
   206 	if ( (false !== strpos($post->post_content, '<!--noteaser-->') && ((!$multipage) || ($page==1))) )
   209 		$stripteaser = 1;
   207 		$stripteaser = true;
   210 	$teaser = $content[0];
   208 	$teaser = $content[0];
   211 	if ( ($more) && ($stripteaser) && ($hasTeaser) )
   209 	if ( $more && $stripteaser && $hasTeaser )
   212 		$teaser = '';
   210 		$teaser = '';
   213 	$output .= $teaser;
   211 	$output .= $teaser;
   214 	if ( count($content) > 1 ) {
   212 	if ( count($content) > 1 ) {
   215 		if ( $more ) {
   213 		if ( $more ) {
   216 			$output .= '<span id="more-' . $id . '"></span>' . $content[1];
   214 			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
   217 		} else {
   215 		} else {
   218 			if ( ! empty($more_link_text) )
   216 			if ( ! empty($more_link_text) )
   219 				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-$id\" class=\"more-link\">$more_link_text</a>", $more_link_text );
   217 				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );
   220 			$output = force_balance_tags($output);
   218 			$output = force_balance_tags($output);
   221 		}
   219 		}
   222 
   220 
   223 	}
   221 	}
   224 	if ( $preview ) // preview fix for javascript bug with foreign languages
   222 	if ( $preview ) // preview fix for javascript bug with foreign languages
   225 		$output =	preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output);
   223 		$output =	preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $output);
   226 
   224 
   227 	return $output;
   225 	return $output;
       
   226 }
       
   227 
       
   228 /**
       
   229  * Preview fix for javascript bug with foreign languages
       
   230  *
       
   231  * @since 3.1.0
       
   232  * @access private
       
   233  * @param array $match Match array from preg_replace_callback
       
   234  * @returns string
       
   235  */
       
   236 function _convert_urlencoded_to_entities( $match ) {
       
   237 	return '&#' . base_convert( $match[1], 16, 10 ) . ';';
   228 }
   238 }
   229 
   239 
   230 /**
   240 /**
   231  * Display the post excerpt.
   241  * Display the post excerpt.
   232  *
   242  *
   243  * @since 0.71
   253  * @since 0.71
   244  *
   254  *
   245  * @param mixed $deprecated Not used.
   255  * @param mixed $deprecated Not used.
   246  * @return string
   256  * @return string
   247  */
   257  */
   248 function get_the_excerpt($deprecated = '') {
   258 function get_the_excerpt( $deprecated = '' ) {
       
   259 	if ( !empty( $deprecated ) )
       
   260 		_deprecated_argument( __FUNCTION__, '2.3' );
       
   261 
   249 	global $post;
   262 	global $post;
   250 	$output = $post->post_excerpt;
   263 	$output = $post->post_excerpt;
   251 	if ( post_password_required($post) ) {
   264 	if ( post_password_required($post) ) {
   252 		$output = __('There is no excerpt because this is a protected post.');
   265 		$output = __('There is no excerpt because this is a protected post.');
   253 		return $output;
   266 		return $output;
   307 	if ( empty($post) )
   320 	if ( empty($post) )
   308 		return $classes;
   321 		return $classes;
   309 
   322 
   310 	$classes[] = 'post-' . $post->ID;
   323 	$classes[] = 'post-' . $post->ID;
   311 	$classes[] = $post->post_type;
   324 	$classes[] = $post->post_type;
       
   325 	$classes[] = 'type-' . $post->post_type;
       
   326 	$classes[] = 'status-' . $post->post_status;
       
   327 
       
   328 	// Post Format
       
   329 	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
       
   330 		$post_format = get_post_format( $post->ID );
       
   331 
       
   332 		if ( $post_format && !is_wp_error($post_format) )
       
   333 			$classes[] = 'format-' . sanitize_html_class( $post_format );
       
   334 		else
       
   335 			$classes[] = 'format-standard';
       
   336 	}
       
   337 
       
   338 	// post requires password
       
   339 	if ( post_password_required($post->ID) )
       
   340 		$classes[] = 'post-password-required';
   312 
   341 
   313 	// sticky for Sticky Posts
   342 	// sticky for Sticky Posts
   314 	if ( is_sticky($post->ID) && is_home())
   343 	if ( is_sticky($post->ID) && is_home() && !is_paged() )
   315 		$classes[] = 'sticky';
   344 		$classes[] = 'sticky';
   316 
   345 
   317 	// hentry for hAtom compliace
   346 	// hentry for hAtom compliance
   318 	$classes[] = 'hentry';
   347 	$classes[] = 'hentry';
   319 
   348 
   320 	// Categories
   349 	// Categories
   321 	foreach ( (array) get_the_category($post->ID) as $cat ) {
   350 	if ( is_object_in_taxonomy( $post->post_type, 'category' ) ) {
   322 		if ( empty($cat->slug ) )
   351 		foreach ( (array) get_the_category($post->ID) as $cat ) {
   323 			continue;
   352 			if ( empty($cat->slug ) )
   324 		$classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
   353 				continue;
       
   354 			$classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->term_id);
       
   355 		}
   325 	}
   356 	}
   326 
   357 
   327 	// Tags
   358 	// Tags
   328 	foreach ( (array) get_the_tags($post->ID) as $tag ) {
   359 	if ( is_object_in_taxonomy( $post->post_type, 'post_tag' ) ) {
   329 		if ( empty($tag->slug ) )
   360 		foreach ( (array) get_the_tags($post->ID) as $tag ) {
   330 			continue;
   361 			if ( empty($tag->slug ) )
   331 		$classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
   362 				continue;
       
   363 			$classes[] = 'tag-' . sanitize_html_class($tag->slug, $tag->term_id);
       
   364 		}
   332 	}
   365 	}
   333 
   366 
   334 	if ( !empty($class) ) {
   367 	if ( !empty($class) ) {
   335 		if ( !is_array( $class ) )
   368 		if ( !is_array( $class ) )
   336 			$class = preg_split('#\s+#', $class);
   369 			$class = preg_split('#\s+#', $class);
   337 		$classes = array_merge($classes, $class);
   370 		$classes = array_merge($classes, $class);
   338 	}
   371 	}
   339 
   372 
   340 	$classes = array_map('esc_attr', $classes);
   373 	$classes = array_map('esc_attr', $classes);
   341 
   374 
   342 	return apply_filters('post_class', $classes, $class, $post_id);
   375 	return apply_filters('post_class', $classes, $class, $post->ID);
   343 }
   376 }
   344 
   377 
   345 /**
   378 /**
   346  * Display the classes for the body element.
   379  * Display the classes for the body element.
   347  *
   380  *
   361  *
   394  *
   362  * @param string|array $class One or more classes to add to the class list.
   395  * @param string|array $class One or more classes to add to the class list.
   363  * @return array Array of classes.
   396  * @return array Array of classes.
   364  */
   397  */
   365 function get_body_class( $class = '' ) {
   398 function get_body_class( $class = '' ) {
   366 	global $wp_query, $wpdb, $current_user;
   399 	global $wp_query, $wpdb;
   367 
   400 
   368 	$classes = array();
   401 	$classes = array();
   369 
   402 
   370 	if ( 'rtl' == get_bloginfo('text_direction') )
   403 	if ( is_rtl() )
   371 		$classes[] = 'rtl';
   404 		$classes[] = 'rtl';
   372 
   405 
   373 	if ( is_front_page() )
   406 	if ( is_front_page() )
   374 		$classes[] = 'home';
   407 		$classes[] = 'home';
   375 	if ( is_home() )
   408 	if ( is_home() )
   376 		$classes[] = 'blog';
   409 		$classes[] = 'blog';
   377 	if ( is_archive() )
   410 	if ( is_archive() )
   378 		$classes[] = 'archive';
   411 		$classes[] = 'archive';
   379 	if ( is_date() )
   412 	if ( is_date() )
   380 		$classes[] = 'date';
   413 		$classes[] = 'date';
   381 	if ( is_search() )
   414 	if ( is_search() ) {
   382 		$classes[] = 'search';
   415 		$classes[] = 'search';
       
   416 		$classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
       
   417 	}
   383 	if ( is_paged() )
   418 	if ( is_paged() )
   384 		$classes[] = 'paged';
   419 		$classes[] = 'paged';
   385 	if ( is_attachment() )
   420 	if ( is_attachment() )
   386 		$classes[] = 'attachment';
   421 		$classes[] = 'attachment';
   387 	if ( is_404() )
   422 	if ( is_404() )
   388 		$classes[] = 'error404';
   423 		$classes[] = 'error404';
   389 
   424 
   390 	if ( is_single() ) {
   425 	if ( is_single() ) {
   391 		$wp_query->post = $wp_query->posts[0];
   426 		$post_id = $wp_query->get_queried_object_id();
   392 		setup_postdata($wp_query->post);
   427 		$post = $wp_query->get_queried_object();
   393 
   428 
   394 		$postID = $wp_query->post->ID;
   429 		$classes[] = 'single';
   395 		$classes[] = 'single postid-' . $postID;
   430 		$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
       
   431 		$classes[] = 'postid-' . $post_id;
       
   432 
       
   433 		// Post Format
       
   434 		if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
       
   435 			$post_format = get_post_format( $post->ID );
       
   436 
       
   437 			if ( $post_format && !is_wp_error($post_format) )
       
   438 				$classes[] = 'single-format-' . sanitize_html_class( $post_format );
       
   439 			else
       
   440 				$classes[] = 'single-format-standard';
       
   441 		}
   396 
   442 
   397 		if ( is_attachment() ) {
   443 		if ( is_attachment() ) {
   398 			$mime_type = get_post_mime_type();
   444 			$mime_type = get_post_mime_type($post_id);
   399 			$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
   445 			$mime_prefix = array( 'application/', 'image/', 'text/', 'audio/', 'video/', 'music/' );
   400 			$classes[] = 'attachmentid-' . $postID;
   446 			$classes[] = 'attachmentid-' . $post_id;
   401 			$classes[] = 'attachment-' . str_replace($mime_prefix, '', $mime_type);
   447 			$classes[] = 'attachment-' . str_replace( $mime_prefix, '', $mime_type );
   402 		}
   448 		}
   403 	} elseif ( is_archive() ) {
   449 	} elseif ( is_archive() ) {
   404 		if ( is_author() ) {
   450 		if ( is_post_type_archive() ) {
       
   451 			$classes[] = 'post-type-archive';
       
   452 			$classes[] = 'post-type-archive-' . sanitize_html_class( get_query_var( 'post_type' ) );
       
   453 		} else if ( is_author() ) {
   405 			$author = $wp_query->get_queried_object();
   454 			$author = $wp_query->get_queried_object();
   406 			$classes[] = 'author';
   455 			$classes[] = 'author';
   407 			$classes[] = 'author-' . sanitize_html_class($author->user_nicename , $author->ID);
   456 			$classes[] = 'author-' . sanitize_html_class( $author->user_nicename , $author->ID );
       
   457 			$classes[] = 'author-' . $author->ID;
   408 		} elseif ( is_category() ) {
   458 		} elseif ( is_category() ) {
   409 			$cat = $wp_query->get_queried_object();
   459 			$cat = $wp_query->get_queried_object();
   410 			$classes[] = 'category';
   460 			$classes[] = 'category';
   411 			$classes[] = 'category-' . sanitize_html_class($cat->slug, $cat->cat_ID);
   461 			$classes[] = 'category-' . sanitize_html_class( $cat->slug, $cat->term_id );
       
   462 			$classes[] = 'category-' . $cat->term_id;
   412 		} elseif ( is_tag() ) {
   463 		} elseif ( is_tag() ) {
   413 			$tags = $wp_query->get_queried_object();
   464 			$tags = $wp_query->get_queried_object();
   414 			$classes[] = 'tag';
   465 			$classes[] = 'tag';
   415 			$classes[] = 'tag-' . sanitize_html_class($tags->slug, $tags->term_id);
   466 			$classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
       
   467 			$classes[] = 'tag-' . $tags->term_id;
       
   468 		} elseif ( is_tax() ) {
       
   469 			$term = $wp_query->get_queried_object();
       
   470 			$classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
       
   471 			$classes[] = 'term-' . sanitize_html_class( $term->slug, $term->term_id );
       
   472 			$classes[] = 'term-' . $term->term_id;
   416 		}
   473 		}
   417 	} elseif ( is_page() ) {
   474 	} elseif ( is_page() ) {
   418 		$classes[] = 'page';
   475 		$classes[] = 'page';
   419 
   476 
   420 		$wp_query->post = $wp_query->posts[0];
   477 		$page_id = $wp_query->get_queried_object_id();
   421 		setup_postdata($wp_query->post);
   478 
   422 
   479 		$post = get_page($page_id);
   423 		$pageID = $wp_query->post->ID;
   480 
   424 
   481 		$classes[] = 'page-id-' . $page_id;
   425 		$classes[] = 'page-id-' . $pageID;
   482 
   426 
   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) ) )
   427 		if ( $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' LIMIT 1", $pageID) ) )
       
   428 			$classes[] = 'page-parent';
   484 			$classes[] = 'page-parent';
   429 
   485 
   430 		if ( $wp_query->post->post_parent ) {
   486 		if ( $post->post_parent ) {
   431 			$classes[] = 'page-child';
   487 			$classes[] = 'page-child';
   432 			$classes[] = 'parent-pageid-' . $wp_query->post->post_parent;
   488 			$classes[] = 'parent-pageid-' . $post->post_parent;
   433 		}
   489 		}
   434 		if ( is_page_template() ) {
   490 		if ( is_page_template() ) {
   435 			$classes[] = 'page-template';
   491 			$classes[] = 'page-template';
   436 			$classes[] = 'page-template-' . str_replace( '.php', '-php', get_post_meta( $pageID, '_wp_page_template', true ) );
   492 			$classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', get_page_template_slug( $page_id ) ) );
       
   493 		} else {
       
   494 			$classes[] = 'page-template-default';
   437 		}
   495 		}
   438 	} elseif ( is_search() ) {
       
   439 		if ( !empty($wp_query->posts) )
       
   440 			$classes[] = 'search-results';
       
   441 		else
       
   442 			$classes[] = 'search-no-results';
       
   443 	}
   496 	}
   444 
   497 
   445 	if ( is_user_logged_in() )
   498 	if ( is_user_logged_in() )
   446 		$classes[] = 'logged-in';
   499 		$classes[] = 'logged-in';
   447 
   500 
   448 	$page = $wp_query->get('page');
   501 	if ( is_admin_bar_showing() )
       
   502 		$classes[] = 'admin-bar';
       
   503 
       
   504 	if ( get_theme_mod( 'background_color' ) || get_background_image() )
       
   505 		$classes[] = 'custom-background';
       
   506 
       
   507 	$page = $wp_query->get( 'page' );
   449 
   508 
   450 	if ( !$page || $page < 2)
   509 	if ( !$page || $page < 2)
   451 		$page = $wp_query->get('paged');
   510 		$page = $wp_query->get( 'paged' );
   452 
   511 
   453 	if ( $page && $page > 1 ) {
   512 	if ( $page && $page > 1 ) {
   454 		$classes[] = 'paged-' . $page;
   513 		$classes[] = 'paged-' . $page;
   455 
   514 
   456 		if ( is_single() )
   515 		if ( is_single() )
   465 			$classes[] = 'date-paged-' . $page;
   524 			$classes[] = 'date-paged-' . $page;
   466 		elseif ( is_author() )
   525 		elseif ( is_author() )
   467 			$classes[] = 'author-paged-' . $page;
   526 			$classes[] = 'author-paged-' . $page;
   468 		elseif ( is_search() )
   527 		elseif ( is_search() )
   469 			$classes[] = 'search-paged-' . $page;
   528 			$classes[] = 'search-paged-' . $page;
   470 	}
   529 		elseif ( is_post_type_archive() )
   471 
   530 			$classes[] = 'post-type-paged-' . $page;
   472 	if ( !empty($class) ) {
   531 	}
       
   532 
       
   533 	if ( ! empty( $class ) ) {
   473 		if ( !is_array( $class ) )
   534 		if ( !is_array( $class ) )
   474 			$class = preg_split('#\s+#', $class);
   535 			$class = preg_split( '#\s+#', $class );
   475 		$classes = array_merge($classes, $class);
   536 		$classes = array_merge( $classes, $class );
   476 	}
   537 	} else {
   477 
   538 		// Ensure that we always coerce class to being an array.
   478 	$classes = array_map('esc_attr', $classes);
   539 		$class = array();
   479 
   540 	}
   480 	return apply_filters('body_class', $classes, $class);
   541 
       
   542 	$classes = array_map( 'esc_attr', $classes );
       
   543 
       
   544 	return apply_filters( 'body_class', $classes, $class );
   481 }
   545 }
   482 
   546 
   483 /**
   547 /**
   484  * Whether post requires password and correct password has been provided.
   548  * Whether post requires password and correct password has been provided.
   485  *
   549  *
   486  * @since 2.7.0
   550  * @since 2.7.0
   487  *
   551  *
   488  * @param int|object $post An optional post.  Global $post used if not provided.
   552  * @param int|object $post An optional post. Global $post used if not provided.
   489  * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
   553  * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
   490  */
   554  */
   491 function post_password_required( $post = null ) {
   555 function post_password_required( $post = null ) {
       
   556 	global $wp_hasher;
       
   557 
   492 	$post = get_post($post);
   558 	$post = get_post($post);
   493 
   559 
   494 	if ( empty($post->post_password) )
   560 	if ( empty( $post->post_password ) )
   495 		return false;
   561 		return false;
   496 
   562 
   497 	if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) )
   563 	if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
   498 		return true;
   564 		return true;
   499 
   565 
   500 	if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
   566 	if ( empty( $wp_hasher ) ) {
   501 		return true;
   567 		require_once( ABSPATH . 'wp-includes/class-phpass.php');
   502 
   568 		// By default, use the portable hash from phpass
   503 	return false;
   569 		$wp_hasher = new PasswordHash(8, true);
       
   570 	}
       
   571 
       
   572 	$hash = stripslashes( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
       
   573 
       
   574 	return ! $wp_hasher->CheckPassword( $post->post_password, $hash );
   504 }
   575 }
   505 
   576 
   506 /**
   577 /**
   507  * Display "sticky" CSS class, if a post is sticky.
   578  * Display "sticky" CSS class, if a post is sticky.
   508  *
   579  *
   543  * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to
   614  * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to
   544  *      each bookmarks.
   615  *      each bookmarks.
   545  * 'after' - Default is '</p>' (string). The html or text to append to each
   616  * 'after' - Default is '</p>' (string). The html or text to append to each
   546  *      bookmarks.
   617  *      bookmarks.
   547  * 'link_before' - Default is '' (string). The html or text to prepend to each
   618  * 'link_before' - Default is '' (string). The html or text to prepend to each
   548  *      Pages link inside the <a> tag.
   619  *      Pages link inside the <a> tag. Also prepended to the current item, which
       
   620  *      is not linked.
   549  * 'link_after' - Default is '' (string). The html or text to append to each
   621  * 'link_after' - Default is '' (string). The html or text to append to each
   550  *      Pages link inside the <a> tag.
   622  *      Pages link inside the <a> tag. Also appended to the current item, which
       
   623  *      is not linked.
   551  *
   624  *
   552  * @since 1.2.0
   625  * @since 1.2.0
   553  * @access private
   626  * @access private
   554  *
   627  *
   555  * @param string|array $args Optional. Overwrite the defaults.
   628  * @param string|array $args Optional. Overwrite the defaults.
   563 		'previouspagelink' => __('Previous page'), 'pagelink' => '%',
   636 		'previouspagelink' => __('Previous page'), 'pagelink' => '%',
   564 		'echo' => 1
   637 		'echo' => 1
   565 	);
   638 	);
   566 
   639 
   567 	$r = wp_parse_args( $args, $defaults );
   640 	$r = wp_parse_args( $args, $defaults );
       
   641 	$r = apply_filters( 'wp_link_pages_args', $r );
   568 	extract( $r, EXTR_SKIP );
   642 	extract( $r, EXTR_SKIP );
   569 
   643 
   570 	global $post, $page, $numpages, $multipage, $more, $pagenow;
   644 	global $page, $numpages, $multipage, $more, $pagenow;
   571 
   645 
   572 	$output = '';
   646 	$output = '';
   573 	if ( $multipage ) {
   647 	if ( $multipage ) {
   574 		if ( 'number' == $next_or_number ) {
   648 		if ( 'number' == $next_or_number ) {
   575 			$output .= $before;
   649 			$output .= $before;
   576 			for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
   650 			for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
   577 				$j = str_replace('%',"$i",$pagelink);
   651 				$j = str_replace('%',$i,$pagelink);
   578 				$output .= ' ';
   652 				$output .= ' ';
   579 				if ( ($i != $page) || ((!$more) && ($page==1)) ) {
   653 				if ( ($i != $page) || ((!$more) && ($page==1)) ) {
   580 					if ( 1 == $i ) {
   654 					$output .= _wp_link_page($i);
   581 						$output .= '<a href="' . get_permalink() . '">';
       
   582 					} else {
       
   583 						if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
       
   584 							$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">';
       
   585 						else
       
   586 							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
       
   587 					}
       
   588 
       
   589 				}
   655 				}
   590 				$output .= $link_before;
   656 				$output .= $link_before . $j . $link_after;
   591 				$output .= $j;
       
   592 				$output .= $link_after;
       
   593 				if ( ($i != $page) || ((!$more) && ($page==1)) )
   657 				if ( ($i != $page) || ((!$more) && ($page==1)) )
   594 					$output .= '</a>';
   658 					$output .= '</a>';
   595 			}
   659 			}
   596 			$output .= $after;
   660 			$output .= $after;
   597 		} else {
   661 		} else {
   598 			if ( $more ) {
   662 			if ( $more ) {
   599 				$output .= $before;
   663 				$output .= $before;
   600 				$i = $page - 1;
   664 				$i = $page - 1;
   601 				if ( $i && $more ) {
   665 				if ( $i && $more ) {
   602 					if ( 1 == $i ) {
   666 					$output .= _wp_link_page($i);
   603 						$output .= '<a href="' . get_permalink() . '">' . $link_before. $previouspagelink . $link_after . '</a>';
   667 					$output .= $link_before. $previouspagelink . $link_after . '</a>';
   604 					} else {
       
   605 						if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
       
   606 							$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>';
       
   607 						else
       
   608 							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
       
   609 					}
       
   610 				}
   668 				}
   611 				$i = $page + 1;
   669 				$i = $page + 1;
   612 				if ( $i <= $numpages && $more ) {
   670 				if ( $i <= $numpages && $more ) {
   613 					if ( 1 == $i ) {
   671 					$output .= _wp_link_page($i);
   614 						$output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>';
   672 					$output .= $link_before. $nextpagelink . $link_after . '</a>';
   615 					} else {
       
   616 						if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
       
   617 							$output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>';
       
   618 						else
       
   619 							$output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
       
   620 					}
       
   621 				}
   673 				}
   622 				$output .= $after;
   674 				$output .= $after;
   623 			}
   675 			}
   624 		}
   676 		}
   625 	}
   677 	}
   628 		echo $output;
   680 		echo $output;
   629 
   681 
   630 	return $output;
   682 	return $output;
   631 }
   683 }
   632 
   684 
       
   685 /**
       
   686  * Helper function for wp_link_pages().
       
   687  *
       
   688  * @since 3.1.0
       
   689  * @access private
       
   690  *
       
   691  * @param int $i Page number.
       
   692  * @return string Link.
       
   693  */
       
   694 function _wp_link_page( $i ) {
       
   695 	global $post, $wp_rewrite;
       
   696 
       
   697 	if ( 1 == $i ) {
       
   698 		$url = get_permalink();
       
   699 	} else {
       
   700 		if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
       
   701 			$url = add_query_arg( 'page', $i, get_permalink() );
       
   702 		elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
       
   703 			$url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
       
   704 		else
       
   705 			$url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
       
   706 	}
       
   707 
       
   708 	return '<a href="' . esc_url( $url ) . '">';
       
   709 }
   633 
   710 
   634 //
   711 //
   635 // Post-meta: Custom per-post fields.
   712 // Post-meta: Custom per-post fields.
   636 //
   713 //
   637 
   714 
   639  * Retrieve post custom meta data field.
   716  * Retrieve post custom meta data field.
   640  *
   717  *
   641  * @since 1.5.0
   718  * @since 1.5.0
   642  *
   719  *
   643  * @param string $key Meta data key name.
   720  * @param string $key Meta data key name.
   644  * @return string|array Array of values or single value, if only one element exists.
   721  * @return bool|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
   645  */
   722  */
   646 function post_custom( $key = '' ) {
   723 function post_custom( $key = '' ) {
   647 	$custom = get_post_custom();
   724 	$custom = get_post_custom();
   648 
   725 
   649 	if ( 1 == count($custom[$key]) )
   726 	if ( !isset( $custom[$key] ) )
       
   727 		return false;
       
   728 	elseif ( 1 == count($custom[$key]) )
   650 		return $custom[$key][0];
   729 		return $custom[$key][0];
   651 	else
   730 	else
   652 		return $custom[$key];
   731 		return $custom[$key];
   653 }
   732 }
   654 
   733 
   662 function the_meta() {
   741 function the_meta() {
   663 	if ( $keys = get_post_custom_keys() ) {
   742 	if ( $keys = get_post_custom_keys() ) {
   664 		echo "<ul class='post-meta'>\n";
   743 		echo "<ul class='post-meta'>\n";
   665 		foreach ( (array) $keys as $key ) {
   744 		foreach ( (array) $keys as $key ) {
   666 			$keyt = trim($key);
   745 			$keyt = trim($key);
   667 			if ( '_' == $keyt{0} )
   746 			if ( is_protected_meta( $keyt, 'post' ) )
   668 				continue;
   747 				continue;
   669 			$values = array_map('trim', get_post_custom_values($key));
   748 			$values = array_map('trim', get_post_custom_values($key));
   670 			$value = implode($values,', ');
   749 			$value = implode($values,', ');
   671 			echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
   750 			echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value);
   672 		}
   751 		}
   688  */
   767  */
   689 function wp_dropdown_pages($args = '') {
   768 function wp_dropdown_pages($args = '') {
   690 	$defaults = array(
   769 	$defaults = array(
   691 		'depth' => 0, 'child_of' => 0,
   770 		'depth' => 0, 'child_of' => 0,
   692 		'selected' => 0, 'echo' => 1,
   771 		'selected' => 0, 'echo' => 1,
   693 		'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',
   772 		'name' => 'page_id', 'id' => '',
       
   773 		'show_option_none' => '', 'show_option_no_change' => '',
   694 		'option_none_value' => ''
   774 		'option_none_value' => ''
   695 	);
   775 	);
   696 
   776 
   697 	$r = wp_parse_args( $args, $defaults );
   777 	$r = wp_parse_args( $args, $defaults );
   698 	extract( $r, EXTR_SKIP );
   778 	extract( $r, EXTR_SKIP );
   699 
   779 
   700 	$pages = get_pages($r);
   780 	$pages = get_pages($r);
   701 	$output = '';
   781 	$output = '';
   702 	$name = esc_attr($name);
   782 	// Back-compat with old system where both id and name were based on $name argument
       
   783 	if ( empty($id) )
       
   784 		$id = $name;
   703 
   785 
   704 	if ( ! empty($pages) ) {
   786 	if ( ! empty($pages) ) {
   705 		$output = "<select name=\"$name\" id=\"$name\">\n";
   787 		$output = "<select name='" . esc_attr( $name ) . "' id='" . esc_attr( $id ) . "'>\n";
   706 		if ( $show_option_no_change )
   788 		if ( $show_option_no_change )
   707 			$output .= "\t<option value=\"-1\">$show_option_no_change</option>";
   789 			$output .= "\t<option value=\"-1\">$show_option_no_change</option>";
   708 		if ( $show_option_none )
   790 		if ( $show_option_none )
   709 			$output .= "\t<option value=\"" . esc_attr($option_none_value) . "\">$show_option_none</option>\n";
   791 			$output .= "\t<option value=\"" . esc_attr($option_none_value) . "\">$show_option_none</option>\n";
   710 		$output .= walk_page_dropdown_tree($pages, $depth, $r);
   792 		$output .= walk_page_dropdown_tree($pages, $depth, $r);
   808 	$menu = '';
   890 	$menu = '';
   809 
   891 
   810 	$list_args = $args;
   892 	$list_args = $args;
   811 
   893 
   812 	// Show Home in the menu
   894 	// Show Home in the menu
   813 	if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
   895 	if ( ! empty($args['show_home']) ) {
   814 		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
   896 		if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
   815 			$text = __('Home');
   897 			$text = __('Home');
   816 		else
   898 		else
   817 			$text = $args['show_home'];
   899 			$text = $args['show_home'];
   818 		$class = '';
   900 		$class = '';
   819 		if ( is_front_page() && !is_paged() )
   901 		if ( is_front_page() && !is_paged() )
   820 			$class = 'class="current_page_item"';
   902 			$class = 'class="current_page_item"';
   821 		$menu .= '<li ' . $class . '><a href="' . get_option('home') . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
   903 		$menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '" title="' . esc_attr($text) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
   822 		// If the front page is a page, add it to the exclude list
   904 		// If the front page is a page, add it to the exclude list
   823 		if (get_option('show_on_front') == 'page') {
   905 		if (get_option('show_on_front') == 'page') {
   824 			if ( !empty( $list_args['exclude'] ) ) {
   906 			if ( !empty( $list_args['exclude'] ) ) {
   825 				$list_args['exclude'] .= ',';
   907 				$list_args['exclude'] .= ',';
   826 			} else {
   908 			} else {
   881 		$walker = $args[2]['walker'];
   963 		$walker = $args[2]['walker'];
   882 
   964 
   883 	return call_user_func_array(array(&$walker, 'walk'), $args);
   965 	return call_user_func_array(array(&$walker, 'walk'), $args);
   884 }
   966 }
   885 
   967 
       
   968 /**
       
   969  * Create HTML list of pages.
       
   970  *
       
   971  * @package WordPress
       
   972  * @since 2.1.0
       
   973  * @uses Walker
       
   974  */
       
   975 class Walker_Page extends Walker {
       
   976 	/**
       
   977 	 * @see Walker::$tree_type
       
   978 	 * @since 2.1.0
       
   979 	 * @var string
       
   980 	 */
       
   981 	var $tree_type = 'page';
       
   982 
       
   983 	/**
       
   984 	 * @see Walker::$db_fields
       
   985 	 * @since 2.1.0
       
   986 	 * @todo Decouple this.
       
   987 	 * @var array
       
   988 	 */
       
   989 	var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
       
   990 
       
   991 	/**
       
   992 	 * @see Walker::start_lvl()
       
   993 	 * @since 2.1.0
       
   994 	 *
       
   995 	 * @param string $output Passed by reference. Used to append additional content.
       
   996 	 * @param int $depth Depth of page. Used for padding.
       
   997 	 */
       
   998 	function start_lvl( &$output, $depth = 0, $args = array() ) {
       
   999 		$indent = str_repeat("\t", $depth);
       
  1000 		$output .= "\n$indent<ul class='children'>\n";
       
  1001 	}
       
  1002 
       
  1003 	/**
       
  1004 	 * @see Walker::end_lvl()
       
  1005 	 * @since 2.1.0
       
  1006 	 *
       
  1007 	 * @param string $output Passed by reference. Used to append additional content.
       
  1008 	 * @param int $depth Depth of page. Used for padding.
       
  1009 	 */
       
  1010 	function end_lvl( &$output, $depth = 0, $args = array() ) {
       
  1011 		$indent = str_repeat("\t", $depth);
       
  1012 		$output .= "$indent</ul>\n";
       
  1013 	}
       
  1014 
       
  1015 	/**
       
  1016 	 * @see Walker::start_el()
       
  1017 	 * @since 2.1.0
       
  1018 	 *
       
  1019 	 * @param string $output Passed by reference. Used to append additional content.
       
  1020 	 * @param object $page Page data object.
       
  1021 	 * @param int $depth Depth of page. Used for padding.
       
  1022 	 * @param int $current_page Page ID.
       
  1023 	 * @param array $args
       
  1024 	 */
       
  1025 	function start_el( &$output, $page, $depth, $args, $current_page = 0 ) {
       
  1026 		if ( $depth )
       
  1027 			$indent = str_repeat("\t", $depth);
       
  1028 		else
       
  1029 			$indent = '';
       
  1030 
       
  1031 		extract($args, EXTR_SKIP);
       
  1032 		$css_class = array('page_item', 'page-item-'.$page->ID);
       
  1033 		if ( !empty($current_page) ) {
       
  1034 			$_current_page = get_page( $current_page );
       
  1035 			_get_post_ancestors($_current_page);
       
  1036 			if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
       
  1037 				$css_class[] = 'current_page_ancestor';
       
  1038 			if ( $page->ID == $current_page )
       
  1039 				$css_class[] = 'current_page_item';
       
  1040 			elseif ( $_current_page && $page->ID == $_current_page->post_parent )
       
  1041 				$css_class[] = 'current_page_parent';
       
  1042 		} elseif ( $page->ID == get_option('page_for_posts') ) {
       
  1043 			$css_class[] = 'current_page_parent';
       
  1044 		}
       
  1045 
       
  1046 		$css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
       
  1047 
       
  1048 		$output .= $indent . '<li class="' . $css_class . '"><a href="' . get_permalink($page->ID) . '">' . $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>';
       
  1049 
       
  1050 		if ( !empty($show_date) ) {
       
  1051 			if ( 'modified' == $show_date )
       
  1052 				$time = $page->post_modified;
       
  1053 			else
       
  1054 				$time = $page->post_date;
       
  1055 
       
  1056 			$output .= " " . mysql2date($date_format, $time);
       
  1057 		}
       
  1058 	}
       
  1059 
       
  1060 	/**
       
  1061 	 * @see Walker::end_el()
       
  1062 	 * @since 2.1.0
       
  1063 	 *
       
  1064 	 * @param string $output Passed by reference. Used to append additional content.
       
  1065 	 * @param object $page Page data object. Not used.
       
  1066 	 * @param int $depth Depth of page. Not Used.
       
  1067 	 */
       
  1068 	function end_el( &$output, $page, $depth = 0, $args = array() ) {
       
  1069 		$output .= "</li>\n";
       
  1070 	}
       
  1071 
       
  1072 }
       
  1073 
       
  1074 /**
       
  1075  * Create HTML dropdown list of pages.
       
  1076  *
       
  1077  * @package WordPress
       
  1078  * @since 2.1.0
       
  1079  * @uses Walker
       
  1080  */
       
  1081 class Walker_PageDropdown extends Walker {
       
  1082 	/**
       
  1083 	 * @see Walker::$tree_type
       
  1084 	 * @since 2.1.0
       
  1085 	 * @var string
       
  1086 	 */
       
  1087 	var $tree_type = 'page';
       
  1088 
       
  1089 	/**
       
  1090 	 * @see Walker::$db_fields
       
  1091 	 * @since 2.1.0
       
  1092 	 * @todo Decouple this
       
  1093 	 * @var array
       
  1094 	 */
       
  1095 	var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
       
  1096 
       
  1097 	/**
       
  1098 	 * @see Walker::start_el()
       
  1099 	 * @since 2.1.0
       
  1100 	 *
       
  1101 	 * @param string $output Passed by reference. Used to append additional content.
       
  1102 	 * @param object $page Page data object.
       
  1103 	 * @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.
       
  1105 	 */
       
  1106 	function start_el(&$output, $page, $depth, $args, $id = 0) {
       
  1107 		$pad = str_repeat('&nbsp;', $depth * 3);
       
  1108 
       
  1109 		$output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
       
  1110 		if ( $page->ID == $args['selected'] )
       
  1111 			$output .= ' selected="selected"';
       
  1112 		$output .= '>';
       
  1113 		$title = apply_filters( 'list_pages', $page->post_title, $page );
       
  1114 		$output .= $pad . esc_html( $title );
       
  1115 		$output .= "</option>\n";
       
  1116 	}
       
  1117 }
       
  1118 
   886 //
  1119 //
   887 // Attachments
  1120 // Attachments
   888 //
  1121 //
   889 
  1122 
   890 /**
  1123 /**
   895  * @param int $id Optional. Post ID.
  1128  * @param int $id Optional. Post ID.
   896  * @param bool $fullsize Optional, default is false. Whether to use full size.
  1129  * @param bool $fullsize Optional, default is false. Whether to use full size.
   897  * @param bool $deprecated Deprecated. Not used.
  1130  * @param bool $deprecated Deprecated. Not used.
   898  * @param bool $permalink Optional, default is false. Whether to include permalink.
  1131  * @param bool $permalink Optional, default is false. Whether to include permalink.
   899  */
  1132  */
   900 function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
  1133 function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
       
  1134 	if ( !empty( $deprecated ) )
       
  1135 		_deprecated_argument( __FUNCTION__, '2.5' );
       
  1136 
   901 	if ( $fullsize )
  1137 	if ( $fullsize )
   902 		echo wp_get_attachment_link($id, 'full', $permalink);
  1138 		echo wp_get_attachment_link($id, 'full', $permalink);
   903 	else
  1139 	else
   904 		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
  1140 		echo wp_get_attachment_link($id, 'thumbnail', $permalink);
   905 }
  1141 }
   915  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
  1151  * @param bool $permalink Optional, default is false. Whether to add permalink to image.
   916  * @param bool $icon Optional, default is false. Whether to include icon.
  1152  * @param bool $icon Optional, default is false. Whether to include icon.
   917  * @param string $text Optional, default is false. If string, then will be link text.
  1153  * @param string $text Optional, default is false. If string, then will be link text.
   918  * @return string HTML content.
  1154  * @return string HTML content.
   919  */
  1155  */
   920 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false) {
  1156 function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
   921 	$id = intval($id);
  1157 	$id = intval( $id );
   922 	$_post = & get_post( $id );
  1158 	$_post = & get_post( $id );
   923 
  1159 
   924 	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
  1160 	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
   925 		return __('Missing Attachment');
  1161 		return __( 'Missing Attachment' );
   926 
  1162 
   927 	if ( $permalink )
  1163 	if ( $permalink )
   928 		$url = get_attachment_link($_post->ID);
  1164 		$url = get_attachment_link( $_post->ID );
   929 
  1165 
   930 	$post_title = esc_attr($_post->post_title);
  1166 	$post_title = esc_attr( $_post->post_title );
   931 
  1167 
   932 	if ( $text ) {
  1168 	if ( $text )
   933 		$link_text = esc_attr($text);
  1169 		$link_text = $text;
   934 	} elseif ( ( is_int($size) && $size != 0 ) or ( is_string($size) && $size != 'none' ) or $size != false ) {
  1170 	elseif ( $size && 'none' != $size )
   935 		$link_text = wp_get_attachment_image($id, $size, $icon);
  1171 		$link_text = wp_get_attachment_image( $id, $size, $icon );
   936 	}
  1172 	else
   937 
  1173 		$link_text = '';
   938 	if( trim($link_text) == '' )
  1174 
       
  1175 	if ( trim( $link_text ) == '' )
   939 		$link_text = $_post->post_title;
  1176 		$link_text = $_post->post_title;
   940 
  1177 
   941 	return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
  1178 	return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
   942 }
       
   943 
       
   944 /**
       
   945  * Retrieve HTML content of attachment image with link.
       
   946  *
       
   947  * @since 2.0.0
       
   948  * @deprecated Use {@link wp_get_attachment_link()}
       
   949  * @see wp_get_attachment_link() Use instead.
       
   950  *
       
   951  * @param int $id Optional. Post ID.
       
   952  * @param bool $fullsize Optional, default is false. Whether to use full size image.
       
   953  * @param array $max_dims Optional. Max image dimensions.
       
   954  * @param bool $permalink Optional, default is false. Whether to include permalink to image.
       
   955  * @return string
       
   956  */
       
   957 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
       
   958 	$id = (int) $id;
       
   959 	$_post = & get_post($id);
       
   960 
       
   961 	if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
       
   962 		return __('Missing Attachment');
       
   963 
       
   964 	if ( $permalink )
       
   965 		$url = get_attachment_link($_post->ID);
       
   966 
       
   967 	$post_title = esc_attr($_post->post_title);
       
   968 
       
   969 	$innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
       
   970 	return "<a href='$url' title='$post_title'>$innerHTML</a>";
       
   971 }
       
   972 
       
   973 /**
       
   974  * Retrieve icon URL and Path.
       
   975  *
       
   976  * @since 2.1.0
       
   977  * @deprecated Use {@link wp_get_attachment_image_src()}
       
   978  * @see wp_get_attachment_image_src() Use instead.
       
   979  *
       
   980  * @param int $id Optional. Post ID.
       
   981  * @param bool $fullsize Optional, default to false. Whether to have full image.
       
   982  * @return array Icon URL and full path to file, respectively.
       
   983  */
       
   984 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
       
   985 	$id = (int) $id;
       
   986 	if ( !$post = & get_post($id) )
       
   987 		return false;
       
   988 
       
   989 	$file = get_attached_file( $post->ID );
       
   990 
       
   991 	if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
       
   992 		// We have a thumbnail desired, specified and existing
       
   993 
       
   994 		$src_file = basename($src);
       
   995 		$class = 'attachmentthumb';
       
   996 	} elseif ( wp_attachment_is_image( $post->ID ) ) {
       
   997 		// We have an image without a thumbnail
       
   998 
       
   999 		$src = wp_get_attachment_url( $post->ID );
       
  1000 		$src_file = & $file;
       
  1001 		$class = 'attachmentimage';
       
  1002 	} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
       
  1003 		// No thumb, no image. We'll look for a mime-related icon instead.
       
  1004 
       
  1005 		$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
       
  1006 		$src_file = $icon_dir . '/' . basename($src);
       
  1007 	}
       
  1008 
       
  1009 	if ( !isset($src) || !$src )
       
  1010 		return false;
       
  1011 
       
  1012 	return array($src, $src_file);
       
  1013 }
       
  1014 
       
  1015 /**
       
  1016  * Retrieve HTML content of icon attachment image element.
       
  1017  *
       
  1018  * @since 2.0.0
       
  1019  * @deprecated Use {@link wp_get_attachment_image()}
       
  1020  * @see wp_get_attachment_image() Use instead of.
       
  1021  *
       
  1022  * @param int $id Optional. Post ID.
       
  1023  * @param bool $fullsize Optional, default to false. Whether to have full size image.
       
  1024  * @param array $max_dims Optional. Dimensions of image.
       
  1025  * @return string HTML content.
       
  1026  */
       
  1027 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
       
  1028 	$id = (int) $id;
       
  1029 	if ( !$post = & get_post($id) )
       
  1030 		return false;
       
  1031 
       
  1032 	if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
       
  1033 		return false;
       
  1034 
       
  1035 	list($src, $src_file) = $src;
       
  1036 
       
  1037 	// Do we need to constrain the image?
       
  1038 	if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
       
  1039 
       
  1040 		$imagesize = getimagesize($src_file);
       
  1041 
       
  1042 		if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
       
  1043 			$actual_aspect = $imagesize[0] / $imagesize[1];
       
  1044 			$desired_aspect = $max_dims[0] / $max_dims[1];
       
  1045 
       
  1046 			if ( $actual_aspect >= $desired_aspect ) {
       
  1047 				$height = $actual_aspect * $max_dims[0];
       
  1048 				$constraint = "width='{$max_dims[0]}' ";
       
  1049 				$post->iconsize = array($max_dims[0], $height);
       
  1050 			} else {
       
  1051 				$width = $max_dims[1] / $actual_aspect;
       
  1052 				$constraint = "height='{$max_dims[1]}' ";
       
  1053 				$post->iconsize = array($width, $max_dims[1]);
       
  1054 			}
       
  1055 		} else {
       
  1056 			$post->iconsize = array($imagesize[0], $imagesize[1]);
       
  1057 			$constraint = '';
       
  1058 		}
       
  1059 	} else {
       
  1060 		$constraint = '';
       
  1061 	}
       
  1062 
       
  1063 	$post_title = esc_attr($post->post_title);
       
  1064 
       
  1065 	$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
       
  1066 
       
  1067 	return apply_filters( 'attachment_icon', $icon, $post->ID );
       
  1068 }
       
  1069 
       
  1070 /**
       
  1071  * Retrieve HTML content of image element.
       
  1072  *
       
  1073  * @since 2.0.0
       
  1074  * @deprecated Use {@link wp_get_attachment_image()}
       
  1075  * @see wp_get_attachment_image() Use instead.
       
  1076  *
       
  1077  * @param int $id Optional. Post ID.
       
  1078  * @param bool $fullsize Optional, default to false. Whether to have full size image.
       
  1079  * @param array $max_dims Optional. Dimensions of image.
       
  1080  * @return string
       
  1081  */
       
  1082 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
       
  1083 	$id = (int) $id;
       
  1084 	if ( !$post = & get_post($id) )
       
  1085 		return false;
       
  1086 
       
  1087 	if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
       
  1088 		return $innerHTML;
       
  1089 
       
  1090 
       
  1091 	$innerHTML = esc_attr($post->post_title);
       
  1092 
       
  1093 	return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
       
  1094 }
  1179 }
  1095 
  1180 
  1096 /**
  1181 /**
  1097  * Wrap attachment in <<p>> element before content.
  1182  * Wrap attachment in <<p>> element before content.
  1098  *
  1183  *
  1129  *
  1214  *
  1130  * @return string HTML content for password form for password protected post.
  1215  * @return string HTML content for password form for password protected post.
  1131  */
  1216  */
  1132 function get_the_password_form() {
  1217 function get_the_password_form() {
  1133 	global $post;
  1218 	global $post;
  1134 	$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
  1219 	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
  1135 	$output = '<form action="' . get_option('siteurl') . '/wp-pass.php" method="post">
  1220 	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post">
  1136 	<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
  1221 	<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
  1137 	<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>
  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>
  1138 	</form>
  1223 </form>
  1139 	';
  1224 	';
  1140 	return apply_filters('the_password_form', $output);
  1225 	return apply_filters('the_password_form', $output);
  1141 }
  1226 }
  1142 
  1227 
  1143 /**
  1228 /**
  1144  * Whether currently in a page template.
  1229  * Whether currently in a page template.
  1145  *
  1230  *
  1146  * This template tag allows you to determine whether or not you are in a page
  1231  * This template tag allows you to determine if you are in a page template.
  1147  * template. You can optional provide a template name and then the check will be
  1232  * You can optionally provide a template name and then the check will be
  1148  * specific to that template.
  1233  * specific to that template.
  1149  *
  1234  *
  1150  * @since 2.5.0
  1235  * @since 2.5.0
  1151  * @uses $wp_query
  1236  * @uses $wp_query
  1152  *
  1237  *
  1153  * @param string $template The specific template name if specific matching is required.
  1238  * @param string $template The specific template name if specific matching is required.
  1154  * @return bool False on failure, true if success.
  1239  * @return bool False on failure, true if success.
  1155  */
  1240  */
  1156 function is_page_template($template = '') {
  1241 function is_page_template( $template = '' ) {
  1157 	if (!is_page()) {
  1242 	if ( ! is_page() )
  1158 		return false;
  1243 		return false;
  1159 	}
  1244 
  1160 
  1245 	$page_template = get_page_template_slug( get_queried_object_id() );
  1161 	global $wp_query;
  1246 
  1162 
  1247 	if ( empty( $template ) )
  1163 	$page = $wp_query->get_queried_object();
  1248 		return (bool) $page_template;
  1164 	$custom_fields = get_post_custom_values('_wp_page_template',$page->ID);
  1249 
  1165 	$page_template = $custom_fields[0];
  1250 	if ( $template == $page_template )
  1166 
       
  1167 	// We have no argument passed so just see if a page_template has been specified
       
  1168 	if ( empty( $template ) ) {
       
  1169 		if (!empty( $page_template ) ) {
       
  1170 			return true;
       
  1171 		}
       
  1172 	} elseif ( $template == $page_template) {
       
  1173 		return true;
  1251 		return true;
  1174 	}
  1252 
       
  1253 	if ( 'default' == $template && ! $page_template )
       
  1254 		return true;
  1175 
  1255 
  1176 	return false;
  1256 	return false;
       
  1257 }
       
  1258 
       
  1259 /**
       
  1260  * Get the specific template name for a page.
       
  1261  *
       
  1262  * @since 3.4.0
       
  1263  *
       
  1264  * @param int $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
       
  1266  * 	is in use. Returns false if the post is not a page.
       
  1267  */
       
  1268 function get_page_template_slug( $post_id = null ) {
       
  1269 	$post = get_post( $post_id );
       
  1270 	if ( 'page' != $post->post_type )
       
  1271 		return false;
       
  1272 	$template = get_post_meta( $post->ID, '_wp_page_template', true );
       
  1273 	if ( ! $template || 'default' == $template )
       
  1274 		return '';
       
  1275 	return $template;
  1177 }
  1276 }
  1178 
  1277 
  1179 /**
  1278 /**
  1180  * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
  1279  * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
  1181  *
  1280  *
  1201 	/* translators: 1: date */
  1300 	/* translators: 1: date */
  1202 	$autosavef = __( '%1$s [Autosave]' );
  1301 	$autosavef = __( '%1$s [Autosave]' );
  1203 	/* translators: 1: date */
  1302 	/* translators: 1: date */
  1204 	$currentf  = __( '%1$s [Current Revision]' );
  1303 	$currentf  = __( '%1$s [Current Revision]' );
  1205 
  1304 
  1206 	$date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) );
  1305 	$date = date_i18n( $datef, strtotime( $revision->post_modified ) );
  1207 	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
  1306 	if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) )
  1208 		$date = "<a href='$link'>$date</a>";
  1307 		$date = "<a href='$link'>$date</a>";
  1209 
  1308 
  1210 	if ( !wp_is_post_revision( $revision ) )
  1309 	if ( !wp_is_post_revision( $revision ) )
  1211 		$date = sprintf( $currentf, $date );
  1310 		$date = sprintf( $currentf, $date );
  1221  * Can output either a UL with edit links or a TABLE with diff interface, and
  1320  * Can output either a UL with edit links or a TABLE with diff interface, and
  1222  * restore action links.
  1321  * restore action links.
  1223  *
  1322  *
  1224  * Second argument controls parameters:
  1323  * Second argument controls parameters:
  1225  *   (bool)   parent : include the parent (the "Current Revision") in the list.
  1324  *   (bool)   parent : include the parent (the "Current Revision") in the list.
  1226  *   (string) format : 'list' or 'form-table'.  'list' outputs UL, 'form-table'
  1325  *   (string) format : 'list' or 'form-table'. 'list' outputs UL, 'form-table'
  1227  *                     outputs TABLE with UI.
  1326  *                     outputs TABLE with UI.
  1228  *   (int)    right  : what revision is currently being viewed - used in
  1327  *   (int)    right  : what revision is currently being viewed - used in
  1229  *                     form-table format.
  1328  *                     form-table format.
  1230  *   (int)    left   : what revision is currently being diffed against right -
  1329  *   (int)    left   : what revision is currently being diffed against right -
  1231  *                     used in form-table format.
  1330  *                     used in form-table format.
  1251 
  1350 
  1252 	$defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
  1351 	$defaults = array( 'parent' => false, 'right' => false, 'left' => false, 'format' => 'list', 'type' => 'all' );
  1253 	extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
  1352 	extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
  1254 
  1353 
  1255 	switch ( $type ) {
  1354 	switch ( $type ) {
  1256 	case 'autosave' :
  1355 		case 'autosave' :
  1257 		if ( !$autosave = wp_get_post_autosave( $post->ID ) )
  1356 			if ( !$autosave = wp_get_post_autosave( $post->ID ) )
  1258 			return;
  1357 				return;
  1259 		$revisions = array( $autosave );
  1358 			$revisions = array( $autosave );
  1260 		break;
  1359 			break;
  1261 	case 'revision' : // just revisions - remove autosave later
  1360 		case 'revision' : // just revisions - remove autosave later
  1262 	case 'all' :
  1361 		case 'all' :
  1263 	default :
  1362 		default :
  1264 		if ( !$revisions = wp_get_post_revisions( $post->ID ) )
  1363 			if ( !$revisions = wp_get_post_revisions( $post->ID ) )
  1265 			return;
  1364 				return;
  1266 		break;
  1365 			break;
  1267 	}
  1366 	}
  1268 
  1367 
  1269 	/* translators: post revision: 1: when, 2: author name */
  1368 	/* translators: post revision: 1: when, 2: author name */
  1270 	$titlef = _x( '%1$s by %2$s', 'post revision' );
  1369 	$titlef = _x( '%1$s by %2$s', 'post revision' );
  1271 
  1370 
  1272 	if ( $parent )
  1371 	if ( $parent )
  1273 		array_unshift( $revisions, $post );
  1372 		array_unshift( $revisions, $post );
  1274 
  1373 
  1275 	$rows = '';
  1374 	$rows = $right_checked = '';
  1276 	$class = false;
  1375 	$class = false;
  1277 	$can_edit_post = current_user_can( 'edit_post', $post->ID );
  1376 	$can_edit_post = current_user_can( 'edit_post', $post->ID );
  1278 	foreach ( $revisions as $revision ) {
  1377 	foreach ( $revisions as $revision ) {
  1279 		if ( !current_user_can( 'read_post', $revision->ID ) )
  1378 		if ( !current_user_can( 'read_post', $revision->ID ) )
  1280 			continue;
  1379 			continue;
  1292 			$right_checked = $right == $revision->ID ? ' checked="checked"' : '';
  1391 			$right_checked = $right == $revision->ID ? ' checked="checked"' : '';
  1293 
  1392 
  1294 			$class = $class ? '' : " class='alternate'";
  1393 			$class = $class ? '' : " class='alternate'";
  1295 
  1394 
  1296 			if ( $post->ID != $revision->ID && $can_edit_post )
  1395 			if ( $post->ID != $revision->ID && $can_edit_post )
  1297 				$actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'diff' => false, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';
  1396 				$actions = '<a href="' . wp_nonce_url( add_query_arg( array( 'revision' => $revision->ID, 'action' => 'restore' ) ), "restore-post_$post->ID|$revision->ID" ) . '">' . __( 'Restore' ) . '</a>';
  1298 			else
  1397 			else
  1299 				$actions = '';
  1398 				$actions = '';
  1300 
  1399 
  1301 			$rows .= "<tr$class>\n";
  1400 			$rows .= "<tr$class>\n";
  1302 			$rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";
  1401 			$rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='$revision->ID'$left_checked /></th>\n";
       
  1402 			$rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='$revision->ID'$right_checked /></th>\n";
  1303 			$rows .= "\t<td>$date</td>\n";
  1403 			$rows .= "\t<td>$date</td>\n";
  1304 			$rows .= "\t<td>$name</td>\n";
  1404 			$rows .= "\t<td>$name</td>\n";
  1305 			$rows .= "\t<td class='action-links'>$actions</td>\n";
  1405 			$rows .= "\t<td class='action-links'>$actions</td>\n";
  1306 			$rows .= "</tr>\n";
  1406 			$rows .= "</tr>\n";
  1307 		} else {
  1407 		} else {
  1316 
  1416 
  1317 <div class="tablenav">
  1417 <div class="tablenav">
  1318 	<div class="alignleft">
  1418 	<div class="alignleft">
  1319 		<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" />
  1419 		<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Compare Revisions' ); ?>" />
  1320 		<input type="hidden" name="action" value="diff" />
  1420 		<input type="hidden" name="action" value="diff" />
       
  1421 		<input type="hidden" name="post_type" value="<?php echo esc_attr($post->post_type); ?>" />
  1321 	</div>
  1422 	</div>
  1322 </div>
  1423 </div>
  1323 
  1424 
  1324 <br class="clear" />
  1425 <br class="clear" />
  1325 
  1426 
  1326 <table class="widefat post-revisions" cellspacing="0">
  1427 <table class="widefat post-revisions" cellspacing="0" id="post-revisions">
       
  1428 	<col />
  1327 	<col />
  1429 	<col />
  1328 	<col style="width: 33%" />
  1430 	<col style="width: 33%" />
  1329 	<col style="width: 33%" />
  1431 	<col style="width: 33%" />
  1330 	<col style="width: 33%" />
  1432 	<col style="width: 33%" />
  1331 <thead>
  1433 <thead>
  1332 <tr>
  1434 <tr>
  1333 	<th scope="col"></th>
  1435 	<th scope="col"><?php /* translators: column name in revisons */ _ex( 'Old', 'revisions column name' ); ?></th>
  1334 	<th scope="col"><?php _e( 'Date Created' ); ?></th>
  1436 	<th scope="col"><?php /* translators: column name in revisons */ _ex( 'New', 'revisions column name' ); ?></th>
       
  1437 	<th scope="col"><?php /* translators: column name in revisons */ _ex( 'Date Created', 'revisions column name' ); ?></th>
  1335 	<th scope="col"><?php _e( 'Author' ); ?></th>
  1438 	<th scope="col"><?php _e( 'Author' ); ?></th>
  1336 	<th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
  1439 	<th scope="col" class="action-links"><?php _e( 'Actions' ); ?></th>
  1337 </tr>
  1440 </tr>
  1338 </thead>
  1441 </thead>
  1339 <tbody>
  1442 <tbody>