Changeset 480

Show
Ignore:
Timestamp:
02/18/08 13:54:47 (11 months ago)
Author:
padams
Message:

- added additional url strip rule if dangeling '?' is found at the end of the URL after striping all params.
- refactored link template in wordpress feed tracking

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/base/classes/event.php

    r411 r480  
    319319        function stripDocumentUrl($url) { 
    320320                 
    321                         if (!empty($this->config['query_string_filters'])): 
    322                                 $filters = str_replace(' ', '', $this->config['query_string_filters']); 
    323                                 $filters = explode(',', $filters); 
    324                         else: 
    325                                 $filters = array(); 
    326                         endif; 
    327                          
    328                         // OWA specific params to filter 
    329                         array_push($filters, $this->config['ns'].$this->config['source_param']); 
    330                         array_push($filters, $this->config['ns'].$this->config['feed_subscription_id']); 
    331                          
    332                         //print_r($filters); 
    333                          
    334                         foreach ($filters as $filter => $value) { 
    335                                  
    336                   $url = preg_replace( 
    337                     '#\?' . 
    338                     $value . 
    339                     '=.*$|&' . 
    340                     $value . 
    341                     '=.*$|' . 
    342                     $value . 
    343                     '=.*&#msiU', 
    344                     '', 
    345                     $url 
    346                   ); 
    347                    
    348                 } 
    349                  
     321                if (!empty($this->config['query_string_filters'])): 
     322                        $filters = str_replace(' ', '', $this->config['query_string_filters']); 
     323                        $filters = explode(',', $filters); 
     324                else: 
     325                        $filters = array(); 
     326                endif; 
     327                         
     328                // OWA specific params to filter 
     329                array_push($filters, $this->config['ns'].$this->config['source_param']); 
     330                array_push($filters, $this->config['ns'].$this->config['feed_subscription_id']); 
     331                 
     332                //print_r($filters); 
     333                 
     334                foreach ($filters as $filter => $value) { 
     335                         
     336                  $url = preg_replace( 
     337                        '#\?' . 
     338                        $value . 
     339                        '=.*$|&' . 
     340                        $value . 
     341                        '=.*$|' . 
     342                        $value . 
     343                        '=.*&#msiU', 
     344                        '', 
     345                        $url 
     346                  ); 
     347                   
     348                } 
     349                 
     350                 
     351            //check for dangling '?'. this might occure if all params are stripped. 
     352                 
     353            // returns last character of string 
     354                $test = substr($url, -1);                
     355                 
     356                // if dangling '?' is found clean up the url by removing it. 
     357                if ($test == '?'): 
     358                        $url = substr($url, 0, -1); 
     359                endif;   
     360                         
    350361        $this->e->debug('striped url: '.$url); 
    351362         
  • trunk/owa_wp.php

    r477 r480  
    5858                 
    5959                // check for presence of '?' which is not present under URL rewrite conditions 
     60         
    6061                if (strpos($link, "?") === false): 
     62                        // add the '?' if not found 
    6163                        $link .= '?'; 
    6264                endif; 
    6365                 
    64          
    65                  
    6666                // setup link template 
    67                 $link_template = "%s&%s&%s"; 
     67                $link_template = "%s&%s=%s&%s=%s"; 
    6868                         
    6969                return sprintf($link_template, 
    7070                                           $link, 
    71                                            $this->config['ns'].$this->config['source_param'].'=feed', 
    72                                            $this->config['ns'].$this->config['feed_subscription_param']."=".$_GET[$this->config['feed_subscription_param']]); 
    73                                             
    74                 /*                  
    75                 if (!empty($_GET[$this->config['feed_subscription_id']])): 
    76                         return $link."&".$this->config['ns'].$this->config['source_param']."=feed"."&".$this->config['ns'].$this->config['feed_subscription_id']."=".$_GET[$this->config['feed_subscription_id']]; 
    77                 else: 
    78                         return $link."&".$this->config['ns'].$this->config['source_param']."=feed"; 
    79                 endif; 
    80                 */ 
     71                                           $this->config['ns'].$this->config['source_param'], 
     72                                           'feed', 
     73                                           $this->config['ns'].$this->config['feed_subscription_param'], 
     74                                           $_GET[$this->config['feed_subscription_param']]); 
     75                                           
    8176        } 
    8277