* @return string|bool False if not found. Permalink structure string.
*/
function get_extra_permastruct($name) {
+ if ( empty($this->permalink_structure) )
+ return false;
if ( isset($this->extra_permastructs[$name]) )
return $this->extra_permastructs[$name];
return false;
$subcommentquery = $subquery . '&cpage=' . $this->preg_index(2);
//do endpoints for attachments
- if ( !empty($endpoint) ) { foreach ( (array) $ep_query_append as $regex => $ep ) {
+ if ( !empty($endpoints) ) { foreach ( (array) $ep_query_append as $regex => $ep ) {
if ($ep[0] & EP_ATTACHMENT) {
- $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
- $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
+ $rewrite[$sub1 . $regex] = $subquery . $ep[1] . $this->preg_index(2);
+ $rewrite[$sub2 . $regex] = $subquery . $ep[1] . $this->preg_index(2);
}
} }
* @return array Rewrite rules.
*/
function wp_rewrite_rules() {
- $this->rules = get_transient('rewrite_rules');
+ $this->rules = get_option('rewrite_rules');
if ( empty($this->rules) ) {
$this->matches = 'matches';
$this->rewrite_rules();
- set_transient('rewrite_rules', $this->rules);
+ update_option('rewrite_rules', $this->rules);
}
return $this->rules;
*
* @return string
*/
- function iis7_url_rewrite_rules(){
+ function iis7_url_rewrite_rules($add_parent_tags = false, $indent = " ", $end_of_line = "\n") {
if ( ! $this->using_permalinks()) {
return '';
}
- $rules = "<rule name=\"wordpress\" patternSyntax=\"Wildcard\">\n";
- $rules .= " <match url=\"*\" />\n";
- $rules .= " <conditions>\n";
- $rules .= " <add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />\n";
- $rules .= " <add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />\n";
- $rules .= " </conditions>\n";
- $rules .= " <action type=\"Rewrite\" url=\"index.php\" />\n";
- $rules .= "</rule>";
+
+ $rules = '';
+ $extra_indent = '';
+ if ( $add_parent_tags ) {
+ $rules .= "<configuration>".$end_of_line;
+ $rules .= $indent."<system.webServer>".$end_of_line;
+ $rules .= $indent.$indent."<rewrite>".$end_of_line;
+ $rules .= $indent.$indent.$indent."<rules>".$end_of_line;
+ $extra_indent = $indent.$indent.$indent.$indent;
+ }
+
+ $rules .= $extra_indent."<rule name=\"wordpress\" patternSyntax=\"Wildcard\">".$end_of_line;
+ $rules .= $extra_indent.$indent."<match url=\"*\" />".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent."<conditions>".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsFile\" negate=\"true\" />".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent.$indent."<add input=\"{REQUEST_FILENAME}\" matchType=\"IsDirectory\" negate=\"true\" />".$end_of_line;
+ $rules .= $extra_indent.$indent.$indent."</conditions>".$end_of_line;
+ $rules .= $extra_indent.$indent."<action type=\"Rewrite\" url=\"index.php\" />".$end_of_line;
+ $rules .= $extra_indent."</rule>";
+
+ if ( $add_parent_tags ) {
+ $rules .= $end_of_line.$indent.$indent.$indent."</rules>".$end_of_line;
+ $rules .= $indent.$indent."</rewrite>".$end_of_line;
+ $rules .= $indent."</system.webServer>".$end_of_line;
+ $rules .= "</configuration>";
+ }
$rules = apply_filters('iis7_url_rewrite_rules', $rules);
*
* @since 2.0.1
* @access public
- * @param $hard bool Whether to update .htaccess (hard flush) or just update rewrite_rules transient (soft flush). Default is true (hard).
+ * @param $hard bool Whether to update .htaccess (hard flush) or just update rewrite_rules option (soft flush). Default is true (hard).
*/
function flush_rules($hard = true) {
- delete_transient('rewrite_rules');
+ delete_option('rewrite_rules');
$this->wp_rewrite_rules();
if ( $hard && function_exists('save_mod_rewrite_rules') )
save_mod_rewrite_rules();