/**
  * Initiate tracking on display
  */
 function action_add_template_vars($theme)
 {
     static $set = false;
     if ($set == true || !is_object($theme->matched_rule) || $theme->matched_rule->action != 'display_post' || $theme->post->content_type != Post::type('link')) {
         return;
     }
     $post = $theme->post;
     $type = Traffum::TYPE_VIEW_NORMAL;
     if (Controller::get_var('refer') != null && Controller::get_var('refer') == 'atom') {
         $type = Traffum::TYPE_VIEW_ATOM;
     }
     Traffum::create(array('post_id' => $post->id, 'type' => $type));
     $set = true;
 }
 /**
  * static function create
  * Creates a traffum and saves it
  * @param array An associative array of traffum fields
  * $return Traffum The traffum object that was created
  **/
 static function create($paramarray)
 {
     $traffum = new Traffum($paramarray);
     $traffum->insert();
     return $traffum;
 }