WordPress.org

Plugin Directory

Changeset 610053


Ignore:
Timestamp:
10/09/12 14:30:11 (19 months ago)
Author:
cfinke
Message:

Not generating a clickthrough URL for relative URLs or mailto.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wordpress-feed-statistics/trunk/feed-statistics.php

    r610052 r610053  
    993993            $redirect_url = home_url( '/?feed-stats-url=' ); 
    994994         
    995             $content = preg_replace("/(<a[^>]+href=)(['\"])([^'\"]+)(['\"])([^>]*>)/e", "'$1\"'.esc_url('$redirect_url' . base64_encode('\\3') ) . '\"$5'", $content); 
     995            $content = preg_replace("/(<a[^>]+href=)(['\"])([^\#][^'\"]+)(['\"])([^>]*>)/e", "'$1\"' . FEED_STATS::generate_clickthrough_url( '\\3' ) . '\"$5'", $content); 
    996996        }    
    997997         
    998998        return $content; 
     999    } 
     1000     
     1001    static function generate_clickthrough_url( $url ) { 
     1002        if ( strpos( $url, "//" ) === false ) { 
     1003            return $url; 
     1004        } 
     1005         
     1006        return esc_url( home_url( '/?feed-stats-url=' . base64_encode( $url ) ) ); 
    9991007    } 
    10001008     
Note: See TracChangeset for help on using the changeset viewer.