Changeset 777846
- Timestamp:
- 09/24/2013 04:49:29 PM (13 years ago)
- File:
-
- 1 edited
-
subdomains/trunk/subdomains.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subdomains/trunk/subdomains.php
r777796 r777846 5 5 Plugin URI: http://pankajanupam.in/wordpress-plugins/subdomains/ 6 6 Description: Use selecttive categories as subdomain 7 Version: 1.0. 07 Version: 1.0.1 8 8 Author: PANKAJ ANUPAM 9 9 Author URI: http://pankajanupam.in … … 44 44 public $query_var; 45 45 46 public $rules; 47 46 48 public function __construct() { 47 49 parent::__construct(); 48 50 51 $this->rules = array(); 49 52 $this->query_var = 'category_name'; 50 53 … … 67 70 public function add_filters() { 68 71 72 add_filter( 'post_rewrite_rules', array(&$this,'post_rewrite_rules') ); 73 69 74 //return all rewite rules 70 75 add_filter('rewrite_rules_array', array(&$this, 'rewrite_rules_array')); 71 76 72 77 //return category rewite rules 73 78 // add_filter('category_rewrite_rules', array(&$this, 'category_rewrite_rules')); … … 77 82 //add_filter( 'root_rewrite_rules', array(&$this,'root_rewrite_rules') ); 78 83 79 //add_filter( 'post_link', array(&$this, 'post_link'), 10, 2 );84 add_filter( 'post_link', array(&$this, 'post_link'), 10, 2 ); 80 85 } 81 86 … … 103 108 public function rewrite_rules_array($rules) { 104 109 105 if ( $this->current_subdomain_is_category()) {106 $rules = $this->category_rewrite_rules( );110 if (!$this->current_subdomain_is_category()) { 111 $rules = $this->category_rewrite_rules($this->rules); 107 112 } 108 113 … … 126 131 } 127 132 128 function category_rewrite_rules( ) {133 function category_rewrite_rules($rules = array()) { 129 134 130 $rules = array();131 135 $rules["feed/(feed|rdf|rss|rss2|atom)/?$"] = "index.php?" . $this->query_var . "=" . $this->categor_slug . "&feed=\$matches[1]"; 132 136 $rules["(feed|rdf|rss|rss2|atom)/?$"] = "index.php?" . $this->query_var . "=" . $this->categor_slug . "&feed=\$matches[1]"; … … 147 151 148 152 return $link; 153 } 154 155 function post_rewrite_rules($rules) { 156 $this->rules = $rules; 157 return $rules; 149 158 } 150 159
Note: See TracChangeset
for help on using the changeset viewer.