function html($sp) { $list = ''; if (isset($_GET['listID'])) { $list_id = $_GET['listID']; $listinfo = get_post($_GET['listID']); } $backLink = apply_filters('sendpress_back_to_lists_link', 'Subscribers'); ?> <div id="taskbar"> <div id="button-area" > <a href="<?php echo SendPress_Admin::link($backLink); ?> " class="btn btn-large btn-default" ><i class="icon-backward"></i> <?php _e('Back to Lists', 'sendpress'); ?> </a> <a href="#" id="save-update" class="btn btn-primary btn-large"><?php _e('Save', 'sendpress'); ?> </a> </div> <h2><?php _e('Form Settings for List ', 'sendpress'); echo ':' . $listinfo->post_title; ?> </h2> </div> <br class="clear"> <form id="post" method="post"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">HTML/Remote Post</h3> </div> <div class="panel-body"> <div class="boxer form-box"> <div style="float: right; width: 45%;"><br> <b>HTML</b><br> <textarea style="width:100%; padding: 8px;" rows="21" name="post-page-text"> <form method="post" action="<?php echo trailingslashit(site_url()); ?> "> <input type="hidden" name="sp_list" value="<?php echo $list_id; ?> "/> <input type="hidden" name="sendpress" value="post" /> <div id="form-wrap"> <p name="email"> <label for="email">EMail:</label> <input type="text" value="" name="sp_email"/> </p> <p name="firstname"> <label for="email">First Name:</label> <input type="text" value="" name="sp_firstname"/> </p> <p name="lastname"> <label for="email">Last Name:</label> <input type="text" value="" name="sp_lastname"/> </p> <p class="submit"> <input value="Submit" class="sendpress-submit" type="submit" id="submit" name="submit"> </p> </div> </form> </textarea> </div> <div style="width: 45%; margin-right: 10%"><br> Post URL <div class='well'> <input type="hidden" name="listID" value="<?php echo $list_id; ?> " /> <input type="text" readonly value="<?php echo trailingslashit(site_url()); ?> " class="sp-text"/> </div> Response Options <div class='well'> <?php $ctype = get_post_meta($list_id, 'post-page', true); if ($ctype == false) { $ctype = 'default'; } ?> <input type="radio" name="post-page" value="default" <?php if ($ctype == 'default') { echo "checked='checked'"; } ?> /> Show Default SendPress Page<br><br> <input type="radio" name="post-page" value="custom" <?php if ($ctype == 'custom') { echo "checked='checked'"; } ?> /> Redirect to <select name="post-page-id"> <option value=""> <?php $cpageid = get_post_meta($list_id, 'post-page-id', true); echo esc_attr(__('Select page')); ?> </option> <?php $pages = get_pages(); foreach ($pages as $page) { $s = ''; if ($cpageid == $page->ID) { $s = "selected"; } $option = '<option value="' . $page->ID . '" ' . $s . '>'; $option .= $page->post_title; $option .= '</option>'; echo $option; } ?> </select><br><br> <input type="radio" name="post-page" value="json" <?php if ($ctype == 'json') { echo "checked='checked'"; } ?> /> Return Json Data ie: { success: true/false, list: listid , name: listname, optin: true/false }<br><br> <?php $link = get_post_meta($list_id, 'post-redirect', true); ?> <input type="radio" name="post-page" value="redirect" <?php if ($ctype == 'redirect') { echo "checked='checked'"; } ?> /> Redirect to url entered below. <br><br><input type="text" name="post-redirect" class="sp-text" value="<?php echo $link; ?> "><br><br> </div> </div> </div> </div> <br class="clear"> </div> <br class="clear"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">iFrame</h3> </div> <div class="panel-body"> <div class="boxer form-box"> <div style="float: right; width: 45%;"><br> <b>HTML</b><br> <textarea style="width:100%; padding: 8px;" rows="21" name="post-page-text"><iframe width="100%" scrolling="no" frameborder="0" src="<?php echo site_url(); ?> ?sendpress=form&list=<?php echo $_GET['listID']; ?> " vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 130px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription SendPress" ></iframe></textarea> </div> <div style="width: 45%; margin-right: 10%"><br> <!-- <iframe width="100%" scrolling="no" frameborder="0" src="http://joshlmbprd.whipplehill.com/wp/?wysija-page=1&controller=subscribers&action=wysija_outter&widgetnumber=4&external_site=1&wysijap=subscriptions" name="wysija-1358371025" class="iframe-wysija" id="wysija-4" vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 330px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription Wysija"></iframe> --> <iframe width="100%" scrolling="no" frameborder="0" src="<?php echo site_url(); ?> ?sendpress=form&list=<?php echo $_GET['listID']; ?> " vspace="0" tabindex="0" style="position: static; top: 0pt; margin: 0px; border-style: none; height: 130px; left: 0pt; visibility: visible;" marginwidth="0" marginheight="0" hspace="0" allowtransparency="true" title="Subscription SendPress" ></iframe> </div> <br class="clear"> </div> </div> </div> <?php wp_nonce_field(SendPress_Data::nonce()); ?> </form> <?php }
static function nonce_field() { wp_nonce_field(SendPress_Data::nonce()); }
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 }
private static function manage_subscription($options) { //debug // $link_data = array( // "id"=>23, // "report"=>0, // "urlID"=> '0', // "view"=>"manage", // "listID"=>"0", // "action"=>"" // ); // $code = SendPress_Data::encrypt( $link_data ); // $link = SendPress_Manager::public_url($code); // print_r($link); $_nonce_value = 'sendpress-is-awesome'; $info = self::data(); //SendPress_Error::log($info->id); //print_r($info); if (!isset($info->id)) { $info = new stdClass(); $info->id = ''; } $s = $info->id; //SendPress_Error::log($s); extract($options); if (is_numeric($s)) { $sub = SendPress_Data::get_subscriber($s); if ($sub == false) { $sub = new stdClass(); $sub->email = '*****@*****.**'; $sub->join_date = date("F j, Y, g:i a"); } // print_r($sub); ?> <link rel="stylesheet" type="text/css" href="<?php echo SENDPRESS_URL; ?> /css/manage-front-end.css"> <div class="sendpress-content"> <h4>Manage Subscriptions</h4> <div class="subscriber-info"> <b><?php _e('Email', 'sendpress'); ?> </b> <?php echo $sub->email; ?> <br> <b><?php _e('Signup Date', 'sendpress'); ?> </b> <?php echo $sub->join_date; ?> </div> <?php if (self::handle_unsubscribes()) { ?> <div class="alert alert-block alert-info"> <h4 class="alert-heading"><?php _e('Saved', 'sendpress'); ?> !</h4> <?php _e('Your subscriptions have been updated. Thanks.', 'sendpress'); ?> </div> <?php } ?> <p><?php _e('You are subscribed to the following lists:', 'sendpress'); ?> </p> <?php $info->action = "update"; $key = SendPress_Data::encrypt($info); $query_var = ''; if (get_query_var('spms')) { $query_var = "?spms=" . $key; } elseif (get_query_var('sendpress')) { $query_var = "?sendpress=" . $key; } ?> <form action="<?php echo $query_var; ?> " method="post"> <?php wp_nonce_field(SendPress_Data::nonce()); ?> <input type="hidden" name="subscriberid" id="subscriberid" value="<?php echo $s; ?> " /> <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">Updated</th> <th class="hidden-phone">Other Info</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, $s); ?> <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> </div> <?php } }
function test_nonce() { $this->assertEquals('sendpress-is-awesome', SendPress_Data::nonce()); }