本文整理汇总了PHP中SPNL函数的典型用法代码示例。如果您正苦于以下问题:PHP SPNL函数的具体用法?PHP SPNL怎么用?PHP SPNL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SPNL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intro_tour
/**
* Load the introduction tour
*/
function intro_tour()
{
global $pagenow, $current_user;
$page = '';
if (isset($_GET['page'])) {
$page = SPNL()->validate->page($_GET['page']);
}
$function = '';
$button2 = '';
$opt_arr = array();
$id = '.nav-sp';
//echo $page;
if ('admin.php' != $pagenow || !array_key_exists($page, $adminpages)) {
$id = '#toplevel_page_sp-overview';
$content = '<h3>' . __('Welcome to SendPress', 'sendpress') . '</h3>';
$content .= '<p>' . __('You\'ve just installed SendPress! Click “Start Tour” to view a quick introduction of this plugins core functionality.', 'sendpress') . '</p>';
$opt_arr = array('content' => $content, 'position' => array('edge' => 'left', 'align' => 'left'));
$button2 = __("Start Tour", 'sendpress');
$function = 'document.location="' . admin_url('admin.php?page=sp-overview') . '";';
} else {
if ('' != $page && in_array($page, array_keys($adminpages))) {
$opt_arr = array('content' => $adminpages[$page]['content'], 'position' => array('edge' => 'top', 'align' => 'left'), 'pointerWidth' => 400);
$button2 = $adminpages[$page]['button2'];
$function = $adminpages[$page]['function'];
}
}
$this->print_scripts($id, $opt_arr, __("Close", 'sendpress'), $button2, $function);
}
示例2: 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
}
示例3: html
function html()
{
$email_id = get_query_var('spemail');
global $post;
if (is_object($this->data()) && $this->data()->id) {
$email_id = $this->data()->id;
}
if (isset($_GET['eid'])) {
$email_id = SPNL()->validate->int(base64_decode($_GET['eid']));
}
// If there's a subscriber ID in the URL, we need to get the subscriber object from it to use for the str_replace below.
if (isset($_GET['sid'])) {
$subscriber_id = SPNL()->validate->int(base64_decode($_GET['sid']));
} else {
$subscriber_id = 0;
}
//$post = get_post($email_id);
$inline = false;
if (isset($_GET['inline'])) {
$inline = true;
}
SendPress_Email_Cache::build_cache_for_email($email_id);
$message = new SendPress_Email();
$message->id($email_id);
$message->subscriber_id($subscriber_id);
$message->list_id(0);
$body = $message->html();
//print_r( $body );
unset($message);
echo $body;
//echo SendPress_Template::get_instance()->render_html(false, true, $inline );
}
示例4: 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;
}
示例5: 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;
}
}
}
}
示例6: html
function html()
{
$ip = $_SERVER['REMOTE_ADDR'];
$info = $this->data();
SPNL()->db->subscribers_tracker->open($info->report, $info->id);
//$link = SendPress_Data::track_open($info->id , $info->report , $ip , $this->_device_type, $this->_device );
header('Content-type: image/gif');
//include(SENDPRESS_PATH. 'img/clear.gif');
}
示例7: 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
}
示例8: html
function html($sp)
{
global $sendpress_html_templates;
//print_r($sendpress_html_templates[$_GET['templateID']]);
$list = SPNL()->validate->int($_GET['templateID']);
$postdata = get_post($list);
//print_r( $postdata );
?>
<form method="post" name="post" >
<input type="hidden" value="<?php
echo $list;
?>
" name="templateID" />
<div class="pull-right">
<a href="<?php
echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $list));
?>
">Back to Template</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 Page Footer', 'sendpress');
?>
</h2><br>
<div class="tab-pane fade in active" id="home"><?php
wp_editor(get_post_meta($postdata->ID, '_footer_page', true), 'footer-content');
?>
</div>
<br><br>
<?php
_e('Default Content', 'sendpress');
?>
<textarea class="form-control" rows="3">
<?php
$sys = false;
get_post_meta($postdata->ID, '_system_template', true);
if (true == get_post_meta($postdata->ID, '_system_template', true)) {
$sys = true;
}
echo SendPress_Tag_Footer_Page::content(true);
?>
</textarea>
<?php
SendPress_Data::nonce_field();
?>
</form>
<?php
$this->popup();
}
示例9: 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>";
}
示例10: 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);
}
示例11: 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
}
示例12: 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;
}
示例13: html
function html()
{
SendPress_Tracking::event('Emails Tab');
//SendPress_Template_Manager::update_template_content();
//Create an instance of our package class...
$testListTable = new Jaiminho_Email_Local_Table();
//Fetch, prepare, sort, and filter our data...
$testListTable->prepare_items();
?>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
<form id="email-filter" method="get">
<div id="taskbar" class="lists-dashboard rounded group">
<h2><?php
_e('Templates', 'sendpress');
?>
</h2>
<small><?php
_e('Help', 'sendpress');
?>
: <a target="_blank" href="http://docs.sendpress.com/article/58-setting-up-a-newsletter-template/"><?php
_e('Getting Started with Templates', 'sendpress');
?>
</a></small>
</div>
<!-- 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();
?>
" />
<!-- Now we can render the completed list table -->
<?php
$testListTable->display();
?>
<?php
wp_nonce_field($this->_nonce_value);
?>
</form><br>
<!--a href="<?php
echo SendPress_Admin::link('Emails_Temp', array('action' => 'install'));
?>
" class="btn btn-primary">Install Starter Templates</a-->
<a href="<?php
echo SendPress_Admin::link('Emails_Temp', array('action' => 'install'));
?>
" class="btn btn-primary">Install Starter Templates</a>
<?php
}
示例14: 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'] = SPNL()->validate->int($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'] = sanitize_text_field($user_info['firstname']);
} else {
$valid_user['firstname'] = '';
}
if (isset($user_info['lastname'])) {
$valid_user['lastname'] = sanitize_text_field($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;
}
示例15: html
function html()
{
$ip = $_SERVER['REMOTE_ADDR'];
$info = $this->data();
SPNL()->load("Subscribers_Tracker")->open($info->report, $info->id);
//Get the filesize of the image for headers
$filesize = filesize(SENDPRESS_PATH . 'img/icon.png');
//Now actually output the image requested (intentionally disregarding if the database was affected)
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: public ', false);
header('Content-type: image/png');
header('Content-Length: ' . $filesize);
echo file_get_contents(SENDPRESS_PATH . 'img/icon.png');
}