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('<!--more-->', $content, 2);
if ( (preg_match('/<!--noteaser-->/', $post->post_content) && ((!$multipage) || ($page==1))) )
if ( '' == get_settings('permalink_structure') )
echo '<a href="' . get_permalink() . '&page=' . $i . '">';
else
- echo '<a href="' . trailingslashit( get_permalink() ) . $i . '/">';
+ echo '<a href="' . trailingslashit(get_permalink()) . $i . '/">';
}
echo $j;
if ( ($i != $page) || ((!$more) && ($page==1)) )
if ( '' == get_settings('permalink_structure') )
echo '<a href="' . get_permalink() . '&page=' . $i . '">'.$previouspagelink.'</a>';
else
- echo '<a href="' . get_permalink() . $i . '/">'.$previouspagelink.'</a>';
+ echo '<a href="' . get_permalink() . $i . '/">' . $previouspagelink . '</a>';
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
if ( '' == get_settings('permalink_structure') )
- echo '<a href="'.get_permalink() . '&page=' . $i . '">'.$nextpagelink.'</a>';
+ echo '<a href="' . get_permalink() . '&page=' . $i . '">' . $nextpagelink . '</a>';
else
- echo '<a href="'.get_permalink().$i.'/">'.$nextpagelink.'</a>';
+ echo '<a href="' . trailingslashit(get_permalink()) . $i . '/">' . $nextpagelink . '</a>';
}
echo $after;
}
if ( ! $post_id )
$post_id = $id;
+ $post_id = (int) $post_id;
+
if ( isset($post_meta_cache[$post_id]) )
return $post_meta_cache[$post_id];
// 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'];
// this will probably change at some point...
function the_meta() {
- global $id, $post_meta_cache;
+ global $id;
if ( $keys = get_post_custom_keys() ) {
echo "<ul class='post-meta'>\n";
foreach ( $keys as $key ) {
+ $keyt = trim($key);
+ if ( '_' == $keyt{0} )
+ continue;
$values = array_map('trim', get_post_custom_values($key));
$value = implode($values,', ');
echo "<li><span class='post-meta-key'>$key:</span> $value</li>\n";
foreach ( $page_tree[$parent]['children'] as $page_id ) {
$cur_page = $page_tree[$page_id];
- $title = $cur_page['title'];
+ $title = attribute_escape($cur_page['title']);
$css_class = 'page_item';
if ( $page_id == $queried_obj->ID )
$css_class .= ' current_page_item';
- $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '">' . $title . '</a>';
+ $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . $title . '">' . $title . '</a>';
if ( isset($cur_page['ts']) ) {
$format = get_settings('date_format');