1060
1060
* @return string|bool False if not found. Permalink structure string.
1062
1062
function get_extra_permastruct($name) {
1063
if ( empty($this->permalink_structure) )
1063
1065
if ( isset($this->extra_permastructs[$name]) )
1064
1066
return $this->extra_permastructs[$name];
1442
1444
$subcommentquery = $subquery . '&cpage=' . $this->preg_index(2);
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);
1607
1609
* @return array Rewrite rules.
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);
1617
1619
return $this->rules;
1716
1718
* @return string
1718
function iis7_url_rewrite_rules(){
1720
function iis7_url_rewrite_rules($add_parent_tags = false, $indent = " ", $end_of_line = "\n") {
1720
1722
if ( ! $this->using_permalinks()) {
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>";
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;
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>";
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>";
1732
1752
$rules = apply_filters('iis7_url_rewrite_rules', $rules);
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).
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();