本文整理汇总了PHP中SendPress_Data类的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data类的具体用法?PHP SendPress_Data怎么用?PHP SendPress_Data使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SendPress_Data类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
}
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:27,代码来源:class-sendpress-public-view-confirm.php
示例2: 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
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:46,代码来源:class-sendpress-settings-forms-table.php
示例3: 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
}
开发者ID:anirut,项目名称:sendpress,代码行数:60,代码来源:class-sendpress-view-emails-footer.php
示例4: 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;
}
}
}
}
开发者ID:radscheit,项目名称:unicorn,代码行数:27,代码来源:class-sendpress-public-view-confirm.php
示例5: html
function html($sp)
{
$list = SPNL()->validate->int($_GET['listID']);
if ($list > 0) {
$role_to_sync = get_post_meta($list, 'sync_role', true);
SendPress_Data::drop_active_subscribers_for_sync($list);
if ($role_to_sync == 'meta') {
$meta_key = get_post_meta($list, 'meta-key', true);
$meta_value = get_post_meta($list, 'meta-value', true);
$meta_compare = get_post_meta($list, 'meta-compare', true);
// WP_User_Query arguments
$args = array('meta_query' => array(array('key' => $meta_key, 'value' => $meta_value, 'compare' => $meta_compare)));
$user_query = new WP_User_Query($args);
$blogusers = $user_query->get_total();
} else {
$result = count_users();
foreach ($result['avail_roles'] as $role => $count) {
if ($role == $role_to_sync) {
$blogusers = $count;
}
}
}
}
//$blogusers = get_users( 'role=' . $role );
//echo count($blogusers);
?>
<div id="taskbar" class="lists-dashboard rounded group">
</div>
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $list;
?>
" />
<div class='well' id="sync-wordpress-roles">
<h2><strong><?php
_e('Syncing ', 'sendpress');
?>
<?php
echo ucwords($role);
?>
<?php
_e(' Role to List', 'sendpress');
?>
<?php
echo get_the_title($list);
?>
</strong></h2>
<br>
<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 $blogusers;
?>
</span>
</div>
<?php
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:60,代码来源:class-sendpress-view-subscribers-sync.php
示例6: external
static function external($template_id, $email_id, $subscriber_id, $e)
{
$links = SendPress_Data::build_social();
if ($links != '' && $links != false) {
return $links;
}
return '';
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:8,代码来源:class-sendpress-tag-social-links.php
示例7: delete_subscribers_bulk_all
static function delete_subscribers_bulk_all()
{
if (isset($_GET['subscriber']) && is_array($_GET['subscriber'])) {
foreach ($_GET['subscriber'] as $value) {
SendPress_Data::delete_subscriber($value);
}
}
SendPress_Admin::redirect('Subscribers_All');
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:9,代码来源:class-sendpress-view-subscribers-all.php
示例8: 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
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:57,代码来源:class-sendpress-view-emails-send-queue.php
示例9: build_cache
public static function build_cache()
{
self::getInstance();
$email_list = SendPress_Data::get_email_id_from_queue();
foreach ($email_list as $email) {
$html = SendPress_Template::get_instance()->render_html($email->emailID, false, false, false);
self::set($email->emailID, $html);
}
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:9,代码来源:class-sendpress-email-cache.php
示例10: html
function html()
{
$ip = $_SERVER['REMOTE_ADDR'];
$info = $this->data();
$link = SendPress_Data::get_url_by_id($info->urlID);
SendPress_Data::track_click($info->id, $info->report, $info->urlID, $ip, $this->_device_type, $this->_device);
header("Location: " . esc_url_raw($link->url));
//wp_redirect( $link->url );
exit;
}
开发者ID:radscheit,项目名称:unicorn,代码行数:10,代码来源:class-sendpress-public-view-link.php
示例11: html
function html($sp)
{
echo "<h2>" . __('Attempting to install or repair missing data', 'sendpress') . "</h2><br>";
SendPress_Data::install();
@SPNL()->db->subscribers_tracker->create_table();
@SPNL()->db->url->create_table();
@SPNL()->db->subscribers_url->create_table();
echo "<pre>";
echo SendPress_DB_Tables::check_setup_support();
echo "</pre>";
}
开发者ID:radscheit,项目名称:unicorn,代码行数:11,代码来源:class-sendpress-view-settings-install.php
示例12: 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');
}
开发者ID:radscheit,项目名称:unicorn,代码行数:11,代码来源:class-sendpress-view-subscribers-listcreate.php
示例13: 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');
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:12,代码来源:class-sendpress-view-settings-dbfix.php
示例14: html
function html()
{
$info = $this->data();
if (isset($_GET['id'])) {
$id = SPNL()->validate->int($_GET['id']);
} else {
$id = $info->id;
}
$email = SendPress_Data::process_with_iron($id);
$data = array("send" => $email);
echo json_encode($data);
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:12,代码来源:class-sendpress-public-view-process.php
示例15: data
static function data()
{
$transient_key = 'sendpress_tracking_cache';
$data = get_transient($transient_key);
// bail if transient is set and valid
if ($data !== false) {
return;
}
// Make sure to only send tracking data once a week
set_transient($transient_key, 1, WEEK_IN_SECONDS);
// Start of Metrics
global $blog_id, $wpdb;
$hash = get_option('SendPress_Tracking_Hash', false);
if (!$hash || empty($hash)) {
// create and store hash
$hash = md5(site_url());
update_option('SendPress_Tracking_Hash', $hash);
}
$pts = array();
$post_types = get_post_types(array('public' => true));
if (is_array($post_types) && $post_types !== array()) {
foreach ($post_types as $post_type) {
$count = wp_count_posts($post_type);
$pts[$post_type] = $count->publish;
}
}
unset($post_types);
$comments_count = wp_count_comments();
$theme_data = wp_get_theme();
$theme = array('name' => $theme_data->display('Name', false, false), 'theme_uri' => $theme_data->display('ThemeURI', false, false), 'version' => $theme_data->display('Version', false, false), 'author' => $theme_data->display('Author', false, false), 'author_uri' => $theme_data->display('AuthorURI', false, false));
$theme_template = $theme_data->get_template();
if ($theme_template !== '' && $theme_data->parent()) {
$theme['template'] = array('version' => $theme_data->parent()->display('Version', false, false), 'name' => $theme_data->parent()->display('Name', false, false), 'theme_uri' => $theme_data->parent()->display('ThemeURI', false, false), 'author' => $theme_data->parent()->display('Author', false, false), 'author_uri' => $theme_data->parent()->display('AuthorURI', false, false));
} else {
$theme['template'] = '';
}
unset($theme_template);
$plugins = array();
$active_plugin = get_option('active_plugins');
foreach ($active_plugin as $plugin_path) {
if (!function_exists('get_plugin_data')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugin_info = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin_path);
$slug = str_replace('/' . basename($plugin_path), '', $plugin_path);
$plugins[$slug] = array('version' => $plugin_info['Version'], 'name' => $plugin_info['Name'], 'plugin_uri' => $plugin_info['PluginURI'], 'author' => $plugin_info['AuthorName'], 'author_uri' => $plugin_info['AuthorURI']);
}
unset($active_plugins, $plugin_path);
$lists = SendPress_Data::get_lists();
$data = array('site' => array('hash' => $hash, 'wp_version' => get_bloginfo('version'), 'sp' => SENDPRESS_VERSION, 'pro' => defined('SENDPRESS_PRO_VERSION') ? SENDPRESS_PRO_VERSION : 0, 'lists' => count($lists->posts), 'subscribers' => SendPress_Data::get_total_subscribers(), 'multisite' => is_multisite(), 'lang' => get_locale()), 'pts' => $pts, 'options' => apply_filters('sp_tracking_filters', array()), 'theme' => $theme, 'plugins' => $plugins);
$args = array('body' => $data, 'blocking' => false, 'sslverify' => false);
wp_remote_post('http://api.sendpress.com/api/v1/track/add', $args);
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:53,代码来源:class-sendpress-tracking.php
示例16: html
function html($sp)
{
global $post_ID, $post;
$view = isset($_GET['view']) ? $_GET['view'] : '';
if (isset($_GET['emailID'])) {
$emailID = SPNL()->validate->int($_GET['emailID']);
$post = get_post($emailID);
$post_ID = $post->ID;
}
?>
<form method="post">
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $post->ID;
?>
" />
<h2><?php
_e('Cancel Scheduled Email', 'sendpress');
?>
</h2>
<div class='well'>
<?php
$info = get_post_meta($post->ID, '_send_time', true);
?>
<p><?php
_e('Subject', 'sendpress');
?>
: <?php
echo $post->post_title;
?>
</p>
<p><?php
_e('Date', 'sendpress');
?>
: <?php
echo date_i18n('Y/m/d @ h:i A', strtotime($info));
?>
</p>
<?php
SendPress_Data::nonce_field();
?>
<button class="btn" value="cancel" name="submit"><?php
_e('Cancel', 'sendpress');
?>
</button>
<button class="btn btn-danger" value="delete" name="submit"><?php
_e('Delete Scheduled Email', 'sendpress');
?>
</button>
</div>
</form>
<?php
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:52,代码来源:class-sendpress-view-emails-send-cancel.php
示例17: html
function html()
{
//$ip = $_SERVER['REMOTE_ADDR'];
$info = $this->data();
//$hash = wp_hash( $info->url , 'sendpress' );
$db_url = SPNL()->db->url;
$url_in_db = $db_url->get($info->url);
//= SendPress_Data::get_url_by_hash( $hash );
if ($url_in_db == false) {
$id = $db_url->add($info->url);
} else {
$id = $url_in_db;
}
$dk = SendPress_Data::devicetypes($this->_device_type);
$url = $info->url;
switch ($info->url) {
case '{sp-browser-url}':
$url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Browser_Url::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false);
break;
case '{sp-unsubscribe-url}':
$url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Unsubscribe::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false);
break;
case '{sp-manage-subscription-url}':
$url = SPNL()->template_tags->do_subscriber_tags(SendPress_Tag_Manage_Subscriptions::external($info->url, $info->report, $info->id, false), $info->report, $info->report, $info->id, false);
break;
}
SPNL()->db->subscribers_url->add_update(array('subscriber_id' => $info->id, 'email_id' => $info->report, 'url_id' => $id));
SPNL()->db->subscribers_tracker->open($info->report, $info->id, 2);
if (strrpos($url, "mailto") !== false) {
header("Location: " . esc_url_raw($url));
} else {
if (defined("SENDPRESS_PRO_VERSION")) {
$url = add_query_arg('utm_medium', 'email', $url);
$url = add_query_arg('utm_source', 'sendpress', $url);
$sub = get_post_meta($info->report, '_sendpress_subject', true);
$alt = get_post_meta($info->report, 'google-campaign-name', true);
if ($alt !== false) {
$sub = $alt;
}
$url = add_query_arg('utm_campaign', $sub, $url);
}
wp_redirect(esc_url_raw($url));
}
exit;
//
//$link = SendPress_Data::get_url_by_id( $info->urlID );
//SendPress_Data::track_click( $info->id , $info->report, $info->urlID , $ip , $this->_device_type, $this->_device );
//header("Location: " . $link->url);
//wp_redirect( $link->url );
//exit;
}
开发者ID:radscheit,项目名称:unicorn,代码行数:51,代码来源:class-sendpress-public-view-tracker.php
示例18: export_list
function export_list()
{
$l = SPNL()->validate->int($_GET['listID']);
if ($l > 0) {
$items = SendPress_Data::export_subscirbers($l);
header("Content-type:text/octect-stream");
header("Content-Disposition:attachment;filename=sendpress.csv");
print "email,firstname,lastname,status \n";
foreach ($items as $user) {
print $user->email . "," . $user->firstname . "," . $user->lastname . "," . $user->status . "\n";
}
}
exit;
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:14,代码来源:class-sendpress-view-subscribers.php
示例19: sendpress_register_template
function sendpress_register_template($html_template = array())
{
global $sendpress_html_templates;
$id = SendPress_Data::get_html_template_id_by_slug(sanitize_title_for_query($html_template['name']));
//$id = 0;
echo $id;
$content = file_get_contents($html_template['path']);
$my_post = array('ID' => $id, 'post_content' => $content, 'post_title' => $html_template['name'], 'post_status' => 'draft');
//print_r( $my_post );
// Update the post into the database
wp_update_post($my_post);
//$html_template['ID'] = $id;
//$sendpress_html_templates[$id] = $html_template;
}
开发者ID:richardsweeney,项目名称:sendpress,代码行数:14,代码来源:functions.php
示例20: save
function save()
{
$post_options = array('list', 'email', 'firstname', 'lastname', 'status');
$user_info = array();
foreach ($post_options as $opt) {
$user_info[$opt] = isset($_POST['sp_' . $opt]) ? $_POST['sp_' . $opt] : false;
}
$valid_user = array();
//foreach()
if (isset($user_info['list'])) {
if (!is_array($user_info['list'])) {
$user_info['list'] = array($user_info['list']);
}
if (isset($user_info['status'])) {
$valid_user['status'] = $user_info['status'];
} else {
$valid_user['status'] = 2;
}
$data_error = false;
if (isset($user_info['email']) && is_email($user_info['email'])) {
$valid_user['email'] = $user_info['email'];
} else {
$data_error = __('Invalid Email', 'sendpress');
}
if (isset($user_info['firstname'])) {
$valid_user['firstname'] = $user_info['firstname'];
} else {
$valid_user['firstname'] = '';
}
if (isset($user_info['lastname'])) {
$valid_user['lastname'] = $user_info['lastname'];
} else {
$valid_user['lastname'] = '';
}
$status = false;
if ($data_error == false) {
$list = implode(",", $user_info['list']);
$custom = apply_filters('sendpress_subscribe_to_list_custom_fields', array(), $_POST);
$status = SendPress_Data::subscribe_user($list, $valid_user['email'], $valid_user['firstname'], $valid_user['lastname'], $valid_user['status'], $custom);
if ($status == false) {
$data_error = __('Problem with subscribing user.', 'sendpress');
} else {
$data_error = __('Thanks for subscribing.', 'sendpress');
}
}
}
$this->message = $data_error;
}
开发者ID:radscheit,项目名称:unicorn,代码行数:48,代码来源:class-sendpress-public-view-form.php
注:本文中的SendPress_Data类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论