function content_tag_filter_replace($matches)
 {
     $link_uri = substr($_SERVER["REQUEST_URI"], -20);
     switch (strtolower($matches[1])) {
         case 'pageviews':
             $data = new GADWidgetData(get_option('gad_auth_token'), get_option('gad_account_id'));
             if (isset($matches[3]) && trim($matches[3]) != '') {
                 return $data->gad_pageviews_sparkline($link_uri);
             } else {
                 return $data->gad_pageviews_text($link_uri);
             }
             break;
         default:
             return '';
     }
 }
 function widget($args, $instance)
 {
     extract($args);
     echo $before_widget;
     $link_uri = substr($_SERVER["REQUEST_URI"], -20);
     echo '<div>';
     switch ($instance['data_type']) {
         case 'pageviews-sparkline':
             $data = new GADWidgetData();
             echo $data->gad_pageviews_sparkline($link_uri);
             break;
         case 'pageviews-text':
             $data = new GADWidgetData();
             echo $data->gad_pageviews_text($link_uri);
             break;
     }
     echo '</div>';
     echo $after_widget;
 }