<?php

/*
  MailBeez Automatic Trigger Email Campaigns
  http://www.mailbeez.com

  Copyright (c) 2010, 2011 MailBeez

  inspired and in parts based on
  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License

  rewrite emails to add tracking code

  $ga = new analyticsCustom('parameter', 'source');
  $nInfo->content = $ga->rewriteContent($nInfo, 'content');

  // or
  $ga = new analyticsEconda($medium, $campaign, $source);
  $content = $ga->rewriteContent($content);
 */

///////////////////////////////////////////////////////////////////////////////
///																																					 //
///                 MailBeez Core file - do not edit                         //
///                                                                          //
///////////////////////////////////////////////////////////////////////////////

require_once(MH_DIR_FS_CATALOG . MH_ROOT_PATH . 'common/classes/analytics_base.php');


class analyticsCustom extends analyticsBase
{

// class constructor
    function __construct($parameter= null, $keyword = 'module')
    {
        parent::__construct();
        if (is_null($parameter)) {
            $parameter = mh_cfg('MAILBEEZ_MAILHIVE_ANALYTICS_CUSTOM_PARAMETER');
        }

        $this->parameter = $parameter;
        $this->buildCode();
        $this->rewrite_format = mh_cfg('MAILBEEZ_MAILHIVE_CUSTOM_REWRITE_FORMAT');
    }

    function buildCode()
    {

        // clean up input
        $array = array();
        parse_str(str_replace('?', '', $this->parameter), $array);
        $this->code = http_build_query($array);
    }

}
