本文整理汇总了PHP中SendPress_Data::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data::encrypt方法的具体用法?PHP SendPress_Data::encrypt怎么用?PHP SendPress_Data::encrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendPress_Data
的用法示例。
在下文中一共展示了SendPress_Data::encrypt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: external
static function external($template_id, $email_id, $subscriber_id, $e)
{
//maybe saved link?
$link_data = array("id" => $subscriber_id, "view" => 'manage');
$code = SendPress_Data::encrypt($link_data);
$link = SendPress_Manager::public_url($code);
if (SendPress_Option::get('manage-page') == 'custom') {
$page = SendPress_Option::get('manage-page-id');
if ($page != false) {
$plink = get_permalink($page);
if ($plink != "") {
$link = $plink . '?spms=' . $code;
}
}
}
return $link;
}
示例2: prerender
function prerender()
{
$r = $_GET['rid'];
$s = $_GET['sid'];
$r = (int) base64_decode($r);
$s = (int) base64_decode($s);
if (is_numeric($r)) {
$lists = get_post_meta($r, '_send_lists', true);
$lists = explode(",", $lists);
foreach ($lists as $list) {
SendPress_Data::unsubscribe_from_list($s, $r, $list);
}
}
$link_data = array("id" => $s, "report" => $r, "urlID" => '0', "view" => "manage", "listID" => "0", "action" => "");
$code = SendPress_Data::encrypt($link_data);
$link = SendPress_Manager::public_url($code);
$this->redirect($link);
exit;
}
示例3: send_manage_subscription
static function send_manage_subscription($subscriberID, $listids, $lists)
{
$subscriber = SendPress_Data::get_subscriber($subscriberID);
$l = '';
foreach ($lists as $list) {
if (in_array($list->ID, $listids)) {
$l .= $list->post_title . " <br>";
}
}
// add_filter( 'the_content', array( $this, 'the_content') );
$optin = SendPress_Data::get_template_id_by_slug('double-optin');
$user = SendPress_Data::get_template_id_by_slug('user-style');
SendPress_Posts::copy_meta_info($optin, $user);
$message = new SendPress_Email();
$message->id($optin);
$message->subscriber_id($subscriberID);
$message->remove_links(true);
$message->purge(true);
$html = $message->html();
$message->purge(false);
$text = $message->text();
$code = array("id" => $subscriberID, "listids" => implode(',', $listids), "view" => "confirm");
$code = SendPress_Data::encrypt($code);
if (SendPress_Option::get('old_permalink') || !get_option('permalink_structure')) {
$link = home_url() . "?sendpress=" . $code;
} else {
$link = home_url() . "/sendpress/" . $code;
}
$href = $link;
$html_href = "<a href='" . $link . "'>" . $link . "</a>";
$html = str_replace("*|SP:CONFIRMLINK|*", $html_href, $html);
$text = str_replace("*|SP:CONFIRMLINK|*", $href, $text);
$text = nl2br($text);
$sub = $message->subject();
SendPress_Data::register_event('confirm_sent', $subscriberID);
SendPress_Manager::send($subscriber->email, $sub, $html, $text, false);
}
示例4: html
function html()
{
$post_template = $this->id();
global $wpdb;
//$email = $this->email();
// Get any existing copy of our transient data
if (SendPress_Email_Cache::get($this->id()) != null) {
$body_html = SendPress_Email_Cache::get($this->id());
$post_template = get_post_meta($this->id(), '_sendpress_template', true);
$body_html = spnl_do_email_tags($body_html, $post_template, $this->id(), $this->subscriber_id(), true);
} else {
if (false === ($body_html = get_transient('sendpress_report_body_html_' . $this->id())) || $this->purge() == true) {
// It wasn't there, so regenerate the data and save the transient
if (!$this->post_info) {
$this->post_info = get_post($this->id());
}
if ($this->cache() !== false) {
$body_html = $this->cache();
} else {
$body_html = SendPress_Template::get_instance()->render($this->id(), false, false, $this->remove_links());
$this->cache($body_html);
}
set_transient('sendpress_report_body_html_' . $this->id(), $body_html, 60 * 60 * 2);
}
}
$subscriber = SendPress_Data::get_subscriber($this->subscriber_id());
if (!is_null($subscriber)) {
$body_html = str_replace("*|FNAME|*", $subscriber->firstname, $body_html);
$body_html = str_replace("*|LNAME|*", $subscriber->lastname, $body_html);
$body_html = str_replace("*|EMAIL|*", $subscriber->email, $body_html);
$body_html = str_replace("*|ID|*", $subscriber->subscriberID, $body_html);
}
$open_info = array("id" => $this->subscriber_id(), "report" => $this->id(), "view" => "open");
$code = SendPress_Data::encrypt($open_info);
$link = SendPress_Manager::public_url($code);
$tracker = "<img src='" . $link . "' width='1' height='1'/></body>";
$body_html = str_replace("</body>", $tracker, $body_html);
$body_link = get_post_meta($this->id(), 'body_link', true);
$body_html = spnl_do_subscriber_tags($body_html, $post_template, $this->id(), $this->subscriber_id(), true);
//$pattern ="/(?<=href=(\"|'))[^\"']+(?=(\"|'))/";
//$body_html = preg_replace( $pattern , site_url() ."?sendpress=link&fxti=".$subscriber_key."&spreport=". $this->id ."&spurl=$0", $body_html );
if (class_exists("DomDocument")) {
$dom = new DomDocument();
$dom->strictErrorChecking = false;
@$dom->loadHtml($body_html);
$pTags = $dom->getElementsByTagName('p');
foreach ($pTags as $pElement) {
$px = $pElement->getAttribute('style');
$pElement->setAttribute('style', $px . ' margin-top:0;margin-bottom:10px;');
}
if ($this->tracker()) {
$aTags = $dom->getElementsByTagName('a');
foreach ($aTags as $aElement) {
$href = $aElement->getAttribute('href');
/*
$style = $aElement->getAttribute('style');
if($style == ""){
$aElement->setAttribute('style');
}
*/
//ADD TO DB?
if (strrpos($href, "*|") === false && strrpos($href, "#") !== 0) {
if (SendPress_Option::get('skip_mailto', false) == true && strrpos($href, "mailto") !== false) {
continue;
}
/*
$urlinDB = SendPress_Data::get_url_by_report_url( $this->id(), $href );
if(!isset($urlinDB[0])){
$urlData = array(
'url' => trim($href),
'reportID' => $this->id(),
);
$urlID = SendPress_Data::insert_report_url( $urlData );
} else {
$urlID = $urlinDB[0]->urlID;
}
$link = array(
"id"=>$this->subscriber_id(),
"report"=> $this->id(),
"urlID"=> $urlID,
"view"=>"link"
);
*/
$link = array("id" => $this->subscriber_id(), "report" => $this->id(), "view" => "tracker", "url" => $href);
$code = SendPress_Data::encrypt($link);
$link = SendPress_Manager::public_url($code);
$href = $link;
$aElement->setAttribute('href', $href);
}
}
}
$body_html = $dom->saveHtml();
}
$link_data = array("id" => $this->subscriber_id(), "report" => $this->id(), "urlID" => '0', "view" => "manage", "listID" => $this->list_id(), "action" => "unsubscribe");
$code = SendPress_Data::encrypt($link_data);
$link = SendPress_Manager::public_url($code);
if (SendPress_Option::get('old_unsubscribe_link', false) === true) {
//.........这里部分代码省略.........
示例5: render_html
//.........这里部分代码省略.........
}
$headercontent = "<div style='padding: 10px; text-align:center;'><h1 style='text-align:center; color: " . $header_text_color . " !important;'>" . $header_link_open . $header_text . $header_link_close . "</h1>" . $sub_header_text . "</div>";
$HtmlCode = str_replace("*|SP:HEADERCONTENT|*", $headercontent, $HtmlCode);
}
$HtmlCode = str_replace("*|SP:HEADERBG|*", $header_bg, $HtmlCode);
$HtmlCode = str_replace("*|SP:HEADERTEXT|*", $header_text_color, $HtmlCode);
$HtmlCode = str_replace("*|SP:BODYBG|*", $body_bg, $HtmlCode);
$HtmlCode = str_replace("*|SP:BODYTEXT|*", $body_text, $HtmlCode);
$HtmlCode = str_replace("*|SP:BODYLINK|*", $body_link, $HtmlCode);
$HtmlCode = str_replace("*|SP:CONTENTBG|*", $content_bg, $HtmlCode);
$HtmlCode = str_replace("*|SP:CONTENTTEXT|*", $content_text, $HtmlCode);
$HtmlCode = str_replace("*|SP:CONTENTLINK|*", $content_link, $HtmlCode);
$HtmlCode = str_replace("*|SP:CONTENTBORDER|*", $content_border, $HtmlCode);
$HtmlCode = $this->tag_replace($HtmlCode);
// Date processing
$canspam = wpautop(SendPress_Option::get('canspam'));
$HtmlCode = str_replace("*|SP:CANSPAM|*", $canspam, $HtmlCode);
$social = '';
if ($twit = SendPress_Option::get('twitter')) {
$social .= "<a href='{$twit}' style='color: {$body_link};'>Twitter</a>";
}
if ($fb = SendPress_Option::get('facebook')) {
if ($social != '') {
$social .= " | ";
}
$social .= "<a href='{$fb}' style='color: {$body_link};'>Facebook</a>";
}
if ($ld = SendPress_Option::get('linkedin')) {
if ($social != '') {
$social .= " | ";
}
$social .= "<a href='{$ld}' style='color: {$body_link};'>LinkedIn</a>";
}
$social = SendPress_Data::build_social($body_link);
$HtmlCode = str_replace("*|SP:SOCIAL|*", $social, $HtmlCode);
/*
$dom = new DomDocument();
$dom->strictErrorChecking = false;
@$dom->loadHtml($HtmlCode);
$iTags = $dom->getElementsByTagName('img');
foreach ($iTags as $iElement) {
$class = $iElement->getAttribute('class');
}
$body_html = $dom->saveHtml();
*/
/*
$simplecss = file_get_contents(SENDPRESS_PATH.'/templates/simple.css');
// create instance
$cssToInlineStyles = new CSSToInlineStyles($HtmlCode, $simplecss);
// grab the processed HTML
$HtmlCode = $cssToInlineStyles->convert();
*/
$display_correct = __("Is this email not displaying correctly?", "sendpress");
$view = __("View it in your browser", "sendpress");
$start_text = __("Not interested anymore?", "sendpress");
$unsubscribe = __("Unsubscribe", "sendpress");
$instantly = __("Instantly", "sendpress");
$manage = __("Manage Subscription", "sendpress");
if ($render) {
//RENDER IN BROWSER
if ($inline) {
$link = get_permalink($post->ID);
$browser = $display_correct . ' <a style="color: ' . $body_link . ';" href="' . $link . '">' . $view . '</a>.';
$HtmlCode = str_replace("*|SP:BROWSER|*", $browser, $HtmlCode);
$remove_me = ' <a href="#" style="color: ' . $body_link . ';" >' . $unsubscribe . '</a> | ';
$manage = ' <a href="#" style="color: ' . $body_link . ';" >' . $manage . '</a> ';
$HtmlCode = str_replace("*|SP:MANAGE|*", $manage, $HtmlCode);
$HtmlCode = str_replace("*|SP:UNSUBSCRIBE|*", $remove_me, $HtmlCode);
} else {
$HtmlCode = str_replace("*|SP:BROWSER|*", '', $HtmlCode);
$HtmlCode = str_replace("*|SP:UNSUBSCRIBE|*", '', $HtmlCode);
$HtmlCode = str_replace("*|SP:MANAGE|*", '', $HtmlCode);
$HtmlCode = str_replace("*|ID|*", '', $HtmlCode);
$HtmlCode = str_replace("*|FNAME|*", '', $HtmlCode);
$HtmlCode = str_replace("*|LNAME|*", '', $HtmlCode);
$HtmlCode = str_replace("*|EMAIL|*", '', $HtmlCode);
}
echo $HtmlCode;
} else {
//PREP FOR SENDING
if ($no_links == false) {
$link = get_permalink($post->ID);
$open_info = array("id" => $post->ID, "view" => "email");
$code = SendPress_Data::encrypt($open_info);
$xlink = SendPress_Manager::public_url($code);
$browser = $display_correct . ' <a style="color: ' . $body_link . ';" href="' . $xlink . '">' . $view . '</a>.';
$HtmlCode = str_replace("*|SP:BROWSER|*", $browser, $HtmlCode);
} else {
$HtmlCode = str_replace("*|SP:BROWSER|*", '', $HtmlCode);
$HtmlCode = str_replace("*|SP:UNSUBSCRIBE|*", '', $HtmlCode);
$HtmlCode = str_replace("*|SP:MANAGE|*", '', $HtmlCode);
}
return $HtmlCode;
}
} else {
//echo __('Sorry we could not find your email template.','sendpress');
return;
}
}
示例6: html
//.........这里部分代码省略.........
</script>
<select name="send-later-time" id="datepicker-time" class="fifty">
<option value="00:00:00">12:00 am</option>
<option value="01:00:00">1:00 am</option>
<option value="02:00:00">2:00 am</option>
<option value="03:00:00">3:00 am</option>
<option value="04:00:00">4:00 am</option>
<option value="05:00:00">5:00 am</option>
<option value="06:00:00">6:00 am</option>
<option value="07:00:00">7:00 am</option>
<option value="08:00:00">8:00 am</option>
<option value="09:00:00">9:00 am</option>
<option value="10:00:00">10:00 am</option>
<option value="11:00:00">11:00 am</option>
<option value="12:00:00">12:00 pm</option>
<option value="13:00:00">1:00 pm</option>
<option value="14:00:00">2:00 pm</option>
<option value="15:00:00">3:00 pm</option>
<option value="16:00:00">4:00 pm</option>
<option value="17:00:00">5:00 pm</option>
<option value="18:00:00">6:00 pm</option>
<option value="19:00:00">7:00 pm</option>
<option value="20:00:00">8:00 pm</option>
<option value="21:00:00">9:00 pm</option>
<option value="22:00:00">10:00 pm</option>
<option value="23:00:00">11:00 pm</option>
</select>
</div>
<?php
$this->panel_end();
do_action('spnl_add_to_sending', $this);
$this->panel_start('<span class="glyphicon glyphicon-list"></span> ' . __('Lists', 'sendpress'));
$post_args = array('post_type' => 'sendpress_list', 'numberposts' => -1, 'offset' => 0, 'orderby' => 'post_title', 'order' => 'DESC');
$current_lists = get_posts($post_args);
foreach ($current_lists as $list) {
$t = '';
$tlist = '';
if (get_post_meta($list->ID, '_test_list', true) == 1) {
$t = ' <span class="label label-info">Test List</span>';
$tlist = ' test-list-add';
}
echo "<input name='listIDS[]' type='checkbox' id='listIDS' class='sp-send-lists " . $tlist . "' value=" . $list->ID . "> " . $list->post_title . " <small>(" . SendPress_Data::get_count_subscribers($list->ID) . ")</small>{$t}<br>";
}
$this->panel_end();
$this->panel_start('<span class="glyphicon glyphicon-tag"></span> ' . __('Mark as Test', 'sendpress'));
echo "<input name='test_report' type='checkbox' id='test_report' value='1'> " . __('Test', 'sendpress') . "<br>";
echo "<small class='text-muted'> " . __('This puts the report into the Test tab on the Reports screen', 'sendpress') . ".</small>";
$this->panel_end();
?>
<!--
<div class="style-unit">
<h4><?php
_e('Settings', 'sendpress');
?>
</h4>
<input type="checkbox" name="test-send" value="1" /> Mark as Test
<textarea name="test-add" cols='26' rows='6'></textarea>
</div>
-->
<?php
wp_nonce_field($sp->_nonce_value);
?>
</div>
<div style="margin-left: 250px;">
<div class="widerightcol">
<?php
$url = get_site_url();
//$link = get_permalink( $post->ID );
$open_info = array("id" => $post->ID, "view" => "email");
$code = SendPress_Data::encrypt($open_info);
$url = SendPress_Manager::public_url($code);
$sep = strstr($url, '?') ? '&' : '?';
$link = $url . $sep . 'inline=true';
?>
<iframe src="<?php
echo $link;
?>
" width="100%" height="600px"></iframe>
<small><?php
_e('Displaying a 404? Please try saving your permalinks', 'sendpress');
?>
<a href="<?php
echo admin_url('options-permalink.php');
?>
"><?php
_e('here', 'sendpress');
?>
</a>.</small>
</div>
</div>
<br class="clear" />
</div>
</form>
<?php
}
示例7: manage_sub_prerender
private static function manage_sub_prerender()
{
$info = self::data();
if (isset($info->action) && $info->action == 'unsubscribe') {
SendPress_Data::unsubscribe_from_list($info->id, $info->report, $info->listID);
$link_data = array("id" => $info->id, "report" => $info->report, "urlID" => '0', "view" => "manage", "listID" => $info->listID, "action" => "");
$code = SendPress_Data::encrypt($link_data);
$link = SendPress_Manager::public_url($code);
//$this->redirect( $link );
//exit;
}
}
示例8: html
//.........这里部分代码省略.........
_e('Confirm Send', 'sendpress');
?>
</h2>
<br>
<input type="hidden" id="user-id" name="user_ID" value="<?php
//echo $current_user->ID;
?>
" />
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $post->ID;
?>
" />
<div class="boxer">
<div class="boxer-inner">
<?php
$this->panel_start('<span class="glyphicon glyphicon-inbox"></span> ' . __('Subject', 'sendpress'));
?>
<input type="text" class="form-control" value="<?php
echo stripslashes(esc_attr(htmlspecialchars($subject)));
?>
" disabled />
<?php
$this->panel_end();
?>
<div class="leftcol">
<?php
$this->panel_start('<span class="glyphicon glyphicon-calendar"></span> ' . __('Date & Time', 'sendpress'));
if ($info['send_at'] == '0000-00-00 00:00:00') {
echo "Your email will start sending right away!";
} else {
echo "Your email will start sending on " . date('Y/m/d', strtotime($info['send_at'])) . " at " . date('h:i A', strtotime($info['send_at']));
}
$this->panel_end();
$this->panel_start('<span class="glyphicon glyphicon-list"></span> ' . __('Lists', 'sendpress'));
?>
<?php
if (!empty($info['listIDS'])) {
foreach ($info['listIDS'] as $list_id) {
$list = $sp->get_list_details($list_id);
echo $list->post_title . " <small>(" . SendPress_Data::get_count_subscribers($list_id) . ")</small><br>";
}
} else {
_e('No Lists Selected', 'sendpress');
echo "<br>";
}
$this->panel_end();
$this->panel_start('<span class="glyphicon glyphicon-tag"></span> ' . __('Mark as Test', 'sendpress'));
$sel = '';
if (get_post_meta($post_ID, 'istest', true) == true) {
$sel = 'checked';
}
echo "<input {$sel} name='test_report' type='checkbox' id='test_report' value='1' disabled> Test<br>";
echo "<small class='text-muted'>" . __('This puts the report into the Test tab on the Reports screen', 'sendpress') . ".</small>";
$this->panel_end();
?>
</div>
<div style="margin-left: 250px;">
<div class="widerightcol">
<?php
$link = get_permalink($post->ID);
$sep = strstr($link, '?') ? '&' : '?';
$link = $link . $sep . 'inline=true';
$open_info = array("id" => $post->ID, "view" => "email");
$code = SendPress_Data::encrypt($open_info);
$url = SendPress_Manager::public_url($code);
$sep = strstr($url, '?') ? '&' : '?';
$link = $url . $sep . 'inline=true';
?>
<iframe src="<?php
echo $link;
?>
" width="100%" height="600px"></iframe>
<small><?php
_e('Displaying a 404? Please try saving your permalinks', 'sendpress');
?>
<a href="<?php
echo admin_url('options-permalink.php');
?>
"><?php
_e('here', 'sendpress');
?>
</a>.</small>
</div>
<?php
wp_nonce_field($sp->_nonce_value);
?>
<br><br>
</div>
</div>
<br class="clear" />
</div>
</form>
<?php
}
示例9: send_email
function send_email($to, $subject, $html, $text, $istest = false, $sid, $list_id, $report_id)
{
$this->emailText = $text;
$this->sid = $sid;
$this->list_id = $list_id;
$this->report_id = $report_id;
//add_filter( 'phpmailer_init' , array( $this , 'wpmail_init' ) , 90 );
$link2 = array("id" => $sid, "report" => $list_id, "view" => "tracker", "url" => "{sp-unsubscribe-url}");
$code2 = SendPress_Data::encrypt($link2);
$link2 = SendPress_Manager::public_url($code2);
$rpath = SendPress_Option::get('bounce_email');
if ($rpath != false) {
$rpath = SendPress_Option::get('fromname');
}
$headers = array('Content-Type: text/html; charset=' . SendPress_Option::get('email-charset', 'UTF-8'), 'X-SP-LIST: ' . $this->list_id . ';', 'X-SP-REPORT: ' . $this->report_id . ';', 'X-SP-SUBSCRIBER: ' . $this->sid . ';', 'X-SP-METHOD: website wp_mail', 'From: ' . SendPress_Option::get('fromname') . ' <' . SendPress_Option::get('fromemail') . '>', 'List-Unsubscribe: <' . $link2 . '>', 'Return-Path: ' . $rpath);
$r = wp_mail($to, $subject, $html, $headers);
//remove_filter( 'phpmailer_init' , array( $this , 'wpmail_init' ) , 90 );
return $r;
}
示例10: encrypt_data
function encrypt_data($message)
{
_deprecated_function(__FUNCTION__, '0.8.9', 'SendPress_Data::encrypt()');
return SendPress_Data::encrypt($message);
}