Make WordPress Core


Ignore:
Timestamp:
06/08/2006 02:22:16 AM (20 years ago)
Author:
ryan
Message:

Move user functions to user.php. Relocate more post functions to post.php. #2525

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r3824 r3854  
    10381038}
    10391039
     1040//
     1041// Private helper functions
     1042//
     1043
     1044// Setup global post data.
     1045function setup_postdata($post) {
     1046        global $id, $postdata, $authordata, $day, $page, $pages, $multipage, $more, $numpages, $wp_query;
     1047        global $pagenow;
     1048
     1049        $id = $post->ID;
     1050
     1051        $authordata = get_userdata($post->post_author);
     1052
     1053        $day = mysql2date('d.m.y', $post->post_date);
     1054        $currentmonth = mysql2date('m', $post->post_date);
     1055        $numpages = 1;
     1056        $page = get_query_var('page');
     1057        if ( !$page )
     1058                $page = 1;
     1059        if ( is_single() || is_page() )
     1060                $more = 1;
     1061        $content = $post->post_content;
     1062        if ( preg_match('/<!--nextpage-->/', $content) ) {
     1063                if ( $page > 1 )
     1064                        $more = 1;
     1065                $multipage = 1;
     1066                $content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content);
     1067                $content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content);
     1068                $content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content);
     1069                $pages = explode('<!--nextpage-->', $content);
     1070                $numpages = count($pages);
     1071        } else {
     1072                $pages[0] = $post->post_content;
     1073                $multipage = 0;
     1074        }
     1075        return true;
     1076}
     1077
    10401078?>
Note: See TracChangeset for help on using the changeset viewer.