]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/rewrite.php
Wordpress 2.6.2
[autoinstalls/wordpress.git] / wp-includes / rewrite.php
index 22294974c2551a0bf2c5f95ed8fe4b207cc2044c..15247d8031eef436e62f6e090dde657c92f2dc97 100644 (file)
@@ -31,7 +31,8 @@ function add_feed($feedname, $function) {
                $wp_rewrite->feeds[] = $feedname;
        }
        $hook = 'do_feed_' . $feedname;
-       remove_action($hook, $function, 10, 1);
+       // Remove default function hook
+       remove_action($hook, $hook, 10, 1);
        add_action($hook, $function, 10, 1);
        return $hook;
 }
@@ -59,6 +60,20 @@ function add_rewrite_endpoint($name, $places) {
        $wp_rewrite->add_endpoint($name, $places);
 }
 
+/**
+  * _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/
+  * @param string $base the taxonomy base that we're going to filter
+  * @return string
+  * @author Mark Jaquith 
+  */
+function _wp_filter_taxonomy_base( $base ) {
+       if ( !empty( $base ) ) {
+               $base = preg_replace( '|^/index\.php/|', '', $base );
+               $base = trim( $base, '/' );
+       }
+       return $base;
+}
+
 // examine a url (supposedly from this blog) and try to
 // determine the post ID it represents.
 function url_to_postid($url) {
@@ -137,7 +152,7 @@ function url_to_postid($url) {
                        $query = preg_replace("!^.+\?!", '', $query);
 
                        // Substitute the substring matches into the query.
-                       eval("\$query = \"$query\";");
+                       eval("\$query = \"" . addslashes($query) . "\";");
                        // Filter out non-public query vars
                        global $wp;
                        parse_str($query, $query_vars);
@@ -432,9 +447,9 @@ class WP_Rewrite {
                }
 
                if (empty($this->category_base))
-                       $this->category_structure = $this->front . 'category/';
+                       $this->category_structure = trailingslashit( $this->front . 'category' );
                else
-                       $this->category_structure = $this->category_base . '/';
+                       $this->category_structure = trailingslashit( '/' . $this->root . $this->category_base );
 
                $this->category_structure .= '%category%';
 
@@ -452,9 +467,9 @@ class WP_Rewrite {
                }
 
                if (empty($this->tag_base))
-                       $this->tag_structure = $this->front . 'tag/';
+                       $this->tag_structure = trailingslashit( $this->front . 'tag' );
                else
-                       $this->tag_structure = $this->tag_base . '/';
+                       $this->tag_structure = trailingslashit( '/' . $this->root . $this->tag_base );
 
                $this->tag_structure .= '%tag%';
 
@@ -793,12 +808,12 @@ class WP_Rewrite {
                $robots_rewrite = array('robots.txt$' => $this->index . '?robots=1');
 
                //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
-               $default_feeds = array( '.*/wp-atom.php$'       =>      $this->index .'?feed=atom',
-                                                               '.*/wp-rdf.php$'        =>      $this->index .'?feed=rdf',
-                                                               '.*/wp-rss.php$'        =>      $this->index .'?feed=rss',
-                                                               '.*/wp-rss2.php$'       =>      $this->index .'?feed=rss2',
-                                                               '.*/wp-feed.php$'       =>      $this->index .'?feed=feed',
-                                                               '.*/wp-commentsrss2.php$'       =>      $this->index . '?feed=rss2&withcomments=1');
+               $default_feeds = array( '.*wp-atom.php$'        =>      $this->index .'?feed=atom',
+                                                               '.*wp-rdf.php$' =>      $this->index .'?feed=rdf',
+                                                               '.*wp-rss.php$' =>      $this->index .'?feed=rss',
+                                                               '.*wp-rss2.php$'        =>      $this->index .'?feed=rss2',
+                                                               '.*wp-feed.php$'        =>      $this->index .'?feed=feed',
+                                                               '.*wp-commentsrss2.php$'        =>      $this->index . '?feed=rss2&withcomments=1');
 
                // Post
                $post_rewrite = $this->generate_rewrite_rules($this->permalink_structure, EP_PERMALINK);