diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-05-21 18:37:58 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-05-21 18:37:58 +0000 |
commit | 89fe0ff804e7c6497ebacc8b341ac89974f6f255 (patch) | |
tree | 3fce310b29c685008fdbb75c5ab531bc3a6ae12a /wp-includes/post-template.php | |
parent | a139071806ba941346a109fbefb2d5f22bae1cc4 (diff) | |
download | wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.gz wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.xz wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.zip |
WP Merge to rev 5499, this is a big one! Test it before you put it live!
Test only, not for production use yet
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@972 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/post-template.php')
-rw-r--r-- | wp-includes/post-template.php | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 94d2876..cee198b 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -80,7 +80,7 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_ $page = count($pages); // give them the highest numbered page that DOES exist $content = $pages[$page-1]; - if ( preg_match('/<!--more(.+?)?-->/', $content, $matches) ) { + if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) { $content = explode($matches[0], $content, 2); if ( !empty($matches[1]) && !empty($more_link_text) ) $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1]))); @@ -129,19 +129,23 @@ function get_the_excerpt($fakeit = true) { return apply_filters('get_the_excerpt', $output); } +function has_excerpt( $id = 0 ) { + $post = &get_post( $id ); + return ( !empty( $post->post_excerpt ) ); +} function wp_link_pages($args = '') { - if ( is_array($args) ) - $r = &$args; - else - parse_str($args, $r); - - $defaults = array('before' => '<p>' . __('Pages:'), 'after' => '</p>', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), - 'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'more_file' => '', 'echo' => 1); - $r = array_merge($defaults, $r); - extract($r); - - global $id, $page, $numpages, $multipage, $more, $pagenow; + $defaults = array( + 'before' => '<p>' . __('Pages:'), 'after' => '</p>', + 'next_or_number' => 'number', 'nextpagelink' => __('Next page'), + 'previouspagelink' => __('Previous page'), 'pagelink' => '%', + 'more_file' => '', 'echo' => 1 + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r ); + + global $post, $id, $page, $numpages, $multipage, $more, $pagenow; if ( $more_file != '' ) $file = $more_file; else @@ -158,7 +162,7 @@ function wp_link_pages($args = '') { if ( 1 == $i ) { $output .= '<a href="' . get_permalink() . '">'; } else { - if ( '' == get_option('permalink_structure') ) + if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) $output .= '<a href="' . get_permalink() . '&page=' . $i . '">'; else $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">'; @@ -177,7 +181,7 @@ function wp_link_pages($args = '') { if ( 1 == $i ) { $output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>'; } else { - if ( '' == get_option('permalink_structure') ) + if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) $output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $previouspagelink . '</a>'; else $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>'; @@ -188,7 +192,7 @@ function wp_link_pages($args = '') { if ( 1 == $i ) { $output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>'; } else { - if ( '' == get_option('permalink_structure') ) + if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status ) $output .= '<a href="' . get_permalink() . '&page=' . $i . '">' . $nextpagelink . '</a>'; else $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>'; @@ -233,7 +237,7 @@ function the_meta() { 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"; + echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value); } echo "</ul>\n"; } @@ -245,15 +249,14 @@ function the_meta() { // function wp_dropdown_pages($args = '') { - if ( is_array($args) ) - $r = &$args; - else - parse_str($args, $r); - - $defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1, - 'name' => 'page_id', 'show_option_none' => ''); - $r = array_merge($defaults, $r); - extract($r); + $defaults = array( + 'depth' => 0, 'child_of' => 0, + 'selected' => 0, 'echo' => 1, + 'name' => 'page_id', 'show_option_none' => '' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r ); $pages = get_pages($r); $output = ''; @@ -275,14 +278,16 @@ function wp_dropdown_pages($args = '') { } function wp_list_pages($args = '') { - if ( is_array($args) ) - $r = &$args; - else - parse_str($args, $r); - - $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), - 'child_of' => 0, 'exclude' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title'); - $r = array_merge($defaults, $r); + $defaults = array( + 'depth' => 0, 'show_date' => '', + 'date_format' => get_option('date_format'), + 'child_of' => 0, 'exclude' => '', + 'title_li' => __('Pages'), 'echo' => 1, + 'authors' => '', 'sort_column' => 'menu_order, post_title' + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r ); $output = ''; $current_page = 0; @@ -345,7 +350,7 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false) $id = (int) $id; $_post = & get_post($id); - if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url() ) + if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) ) return __('Missing Attachment'); $post_title = attribute_escape($_post->post_title); |