本文整理汇总了PHP中SendPress_Option类的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Option类的具体用法?PHP SendPress_Option怎么用?PHP SendPress_Option使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SendPress_Option类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$_POST['post_type'] = SendPress_Data::email_post_type();
// Update post 37 (37!)
$my_post = _wp_translate_postdata(true);
$system_emails = SendPress_Option::base_get('system-emails');
$my_post['post_status'] = 'sp-systememail';
$my_post['post_content'] = SendPress_Data::get_sysemail_content($_POST['email_type']);
// Update the post into the database
wp_update_post($my_post);
update_post_meta($my_post['ID'], '_sendpress_subject', $_POST['post_subject']);
update_post_meta($my_post['ID'], '_sendpress_template', $_POST['template']);
update_post_meta($my_post['ID'], '_sendpress_status', 'private');
update_post_meta($my_post['ID'], '_sendpress_system', 'new');
update_post_meta($my_post['ID'], '_system_email_type', $_POST['email_type']);
update_post_meta($my_post['ID'], '_system_default', $_POST['default']);
if ($_POST['default']) {
//set default system e-mail for this type
SendPress_Data::set_system_email_default($my_post['ID'], $_POST['email_type']);
}
SendPress_Email::set_default_style($my_post['ID']);
//clear the cached file.
delete_transient('sendpress_email_html_' . $my_post['ID']);
if (!in_array($_POST['email_type'], $system_emails)) {
$system_emails[] = $_POST['email_type'];
}
SendPress_Option::base_set('system-emails', $system_emails);
SendPress_Admin::redirect('Settings_Emailedit', array('emailID' => $my_post['ID']));
//$this->save_redirect( $_POST );
}
开发者ID:pmatheus,项目名称:participacao-sitebase,代码行数:30,代码来源:class-sendpress-view-settings-systememailcreate.php
示例2: send_email
function send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id)
{
//$user = SendPress_Option::get( 'mandrilluser' );
//$pass = SendPress_Option::get( 'mandrillpass' );
$from_email = SendPress_Option::get('fromemail');
//$hdr = new SendPress_SendGrid_SMTP_API();
$m = SendPress_Option::get_sender('sendpress');
//$hdr->addFilterSetting('dkim', 'domain', SendPress_Manager::get_domain_from_email($from_email) );
//$phpmailer->AddCustomHeader(sprintf( 'X-SMTPAPI: %s', $hdr->asJSON() ) );
$info = array("X-SP-METHOD" => "WPED.co", "X-SP-LIST" => $list_id, "X-SP-REPORT" => $report_id, "X-SP-SUBSCRIBER" => $sid, "X-SP-DOMAIN" => home_url());
$url = 'https://gateway.wped.co/send/';
//$url = 'http://spnl.dev/';
$verify_ssl = true;
if (isset($m['verifyssl']) && $m['verifyssl'] == 'donotverify') {
$verify_ssl = false;
$url = 'http://api.wped.co/send';
}
$message = array('to' => array(array('email' => $to)), 'subject' => $subject, 'html' => $html, 'text' => $text, 'from_email' => $from_email, 'from_name' => SendPress_Option::get('fromname'), 'headers' => $info, 'inline_css' => true, 'subaccount' => $m['sendpress-key'], 'metadata' => array('sender' => 'SPNL', 'return' => home_url()));
$response = wp_remote_post($url, array('method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array('Content-Type' => 'application/json'), 'body' => json_encode($message), 'sslverify' => $verify_ssl, 'cookies' => array()));
if (is_wp_error($response)) {
$error_message = $response->get_error_message();
SPNL()->log->add('WPED Sending', $error_message, 0, 'sending');
return false;
} else {
return true;
}
return false;
}
示例3: prerender
function prerender()
{
$ip = $_SERVER['REMOTE_ADDR'];
//print_r($info);
$info = $this->data();
if (isset($info->id)) {
$lists = SendPress_Data::get_list_ids_for_subscriber($info->id);
//$lists = explode(',',$info->listids);
foreach ($lists as $list) {
$status = SendPress_Data::get_subscriber_list_status($list->listID, $info->id);
if ($status->statusid == 1) {
SendPress_Data::update_subscriber_status($list->listID, $info->id, '2');
}
}
SPNL()->db("Subscribers_Tracker")->open($info->report, $info->id, 4);
}
if (SendPress_Option::get('confirm-page') == 'custom') {
$page = SendPress_Option::get('confirm-page-id');
if ($page != false) {
$plink = get_permalink($page);
if ($plink != "") {
wp_safe_redirect(esc_url_raw($plink));
exit;
}
}
}
}
示例4: save
function save()
{
if (isset($_POST['send-date']) && $_POST['send-date'] == 'later') {
$send_at = $_POST['date-pickit'] . " " . $_POST['send-later-time'];
} else {
$send_at = '0000-00-00 00:00:00';
}
if (isset($_POST['test-add'])) {
$csvadd = "email,firstname,lastname\n" . trim($_POST['test-add']);
$data = SendPress_Data::subscriber_csv_post_to_array($csvadd);
} else {
$data = false;
}
$listids = isset($_POST['listIDS']) ? $_POST['listIDS'] : array();
SendPress_Option::set('current_send_' . $_POST['post_ID'], array('listIDS' => $listids, 'testemails' => $data, 'send_at' => $send_at));
SendPress_Option::set('current_send_subject_' . $_POST['post_ID'], $_POST['post_subject']);
if (isset($_POST['test_report'])) {
update_post_meta($_POST['post_ID'], 'istest', true);
} else {
update_post_meta($_POST['post_ID'], 'istest', false);
}
if (isset($_POST['google-campaign-name'])) {
update_post_meta($_POST['post_ID'], 'google-campaign-name', $_POST['google-campaign-name']);
}
if (isset($_POST['submit']) && $_POST['submit'] == 'save-next') {
SendPress_Admin::redirect('Emails_Send_Confirm', array('emailID' => $_GET['emailID']));
} else {
SendPress_Admin::redirect('Emails_Style', array('emailID' => $_GET['emailID']));
}
}
示例5: prerender
function prerender()
{
$ip = $_SERVER['REMOTE_ADDR'];
//print_r($info);
$info = $this->data();
if (isset($info->listids)) {
$lists = explode(',', $info->listids);
foreach ($lists as $list_id) {
if ($list_id > 0) {
$status = SendPress_Data::get_subscriber_list_status($list_id, $info->id);
if (!isset($status) || $status->status != '2') {
SendPress_Data::update_subscriber_status($list_id, $info->id, '2');
}
}
}
}
if (SendPress_Option::get('confirm-page') == 'custom') {
$page = SendPress_Option::get('confirm-page-id');
if ($page != false) {
$plink = get_permalink($page);
if ($plink != "") {
wp_safe_redirect(esc_url_raw($plink));
exit;
}
}
}
}
示例6: external
static function external($template_id, $email_id, $subscriber_id, $example)
{
$canspam = SendPress_Option::get('canspam');
if ($canspam != '' && $canspam != false) {
return nl2br($canspam);
}
return '';
}
示例7: module_deactivate_sendpress_pro
function module_deactivate_sendpress_pro()
{
$path = $_POST['plugin_path'];
$pro_options = SendPress_Option::get('pro_plugins');
if (!preg_match('/sendpress-pro.php/i', $path)) {
if (preg_match('/sendpress-pro/i', $path)) {
//make sure the plugin loads from sendpress pro
$pro_options[$path] = false;
SendPress_Option::set('pro_plugins', $pro_options);
}
} else {
deactivate_plugins($path);
}
}
示例8: sendpress
function sendpress($phpmailer)
{
// Set the mailer type as per config above, this overrides the already called isMail method
$phpmailer->Mailer = 'smtp';
// We are sending SMTP mail
$phpmailer->IsSMTP();
// Set the other options
$phpmailer->Host = 'smtp.sendgrid.net';
$phpmailer->Port = 25;
// If we're using smtp auth, set the username & password
$phpmailer->SMTPAuth = TRUE;
$phpmailer->Username = SendPress_Option::get('sp_user');
$phpmailer->Password = SendPress_Option::get('sp_pass');
return $phpmailer;
}
示例9: external
static function external($template_id, $email_id, $subscriber_id, $e)
{
//maybe saved link?
$link_data = array("id" => $subscriber_id, "view" => 'manage');
$code = SendPress_Data::encrypt($link_data);
$link = SendPress_Manager::public_url($code);
if (SendPress_Option::get('manage-page') == 'custom') {
$page = SendPress_Option::get('manage-page-id');
if ($page != false) {
$plink = get_permalink($page);
if ($plink != "") {
$link = $plink . '?spms=' . $code;
}
}
}
return $link;
}
示例10: send_mail_cron
static function send_mail_cron()
{
//@ini_set('max_execution_time',0);
global $wpdb;
$count = SendPress_Option::get('emails-per-hour');
$count = SendPress_Option::get('wpcron-per-call', 25);
$email_count = 0;
$attempts = 0;
if (SendPress_Manager::limit_reached($count)) {
return;
}
SendPress_Email_Cache::build_cache();
for ($i = 0; $i < $count; $i++) {
$email = SendPress_Data::get_single_email_from_queue();
if ($email != null) {
$attempts++;
SendPress_Data::queue_email_process($email->id);
$result = SendPress_Manager::send_email_from_queue($email);
$email_count++;
if ($result) {
if ($result === true) {
$wpdb->update(SendPress_Data::queue_table(), array('success' => 1, 'inprocess' => 3), array('id' => $email->id));
//( $sid, $rid, $lid=null, $uid=null, $ip=null, $device_type=null, $device=null, $type='confirm' )
//$wpdb->update( SendPress_Data::queue_table() , array('success'=>1,'inprocess'=>3 ) , array('id'=> $email->id ));
//$wpdb->insert(SendPress_Data::subscriber_tracker_table() , array('subscriberID'=>$email->subscriberID,'emailID'=>$email->emailID,'sent_at' => get_gmt_from_date( date('Y-m-d H:i:s') )) );
SPNL()->db("Subscribers_Tracker")->add(array('subscriber_id' => intval($email->subscriberID), 'email_id' => intval($email->emailID)));
SendPress_Data::add_subscriber_event($email->subscriberID, $email->emailID, $email->listID, null, null, null, null, 'send');
} else {
$wpdb->update(SendPress_Data::queue_table(), array('success' => 2, 'inprocess' => 3), array('id' => $email->id));
SendPress_Data::add_subscriber_event($email->subscriberID, $email->emailID, $email->listID, null, null, null, null, 'bounce');
SendPress_Data::bounce_subscriber_by_id($email->subscriberID);
}
//$wpdb->insert( $this->subscriber_open_table(), $senddata);
$count++;
//SendPress_Data::update_report_sent_count( $email->emailID );
} else {
$wpdb->update(SendPress_Data::queue_table(), array('attempts' => $email->attempts + 1, 'inprocess' => 0, 'last_attempt' => date('Y-m-d H:i:s')), array('id' => $email->id));
}
} else {
//We ran out of emails to process.
break;
}
set_time_limit(30);
}
return;
}
示例11: pn_select
function pn_select($sub_id, $listid)
{
$pro_list = SendPress_Option::get('pro_notification_lists');
if (isset($pro_list['post_notifications']['id']) && $listid == $pro_list['post_notifications']['id']) {
$current = SendPress_Data::get_subscriber_meta($sub_id, 'post_notifications', $listid);
$info = SendPress_Data::get_post_notification_types();
echo '<select name="' . $listid . '-pn">';
echo "<option cls value='-1' >No Status</option>";
foreach ($info as $key => $value) {
$cls = '';
if ($current == $key) {
$cls = " selected='selected' ";
}
echo "<option {$cls} value='" . $key . "'>" . $value . "</option>";
}
echo '</select> ';
}
}
开发者ID:pmatheus,项目名称:participacao-sitebase,代码行数:18,代码来源:class-sendpress-view-subscribers-subscriber.php
示例12: auto_cron
function auto_cron()
{
// make sure we're in wp-cron.php
if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-cron.php')) {
// make sure a secret string is provided in the ur
if (isset($_GET['action']) && $_GET['action'] == 'sendpress') {
$time_start = microtime(true);
$count = SendPress_Data::emails_in_queue();
$bg = 0;
if ($count > 0) {
SendPress_Queue::send_mail();
$count = SendPress_Data::emails_in_queue();
} else {
SPNL()->log->prune_logs();
SendPress_Data::clean_queue_table();
//SendPress_Logging::prune_logs();
$bg = 1;
}
$attempted_count = SendPress_Option::get('autocron-per-call', 25);
$pro = 0;
if (defined('SENDPRESS_PRO_VERSION')) {
$pro = SENDPRESS_PRO_VERSION;
}
$stuck = SendPress_Data::emails_stuck_in_queue();
$limit = SendPress_Manager::limit_reached();
$emails_per_day = SendPress_Option::get('emails-per-day');
$emails_per_hour = SendPress_Option::get('emails-per-hour');
$hourly_emails = SendPress_Data::emails_sent_in_queue("hour");
$emails_so_far = SendPress_Data::emails_sent_in_queue("day");
$limits = array('autocron' => $attempted_count, 'dl' => $emails_per_day, 'hl' => $emails_per_hour, 'ds' => $emails_so_far, 'hs' => $hourly_emails);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo json_encode(array("background" => $bg, "queue" => $count, "stuck" => $stuck, "version" => SENDPRESS_VERSION, "pro" => $pro, "limit" => $limit, 'info' => $limits, 'time' => number_format($time, 3)));
die;
}
}
}
示例13: html
function html($sp)
{
SendPress_Tracking::event('Queue Tab');
$testListTable = new SendPress_Queue_Errors_Table();
$testListTable->prepare_items();
SendPress_Option::set('no_cron_send', 'false');
$sp->cron_start();
$open_info = array("id" => 13, "report" => 10, "view" => "open");
?>
<h2><?php
_e('Error history for the last 2 Weeks', 'sendpress');
?>
.</h2>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
<form id="email-filter" action="<?php
echo SendPress_Admin::link('Queue_Errors');
?>
" method="get">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php
echo SPNL()->validate->page($_REQUEST['page']);
?>
" />
<!-- Now we can render the completed list table -->
<?php
$testListTable->display();
?>
<?php
wp_nonce_field($sp->_nonce_value);
?>
</form>
<br>
<?php
}
示例14: enqueue
/**
* Enqueue styles and scripts needed for the pointers.
*/
function enqueue()
{
if (!current_user_can('manage_options')) {
return;
}
SendPress_Option::set('allow_tracking', '');
$track = SendPress_Option::get('allow_tracking');
$tour = false;
//SendPress_Option::get( 'intro_tour' );
if (($track == false || $track == '') && !isset($_GET['allow_tracking'])) {
wp_enqueue_style('wp-pointer');
wp_enqueue_script('jquery-ui');
wp_enqueue_script('wp-pointer');
wp_enqueue_script('utils');
add_action('admin_print_footer_scripts', array($this, 'tracking_request'));
} else {
if ($tour == 'false' || $tour == false) {
/*
add_action( 'admin_print_footer_scripts', array( $this, 'intro_tour' ) );
add_action( 'admin_head', array( $this, 'admin_head' ) );
*/
}
}
}
示例15: html
function html()
{
$icon_list = SendPress_Data::social_icons();
$socialsize = SendPress_Option::get('socialsize', 'large');
?>
<form method="post" id="post" role="form">
<div >
<div id="button-area">
<input type="submit" value="<?php
_e('Save', 'sendpress');
?>
" class="btn btn-large btn-primary"/>
</div>
</div>
<br><br><br>
<?php
$this->panel_start();
?>
<div class="sp-row">
<div class="sp-50 sp-first">
<p class="lead"><?php
_e('Social Icons appear in emails in Alphabetical order. If you enter a url in the box below then that icon will show in your emails.', 'sendpress');
?>
</p>
</div>
<div class="sp-50">
<p>
<label >
<input type="radio" name="icon-view" value="large" <?php
checked($socialsize, 'large');
?>
/> <?php
_e('Large', 'sendpress');
?>
( 32px x 32px )
</label>
<br>
<label >
<input type="radio" name="icon-view" value="small" <?php
checked($socialsize, 'small');
?>
/> <?php
_e('Small', 'sendpress');
?>
( 16px x 16px )
</label>
<br>
<label >
<input type="radio" name="icon-view" value="text" <?php
checked($socialsize, 'text');
?>
/> <?php
_e('Text', 'sendpress');
?>
</label>
</p>
</div>
</div>
<div class="sp-row">
<div class="sp-50 sp-first">
<?php
$icons = count($icon_list);
$link = SendPress_Option::get('socialicons');
$firsthalf = array_slice($icon_list, 0, $icons / 2);
$secondhalf = array_slice($icon_list, $icons / 2);
$firsthalf = array_merge(array_flip(array('Facebook', 'LinkedIn', 'GitHub', 'Instagram')), $firsthalf);
$secondhalf = array_merge(array_flip(array('Twitter', 'Skype', 'Vimeo', 'YouTube', 'WordPress')), $secondhalf);
foreach ($firsthalf as $key => $value) {
$class = "";
if (isset($link[$key])) {
$class = "bg-success";
}
?>
<div class="well <?php
echo $class;
?>
">
<div class="form-group">
<?php
echo "<span class='hidden-xs hidden-sm pull-right text-muted'>" . $value . "</span>";
?>
<label for="url-<?php
echo $key;
?>
" class="control-label ">
<img src="<?php
echo SENDPRESS_URL . "img/16px/" . $key . ".png";
?>
" />
<img src="<?php
echo SENDPRESS_URL . "img/32px/" . $key . ".png";
?>
" />
//.........这里部分代码省略.........