本文整理汇总了PHP中SendPress_Data::random_code方法的典型用法代码示例。如果您正苦于以下问题:PHP SendPress_Data::random_code方法的具体用法?PHP SendPress_Data::random_code怎么用?PHP SendPress_Data::random_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SendPress_Data
的用法示例。
在下文中一共展示了SendPress_Data::random_code方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
//$this->security_check();
$saveid = SPNL()->validate->_int('post_ID');
update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
$email_post = get_post($saveid);
$subject = SendPress_Option::get('current_send_subject_' . $saveid);
$info = SendPress_Option::get('current_send_' . $saveid);
$slug = SendPress_Data::random_code();
$new_id = SendPress_Posts::copy($email_post, $subject, $slug, SPNL()->_report_post_type);
SendPress_Posts::copy_meta_info($new_id, $saveid);
$lists = implode(',', $info['listIDS']);
update_post_meta($new_id, '_send_time', $info['send_at']);
update_post_meta($new_id, '_send_lists', $lists);
update_post_meta($new_id, '_stat_type', 'new');
$count = 0;
if (get_post_meta($saveid, 'istest', true) == true) {
update_post_meta($new_id, '_report_type', 'test');
}
update_post_meta($new_id, '_sendpress_subject', $subject);
if (isset($info['testemails']) && $info['testemails'] != false) {
foreach ($info['testemails'] as $email) {
$go = array('from_name' => 'Josh', 'from_email' => 'joshlyford@gmail.com', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
SPNL()->add_email_to_queue($go);
$count++;
}
}
update_post_meta($new_id, '_send_count', $count);
SendPress_Admin::redirect('Emails_Send_Queue', array('emailID' => $new_id));
}
示例2: save
function save($post, $sp)
{
$saveid = $_POST['post_ID'];
update_post_meta($saveid, 'send_date', date('Y-m-d H:i:s'));
$email_post = get_post($saveid);
$subject = SendPress_Option::get('current_send_subject_' . $saveid);
$info = SendPress_Option::get('current_send_' . $saveid);
$slug = SendPress_Data::random_code();
$new_id = SendPress_Posts::copy($email_post, $subject, $slug, $sp->_report_post_type);
SendPress_Posts::copy_meta_info($new_id, $saveid);
$lists = implode(',', $info['listIDS']);
update_post_meta($new_id, '_send_time', $info['send_at']);
update_post_meta($new_id, '_send_lists', $lists);
update_post_meta($new_id, '_stat_type', 'new');
$count = 0;
if (get_post_meta($saveid, 'istest', true) == true) {
update_post_meta($new_id, '_report_type', 'test');
}
update_post_meta($new_id, '_sendpress_subject', $subject);
/*
if(isset($info['listIDS'])){
// foreach($info['listIDS'] as $list_id){
$_email = SendPress_Data::get_active_subscribers_lists($info['listIDS']); //$sp->get_active_subscribers( $list_id );
foreach($_email as $email){
$go = array(
'from_name' => '',
'from_email' => '',
'to_email' => $email->email,
'emailID'=> $new_id,
'subscriberID'=> $email->subscriberID,
//'to_name' => $email->fistname .' '. $email->lastname,
'subject' => '',
'listID'=> $email->listid
);
$sp->add_email_to_queue($go);
$count++;
}
// }
}
*/
if (isset($info['testemails']) && $info['testemails'] != false) {
foreach ($info['testemails'] as $email) {
$go = array('from_name' => 'Josh', 'from_email' => 'joshlyford@gmail.com', 'to_email' => $email['email'], 'emailID' => $new_id, 'subscriberID' => 0, 'subject' => $subject, 'listID' => 0);
$sp->add_email_to_queue($go);
$count++;
}
}
update_post_meta($new_id, '_send_count', $count);
// update_post_meta($new_id,'_send_data', $info );
SendPress_Admin::redirect('Emails_Send_Queue', array('emailID' => $new_id));
//wp_redirect( '?page=sp-queue' );
}
示例3: import_csv_array
static function import_csv_array($data, $map, $list)
{
global $wpdb;
$query = "INSERT IGNORE INTO " . SendPress_Data::subscriber_table() . "(email,firstname,lastname,join_date,registered_ip,identity_key) VALUES ";
$total = count($data);
$emails_added = array();
$x = 0;
foreach ($data as $key_line => $line) {
$values = "";
if (array_key_exists('email', $map)) {
$email = $line[$map['email']];
if (is_email($email)) {
$values .= "'" . esc_sql($email, $wpdb->dbh) . "',";
$emails_added[] = $email;
if (array_key_exists('firstname', $map)) {
$values .= "'" . esc_sql(trim($line[$map['firstname']]), $wpdb->dbh) . "',";
} else {
$values .= "'',";
}
if (array_key_exists('lastname', $map)) {
$values .= "'" . esc_sql(trim($line[$map['lastname']]), $wpdb->dbh) . "',";
} else {
$values .= "'',";
}
$values .= "'" . date('Y-m-d H:i:s') . "',";
if (array_key_exists('ip', $map)) {
$values .= "'" . esc_sql(trim($line[$map['ip']]), $wpdb->dbh) . "',";
} else {
$values .= "'',";
}
$values .= "'" . SendPress_Data::random_code() . "'";
$query .= " ({$values}) ";
}
}
$x++;
if ($total > $x && $values != "") {
$query .= ",";
}
unset($data[$key_line]);
}
$query .= ";";
$wpdb->query($query);
$query_get = "SELECT subscriberID FROM " . SendPress_Data::subscriber_table() . " WHERE email in ('" . implode("','", $emails_added) . "')";
$data = $wpdb->get_results($query_get);
$txt = '';
foreach ($data as $value) {
$txt .= $value->subscriberID . ',';
}
$txt .= '0';
$current_status = "SELECT * FROM " . SendPress_Data::list_subcribers_table() . " WHERE subscriberID in (" . $txt . ") AND listID = " . $list;
$my_data_x = $wpdb->get_results($current_status, OBJECT_K);
$query_update_status = "INSERT IGNORE INTO " . SendPress_Data::list_subcribers_table() . "(subscriberID,listID,status,updated ) VALUES ";
$total = count($data);
$x = 0;
if ($total > 0) {
foreach ($data as $value) {
$x++;
if (!isset($my_data_x[$value->subscriberID])) {
$query_update_status .= "( " . $value->subscriberID . "," . $list . ",2,'" . date('Y-m-d H:i:s') . "') ";
if ($total > $x) {
$query_update_status .= ",";
}
}
}
$query_update_status .= ";";
$wpdb->query($query_update_status);
}
}
示例4: html
function html($sp)
{
do_action('sendpress_event', 'Create Email');
$post = get_default_post_to_edit($sp->_email_post_type, true);
$post_ID = $post->ID;
global $current_user;
wp_enqueue_script('post');
$post_type = SendPress_Data::email_post_type();
$post_type_object = get_post_type_object($post_type);
?>
<form method="POST" name="post" id="post">
<div id="styler-menu">
<div style="float:right;" class="btn-group">
<input type="submit" value="<?php
_e('Save & Next', 'sendpress');
?>
" class="btn btn-primary" />
</div>
<div id="sp-cancel-btn" style="float:right; ">
<a href="<?php
echo SendPress_Admin::link('Emails_Autoresponder');
?>
" id="cancel-update" class="btn btn-default"><?php
echo __('Cancel', 'sendpress');
?>
</a>
</div>
</div>
<h2><?php
_e('Create Autoresponder', 'sendpress');
?>
</h2>
<br>
<!--
has-right-sidebar">
<div id="side-info-column" class="inner-sidebar">
<div class="clear"><br>
<?php
echo do_action('do_meta_boxes', $sp->_email_post_type, 'side', $post);
do_meta_boxes($post_type, 'side', $post);
?>
</div>
</div>
-->
<input type="hidden" value="save-create" name="save-action" id="save-action" />
<input type="hidden" value="save-email" name="action" />
<input type="hidden" id="user-id" name="user_ID" value="<?php
echo $current_user->ID;
?>
" />
<input type="hidden" value="default" name="target-location" id="target-location" />
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $post->ID;
?>
" />
<!--
<h2>Email Template Name</h2>
-->
<input type="hidden" name="post_title" size="30" tabindex="1" value="<?php
echo SendPress_Data::random_code();
//echo esc_attr( htmlspecialchars( $post->post_title ) );
?>
" id="title" autocomplete="off" />
<!--<br><br>-->
<!--<h2><?php
_e('Subject', 'sendpress');
?>
</h2>
<input type="text" name="post_subject" size="30" tabindex="1" value="<?php
echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
?>
" id="email-subject" autocomplete="off" />-->
<?php
$this->panel_start('<span class="glyphicon glyphicon-envelope"></span> ' . __('Subject', 'sendpress'));
?>
<input type="text" name="post_subject" size="30" tabindex="1" class="form-control" value="<?php
echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
?>
" id="email-subject" autocomplete="off" />
<?php
$this->panel_end();
?>
<div class="sp-row">
<div class="sp-50 sp-first">
<?php
$this->panel_start(__('Template', 'sendpress'));
?>
<select class="form-control" name="template">
<?php
$args = array('post_type' => 'sp_template', 'post_status' => array('sp-standard'));
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
//.........这里部分代码省略.........
示例5: html
function html()
{
do_action('sendpress_event', 'Create Email');
$post = get_default_post_to_edit(SPNL()->_email_post_type, true);
$post_ID = $post->ID;
global $current_user;
wp_enqueue_script('post');
$post_type = SendPress_Data::email_post_type();
$post_type_object = get_post_type_object($post_type);
?>
<form method="POST" name="post" id="post">
<div id="styler-menu">
<div style="float:right;" class="btn-group">
<input type="submit" value="<?php
_e('Save & Next', 'sendpress');
?>
" class="btn btn-primary" />
</div>
<div id="sp-cancel-btn" style="float:right; ">
<a href="<?php
echo SendPress_Admin::link('Emails');
?>
" id="cancel-update" class="btn btn-default"><?php
echo __('Cancel', 'sendpress');
?>
</a>
</div>
</div>
<h2><?php
_e('Create Email', 'sendpres');
?>
</h2>
<br>
<!--
has-right-sidebar">
<div id="side-info-column" class="inner-sidebar">
<div class="clear"><br>
<?php
echo do_action('do_meta_boxes', SPNL()->_email_post_type, 'side', $post);
do_meta_boxes($post_type, 'side', $post);
?>
</div>
</div>
-->
<input type="hidden" value="save-create" name="save-action" id="save-action" />
<input type="hidden" value="save-email" name="action" />
<input type="hidden" id="user-id" name="user_ID" value="<?php
echo $current_user->ID;
?>
" />
<input type="hidden" value="default" name="target-location" id="target-location" />
<input type="hidden" id="post_ID" name="post_ID" value="<?php
echo $post->ID;
?>
" />
<!--
<h2>Email Template Name</h2>
-->
<input type="hidden" name="post_title" size="30" tabindex="1" value="<?php
echo SendPress_Data::random_code();
//echo esc_attr( htmlspecialchars( $post->post_title ) );
?>
" id="title" autocomplete="off" />
<!--<br><br>-->
<!--<h2><?php
_e('Subject', 'sendpress');
?>
</h2>
<input type="text" name="post_subject" size="30" tabindex="1" value="<?php
echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
?>
" id="email-subject" autocomplete="off" />-->
<?php
$this->panel_start('<span class="glyphicon glyphicon-envelope"></span> ' . __('Subject', 'sendpress'));
?>
<input type="text" name="post_subject" size="30" tabindex="1" class="form-control" value="<?php
echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
?>
" id="email-subject" autocomplete="off" />
<?php
$this->panel_end();
?>
<div class="sp-row">
<div class="sp-50 sp-first">
<?php
$this->panel_start(__('1.0 Template', 'sendpress'));
?>
<label>
<input type="radio" name="template_system" checked value="new" /> <?php
_e('Use New System', 'sendpres');
?>
</label>
<br>
//.........这里部分代码省略.........
示例6: random_code
function random_code()
{
_deprecated_function(__FUNCTION__, '0.8.9', 'SendPress_Data::random_code()');
return SendPress_Data::random_code();
}