X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/cc7b1505cd9fafd87c3672f669e13e98b0c544f7..022dfbbbe3215917d84708eb09acca93b21ae9e0:/wp-includes/template-functions-post.php
diff --git a/wp-includes/template-functions-post.php b/wp-includes/template-functions-post.php
index 383acb37..800cb7eb 100644
--- a/wp-includes/template-functions-post.php
+++ b/wp-includes/template-functions-post.php
@@ -77,6 +77,9 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
else
$file = $pagenow; //$_SERVER['PHP_SELF'];
+ if ( $page > count($pages) ) // if the requested page doesn't exist
+ $page = count($pages); // give them the highest numbered page that DOES exist
+
$content = $pages[$page-1];
$content = explode('', $content, 2);
if ( (preg_match('//', $post->post_content) && ((!$multipage) || ($page==1))) )
@@ -155,7 +158,7 @@ function link_pages($before='
', $after='
', $next_or_number='number',
if ( '' == get_settings('permalink_structure') )
echo '';
else
- echo '';
+ echo '';
}
echo $j;
if ( ($i != $page) || ((!$more) && ($page==1)) )
@@ -170,14 +173,14 @@ function link_pages($before='
', $after='
', $next_or_number='number',
if ( '' == get_settings('permalink_structure') )
echo ''.$previouspagelink.'';
else
- echo ''.$previouspagelink.'';
+ echo '' . $previouspagelink . '';
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
if ( '' == get_settings('permalink_structure') )
- echo ''.$nextpagelink.'';
+ echo '' . $nextpagelink . '';
else
- echo ''.$nextpagelink.'';
+ echo '' . $nextpagelink . '';
}
echo $after;
}
@@ -197,6 +200,8 @@ function get_post_custom( $post_id = 0 ) {
if ( ! $post_id )
$post_id = $id;
+ $post_id = (int) $post_id;
+
if ( isset($post_meta_cache[$post_id]) )
return $post_meta_cache[$post_id];
@@ -204,7 +209,7 @@ function get_post_custom( $post_id = 0 ) {
// Change from flat structure to hierarchical:
$post_meta_cache = array();
foreach ( $meta_list as $metarow ) {
- $mpid = $metarow['post_id'];
+ $mpid = (int) $metarow['post_id'];
$mkey = $metarow['meta_key'];
$mval = $metarow['meta_value'];
@@ -253,11 +258,14 @@ function post_custom( $key = '' ) {
// this will probably change at some point...
function the_meta() {
- global $id, $post_meta_cache;
+ global $id;
if ( $keys = get_post_custom_keys() ) {
echo "