本文整理汇总了PHP中SendPress_Data::get_lists方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data::get_lists方法的具体用法?PHP SendPress_Data::get_lists怎么用?PHP SendPress_Data::get_lists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendPress_Data
的用法示例。
在下文中一共展示了SendPress_Data::get_lists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: form
/**
* Displays the widget settings controls on the widget panel.
* Make use of the get_field_id() and get_field_name() function
* when creating your form elements. This handles the confusing stuff.
*/
function form($instance)
{
/* Set up some default widget settings. */
$defaults = array('title' => '', 'show_first' => false, 'show_last' => false, 'lists_checked' => true, 'label_display' => 0, 'first_label' => __('First Name', 'sendpress'), 'last_label' => __('Last Name', 'sendpress'), 'email_label' => __('E-Mail', 'sendpress'), 'list_label' => __('List Selection', 'sendpress'), 'desc' => '', 'redirect_page' => false, 'button_text' => __('Submit', 'sendpress'), 'thank_you' => __('Check your inbox now to confirm your subscription.', 'sendpress'));
$lists = SendPress_Data::get_lists(array('meta_query' => array(array('key' => 'public', 'value' => true))), false);
$listids = array();
foreach ($lists as $list) {
$defaults['list_' . $list->ID] = false;
}
$instance = wp_parse_args((array) $instance, $defaults);
?>
<!-- Widget Title: Text Input -->
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'sendpress');
?>
</label>
<input type="text" class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" value="<?php
echo $instance['title'];
?>
" style="width:100%;" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('desc');
?>
"><?php
_e('Description:', 'sendpress');
?>
</label>
<textarea rows="5" type="text" class="widefat" id="<?php
echo $this->get_field_id('desc');
?>
" name="<?php
echo $this->get_field_name('desc');
?>
"><?php
echo $instance['desc'];
?>
</textarea>
<!-- <input type="text" class="widefat" id="<?php
echo $this->get_field_id('desc');
?>
" name="<?php
echo $this->get_field_name('desc');
?>
" value="<?php
echo $instance['desc'];
?>
" style="width:100%;" /> -->
</p>
<p>
<input class="checkbox" type="checkbox" <?php
checked($instance['show_first'], 'on');
?>
id="<?php
echo $this->get_field_id('show_first');
?>
" name="<?php
echo $this->get_field_name('show_first');
?>
" />
<label for="<?php
echo $this->get_field_id('show_first');
?>
"><?php
_e('Collect First Name', 'sendpress');
?>
</label>
</p>
<p>
<input class="checkbox" type="checkbox" <?php
checked($instance['show_last'], 'on');
?>
id="<?php
echo $this->get_field_id('show_last');
?>
" name="<?php
echo $this->get_field_name('show_last');
?>
" />
//.........这里部分代码省略.........
示例3: signup
function signup($settings)
{
$lists = SendPress_Data::get_lists(array('meta_query' => array(array('key' => 'public', 'value' => true))), false);
$listids = array();
foreach ($lists as $list) {
if (!array_key_exists('list_' . $list->ID, $settings)) {
$settings['list_' . $list->ID] = false;
}
}
?>
<div class="sp-row">
<h3><?php
echo $settings['post_title'];
?>
</h3>
</div>
<div class="sp-row">
<div class="sp-50 sp-first">
<?php
$this->panel_start(__('Signup Ui', 'sendpress'));
?>
<p>
<label for="_form_description"><?php
_e('Description:', 'sendpress');
?>
</label>
<textarea rows="5" type="text" class="widefat" id="_form_description" name="_form_description"><?php
echo $settings['_form_description'];
?>
</textarea>
</p>
<p>
<label for="_firstname_label"><?php
_e('First Name Label:', 'sendpress');
?>
</label>
<input type="text" class="widefat" id="_firstname_label" name="_firstname_label" value="<?php
echo $settings['_firstname_label'];
?>
" style="width:100%;" />
</p>
<p>
<label for="_lastname_label"><?php
_e('Last Name Label:', 'sendpress');
?>
</label>
<input type="text" class="widefat" id="_lastname_label" name="_lastname_label" value="<?php
echo $settings['_lastname_label'];
?>
" style="width:100%;" />
</p>
<p>
<label for="_email_label"><?php
_e('E-Mail Label:', 'sendpress');
?>
</label>
<input type="text" class="widefat" id="_email_label" name="_email_label" value="<?php
echo $settings['_email_label'];
?>
" style="width:100%;" />
</p>
<p>
<label for="_button_label"><?php
_e('Button Text:', 'sendpress');
?>
</label>
<input type="text" class="widefat" id="_button_label" name="_button_label" value="<?php
echo $settings['_button_label'];
?>
" style="width:100%;" />
</p>
<p>
<label for="_list_label"><?php
_e('Lists Label: multiple lists only', 'sendpress');
?>
</label>
<input type="text" class="widefat" id="_list_label" name="_list_label" value="<?php
echo $settings['_list_label'];
?>
" style="width:100%;" />
</p>
<p>
<label for="_thankyou_message"><?php
_e('Thank you message:', 'sendpress');
?>
</label>
<textarea rows="5" type="text" class="widefat" id="_thankyou_message" name="_thankyou_message"><?php
echo $settings['_thankyou_message'];
?>
</textarea>
</p>
<?php
//.........这里部分代码省略.........
示例4: prepare_items
/** ************************************************************************
* REQUIRED! This is where you prepare your data for display. This method will
* usually be used to query the database, sort and filter the data, and generally
* get it ready to be displayed. At a minimum, we should set $this->items and
* $this->set_pagination_args(), although the following properties and methods
* are frequently interacted with here...
*
* @uses $this->_column_headers
* @uses $this->items
* @uses $this->get_columns()
* @uses $this->get_sortable_columns()
* @uses $this->get_pagenum()
* @uses $this->set_pagination_args()
**************************************************************************/
function prepare_items()
{
global $wpdb, $_wp_column_headers;
$screen = get_current_screen();
//$this->process_bulk_action();
/*
select t1.* from `sp_sendpress_list_subscribers` as t1 , `sp_sendpress_subscribers` as t2
where t1.subscriberID = t2.subscriberID and t1.listID = 2*/
/* -- Pagination parameters -- */
//Number of elements in your table?
// $totalitems = $wpdb->query($query); //return the total number of affected rows
//How many to display per page?
/* -- Register the Columns -- */
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
/* -- Fetch the items -- */
// $args = array(
// 'post_type' => 'sendpress_list',
// 'post_status' => array('publish','draft')
// );
//$args = apply_filters('sendpress_list_table_query',array('post_type' => 'sendpress_list','post_status' => array('publish','draft')));
$query = SendPress_Data::get_lists(array('post_status' => array('publish', 'draft')));
//$query = new WP_Query( $args );
$totalitems = $query->found_posts;
// get the current user ID
$user = get_current_user_id();
// get the current admin screen
$screen = get_current_screen();
// retrieve the "per_page" option
$screen_option = $screen->get_option('per_page', 'option');
$per_page = 10;
if (!empty($screen_option)) {
// retrieve the value of the option stored for the current user
$per_page = get_user_meta($user, $screen_option, true);
if (empty($per_page) || $per_page < 1) {
// get the default value if none is set
$per_page = $screen->get_option('per_page', 'default');
}
}
//Which page is this?
$paged = !empty($_GET["paged"]) ? esc_sql($_GET["paged"]) : '';
//Page Number
if (empty($paged) || !is_numeric($paged) || $paged <= 0) {
$paged = 1;
}
//How many pages do we have in total?
$totalpages = ceil($totalitems / $per_page);
//adjust the query to take pagination into account
if (!empty($paged) && !empty($per_page)) {
$offset = ($paged - 1) * $per_page;
// $query.=' LIMIT '.(int)$offset.','.(int)$per_page;
}
/* -- Register the pagination -- */
$this->set_pagination_args(array("total_items" => $totalitems, "total_pages" => $totalpages, "per_page" => $per_page));
$args = array('post_type' => 'sendpress_list', 'post_status' => array('publish', 'draft'), 'posts_per_page' => $per_page, 'paged' => $paged);
if (isset($_GET['order'])) {
$args['order'] = $_GET['order'];
}
if (isset($_GET['orderby'])) {
$orderby = $_GET['orderby'];
$args['orderby'] = $orderby;
if ($orderby == 'subject') {
$args['orderby'] = 'meta_value';
$args['meta_key'] = '_sendpress_subject';
}
if ($orderby == 'lastsend') {
$args['orderby'] = 'meta_value';
$args['meta_key'] = 'send_date';
}
}
//$args = apply_filters('sendpress_list_table_query',$args);
$query2 = SendPress_Data::get_lists($args);
// $query2 = new WP_Query( $args );
$this->items = $query2->posts;
}
示例5: load_form
static function load_form($attr, $content = null)
{
global $load_signup_js, $sendpress_show_thanks, $sendpress_signup_error;
$load_signup_js = true;
ob_start();
$lists = SendPress_Data::get_lists(array('meta_query' => array(array('key' => 'public', 'value' => true))), false);
extract(shortcode_atts(array('firstname_label' => 'First Name', 'lastname_label' => 'Last Name', 'email_label' => 'EMail', 'list_label' => 'List Selection', 'listids' => '', 'redirect_page' => false, 'lists_checked' => true, 'display_firstname' => false, 'display_lastname' => false, 'label_display' => false, 'desc' => '', 'label_width' => 100, 'thank_you' => 'Thank you for subscribing!', 'button_text' => 'Submit', 'no_list_error' => '<div><b>-- NO LIST HAS BEEN SET! --</b></div>', 'postnotification' => '', 'pnlistid' => 0), $attr));
$label = filter_var($label_display, FILTER_VALIDATE_BOOLEAN);
$widget_options = SendPress_Option::get('widget_options');
?>
<div class="sendpress-signup-form">
<form id="sendpress_signup" method="POST" <?php
if (!$widget_options['load_ajax']) {
?>
class="sendpress-signup"<?php
} else {
?>
action="?sendpress=post"<?php
}
?>
>
<?php
if ($widget_options['load_ajax']) {
echo '<input type="hidden" name="action" value="signup-user" />';
//echo '<input type="hidden" name="redirect" value="'.get_permalink().'" />';
}
if (empty($listids)) {
echo $no_list_error;
}
if ($redirect_page != false && $redirect_page > 0) {
echo '<input type="hidden" name="redirect" value="' . $redirect_page . '" />';
}
?>
<div id="error"><?php
echo $sendpress_signup_error;
?>
</div>
<div id="thanks" <?php
if ($sendpress_show_thanks) {
echo 'style="display:block;"';
} else {
echo 'style="display:none;"';
}
?>
><?php
echo $thank_you;
?>
</div>
<div id="form-wrap" <?php
if ($sendpress_show_thanks) {
echo 'style="display:none;"';
}
?>
>
<p><?php
echo $desc;
?>
</p>
<?php
$list_ids = explode(",", $listids);
if (count($list_ids) > 1) {
?>
<p>
<label for="list"><?php
echo $list_label;
?>
:</label>
<?php
foreach ($list_ids as $id) {
?>
<input type="checkbox" name="sp_list[]" class="sp_list" id="list<?php
echo $id;
?>
" value="<?php
echo $id;
?>
" <?php
if ($lists_checked) {
echo 'checked';
}
?>
/> <?php
echo get_the_title($id);
?>
<br>
<?php
}
?>
</p>
<?php
} else {
?>
<input type="hidden" name="sp_list" id="list" class="sp_list" value="<?php
echo $listids;
?>
" />
//.........这里部分代码省略.........
示例6: signup
private static function signup($options)
{
//print_r($options);
global $load_signup_js, $sendpress_show_thanks, $sendpress_signup_error;
$sendpress_signup_exists = __("You've already signed up, Thanks!", 'sendpress');
$load_signup_js = true;
$no_list_error = '-- NO LIST HAS BEEN SET! --';
$_listids = '';
extract($options);
$lists = SendPress_Data::get_lists(array('meta_query' => array(array('key' => 'public', 'value' => true))), false);
$default_list_ids = array();
foreach ($lists as $list) {
$default_list_ids[] = $list->ID;
}
$postnotification = '';
$pnlistid = array();
//find post notification list
foreach ($options as $key => $value) {
if (strpos($key, '_meta_for_list_') === 0) {
$pnlistid = array_pop(explode('_', $key));
$postnotification = $value;
}
}
$label = filter_var($_display_labels_inside_fields, FILTER_VALIDATE_BOOLEAN);
$widget_options = SendPress_Option::get('widget_options');
$list_ids = strlen($_listids) > 0 ? explode(",", $_listids) : array();
if (!$_settings_id && empty($list_ids)) {
$list_ids = $default_list_ids;
}
$post_notifications_code = '';
if (!is_wp_error($list_ids) || !is_wp_error($postnotification) || !is_wp_error($pnlistid)) {
$post_notifications_code = apply_filters('sendpress-post-notifications-submit-code', "", $list_ids, $postnotification, $pnlistid);
}
?>
<div class="sendpress-signup-form">
<form id="sendpress_signup" method="POST" <?php
if (!$widget_options['load_ajax']) {
?>
class="sendpress-signup"<?php
} else {
?>
action="?sendpress=post"<?php
}
?>
>
<?php
if ($widget_options['load_ajax']) {
echo '<input type="hidden" name="action" value="signup-user" />';
}
if (empty($_listids) && strlen($post_notifications_code) == 0 && $_settings_id) {
echo $no_list_error;
}
if ($_thankyou_page != false && $_thankyou_page > 0) {
echo '<input type="hidden" name="redirect" value="' . $_thankyou_page . '" />';
}
?>
<div id="exists" style="display:none;"><?php
echo $sendpress_signup_exists;
?>
</div>
<div id="error"><?php
echo $sendpress_signup_error;
?>
</div>
<div id="thanks" <?php
if ($sendpress_show_thanks) {
echo 'style="display:block;"';
} else {
echo 'style="display:none;"';
}
?>
><?php
echo $_thankyou_message;
?>
</div>
<div id="form-wrap" <?php
if ($sendpress_show_thanks) {
echo 'style="display:none;"';
}
?>
>
<p><?php
echo $_form_description;
?>
</p>
<?php
if (count($list_ids) > 0) {
if (count($list_ids) > 1 || strlen($post_notifications_code) > 0) {
?>
<p>
<label for="list"><?php
echo $_list_label;
?>
:</label>
<?php
foreach ($list_ids as $id) {
if ($id !== $pnlistid) {
?>
<input type="checkbox" name="sp_list[]" class="sp_list" id="list<?php
//.........这里部分代码省略.........
示例7: snp_ml_get_sp_lists
function snp_ml_get_sp_lists()
{
if (defined('SENDPRESS_VERSION')) {
$lists = SendPress_Data::get_lists();
foreach ($lists->posts as $v) {
if ($v->ID && $v->post_title) {
$list[$v->ID] = array('name' => $v->post_title);
}
}
}
if (count($list) == 0) {
$list[0] = array('name' => 'Nothing Found...');
}
return $list;
}
示例8: load_page
static function load_page($attr, $content = null)
{
$action = get_query_var('spmanage');
//Look for encrypted data
$info = SendPress_Data::decrypt($action);
//print_r( $info );
?>
<form action="" method="post">
<?php
wp_nonce_field(SendPress_Data::nonce());
?>
<input type="hidden" name="subscriberid" id="subscriberid" value="<?php
echo $info->id;
?>
" />
<input type="hidden" name="action" id="action" value="sendpress-manage-shortcode" />
<table cellpadding="0" cellspacing="0" class="table table-condensed table-striped table-bordered">
<tr>
<th ><?php
_e('Subscribed', 'sendpress');
?>
</th>
<th ><?php
_e('Unsubscribed', 'sendpress');
?>
</th>
<th ><?php
_e('List', 'sendpress');
?>
</th>
<th class="hidden-phone"><?php
_e('Updated', 'sendpress');
?>
</th>
<th class="hidden-phone"><?php
_e('Other Info', 'sendpress');
?>
</th>
</tr>
<?php
$lists = SendPress_Data::get_lists(apply_filters('sendpress_modify_manage_lists', array('meta_query' => array(array('key' => 'public', 'value' => true)))), false);
foreach ($lists as $list) {
$subscriber = SendPress_Data::get_subscriber_list_status($list->ID, $info->id);
?>
<tr>
<?php
$checked = isset($subscriber->statusid) && $subscriber->statusid == 2 ? 'checked' : '';
echo '<td><input type="radio" class="xbutton" data-list="' . $list->ID . '" name="subscribe_' . $list->ID . '" ' . $checked . ' value="2"></td>';
$checked = isset($subscriber->statusid) && $subscriber->statusid == 3 ? 'checked' : '';
echo '<td><input type="radio" class="xbutton" data-list="' . $list->ID . '" name="subscribe_' . $list->ID . '" ' . $checked . ' value="3"></td>';
?>
<td><?php
echo $list->post_title;
?>
</td>
<td class="hidden-phone"><span id="list_<?php
echo $list->ID;
?>
"><?php
if (isset($subscriber->updated)) {
echo $subscriber->updated;
} else {
_e('Never Subscribed', 'sendpress');
}
?>
</span>
</td>
<td class="hidden-phone">
<?php
if (is_object($subscriber)) {
if ($subscriber->statusid != 3 && $subscriber->statusid != 2) {
echo $subscriber->status;
}
}
?>
</td>
<tr>
<?php
}
?>
</table>
<br>
<?php
do_action('sendpress_manage_notifications', $info);
?>
<input type="submit" class="btn btn-primary" value="<?php
_e('Save My Settings', 'sendpress');
?>
"/>
</form><?php
}
示例9: output
/**
* Output the form
*
* @param array $atts
*/
public static function output($atts, $content = null)
{
global $load_signup_js, $sendpress_show_thanks, $sendpress_signup_error;
$load_signup_js = true;
$sendpress_signup_exists = __("You've already signed up, Thanks!", 'sendpress');
$lists = SendPress_Data::get_lists(array('meta_query' => array(array('key' => 'public', 'value' => true))), false);
extract(shortcode_atts(self::options(), $atts));
$label = filter_var($label_display, FILTER_VALIDATE_BOOLEAN);
$widget_options = SendPress_Option::get('widget_options');
$list_ids = strlen($listids) > 0 ? explode(",", $listids) : array();
$post_notifications_code = apply_filters('sendpress-post-notifications-submit-code', "", $list_ids, $postnotification, $pnlistid);
?>
<div class="sendpress-signup-form">
<form id="sendpress_signup" method="POST" <?php
if (!$widget_options['load_ajax']) {
?>
class="sendpress-signup"<?php
} else {
?>
action="?sendpress=post"<?php
}
?>
>
<?php
if ($widget_options['load_ajax']) {
echo '<input type="hidden" name="action" value="signup-user" />';
}
if (empty($listids) && strlen($post_notifications_code) == 0) {
echo $no_list_error;
}
if ($redirect_page != false && $redirect_page > 0) {
echo '<input type="hidden" name="redirect" value="' . $redirect_page . '" />';
}
?>
<div id="exists"><?php
echo $sendpress_signup_exists;
?>
</div>
<div id="error"><?php
echo $sendpress_signup_error;
?>
</div>
<div id="thanks" <?php
if ($sendpress_show_thanks) {
echo 'style="display:block;"';
} else {
echo 'style="display:none;"';
}
?>
><?php
echo $thank_you;
?>
</div>
<div id="form-wrap" <?php
if ($sendpress_show_thanks) {
echo 'style="display:none;"';
}
?>
>
<p><?php
echo $desc;
?>
</p>
<?php
if (count($list_ids) > 0) {
if (count($list_ids) > 1 || strlen($post_notifications_code) > 0) {
?>
<p>
<label for="list"><?php
echo $list_label;
?>
:</label>
<?php
foreach ($list_ids as $id) {
?>
<input type="checkbox" name="sp_list[]" class="sp_list" id="list<?php
echo $id;
?>
" value="<?php
echo $id;
?>
" <?php
if ($lists_checked) {
echo 'checked';
}
?>
/> <?php
echo get_the_title($id);
?>
<br>
<?php
}
?>
</p>
//.........这里部分代码省略.........