| | 3064 | * Set up global post data. |
| | 3065 | * |
| | 3066 | * @param object $post Post data. |
| | 3067 | * @uses do_action_ref_array() Calls 'the_post' |
| | 3068 | * @return bool True when finished. |
| | 3069 | */ |
| | 3070 | function setup_postdata($post) { |
| | 3071 | global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; |
| | 3072 | |
| | 3073 | $id = (int) $post->ID; |
| | 3074 | |
| | 3075 | $authordata = get_userdata( $post->post_author ); |
| | 3076 | |
| | 3077 | $currentday = mysql2date( 'd.m.y', $post->post_date, false ); |
| | 3078 | $currentmonth = mysql2date( 'm', $post->post_date, false ); |
| | 3079 | $numpages = 1; |
| | 3080 | $page = $this->get( 'page' ); |
| | 3081 | if ( !$page ) |
| | 3082 | $page = 1; |
| | 3083 | |
| | 3084 | if ( $this->is_single() || $this->is_page() || $this->is_feed() ) |
| | 3085 | $more = 1; |
| | 3086 | $content = $post->post_content; |
| | 3087 | if ( strpos( $content, '<!--nextpage-->' ) ) { |
| | 3088 | if ( $page > 1 ) |
| | 3089 | $more = 1; |
| | 3090 | $multipage = 1; |
| | 3091 | $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| | 3092 | $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); |
| | 3093 | $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| | 3094 | $pages = explode( '<!--nextpage-->', $content ); |
| | 3095 | $numpages = count( $pages ); |
| | 3096 | } else { |
| | 3097 | $pages = array( $post->post_content ); |
| | 3098 | $multipage = 0; |
| | 3099 | } |
| | 3100 | |
| | 3101 | do_action_ref_array( 'the_post', array( &$post ) ); |
| | 3102 | |
| | 3103 | return true; |
| | 3104 | } |
| | 3105 | |
| | 3106 | |
| | 3107 | /** |
| 3643 | | global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; |
| 3644 | | |
| 3645 | | $id = (int) $post->ID; |
| 3646 | | |
| 3647 | | $authordata = get_userdata($post->post_author); |
| 3648 | | |
| 3649 | | $currentday = mysql2date('d.m.y', $post->post_date, false); |
| 3650 | | $currentmonth = mysql2date('m', $post->post_date, false); |
| 3651 | | $numpages = 1; |
| 3652 | | $multipage = 0; |
| 3653 | | $page = get_query_var('page'); |
| 3654 | | if ( ! $page ) |
| 3655 | | $page = 1; |
| 3656 | | if ( is_single() || is_page() || is_feed() ) |
| 3657 | | $more = 1; |
| 3658 | | $content = $post->post_content; |
| 3659 | | if ( false !== strpos( $content, '<!--nextpage-->' ) ) { |
| 3660 | | if ( $page > 1 ) |
| 3661 | | $more = 1; |
| 3662 | | $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| 3663 | | $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); |
| 3664 | | $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| 3665 | | // Ignore nextpage at the beginning of the content. |
| 3666 | | if ( 0 === strpos( $content, '<!--nextpage-->' ) ) |
| 3667 | | $content = substr( $content, 15 ); |
| 3668 | | $pages = explode('<!--nextpage-->', $content); |
| 3669 | | $numpages = count($pages); |
| 3670 | | if ( $numpages > 1 ) |
| 3671 | | $multipage = 1; |
| 3672 | | } else { |
| 3673 | | $pages = array( $post->post_content ); |
| 3674 | | } |
| | 3687 | global $wp_query; |