Plugin Directory

Changeset 216667


Ignore:
Timestamp:
03/12/2010 02:00:55 PM (16 years ago)
Author:
geraint
Message:
 
Location:
file-proxy/trunk/com/twothirdsdesign
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • file-proxy/trunk/com/twothirdsdesign/core/ttd_plugin_class.php

    r212172 r216667  
    5050
    5151                // Recurse
    52                 rmdirr($dirname . DIRECTORY_SEPARATOR . $entry);
     52                $this->rmdirr($dirname . DIRECTORY_SEPARATOR . $entry);
    5353            }
    5454
  • file-proxy/trunk/com/twothirdsdesign/file-proxy/ttd_file_proxy.php

    r216664 r216667  
    5555       
    5656        // adds proxy rewrite rule & query_var
    57         add_action('generate_rewrite_rules', array(&$this,'add_rewrite_rules'));
     57        add_filter('generate_rewrite_rules', array(&$this,'add_rewrite_rules'));
    5858        add_filter('query_vars', array(&$this, 'query_vars'));
     59        add_filter('wp_redirect', array(&$this, 'test'), 0, 2);
    5960       
    6061        // intercepts and acts on query_var file-proxy
    6162        add_action('init', array(&$this,'request_handler'), 999);
    62         //add_action('init', array(&$this,'flush_rules'));
     63       
     64    }
     65   
     66   
     67    function test($location, $status){
     68        echo $status . " - " . $location;
    6369    }
    6470   
     
    113119     **/
    114120    function add_rewrite_rules( $wp_rewrite ) {
    115         $new_rules = array( $this->get_option('url-key').'/(.+)' => 'index.php?'. $this->get_option('url-key').'=1'.$wp_rewrite->preg_index(1) );
    116         $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
    117         //$this->rules = $wp_rewrite->rules;
     121        $new_rules = array( $this->get_option('url-key').'/?(.+){1,}/?$' => 'index.php?'. $this->get_option('url-key').'='.$wp_rewrite->preg_index(1) );
     122        $new_rules2 = array( 'testing/(.+)/?$' => 'index.php?file=test'.$wp_rewrite->preg_index(1) );
     123        $wp_rewrite->rules = $new_rules + $new_rules2 + $wp_rewrite->rules;
    118124    }
    119125   
     
    222228    public function request_handler()
    223229    {   
    224         global $wp_query;
    225        
    226         $id = $_GET[ $this->get_option('url-key') ];
    227        
     230        global $wp_query, $wp_rewrite;
     231        $this->flush_rules();
     232        $id = $_GET[ 'file'];//$this->get_option('url-key') ];
     233       
     234        //print_r($_GET['file']);
    228235        if ( isset( $id )) {
     236            echo '<pre>';print_r($wp_rewrite->wp_rewrite_rules() ); echo '</pre>';
    229237           
    230238            // Sanatize url var.
     
    238246                exit;
    239247            }
    240                
    241             $this->return_file( $id );
     248
     249            //$this->return_file( $id );
    242250            exit;
    243251        }
Note: See TracChangeset for help on using the changeset viewer.