Пример #1
0
 protected function get_request()
 {
     $valid_params = array('lang', 'rev', 'reset', 'send', 'send_campaign', 'send_test', 'production', 'get_subscriber_count', 'update_send_time', 'update_cache', 'price', 'upload', 'split');
     if (is_array($_GET)) {
         if (array_key_exists('campaignName', $_GET)) {
             echo $this->config['campaign_name_human_readable'];
             exit;
         }
         if (array_key_exists('campaignSubject', $_GET)) {
             $domain = isset($_GET['lang']) ? $_GET['lang'] : 'en';
             echo _e(array('text' => 'title', 'section' => 'html_title', 'domain' => strtoupper($domain)));
             exit;
         }
         if (array_key_exists('campaignFolder', $_GET)) {
             $edm = new MC_edm($this->config);
             echo basename($edm->get_cdn_location());
             exit;
         }
         if (array_key_exists('campaignSchedule', $_GET)) {
             $this->simple_campaign_table('EN', 'test');
         }
         if (array_key_exists('lang', $_GET)) {
             $get_lang = strtoupper($_GET['lang']);
             if (in_array($get_lang, $this->config['languages'])) {
                 $lang = i18n::get_instance();
                 $lang->set_domain($get_lang);
             }
         } else {
             $get_lang = 'EN';
         }
         if (array_key_exists('rev', $_GET)) {
             $this->mc_edm = new MC_edm($this->config);
             $this->mc_edm->increment_all_image_filenames();
         }
         if (array_key_exists('reset', $_GET)) {
             $this->mc_edm = new MC_edm($this->config);
             $this->mc_edm->reset_all_filenames();
         }
         if (array_key_exists('send', $_GET)) {
             $lang = $get_lang ? $get_lang : 'EN';
             $sendto = $_GET['send'] == '' ? 'test' : $_GET['send'];
             $this->create_campaign($lang, $sendto);
         }
         // if ( array_key_exists( 'test', $_GET ) ) {
         // 	$lang = $get_lang ? $get_lang : 'EN';
         // 	$this->mc_edm = new MC_edm( $this->config );
         // 	$html = $this->get_file( $this->host . "?lang={$lang}&production" );
         // 	$this->mc_edm->send_test_mail( $html );
         // }
         if (array_key_exists('get_subscriber_count', $_GET)) {
             $this->get_subscriber_count();
         }
         if (array_key_exists('update_send_time', $_GET)) {
             $this->update_send_time();
         }
         if (array_key_exists('send_campaign', $_GET)) {
             $this->send_campaign();
         }
         if (array_key_exists('send_test', $_GET)) {
             $this->send_test();
         }
         if (array_key_exists('update_cache', $_GET)) {
             $this->update_cache();
         }
         if (array_key_exists('price', $_GET)) {
             $this->generate_prices();
         }
         if (array_key_exists('upload', $_GET)) {
             $this->mc_edm = new MC_edm($this->config);
             $this->upload_image_dir();
         }
         foreach ($_GET as $key => $value) {
             if (!in_array($key, $valid_params)) {
                 echo 'EXIT - ' . $key . " is not a valid parameter\n";
                 exit;
             }
         }
     }
 }
Пример #2
0
function _e_tracking($section = 'product', $extra_params = array())
{
    global $mc_edm_config;
    $lang = i18n::get_instance();
    $campaign = $mc_edm_config['campaign_name'];
    $database = 'database-' . strtolower(_e_get_domain());
    $section = $section == 'product' ? $lang->get_section() : $section;
    $year = substr($mc_edm_config['launch_date'], 0, 4);
    $extra = '';
    if ($extra_params) {
        $extra = '&' . http_build_query($extra_params, '', '&');
    }
    $content = "?utm_campaign={$campaign}_{$year}&utm_medium=email&utm_source={$database}&utm_content={$section}{$extra}";
    return $content;
}