本文整理汇总了PHP中SendPress_Admin类的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Admin类的具体用法?PHP SendPress_Admin怎么用?PHP SendPress_Admin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SendPress_Admin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']));
}
}
示例2: save
function save($post, $sp)
{
// print_r($post);
// die();
$action = isset($post['form_action']) ? $post['form_action'] : 'save';
switch ($action) {
case 'copy':
$postid = SendPress_Data::create_settings_post($post['post_subject'], "", $post['copy_from']);
//wp_redirect( '?page=sp-settings&view=widgets&id='. $postid );
SendPress_Admin::redirect('Settings_Widgets', array('id' => $postid));
break;
case 'create':
$postid = SendPress_Data::create_settings_post($post['post_subject'], $post['form_type']);
//wp_redirect( '?page=sp-settings&view=widgets&id='. $postid );
SendPress_Admin::redirect('Settings_Widgets', array('id' => $postid));
break;
case 'delete':
self::delete_form_save($post, $sp);
//wp_redirect( '?page=sp-settings&view=widgets' );
SendPress_Admin::redirect('Settings_Widgets');
break;
default:
self::save_form($post, $sp);
break;
}
}
示例3: save
function save()
{
//$this->security_check();
$saveid = SPNL()->validate->_int('post_ID');
update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
$email_post = get_post($saveid);
$subject = SendPress_Option::get('current_send_subject_' . $saveid);
$info = SendPress_Option::get('current_send_' . $saveid);
$slug = SendPress_Data::random_code();
$new_id = SendPress_Posts::copy($email_post, $subject, $slug, SPNL()->_report_post_type);
SendPress_Posts::copy_meta_info($new_id, $saveid);
$lists = implode(',', $info['listIDS']);
update_post_meta($new_id, '_send_time', $info['send_at']);
update_post_meta($new_id, '_send_lists', $lists);
update_post_meta($new_id, '_stat_type', 'new');
$count = 0;
if (get_post_meta($saveid, 'istest', true) == true) {
update_post_meta($new_id, '_report_type', 'test');
}
update_post_meta($new_id, '_sendpress_subject', $subject);
if (isset($info['testemails']) && $info['testemails'] != false) {
foreach ($info['testemails'] as $email) {
$go = array('from_name' => 'Josh', 'from_email' => 'joshlyford@gmail.com', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
SPNL()->add_email_to_queue($go);
$count++;
}
}
update_post_meta($new_id, '_send_count', $count);
SendPress_Admin::redirect('Emails_Send_Queue', array('emailID' => $new_id));
}
示例4: save
function save($post, $sp)
{
$options = SendPress_Option::get('notification_options');
$options['email'] = $post['toemail'];
$options['notifications-enable'] = array_key_exists('notifications-enable', $post) ? true : false;
if ($options['notifications-enable']) {
$options['subscribed'] = $post['subscribed'];
$options['unsubscribed'] = $post['unsubscribed'];
$options['send-to-admins'] = array_key_exists('send-to-admins', $post) ? true : false;
}
$options['enable-hipchat'] = array_key_exists('enable-hipchat', $post) ? true : false;
$options['hipchat-api'] = $post['hipchat-api'];
if (strlen($options['hipchat-api']) > 0) {
$options['hipchat-rooms'] = array();
if (!array_key_exists('hipchat-rooms', $post)) {
$post['hipchat-rooms'] = array();
}
global $hc;
$hc = new SendPress_HipChat($options['hipchat-api'], 'https://api.hipchat.com');
try {
foreach ($hc->get_rooms() as $room) {
$options['hipchat-rooms'][$room->room_id] = array_key_exists($room->room_id, $post['hipchat-rooms']) ? true : false;
}
} catch (Exception $e) {
$options['hipchat-room'] = $post['hipchat-room'];
}
}
$options = apply_filters('sendpress_notification_settings_save', $options, $post, $sp);
SendPress_Option::set('notification_options', $options);
SendPress_Admin::redirect('Settings_Notifications');
}
示例5: html
function html($sp)
{
global $sendpress_html_templates;
//print_r($sendpress_html_templates[$_GET['templateID']]);
$postdata = get_post($_GET['templateID']);
//print_r( $postdata );
?>
<form method="post" name="post" >
<input type="hidden" value="<?php
echo $_GET['templateID'];
?>
" name="templateID" />
<div class="pull-right">
<a href="<?php
echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $_GET['templateID']));
?>
"><?php
_e('Back to Template', 'sendpress');
?>
</a> <button class="btn btn-primary " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php
echo __('Save', 'sendpress');
?>
</button>
</div>
<h2><?php
echo $postdata->post_title;
?>
<?php
_e('Template Footer', 'sendpress');
?>
</h2><br>
<div class="tab-pane fade in active" id="home"><?php
wp_editor(get_post_meta($postdata->ID, '_footer_content', true), 'footer-content');
?>
</div>
<?php
SendPress_Data::nonce_field();
?>
</form><br><br><?php
_e('Default Content', 'sendpress');
?>
<textarea class="form-control" rows="3">
<?php
echo SendPress_Tag_Footer_Content::content();
?>
</textarea>
<br>
<?php
echo spnl_get_emails_tags_list();
$this->popup();
?>
<?php
}
示例6: save
function save()
{
if (isset($_POST['delete-this-user']) && $_POST['delete-this-user'] == 'yes') {
SendPress_Data::delete_subscriber($_POST['subscriberID']);
if ($_GET['listID']) {
SendPress_Admin::redirect('Subscribers_Subscribers', array('listID' => $_GET['listID']));
} else {
SendPress_Admin::redirect('Subscribers_All');
}
} else {
global $post;
$subscriber_info = array('email' => $_POST['email'], 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname']);
SendPress_Data::update_subscriber($_POST['subscriberID'], $subscriber_info);
$args = array('post_type' => 'sendpress_list', 'post_status' => array('publish', 'draft'), 'posts_per_page' => 100, 'order' => 'ASC', 'orderby' => 'title');
$postslist = get_posts($args);
foreach ($postslist as $post) {
setup_postdata($post);
if (isset($_POST[$post->ID . "-status"]) && $_POST[$post->ID . "-status"] > 0) {
SendPress_Data::update_subscriber_status($post->ID, $_POST['subscriberID'], $_POST[$post->ID . "-status"]);
} else {
SendPress_Data::remove_subscriber_status($post->ID, $_POST['subscriberID']);
}
$notifications = SendPress_Data::get_post_notification_types();
if (isset($_POST[$post->ID . "-pn"]) && array_key_exists($_POST[$post->ID . "-pn"], $notifications)) {
SendPress_Data::update_subscriber_meta($_POST['subscriberID'], 'post_notifications', $_POST[$post->ID . "-pn"], $post->ID);
}
}
wp_reset_postdata();
}
SendPress_Admin::redirect('Subscribers_Subscriber', array('subscriberID' => $_POST['subscriberID']));
}
开发者ID:pmatheus,项目名称:participacao-sitebase,代码行数:31,代码来源:class-sendpress-view-subscribers-subscriber.php
示例7: column_default
/** ************************************************************************
* Recommended. This method is called when the parent class can't find a method
* specifically build for a given column. Generally, it's recommended to include
* one method for each column you want to render, keeping your package class
* neat and organized. For example, if the class needs to process a column
* named 'title', it would first see if a method named $this->column_title()
* exists - if it does, that method will be used. If it doesn't, this one will
* be used. Generally, you should try to use custom column methods as much as
* possible.
*
* Since we have defined a column_title() method later on, this method doesn't
* need to concern itself with any column with a name of 'title'. Instead, it
* needs to handle everything else.
*
* For more detailed insight into how columns are handled, take a look at
* WP_List_Table::single_row_columns()
*
* @param array $item A singular item (one full row's worth of data)
* @param array $column_name The name/slug of the column to be processed
* @return string Text or HTML to be placed inside the column <td>
**************************************************************************/
function column_default($item, $column_name)
{
$settings = SendPress_Data::get_post_meta_object($item->ID);
switch ($column_name) {
case 'name':
return $item->post_title;
break;
case 'type':
return ucwords(str_replace('_', ' ', $settings['_form_type']));
break;
case 'shortcode':
return '[sp-form formid=' . $item->ID . ']';
break;
case 'actions':
//$type = get_post_meta($item->ID, "_template_type", true);
$a = '<div class="inline-buttons" style="text-align:right;">';
$a .= '<a class="btn btn-default" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID, 'create' => 1)) . '">' . __('Clone', 'sendpress') . '</a> <a class="btn btn-primary" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID)) . '">' . __('Edit', 'sendpress') . '</a>' . '</a> <a class="btn btn-danger" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID, 'delete' => 1)) . '">' . __('Delete', 'sendpress') . '</a>';
$a .= '</div>';
return $a;
break;
default:
return print_r($item, true);
//Show the whole array for troubleshooting purposes
}
}
示例8: save
function save()
{
$post = get_default_post_to_edit('sp_template', true);
$post_ID = $post->ID;
global $current_user;
$content = '';
switch ($_POST['starter']) {
case 'blank':
$content = '';
break;
default:
$content = 'Default HTML';
break;
}
/*
$my_post['ID'] = $_POST['post_ID'];
$my_post['post_content'] = $_POST['content'];
$my_post['post_title'] = $_POST['post_title'];
*/
$post->post_title = $_POST['post_title'];
$post->post_status = 'sp-custom';
$post->post_content = $content;
// Update the post into the database
wp_update_post($post);
//SendPress_Email::set_default_style( $my_post['ID'] );
//clear the cached file.
SendPress_Admin::redirect('Emails_Tempedit', array('templateID' => $post->ID));
//$this->save_redirect( $_POST );
}
示例9: save
function save($post, $sp)
{
$saveid = $_POST['post_ID'];
update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
$email_post = get_post($saveid);
$subject = SendPress_Option::get('current_send_subject_' . $saveid);
$info = SendPress_Option::get('current_send_' . $saveid);
$slug = SendPress_Data::random_code();
$new_id = SendPress_Posts::copy($email_post, $subject, $slug, $sp->_report_post_type);
SendPress_Posts::copy_meta_info($new_id, $saveid);
$lists = implode(',', $info['listIDS']);
update_post_meta($new_id, '_send_time', $info['send_at']);
update_post_meta($new_id, '_send_lists', $lists);
update_post_meta($new_id, '_stat_type', 'new');
$count = 0;
if (get_post_meta($saveid, 'istest', true) == true) {
update_post_meta($new_id, '_report_type', 'test');
}
update_post_meta($new_id, '_sendpress_subject', $subject);
/*
if(isset($info['listIDS'])){
// foreach($info['listIDS'] as $list_id){
$_email = SendPress_Data::get_active_subscribers_lists($info['listIDS']); //$sp->get_active_subscribers( $list_id );
foreach($_email as $email){
$go = array(
'from_name' => '',
'from_email' => '',
'to_email' => $email->email,
'emailID'=> $new_id,
'subscriberID'=> $email->subscriberID,
//'to_name' => $email->fistname .' '. $email->lastname,
'subject' => '',
'listID'=> $email->listid
);
$sp->add_email_to_queue($go);
$count++;
}
// }
}
*/
if (isset($info['testemails']) && $info['testemails'] != false) {
foreach ($info['testemails'] as $email) {
$go = array('from_name' => 'Josh', 'from_email' => 'joshlyford@gmail.com', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
$sp->add_email_to_queue($go);
$count++;
}
}
update_post_meta($new_id, '_send_count', $count);
// update_post_meta($new_id,'_send_data', $info );
SendPress_Admin::redirect('Emails_Send_Queue', array('emailID' => $new_id));
//wp_redirect( '?page=sp-queue' );
}
示例10: save
function save()
{
$template = get_post($_POST['post_ID']);
$template->post_content = stripcslashes($_POST['template-content']);
$template->post_title = $_POST['post_subject'];
wp_update_post($template);
SendPress_Admin::redirect('Emails_Tempedit', array('templateID' => $_GET['templateID']));
}
示例11: save
function save($post, $sp)
{
$value = $_POST['submit'];
if ($value == 'delete') {
SendPress_Data::remove_from_queue($_POST['post_ID']);
update_post_meta($_POST['post_ID'], '_canceled', true);
}
SendPress_Admin::redirect('Reports');
}
示例12: html
function html($sp)
{
global $post_ID, $post;
$list = '';
if (isset($_GET['emailID'])) {
$emailID = SPNL()->validate->int($_GET['emailID']);
$post = get_post($emailID);
$post_ID = $post->ID;
}
update_post_meta($post->ID, '_send_last', 0);
$info = get_post_meta($post->ID, '_send_data', true);
$lists = get_post_meta($post->ID, '_send_lists', true);
$subject = $post->post_title;
$list = explode(",", $lists);
$view = isset($_GET['view']) ? $_GET['view'] : '';
if (isset($_GET['finished'])) {
$time = get_post_meta($post->ID, '_send_time', true);
if ($time == '0000-00-00 00:00:00') {
SendPress_Admin::redirect('Queue');
} else {
SendPress_Admin::redirect('Reports');
}
}
$subs = SendPress_Data::get_active_subscribers_count($list);
update_post_meta($post->ID, '_send_last_count', $subs);
update_post_meta($post->ID, '_sendpress_report', 'new');
?>
<div id="taskbar" class="lists-dashboard rounded group">
</div><input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $post->ID;
?>
" /><input type="hidden" id="reporttoqueue" name="reporttoqueue" value="<?php
echo $lists;
?>
" />
<div class='well' id="confirm-queue-add">
<h2><strong><?php
_e('Adding Subscribers to Queue', 'sendpress');
?>
</strong></h2><br>
<!-- <p>email: <?php
echo stripslashes(esc_attr(htmlspecialchars($subject)));
?>
</p>-->
<div class="progress progress-striped active">
<div class="progress-bar sp-queueit" style="width: 0%;"></div>
</div>
<span id="queue-total">0</span> of <span id="list-total"><?php
echo $subs;
?>
</span>
</div>
<?php
}
示例13: save
function save()
{
$name = $_POST['name'];
$public = 0;
if (isset($_POST['public']) && $_POST['sync_role'] == 'none') {
$public = $_POST['public'];
}
$list_id = SendPress_Data::create_list(array('name' => $name, 'public' => $public));
update_post_meta($list_id, 'sync_role', $_POST['sync_role']);
SendPress_Admin::redirect('Subscribers');
}
示例14: save
function save($post, $sp)
{
if (isset($_POST['templates'])) {
SendPress_Data::remove_all_templates();
SendPress_Template_Manager::update_template_content();
}
if (isset($_POST['settings'])) {
SendPress_Data::remove_all_settings();
//SendPress_Data::create_settings_post_signup_form();
}
SendPress_Admin::redirect('Settings_Dbfix');
}
示例15: create_subscriber
function create_subscriber()
{
$email = $_POST['email'];
$fname = $_POST['firstname'];
$lname = $_POST['lastname'];
$listID = $_POST['listID'];
$status = $_POST['status'];
if (is_email($email)) {
$result = SendPress_Data::add_subscriber(array('firstname' => $fname, 'email' => $email, 'lastname' => $lname));
SendPress_Data::update_subscriber_status($listID, $result, $status, false);
}
SendPress_Admin::redirect('Subscribers_Subscribers', array('listID' => $listID));
}