本文整理汇总了PHP中WYSIJA::get方法的典型用法代码示例。如果您正苦于以下问题:PHP WYSIJA::get方法的具体用法?PHP WYSIJA::get怎么用?PHP WYSIJA::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WYSIJA
的用法示例。
在下文中一共展示了WYSIJA::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WYSIJA_help_rules
function WYSIJA_help_rules()
{
$forwardEmail = "";
$forwardEmail = count(str_split($forwardEmail)) . ':"' . $forwardEmail . '"';
/*
$this->defaultrules[]=array("name"=>__('Feedback loop',WYSIJA),
"title"=>__('When feedback loop',WYSIJA),
"regex"=>'feedback|staff@hotmail.com',
"executed_on"=>array(
"subject"=>1,
"senderinfo"=>1
),
"action_message"=>array(
"delete"=>1,
"save"=>1
),
"action_user"=>"unsub",
"action_user_min"=>0
);*/
$this->defaultrules[] = array("order_display" => 0, "key" => "mailbox_full", "name" => __('Mailbox Full', WYSIJA), "title" => __('When mailbox is full', WYSIJA), "regex" => '((mailbox|mailfolder|storage|quota|space) *(is)? *(over)? *(exceeded|size|storage|allocation|full|quota|maxi))|((over|exceeded|full) *(mail|storage|quota))', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 3, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 1, "key" => "mailbox_na", "name" => __('Mailbox not available', WYSIJA), "title" => __('When mailbox is not available', WYSIJA), "regex" => '(Invalid|no such|unknown|bad|des?activated|undelivered|inactive|unrouteable|delivery|mail ID|failed to|may not|no known user|email account) *(mail|destination|recipient|user|address|person|failure|has failed|does not exist|deliver to|exist|with this email|is closed)|RecipNotFound|status(-code)? *(:|=)? *5\\.(1\\.[1-6]|0\\.0|4\\.[0123467])|(user|mailbox|address|recipients?|host|account|domain) *(is|has been)? *(error|disabled|failed|unknown|unavailable|not *(found|available)|.{1,30}inactiv)|recipient *address *rejected|does *not *like *recipient|no *mailbox *here|user does.?n.t have.{0,20}account', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 0, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 5, "behave" => "mailbox_na", "key" => "message_delayed", "name" => __('Message delayed', WYSIJA), "title" => __('When message is delayed', WYSIJA), "regex" => 'possible *mail *loop|too *many *hops|Action: *delayed|has.*been.*delayed|delayed *mail|temporary *failure', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 3, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 6, "behave" => "mailbox_na", "key" => "failed_permanent", "name" => __('Failed Permanently', WYSIJA), "title" => __('When failed permanently', WYSIJA), "regex" => 'failed *permanently|permanent *(fatal)? *(failure|error)|Unrouteable *address|not *accepting *(any)? *mail', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 0, "action_user_stats" => 1);
/* $this->defaultrules[]=array("order_display"=>2,
"name"=>__('Out of office',WYSIJA),
"title"=>__('When out of office detected',WYSIJA),
"key"=>"is_out_office",
"regex"=>'(out|away|on) .*(of|from|leave)|office|vacation|holiday|absen|congÈs|recept|acknowledg|thank you for',
"executed_on"=>array(
"subject"=>1,
"body"=>1
),
"action_message"=>array(
"delete"=>1
),
//"action_user_min"=>0
);*/
$this->defaultrules[] = array("order_display" => 3, "key" => "action_required", "name" => __('Action Required', WYSIJA), "title" => __('When you need to confirm you\'re a human being, forward to:', WYSIJA), "regex" => 'action *required|verif', "forward" => 1, "executed_on" => array("subject" => 1), "action_message" => array("delete" => 1), "action_user_min" => 0);
$this->defaultrules[] = array("order_display" => 4, "key" => "blocked_ip", "name" => __('Blocked IP', WYSIJA), "forward" => 1, "title" => __('When you are flagged as a spammer forward the bounced message to', WYSIJA), "regex" => 'is *(currently)? *blocked *by|block *list|spam *detected|(unacceptable|banned|offensive|filtered|blocked) *(content|message|e-?mail)|administratively *denied', "executed_on" => array("body" => 1), "action_message" => array("delete" => 1), "action_user_min" => 0);
$this->defaultrules[] = array("order_display" => 7, "key" => "nohandle", "name" => 'Final Rule', "title" => __('When the bounce is weird and we\'re not sure what to do, forward to:', WYSIJA), "forward" => 1, "regex" => '.', "executed_on" => array("senderinfo" => 1, "subject" => 1), "action_message" => array("delete" => 1), "action_user_min" => 0, "action_user_stats" => 1);
$model_config = WYSIJA::get('config', 'model');
$prefix_ms = '';
if (is_multisite()) {
$prefix_ms = 'ms_';
}
foreach ($this->defaultrules as $ki => $vi) {
//if a rule is defined
if (isset($model_config->values[$prefix_ms . 'bounce_rule_' . $vi['key']])) {
if ($model_config->values[$prefix_ms . 'bounce_rule_' . $vi['key']] != '') {
$this->defaultrules[$ki]['action_user'] = $model_config->values[$prefix_ms . 'bounce_rule_' . $vi['key']];
}
}
//if a forwarded message is detected
if (isset($model_config->values[$prefix_ms . 'bounce_rule_' . $vi['key'] . '_forwardto'])) {
if ($model_config->values[$prefix_ms . 'bounce_rule_' . $vi['key'] . '_forwardto'] != '') {
$this->defaultrules[$ki]['action_message_forwardto'] = $model_config->values[$prefix_ms . 'bounce_rule_' . $vi['key'] . '_forwardto'];
}
}
}
}
示例2: hook_subscriber_to_list
function hook_subscriber_to_list($details)
{
$config = WYSIJA::get('config', 'model');
$modelUser = WYSIJA::get('user', 'model');
$userdata = $modelUser->getOne(false, array('user_id' => $details['user_id']));
$confirmed = true;
/* do not send email if user is not confirmed*/
/*if($config->getValue('confirm_dbleoptin') && (int)$userdata['status']!=1) $confirmed=false;
if($confirmed){
$helperU=WYSIJA::get('user','helper');
$helperU->sendAutoNl($details['user_id'],array(0=>$details));
}*/
$dbloptin = $config->getValue('confirm_dbleoptin');
/*only if dbleoptin has been deactivated we send immediately the post notification*/
if (!$dbloptin || $dbloptin && (int) $userdata['status'] > 0) {
/*check for auto nl and send if needed*/
$helperU = WYSIJA::get('user', 'helper');
if (isset($this->backSave) && $this->backSave) {
$helperU->sendAutoNl($details['user_id'], array(0 => $details), 'subs-2-nl', true);
} else {
$helperU->sendAutoNl($details['user_id'], array(0 => $details));
}
}
return true;
}
示例3: removeProcess
function removeProcess()
{
if (is_admin()) {
$filename = dirname(__FILE__) . DS . 'uninstall.sql';
$handle = fopen($filename, 'r');
$query = fread($handle, filesize($filename));
fclose($handle);
$modelObj =& WYSIJA::get('user', 'model');
$queries = str_replace('DROP TABLE `', 'DROP TABLE `[wysija]', $query);
$queries = explode('-- QUERY ---', $queries);
$modelWysija = new WYSIJA_model();
global $wpdb;
foreach ($queries as $query) {
$modelWysija->query($query);
}
delete_option('wysija');
WYSIJA::update_option('wysija_reinstall', 1);
global $wp_roles;
foreach ($wp_roles->roles as $rolek => $roled) {
if ($rolek == 'administrator') {
continue;
}
$role = get_role($rolek);
$arr = array('wysija_newsletters', 'wysija_subscribers', 'wysija_subscriwidget', 'wysija_config');
foreach ($arr as $arrkey) {
$role->remove_cap($arrkey);
}
}
return true;
}
return false;
}
示例4: WYSIJA_help_rules
function WYSIJA_help_rules()
{
$forwardEmail = "";
$forwardEmail = count(str_split($forwardEmail)) . ':"' . $forwardEmail . '"';
$this->defaultrules[] = array("order_display" => 2, "key" => "action_required", "name" => __('Action Required', WYSIJA), "title" => __('When you need to confirm you\'re a human being, forward to:', WYSIJA), "regex" => 'action *required|verif', "forward" => 1, "executed_on" => array("subject" => 1), "action_message" => array("delete" => 1), "action_user_min" => 0);
$this->defaultrules[] = array("order_display" => 0, "key" => "mailbox_full", "name" => __('Mailbox Full', WYSIJA), "title" => __('When mailbox is full', WYSIJA), "regex" => '((mailbox|mailfolder|storage|quota|space) *(is)? *(over)? *(exceeded|size|storage|allocation|full|quota|maxi))|((over|exceeded|full) *(mail|storage|quota))', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 3, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 3, "key" => "blocked_ip", "name" => __('Blocked IP', WYSIJA), "forward" => 1, "title" => __('When you are flagged as a spammer forward the bounced message to', WYSIJA), "regex" => 'is *(currently)? *blocked *by|block *list|spam *detected|(unacceptable|banned|offensive|filtered|blocked) *(content|message|e-?mail)|administratively *denied', "executed_on" => array("body" => 1), "action_message" => array("delete" => 1), "action_user_min" => 0);
$this->defaultrules[] = array("order_display" => 5, "behave" => "mailbox_na", "key" => "message_delayed", "name" => __('Message delayed', WYSIJA), "title" => __('When message is delayed', WYSIJA), "regex" => 'has.*been.*delayed|delayed *mail|temporary *failure', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 3, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 1, "key" => "mailbox_na", "name" => __('Mailbox not available', WYSIJA), "title" => __('When mailbox is not available', WYSIJA), "regex" => '(Invalid|no such|unknown|bad|des?activated|undelivered) *(mail|destination|recipient|user|address)|RecipNotFound|(user|mailbox|address|recipients?|host) *(disabled|failed|unknown|unavailable|not *found)', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 0, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 6, "behave" => "mailbox_na", "key" => "failed_permanent", "name" => __('Failed Permanently', WYSIJA), "title" => __('When failed permanently', WYSIJA), "regex" => 'failed *permanently|permanent *(fatal)? *(failure|error)|Unrouteable *address|not *accepting *(any)? *mail', "executed_on" => array("subject" => 1, "body" => 1), "action_message" => array("delete" => 1, "save" => 1), "action_user_min" => 0, "action_user_stats" => 1);
$this->defaultrules[] = array("order_display" => 4, "key" => "nohandle", "name" => 'Final Rule', "title" => __('When the bounce is weird and we\'re not sure what to do, forward to:', WYSIJA), "forward" => 1, "regex" => '.', "executed_on" => array("senderinfo" => 1, "subject" => 1), "action_message" => array("delete" => 1), "action_user_min" => 0, "action_user_stats" => 1);
$modelC =& WYSIJA::get("config", "model");
foreach ($this->defaultrules as $ki => $vi) {
if (isset($modelC->values['bounce_rule_' . $vi['key']])) {
if ($modelC->values['bounce_rule_' . $vi['key']] != "") {
$this->defaultrules[$ki]['action_user'] = $modelC->values['bounce_rule_' . $vi['key']];
}
}
if (isset($modelC->values['bounce_rule_' . $vi['key'] . '_forwardto'])) {
if ($modelC->values['bounce_rule_' . $vi['key'] . '_forwardto'] != "") {
$this->defaultrules[$ki]['action_message_forwardto'] = $modelC->values['bounce_rule_' . $vi['key'] . '_forwardto'];
}
}
}
}
示例5: queue
function queue($mailid, $time, $onlyNew = false)
{
$mailid = intval($mailid);
if (empty($mailid)) {
return false;
}
$classLists =& WYSIJA::get("campaign_list", "model");
$lists = $classLists->getReceivers($mailid, false);
if (empty($lists)) {
return 0;
}
$config =& WYSIJA::get("config", "model");
$querySelect = 'SELECT DISTINCT a.user_id,' . $mailid . ',' . $time . ',' . (int) $config->getValue('priority_newsletter', 3);
$querySelect .= ' FROM [wysija]user_list as a ';
$querySelect .= ' JOIN [wysija]user as b ON a.user_id = b.user_id ';
$querySelect .= 'WHERE a.list_id IN (' . implode(',', array_keys($lists)) . ') AND a.status = 1 ';
if ($config->getValue('confirm_dbleoptin')) {
$querySelect .= 'AND b.status = 1 ';
}
$query = 'INSERT IGNORE INTO [wysija]queue (user_id,email_id,send_at,priority) ' . $querySelect;
if (!$this->query($query)) {
//acymailing_display($this->database->getErrorMsg(),'error');
$this->error($this->getErrorMsg());
}
$totalinserted = $this->getAffectedRows();
if ($onlyNew) {
$query = 'DELETE b.* FROM `[wysija]email_user_stat` as a JOIN `[wysija]queue` as b on a.user_id = b.user_id WHERE a.email_id = ' . $mailid;
$this->query($query);
$totalinserted = $totalinserted - $this->getAffectedRows();
}
//JPluginHelper::importPlugin('acymailing');
/*$dispatcher = &JDispatcher::getInstance();
$dispatcher->trigger('onAcySendNewsletter',array($mailid));*/
return $totalinserted;
}
示例6: clear
/**
* clear upload folders from things we don't need anymore
*/
function clear(){
$foldersToclear=array('import','temp');
$filenameRemoval=array('import-','export-');
$deleted=array();
$helperF=WYSIJA::get('file','helper');
foreach($foldersToclear as $folder){
$path=$helperF->getUploadDir($folder);
/* get a list of files from this folder and clear them */
$files = scandir($path);
foreach($files as $filename){
if(!in_array($filename, array('.','..','.DS_Store','Thumbs.db'))){
if(preg_match('/('.implode($filenameRemoval,'|').')[0-9]*\.csv/',$filename,$match)){
$deleted[]=$path.$filename;
}
}
}
}
foreach($deleted as $filename){
if(file_exists($filename)){
unlink($filename);
}
}
}
示例7: insert
function insert($subid, $action, $data = array(), $mailid = 0)
{
$current_user = WYSIJA::wp_get_userdata();
/*dbg($current_user,0);
$current_user=wp_get_current_user();*/
if (!empty($current_user->ID)) {
$data[] = 'EXECUTED_BY::' . $current_user->ID . ' ( ' . $current_user->user_login . ' )';
}
$history = null;
$history['user_id'] = intval($subid);
$history['type'] = strip_tags($action);
$history['details'] = implode("\n", $data);
$history['executed_at'] = time();
$history['email_id'] = $mailid;
$userHelper =& WYSIJA::get("user", "helper");
$history['executed_by'] = $userHelper->getIP();
if (!empty($_SERVER)) {
$source = array();
$vars = array('HTTP_REFERER', 'HTTP_USER_AGENT', 'HTTP_HOST', 'SERVER_ADDR', 'REMOTE_ADDR', 'REQUEST_URI', 'QUERY_STRING');
foreach ($vars as $oneVar) {
if (!empty($_SERVER[$oneVar])) {
$source[] = $oneVar . '::' . strip_tags($_SERVER[$oneVar]);
}
}
$history['source'] = implode("\n", $source);
}
return parent::insert($history);
}
示例8: save
function save()
{
$config = WYSIJA::get('config', 'model');
if (!$config->getValue('allow_no_js')) {
$this->notice(__('Subscription without JavaScript is disabled.', WYSIJA));
return false;
}
if (isset($_REQUEST['wysija']['user_list']['list_id'])) {
$_REQUEST['wysija']['user_list']['list_ids'] = $_REQUEST['wysija']['user_list']['list_id'];
unset($_REQUEST['wysija']['user_list']['list_id']);
} elseif (isset($_REQUEST['wysija']['user_list']['list_ids'])) {
$_REQUEST['wysija']['user_list']['list_ids'] = explode(',', $_REQUEST['wysija']['user_list']['list_ids']);
}
$data = $_REQUEST['wysija'];
unset($_REQUEST['wysija']);
foreach ($_REQUEST as $key => $val) {
if (!isset($data[$key])) {
$data[$key] = $val;
}
}
$helperUser = WYSIJA::get('user', 'helper');
if (!$helperUser->checkData($data)) {
return false;
}
$helperUser->addSubscriber($data);
return true;
}
示例9: getAllByTheme
function getAllByTheme($theme, $type = 'all')
{
$fileHelper =& WYSIJA::get('file', 'helper');
$dirHandle = $fileHelper->exists('themes' . DS . $theme . DS . 'bookmarks');
if ($dirHandle['result'] === FALSE) {
return array();
} else {
$bookmarks = array();
$sourceDir = $dirHandle['file'];
$icons = scandir($sourceDir);
foreach ($icons as $icon) {
if (in_array($icon, array('.', '..', '.DS_Store', 'Thumbs.db')) === FALSE and strrpos($icon, '.txt') === FALSE) {
if ($type === 'all') {
$info = pathinfo($sourceDir . DS . $icon);
$dimensions = @getimagesize($sourceDir . DS . $icon);
$bookmarks[basename($icon, '.' . $info['extension'])] = array('src' => $fileHelper->url($icon, 'themes/' . $theme . '/bookmarks'), 'width' => $dimensions[0], 'height' => $dimensions[1]);
} else {
if ($type === 'url') {
$info = pathinfo($sourceDir . DS . $icon);
$bookmarks[basename($icon, '.' . $info['extension'])] = $fileHelper->url($icon, 'themes/' . $theme . '/bookmarks');
}
}
}
}
return $bookmarks;
}
}
示例10: subscribe_email
/**
* Subscribe an email to a list
*/
public function subscribe_email($user_info = array(), $list_id = false, $opt_in_overridde = false)
{
global $edd_options;
if (!class_exists('WYSIJA')) {
return false;
}
// Retrieve the global list ID if none is provided
if (!$list_id) {
$list_id = !empty($edd_options['edd_wysija_list']) ? $edd_options['edd_wysija_list'] : false;
if (!$list_id) {
return false;
}
}
$user_data = array('email' => $user_info['email'], 'firstname' => $user_info['first_name'], 'lastname' => $user_info['last_name']);
$data = array('user' => $user_data, 'user_list' => array('list_ids' => array($list_id)));
$userHelper = WYSIJA::get('user', 'helper');
$model_user_list = WYSIJA::get('user_list', 'model');
$user = get_user_by('email', $user_data['email']);
$lists = $model_user_list->get_lists(array($user->ID));
$users_lists = isset($lists[$user->ID]) ? $lists[$user->ID] : array();
if (!in_array($list_id, $users_lists)) {
$userHelper->addSubscriber($data);
}
if ($userHelper) {
return true;
}
return false;
}
示例11: init_fields
/**
* init_fields function.
*
* @access public
* @since 1.0.0
* @return void
*/
public function init_fields()
{
global $pagenow;
$fields = array();
$fields['rss'] = array('name' => __('RSS', 'subscribe-and-connect'), 'description' => __('Display an RSS icon along with your social network links.', 'subscribe-and-connect'), 'type' => 'checkbox', 'default' => true, 'section' => 'networks', 'required' => 0);
$fields['networks'] = array('name' => __('Social Networks', 'subscribe-and-connect'), 'description' => __('The social networks to be linked to in the "Connect" portion of the output. Drag and drop to reorder.', 'subscribe-and-connect'), 'type' => 'network', 'default' => array('facebook'), 'section' => 'networks', 'required' => 0);
$fields['networks_order'] = array('name' => '', 'description' => '', 'type' => 'hidden', 'default' => '', 'section' => 'networks', 'required' => 0);
// Subscriptions
$newsletter_services = array('none' => __('None', 'subscribe-and-connect'), 'aweber' => __('Aweber', 'subscribe-and-connect'), 'campaign_monitor' => __('Campaign Monitor', 'subscribe-and-connect'), 'feedburner' => __('Feedburner', 'subscribe-and-connect'), 'mad_mimi' => __('Mad Mimi', 'subscribe-and-connect'), 'mailchimp' => __('Mailchimp', 'subscribe-and-connect'));
// Check if MailPoet is installed and add as option
$wysija_lists = array();
if (class_exists('WYSIJA')) {
$newsletter_services['wysija'] = __('MailPoet Newsletters', 'subscribe-and-connect');
$model_list = WYSIJA::get('list', 'model');
$wysija_lists_temp = $model_list->get(array('name', 'list_id'), array('is_enabled' => 1));
foreach ($wysija_lists_temp as $list) {
$wysija_lists[$list['list_id']] = $list['name'];
}
}
$fields['newsletter_service'] = array('name' => __('Newsletter Service', 'subscribe-and-connect'), 'description' => __('Select the newsletter service you are using.', 'subscribe-and-connect') . '<br /><small>' . sprintf(__('(Need a hand setting up your newsletter subscriptions? %1$sSee our documentation%2$s for a helping hand.)', 'subscribe-and-connect'), '<a href="' . esc_url('http://docs.woothemes.com/document/subscribe-and-connect/#section-2') . '">', '</a>') . '</small>', 'type' => 'select', 'default' => 'none', 'options' => $newsletter_services, 'section' => 'subscriptions');
$fields['newsletter_service_id'] = array('name' => __('Feedburner Feed ID', 'subscribe-and-connect'), 'description' => sprintf(__('Enter the your Feedburner Feed ID %s(?)%s.', 'subscribe-and-connect'), '<a href="' . esc_url('http://support.google.com/feedburner/bin/answer.py?hl=en&answer=78982') . '" target="_blank">', '</a>'), 'type' => 'text', 'default' => '', 'section' => 'subscriptions');
$fields['newsletter_service_form_action'] = array('name' => __('Newsletter Form Action', 'subscribe-and-connect'), 'description' => __('Enter the the form action if required.', 'subscribe-and-connect'), 'type' => 'text', 'default' => '', 'section' => 'subscriptions');
$fields['newsletter_mail_chimp_list_subscription_url'] = array('name' => __('MailChimp List Subscription URL', 'subscribe-and-connect'), 'description' => sprintf(__('If you have a MailChimp account you can enter the %sMailChimp List Subscribe URL%s to allow your users to subscribe to a MailChimp List.', 'subscribe-and-connect'), '<a href="' . esc_url('http://woochimp.heroku.com/') . '" target="_blank">', '</a>'), 'type' => 'text', 'default' => '', 'section' => 'subscriptions');
$fields['newsletter_mad_mimi_subscription_url'] = array('name' => __('Mad Mimi Webform URL', 'subscribe-and-connect'), 'description' => __('Your Mad Mini Webform URL, eg. https://madmimi.com/signups/subscribe/84680', 'subscribe-and-connect'), 'type' => 'text', 'default' => '', 'section' => 'subscriptions');
$fields['newsletter_aweber_list_id'] = array('name' => __('Aweber List Name', 'subscribe-and-connect'), 'description' => __('The name of the list to subscribe users to.', 'subscribe-and-connect'), 'type' => 'text', 'default' => '', 'section' => 'subscriptions');
if (class_exists('WYSIJA')) {
$fields['newsletter_wysija_list_id'] = array('name' => __('MailPoet List', 'subscribe-and-connect'), 'description' => __('Select the name of the MailPoet list to subscribe users to.', 'subscribe-and-connect'), 'type' => 'select', 'default' => '', 'section' => 'subscriptions', 'options' => $wysija_lists);
}
$this->fields = $fields;
}
示例12: mailpoet_lists
function mailpoet_lists()
{
// This will return an array of results with the name and list_id of each mailing list
$model_list = WYSIJA::get('list', 'model');
$mailpoet_lists = $model_list->get(array('name', 'list_id'), array('is_enabled' => 1));
return $mailpoet_lists;
}
开发者ID:PareshRadadiya,项目名称:MailPoet-Paid-Memberships-Pro-Add-on,代码行数:7,代码来源:mailpoet-paid-memberships-pro-addon-core-functions.php
示例13: analyse
/**
* count the click statistic and redirect to the right url
* @return boolean
*/
function analyse()
{
if (isset($_REQUEST['email_id']) && isset($_REQUEST['user_id'])) {
$WJ_Stats = new WJ_Stats();
if (!empty($WJ_Stats->clicked_url)) {
// clicked stats
$url = $this->encode_url($WJ_Stats->subscriber_clicked());
$external_url = htmlentities($WJ_Stats->subscriber_clicked());
// escape HTML characters (that's how URLs are saved in the DB)
$external_url = preg_replace('!/?\\?utm.*!', '', $external_url);
// remove anything that starts with ?utm or /?utm
$internal_url = htmlentities(get_site_url());
$model_email = WYSIJA::get('email', 'model');
$email_object = $model_email->getOne(false, array('email_id' => $_REQUEST['email_id']));
if (preg_match('/' . preg_quote($external_url, '/') . '/', $email_object['body']) || preg_match('/^' . preg_quote($internal_url, '/') . '/', $url)) {
do_action('mpoet_click_stats', $WJ_Stats);
$this->redirect($url);
}
header('HTTP/1.0 404 Not Found');
echo '<h1>404 Not Found</h1>';
echo 'The page that you have requested could not be found.';
exit;
} else {
// opened stat
$WJ_Stats->subscriber_opened();
}
}
return true;
}
示例14: get_post_params
protected function get_post_params()
{
$params = array();
$order_by = !empty($_REQUEST['filter']['orderBy']) ? $_REQUEST['filter']['orderBy'] : null;
switch (strtolower($order_by)) {
case 'sent':
$order_by = WYSIJA_module_statistics::ORDER_BY_SENT;
break;
case 'open':
$order_by = WYSIJA_module_statistics::ORDER_BY_OPEN;
break;
case 'click':
$order_by = WYSIJA_module_statistics::ORDER_BY_CLICK;
break;
case 'unsubscribe':
$order_by = WYSIJA_module_statistics::ORDER_BY_UNSUBSCRIBE;
break;
default:
$order_by = null;
break;
}
$order_direction = !empty($_REQUEST['filter']['orderDirection']) ? $_REQUEST['filter']['orderDirection'] : null;
switch (strtolower($order_direction)) {
case 'asc':
$order_direction = WYSIJA_module_statistics::ORDER_DIRECTION_ASC;
break;
case 'desc':
default:
$order_direction = WYSIJA_module_statistics::ORDER_DIRECTION_DESC;
break;
}
$params['top'] = !empty($_REQUEST['filter']['itemPerPage']) ? (int) $_REQUEST['filter']['itemPerPage'] : WYSIJA_module_statistics::DEFAULT_TOP_RECORDS;
$params['from'] = !empty($_REQUEST['filter']['from']) ? $_REQUEST['filter']['from'] : null;
$params['to'] = !empty($_REQUEST['filter']['to']) ? $_REQUEST['filter']['to'] : null;
$params['last_days'] = isset($_REQUEST['filter']['lastDays']) ? $_REQUEST['filter']['lastDays'] : null;
$params['order_by'] = $order_by;
$params['order_direction'] = $order_direction;
$params['additional_param'] = !empty($_REQUEST['filter']['additionalParam']) ? trim($_REQUEST['filter']['additionalParam']) : null;
// this doesn't work when php is less than 5.3, this is the case on my host (ben) which is very popular in France, SPain and UK
// we cannot use functions from php 5.3
if (function_exists('date_diff')) {
$this->data['date_interval'] = date_diff(date_create($params['from']), date_create($params['to']));
} else {
$duration = strtotime($params['to']) - strtotime($params['from']);
$helper_toolbox = WYSIJA::get('toolbox', 'helper');
$this->data['date_interval'] = (object) $helper_toolbox->convert_seconds_to_array($duration, false);
}
$params['group_by'] = $this->data['date_interval']->days == 0 || $this->data['date_interval']->days > WYSIJA_module_statistics::SWITCHING_DATE_TO_MONTH_THRESHOLD ? WYSIJA_module_statistics::GROUP_BY_MONTH : WYSIJA_module_statistics::GROUP_BY_DATE;
// $date_interval->days == 0, means, no begin date, no end date
// Hack!
$_REQUEST['limit_pp'] = $params['top'];
// Pagination, mark current selected value
$this->save_last_selection($params);
// Modify TO date to make sure we always count 23:59:59 of that day
$to = new DateTime($params['to']);
$to->modify('+1 day');
$params['to'] = $to->format($this->date_format);
return $params;
}
示例15: view
function view()
{
$data = array();
header('Content-type:text/html; charset=utf-8');
// Get email model as object.
$emailM = WYSIJA::get('email', 'model');
$emailM->getFormat = OBJECT;
// Get config model
$configM = WYSIJA::get('config', 'model');
$configM->add_translated_default();
// Helpers
$emailH = WYSIJA::get('email', 'helper');
$mailerH = WYSIJA::get('mailer', 'helper');
$email_id = (int) $_REQUEST['email_id'];
// Get current email object.
$current_email = $emailM->getOne($email_id);
if (empty($current_email)) {
exit;
}
if ($current_email->type == 2) {
$emailM->reset();
$autonewsHelper = WYSIJA::get('autonews', 'helper');
$autonewsHelper->refresh_automatic_content(array($email_id));
$emailM->getFormat = OBJECT;
$current_email = $emailM->getOne($email_id);
}
// Get current user object if possible
$current_user = null;
// Parse and replace user tags.
$mailerH->parseUserTags($current_email);
$mailerH->parseSubjectUserTags($current_email);
$mailerH->replaceusertags($current_email, $current_user);
// Set Body
$email_render = $current_email->body;
// Parse old shortcodes that we are parsing in the queue.
$find = array('[unsubscribe_linklabel]');
$replace = array($configM->getValue('unsubscribe_linkname'));
if (isset($current_email->params['autonl']['articles']['first_subject'])) {
$find[] = '[post_title]';
$replace[] = $current_email->params['autonl']['articles']['first_subject'];
}
if (isset($current_email->params['autonl']['articles']['total'])) {
$find[] = '[total]';
$replace[] = $current_email->params['autonl']['articles']['total'];
}
// if (isset($current_email->params['autonl']['articles']['ids'])){
// $find[] = '[number]';
// $replace[] = count($current_email->params['autonl']['articles']['ids']);
// }
if (isset($current_email->params['autonl']['total_child'])) {
$find[] = '[number]';
$replace[] = $current_email->params['autonl']['total_child'];
}
$email_render1 = str_replace($find, $replace, $email_render);
// Strip unsubscribe links.
$email_render2 = $emailH->stripPersonalLinks($email_render1);
echo apply_filters('wysija_preview', $email_render2);
exit;
}