本文整理汇总了PHP中SendPress_Data类的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data类的具体用法?PHP SendPress_Data怎么用?PHP SendPress_Data使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SendPress_Data类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
}
示例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
}
}
示例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
}
示例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;
}
}
}
}
示例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
}
示例6: external
static function external($template_id, $email_id, $subscriber_id, $e)
{
$links = SendPress_Data::build_social();
if ($links != '' && $links != false) {
return $links;
}
return '';
}
示例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');
}
示例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
}
示例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);
}
}
示例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;
}
示例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>";
}
示例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');
}
示例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');
}
示例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);
}
示例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);
}