| | 3326 | * Set up global post data. |
| | 3327 | * |
| | 3328 | * @param object $post Post data. |
| | 3329 | * @uses do_action_ref_array() Calls 'the_post' |
| | 3330 | * @return bool True when finished. |
| | 3331 | */ |
| | 3332 | function setup_postdata( $post ) { |
| | 3333 | global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages; |
| | 3334 | |
| | 3335 | $id = (int) $post->ID; |
| | 3336 | |
| | 3337 | $authordata = get_userdata( $post->post_author ); |
| | 3338 | |
| | 3339 | $currentday = mysql2date( 'd.m.y', $post->post_date, false ); |
| | 3340 | $currentmonth = mysql2date( 'm', $post->post_date, false ); |
| | 3341 | $numpages = 1; |
| | 3342 | $page = $this->get( 'page' ); |
| | 3343 | if ( ! $page ) { |
| | 3344 | $page = 1; |
| | 3345 | } |
| | 3346 | |
| | 3347 | if ( $this->is_single() || $this->is_page() || $this->is_feed() ) { |
| | 3348 | $more = 1; |
| | 3349 | } |
| | 3350 | $content = $post->post_content; |
| | 3351 | if ( false !== strpos( $content, '<!--nextpage-->' ) ) { |
| | 3352 | if ( $page > 1 ) { |
| | 3353 | $more = 1; |
| | 3354 | } |
| | 3355 | $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| | 3356 | $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); |
| | 3357 | $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| | 3358 | // Ignore nextpage at the beginning of the content. |
| | 3359 | if ( 0 === strpos( $content, '<!--nextpage-->' ) ) { |
| | 3360 | $content = substr( $content, 15 ); |
| | 3361 | } |
| | 3362 | $pages = explode( '<!--nextpage-->', $content ); |
| | 3363 | $numpages = count( $pages ); |
| | 3364 | $multipage = $numpages > 1 ? 1 : 0; |
| | 3365 | } else { |
| | 3366 | $pages = array( $post->post_content ); |
| | 3367 | $multipage = 0; |
| | 3368 | } |
| | 3369 | |
| | 3370 | do_action( 'the_post', $post ); |
| | 3371 | |
| | 3372 | return true; |
| | 3373 | } |
| | 3374 | |
| | 3375 | |
| | 3376 | /** |
| 3931 | | $authordata = get_userdata($post->post_author); |
| 3932 | | |
| 3933 | | $currentday = mysql2date('d.m.y', $post->post_date, false); |
| 3934 | | $currentmonth = mysql2date('m', $post->post_date, false); |
| 3935 | | $numpages = 1; |
| 3936 | | $multipage = 0; |
| 3937 | | $page = get_query_var('page'); |
| 3938 | | if ( ! $page ) |
| 3939 | | $page = 1; |
| 3940 | | if ( is_single() || is_page() || is_feed() ) |
| 3941 | | $more = 1; |
| 3942 | | $content = $post->post_content; |
| 3943 | | if ( false !== strpos( $content, '<!--nextpage-->' ) ) { |
| 3944 | | if ( $page > 1 ) |
| 3945 | | $more = 1; |
| 3946 | | $content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| 3947 | | $content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content ); |
| 3948 | | $content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content ); |
| 3949 | | // Ignore nextpage at the beginning of the content. |
| 3950 | | if ( 0 === strpos( $content, '<!--nextpage-->' ) ) |
| 3951 | | $content = substr( $content, 15 ); |
| 3952 | | $pages = explode('<!--nextpage-->', $content); |
| 3953 | | $numpages = count($pages); |
| 3954 | | if ( $numpages > 1 ) |
| 3955 | | $multipage = 1; |
| 3956 | | } else { |
| 3957 | | $pages = array( $post->post_content ); |
| 3958 | | } |
| 3959 | | |
| 3960 | | do_action_ref_array('the_post', array(&$post)); |
| 3961 | | |
| 3962 | | return true; |
| | 3983 | return false; |