]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/template-functions-links.php
Wordpress 2.0.11
[autoinstalls/wordpress.git] / wp-includes / template-functions-links.php
index 9ec7b331d0fa973d2907100c08aa2337f2699ea0..cf9a29672b278e3c6e21cc9e366fe471cd3d3730 100644 (file)
@@ -62,14 +62,15 @@ function get_permalink($id = 0) {
 
                $authordata = get_userdata($post->post_author);
                $author = $authordata->user_nicename;
+               $date = explode(" ",date('Y m d H i s', $unixtime));
                $rewritereplace = 
                array(
-                       date('Y', $unixtime),
-                       date('m', $unixtime),
-                       date('d', $unixtime),
-                       date('H', $unixtime),
-                       date('i', $unixtime),
-                       date('s', $unixtime),
+                       $date[0],
+                       $date[1],
+                       $date[2],
+                       $date[3],
+                       $date[4],
+                       $date[5],
                        $post->post_name,
                        $post->ID,
                        $category,
@@ -86,8 +87,9 @@ function get_permalink($id = 0) {
 function get_page_link($id = false) {
        global $post, $wp_rewrite;
 
+       $id = (int) $id;
        if ( !$id )
-               $id = $post->ID;
+               $id = (int) $post->ID;
 
        $pagestruct = $wp_rewrite->get_page_permastruct();
 
@@ -108,7 +110,7 @@ function get_attachment_link($id = false) {
        $link = false;
 
        if (! $id) {
-               $id = $post->ID;
+               $id = (int) $post->ID;
        }
 
        $object = get_post($id);
@@ -377,7 +379,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
 function get_pagenum_link($pagenum = 1) {
        global $wp_rewrite;
 
-       $qstr = wp_specialchars($_SERVER['REQUEST_URI']);
+       $qstr = $_SERVER['REQUEST_URI'];
 
        $page_querystring = "paged"; 
        $page_modstring = "page/";
@@ -444,7 +446,7 @@ function get_pagenum_link($pagenum = 1) {
        return $qstr;
 }
 
-function next_posts($max_page = 0) { // original by cfactor at cooltux.org
+function get_next_posts_page_link($max_page = 0) {
        global $paged, $pagenow;
 
        if ( !is_single() ) {
@@ -452,10 +454,14 @@ function next_posts($max_page = 0) { // original by cfactor at cooltux.org
                        $paged = 1;
                $nextpage = intval($paged) + 1;
                if ( !$max_page || $max_page >= $nextpage )
-                       echo get_pagenum_link($nextpage);
+                       return get_pagenum_link($nextpage);
        }
 }
 
+function next_posts($max_page = 0) {
+       echo clean_url(get_next_posts_page_link($max_page));
+}
+
 function next_posts_link($label='Next Page »', $max_page=0) {
        global $paged, $result, $request, $posts_per_page, $wpdb, $max_num_pages;
        if ( !$max_page ) {
@@ -478,18 +484,20 @@ function next_posts_link($label='Next Page »', $max_page=0) {
        }
 }
 
-
-function previous_posts() { // original by cfactor at cooltux.org
+function get_previous_posts_page_link() {
        global $paged, $pagenow;
 
        if ( !is_single() ) {
                $nextpage = intval($paged) - 1;
                if ( $nextpage < 1 )
                        $nextpage = 1;
-               echo get_pagenum_link($nextpage);
+               return get_pagenum_link($nextpage);
        }
 }
 
+function previous_posts() {
+       echo clean_url(get_previous_posts_page_link());
+}
 
 function previous_posts_link($label='&laquo; Previous Page') {
        global $paged;