99999) $afs_server = '1'; if ($afs_account > 199999) $afs_server = '2'; if ($afs_account > 299999) $afs_server = '3'; if ($afs_account > 399999) $afs_server = '4'; if ($afs_account > 499999) $afs_server = '5'; if ($afs_account > 599999) $afs_server = '6'; if ($afs_account > 699999) $afs_server = '7'; if ($afs_account > 799999) $afs_server = '8'; if ($afs_account > 899999) $afs_server = '9'; if ($afs_account > 999999) $afs_server = '10'; global $post; $postID = get_the_ID(); $trackerflag=0; if (!isset($trackername)) { $flagid=0; if (is_home()) { $trackername = get_bloginfo('name'); $trackerflag=1; } else { if (is_attachment ($postID)==false && is_page ($postID)==false && is_single ($postID)==false) { $trackerflag=0; } else { if (isset($post->ID)) { $postID = $post->ID; $trackername = get_post_meta($postID, "afstrackername", true); if (empty($trackername)) $trackername = $post->post_title;} $trackerflag=1; } } } if (empty($trackername)) $trackerflag=0; if ( $trackerflag==1) { $trackername = stripslashes($trackername); if (strpos($trackername, '|') !== FALSE) $trackername = strstr($trackername, '|'); } $trackername = addslashes($trackername); $trackername = trim($trackername); $autotrack_all= intval(get_option('afs_autotrack_all')); $autotrack_outbound= intval(get_option('afs_autotrack_outbound')); $autotrack_inside= intval(get_option('afs_autotrack_inside')); $autotrack_download= intval(get_option('afs_autotrack_download')); $autotrack_video= intval(get_option('afs_autotrack_video')); $autotrack_iframe= intval(get_option('afs_autotrack_iframe')); $afs_code ="\n"; $afs_code .="\n"; $afs_code .="\n"; print $afs_code; } function redirect_afs() { $account = get_option('afs_account'); $accesskey= get_option('afs_accesskey'); $faccess=0; if (empty($account) || intval($account)==0) { print "
"; print "

"; _e('You have to define the plugin settings! Settings -> AFS Analytics settings.','afs'); print "

"; print "
"; return; } print "
"; print "

"; _e('Please be patient, AFS Analytics is loading ...','afs'); print "

"; print "
"; print "

"; if (empty($accesskey)==true || $accesskey=="none" || $accesskey=="NULL" || $accesskey=="null" || $accesskey=="NONE") { print "AFS Analytics"; } else { print "AFS Analytics"; $faccess=1; } print "

"; print "\n\n"; } function add_trackerfield() { global $post; $postID = get_the_ID(); if ($postID!=false) { $trackername = stripslashes(get_post_meta($postID, "afstrackername", true)); print "
"; print ""; _e('AFS Analytics tracker name','afs'); //print ":  $postID"; print ": "; print ""; print "
"; } } function save_trackerfield() { global $post; $postID=get_the_ID(); if ($postID!=false) { if (isset($_POST['afstrackername'])) $tracker = addslashes($_POST['afstrackername']); else $tracker = addslashes($_POST['post_title']); if (empty($tracker)) $tracker = $post->post_title; if (!empty($tracker)) { if (!add_post_meta($postID, 'afstrackername', $tracker, true)) { update_post_meta($postID, 'afstrackername', $tracker); } } } } function plugin_menu() { $message = null; $message_updated = __("Data Saved!","afs"); $message_empty = __("Error: AFS website ID number must be a 8 digits! ","afs"); // update options if (!empty($_POST)) { if ($_POST['afs_account']) { $accountstr=$_POST['afs_account']; $accountstr=trim($accountstr); if (strcasecmp($accountstr,"NULL")==0) update_option('afs_account',""); else { $num=intval($accountstr); if ($num==0) $message = $message_empty; else { $accountstr=sprintf("%08d",$num); update_option('afs_account',$accountstr); $message = $message_updated; } } } if ($_POST['afs_accesskey']) { $accesskey=$_POST['afs_accesskey']; $accesskey=trim($accesskey); if (strcasecmp($accountstr,"NULL")==0) update_option('afs_accesskey',""); else update_option('afs_accesskey', $accesskey); } if (isset($_POST['autotrack_all'])) update_option('afs_autotrack_all',$_POST['autotrack_all']); if (isset($_POST['autotrack_outbound'])) update_option('afs_autotrack_outbound',$_POST['autotrack_outbound']); if (isset($_POST['autotrack_inside'])) update_option('afs_autotrack_inside',$_POST['autotrack_inside']); if (isset($_POST['autotrack_download'])) update_option('afs_autotrack_download',$_POST['autotrack_download']); if (isset($_POST['autotrack_video'])) update_option('afs_autotrack_video',$_POST['autotrack_video']); if (isset($_POST['autotrack_iframe'])) update_option('afs_autotrack_iframe',$_POST['autotrack_iframe']); wp_cache_flush(); } /* else { $message = $message_empty; //update_option('afs_account', ""); wp_cache_flush(); } */ ?>

\n"; ?>

"; _e('Click here','afs'); print " "; _e('to get a Website ID','afs'); print "
"; _e('2 - Type your Website ID into the Website ID field','afs'); print ".
"; _e("3 - Click on 'Update' button","afs"); print ".
"; _e('4 - AFS Analytics code will be inserted into the header','afs'); print ".
"; ?>

AFS Analytics Settings

Reset
AutoTrack (general settings)','afs');?>   
Outbound clicks tracking  
Inside clicks tracking  
Download tracking  
Video tracking  
iframe tracking  
Access Key(optional):','afs');?> Reset

"; _e('visible tracker','afs'); print ". "; _e('If you selected a visible tracker, you can specify exactly its location. You do this by adding this line:','afs'); print '<div id="afsanalytics"></div> '; _e('where you want it to show up.','afs'); ?>

Contact-us','afs');?>    AFS Analytics','afs');?>    DataSense','afs');?>