Plugin Directory

Changeset 777846


Ignore:
Timestamp:
09/24/2013 04:49:29 PM (13 years ago)
Author:
pankajanupam
Message:

release 1.0.1

add post subdomain support

Signed-off-by: pankajanupam <mymail.anupam@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • subdomains/trunk/subdomains.php

    r777796 r777846  
    55  Plugin URI: http://pankajanupam.in/wordpress-plugins/subdomains/
    66  Description: Use selecttive categories as subdomain
    7   Version: 1.0.0
     7  Version: 1.0.1
    88  Author: PANKAJ ANUPAM
    99  Author URI: http://pankajanupam.in
     
    4444    public $query_var;
    4545   
     46    public $rules;
     47
    4648    public function __construct() {
    4749        parent::__construct();
    48 
     50       
     51        $this->rules = array();
    4952        $this->query_var = 'category_name';
    5053       
     
    6770    public function add_filters() {
    6871
     72        add_filter( 'post_rewrite_rules', array(&$this,'post_rewrite_rules') );
     73       
    6974        //return all rewite rules
    7075        add_filter('rewrite_rules_array', array(&$this, 'rewrite_rules_array'));
    71 
     76       
    7277        //return category rewite rules
    7378        // add_filter('category_rewrite_rules', array(&$this, 'category_rewrite_rules'));
     
    7782        //add_filter( 'root_rewrite_rules', array(&$this,'root_rewrite_rules') );
    7883       
    79         //add_filter( 'post_link', array(&$this, 'post_link'), 10, 2 );
     84        add_filter( 'post_link', array(&$this, 'post_link'), 10, 2 );
    8085    }
    8186
     
    103108    public function rewrite_rules_array($rules) {
    104109
    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);
    107112        }
    108113       
     
    126131    }
    127132
    128     function category_rewrite_rules() {
     133    function category_rewrite_rules($rules = array()) {
    129134
    130         $rules = array();
    131135        $rules["feed/(feed|rdf|rss|rss2|atom)/?$"] = "index.php?" . $this->query_var . "=" . $this->categor_slug . "&feed=\$matches[1]";
    132136        $rules["(feed|rdf|rss|rss2|atom)/?$"] = "index.php?" . $this->query_var . "=" . $this->categor_slug . "&feed=\$matches[1]";
     
    147151
    148152        return $link;
     153    }
     154   
     155    function post_rewrite_rules($rules) {
     156        $this->rules = $rules;
     157        return $rules;
    149158    }
    150159
Note: See TracChangeset for help on using the changeset viewer.