Example #1
1
            fn_em_delete_subscribers((array) $_REQUEST['subscriber_id']);
        }
        $suffix = '.manage';
    }
    if ($mode == 'sync') {
        EmailSync::instance()->sync();
        $suffix = '.manage';
    }
    if ($mode == 'import') {
        EmailSync::instance()->import();
        $suffix = '.manage';
    }
    return array(CONTROLLER_STATUS_OK, 'em_subscribers' . $suffix);
}
if ($mode == 'manage') {
    list($subscribers, $search) = fn_em_get_subscribers($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
    // Get settings
    $em_settings = array();
    foreach (fn_em_get_managable_settings() as $option) {
        $option_data = Settings::instance()->getSettingDataByName($option);
        $em_settings[$option_data['object_id']] = $option_data;
    }
    Tygh::$app['view']->assign('em_settings', $em_settings);
    Tygh::$app['view']->assign('em_support', EmailSync::instance()->supports());
    Tygh::$app['view']->assign('subscribers', $subscribers);
    Tygh::$app['view']->assign('search', $search);
}
function fn_em_get_managable_settings()
{
    return array('em_show_on_checkout', 'em_checkout_enabled', 'em_double_opt_in', 'em_welcome_letter');
}
function fn_settings_variants_addons_email_marketing_em_madmimi_list()
{
    if (Registry::get('addons.email_marketing.status') == 'A' && Registry::get('addons.email_marketing.em_madmimi_api_key')) {
        return EmailSync::instance('madmimi')->getLists();
    }
    return array('' => __('email_marketing.enter_api_key_and_save'));
}
Example #3
0
function fn_em_exim_sync($primary_object_ids, $import_data, $auth)
{
    foreach ($import_data as $data) {
        $data = array_pop($data);
        // remove index with language code
        if (empty($data['timestamp'])) {
            $data['timestamp'] = fn_timestamp_to_date(time());
        }
        EmailSync::instance()->batchAdd(array('email' => $data['email'], 'name' => $data['name'], 'timestamp' => fn_date_to_timestamp($data['timestamp']), 'lang_code' => !empty($data['lang_code']) ? $data['lang_code'] : CART_LANGUAGE, 'ip_address' => !empty($data['ip_address']) ? $data['ip_address'] : ''));
    }
    EmailSync::instance()->batchSubscribe();
}
<?php

/***************************************************************************
*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\EmailSync;
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
if ($mode == 'process') {
    if (!empty($_REQUEST['token']) && $_REQUEST['token'] == Registry::get('addons.email_marketing.em_token')) {
        EmailSync::instance()->processWebHook($_REQUEST);
    }
    exit;
}
    }
    return array(CONTROLLER_STATUS_OK, 'em_subscribers' . $suffix);
}
if ($mode == 'manage') {
    list($subscribers, $search) = fn_em_get_subscribers($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
    // Get settings
    $em_settings = array();
    foreach (fn_em_get_managable_settings() as $option) {
        $option_data = Settings::instance()->getSettingDataByName($option);
        $em_settings[$option_data['object_id']] = $option_data;
    }
    Registry::get('view')->assign('em_settings', $em_settings);
    Registry::get('view')->assign('em_support', EmailSync::instance()->supports());
    Registry::get('view')->assign('subscribers', $subscribers);
    Registry::get('view')->assign('search', $search);
} elseif ($mode == 'delete') {
    if (!empty($_REQUEST['subscriber_id'])) {
        fn_em_delete_subscribers((array) $_REQUEST['subscriber_id']);
    }
    return array(CONTROLLER_STATUS_OK, "em_subscribers.manage");
} elseif ($mode == 'sync') {
    EmailSync::instance()->sync();
    return array(CONTROLLER_STATUS_OK, "em_subscribers.manage");
} elseif ($mode == 'import') {
    EmailSync::instance()->import();
    return array(CONTROLLER_STATUS_OK, "em_subscribers.manage");
}
function fn_em_get_managable_settings()
{
    return array('em_show_on_checkout', 'em_checkout_enabled', 'em_double_opt_in', 'em_welcome_letter');
}
Example #6
0
            fn_em_delete_subscribers((array) $_REQUEST['subscriber_id']);
        }
        $suffix = '.manage';
    }
    if ($mode == 'sync') {
        EmailSync::instance()->sync();
        $suffix = '.manage';
    }
    if ($mode == 'import') {
        EmailSync::instance()->import();
        $suffix = '.manage';
    }
    return array(CONTROLLER_STATUS_OK, 'em_subscribers' . $suffix);
}
if ($mode == 'manage') {
    list($subscribers, $search) = fn_em_get_subscribers($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
    // Get settings
    $em_settings = array();
    foreach (fn_em_get_managable_settings() as $option) {
        $option_data = Settings::instance()->getSettingDataByName($option);
        $em_settings[$option_data['object_id']] = $option_data;
    }
    Registry::get('view')->assign('em_settings', $em_settings);
    Registry::get('view')->assign('em_support', EmailSync::instance()->supports());
    Registry::get('view')->assign('subscribers', $subscribers);
    Registry::get('view')->assign('search', $search);
}
function fn_em_get_managable_settings()
{
    return array('em_show_on_checkout', 'em_checkout_enabled', 'em_double_opt_in', 'em_welcome_letter');
}