~katiekitty/+junk/wordpress-byet

« back to all changes in this revision

Viewing changes to wp-includes/rewrite.php

  • Committer: kserver
  • Date: 2010-05-15 01:16:36 UTC
  • Revision ID: kserver@kserver-desktop-20100515011636-mnr1j7t637suptdq
Wordpress 2.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1060
1060
         * @return string|bool False if not found. Permalink structure string.
1061
1061
         */
1062
1062
        function get_extra_permastruct($name) {
 
1063
                if ( empty($this->permalink_structure) )
 
1064
                        return false;
1063
1065
                if ( isset($this->extra_permastructs[$name]) )
1064
1066
                        return $this->extra_permastructs[$name];
1065
1067
                return false;
1442
1444
                                        $subcommentquery = $subquery . '&cpage=' . $this->preg_index(2);
1443
1445
 
1444
1446
                                        //do endpoints for attachments
1445
 
                                        if ( !empty($endpoint) ) { foreach ( (array) $ep_query_append as $regex => $ep ) {
 
1447
                                        if ( !empty($endpoints) ) { foreach ( (array) $ep_query_append as $regex => $ep ) {
1446
1448
                                                if ($ep[0] & EP_ATTACHMENT) {
1447
 
                                                        $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
1448
 
                                                        $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
 
1449
                                                        $rewrite[$sub1 . $regex] = $subquery . $ep[1] . $this->preg_index(2);
 
1450
                                                        $rewrite[$sub2 . $regex] = $subquery . $ep[1] . $this->preg_index(2);
1449
1451
                                                }
1450
1452
                                        } }
1451
1453
 
1607
1609
         * @return array Rewrite rules.
1608
1610
         */
1609
1611
        function wp_rewrite_rules() {
1610
 
                $this->rules = get_transient('rewrite_rules');
 
1612
                $this->rules = get_option('rewrite_rules');
1611
1613
                if ( empty($this->rules) ) {
1612
1614
                        $this->matches = 'matches';
1613
1615
                        $this->rewrite_rules();
1614
 
                        set_transient('rewrite_rules', $this->rules);
 
1616
                        update_option('rewrite_rules', $this->rules);
1615
1617
                }
1616
1618
 
1617
1619
                return $this->rules;
1715
1717
         *
1716
1718
         * @return string
1717
1719
         */
1718
 
        function iis7_url_rewrite_rules(){
 
1720
        function iis7_url_rewrite_rules($add_parent_tags = false, $indent = "  ", $end_of_line = "\n") {
1719
1721
 
1720
1722
                if ( ! $this->using_permalinks()) {
1721
1723
                        return '';
1722
1724
                }
1723
 
                $rules  = "<rule name=\"wordpress\" patternSyntax=\"Wildcard\">\n";
1724
 
                $rules .= "     <match url=\"*\" />\n";
1725
 
                $rules .= "     <conditions>\n";
1726
 
                $rules .= "             <add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />\n";
1727
 
                $rules .= "             <add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />\n";
1728
 
                $rules .= "     </conditions>\n";
1729
 
                $rules .= "     <action type=\"Rewrite\" url=\"index.php\" />\n";
1730
 
                $rules .= "</rule>";
 
1725
                
 
1726
                $rules = '';
 
1727
                $extra_indent = '';
 
1728
                if ( $add_parent_tags ) {
 
1729
                        $rules .= "<configuration>".$end_of_line;
 
1730
                        $rules .= $indent."<system.webServer>".$end_of_line;
 
1731
                        $rules .= $indent.$indent."<rewrite>".$end_of_line;
 
1732
                        $rules .= $indent.$indent.$indent."<rules>".$end_of_line;
 
1733
                        $extra_indent = $indent.$indent.$indent.$indent;
 
1734
                }
 
1735
                
 
1736
                $rules .= $extra_indent."<rule name=\"wordpress\" patternSyntax=\"Wildcard\">".$end_of_line;
 
1737
                $rules .= $extra_indent.$indent."<match url=\"*\" />".$end_of_line;
 
1738
                $rules .= $extra_indent.$indent.$indent."<conditions>".$end_of_line;
 
1739
                $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />".$end_of_line;
 
1740
                $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />".$end_of_line;
 
1741
                $rules .= $extra_indent.$indent.$indent."</conditions>".$end_of_line;
 
1742
                $rules .= $extra_indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line;
 
1743
                $rules .= $extra_indent."</rule>";
 
1744
                
 
1745
                if ( $add_parent_tags ) {
 
1746
                        $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line;
 
1747
                        $rules .= $indent.$indent."</rewrite>".$end_of_line;
 
1748
                        $rules .= $indent."</system.webServer>".$end_of_line;
 
1749
                        $rules .= "</configuration>";
 
1750
                }
1731
1751
 
1732
1752
                $rules = apply_filters('iis7_url_rewrite_rules', $rules);
1733
1753
 
1822
1842
         *
1823
1843
         * @since 2.0.1
1824
1844
         * @access public
1825
 
         * @param $hard bool Whether to update .htaccess (hard flush) or just update rewrite_rules transient (soft flush). Default is true (hard).
 
1845
         * @param $hard bool Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).
1826
1846
         */
1827
1847
        function flush_rules($hard = true) {
1828
 
                delete_transient('rewrite_rules');
 
1848
                delete_option('rewrite_rules');
1829
1849
                $this->wp_rewrite_rules();
1830
1850
                if ( $hard && function_exists('save_mod_rewrite_rules') )
1831
1851
                        save_mod_rewrite_rules();