/** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     $settings = SendPress_Data::get_post_meta_object($item->ID);
     switch ($column_name) {
         case 'name':
             return $item->post_title;
             break;
         case 'type':
             return ucwords(str_replace('_', ' ', $settings['_form_type']));
             break;
         case 'shortcode':
             return '[sp-form formid=' . $item->ID . ']';
             break;
         case 'actions':
             //$type = get_post_meta($item->ID, "_template_type", true);
             $a = '<div class="inline-buttons" style="text-align:right;">';
             $a .= '<a class="btn btn-default" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID, 'create' => 1)) . '">' . __('Clone', 'sendpress') . '</a> <a class="btn btn-primary" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID)) . '">' . __('Edit', 'sendpress') . '</a>' . '</a> <a class="btn btn-danger" href="' . SendPress_Admin::link('Settings_Widgets', array('id' => $item->ID, 'delete' => 1)) . '">' . __('Delete', 'sendpress') . '</a>';
             $a .= '</div>';
             return $a;
             break;
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
    function html($sp)
    {
        global $sendpress_html_templates;
        //print_r($sendpress_html_templates[$_GET['templateID']]);
        $postdata = get_post($_GET['templateID']);
        //print_r( $postdata );
        ?>
    <form method="post" name="post" >
    <input type="hidden" value="<?php 
        echo $_GET['templateID'];
        ?>
" name="templateID" />
     
   	<div class="pull-right">
     <a href="<?php 
        echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $_GET['templateID']));
        ?>
"><?php 
        _e('Back to Template', 'sendpress');
        ?>
</a>&nbsp;&nbsp;&nbsp;<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 Footer', 'sendpress');
        ?>
</h2><br>
     <div class="tab-pane fade in active" id="home"><?php 
        wp_editor(get_post_meta($postdata->ID, '_footer_content', true), 'footer-content');
        ?>
</div>

		<?php 
        SendPress_Data::nonce_field();
        ?>
     </form><br><br><?php 
        _e('Default Content', 'sendpress');
        ?>
<textarea class="form-control" rows="3">
<?php 
        echo SendPress_Tag_Footer_Content::content();
        ?>
</textarea>
<br>



<?php 
        echo spnl_get_emails_tags_list();
        $this->popup();
        ?>


<?php 
    }
Esempio n. 3
0
    static function footer()
    {
        ?>
		<div class="sp-footer">
			<a href="<?php 
        echo SendPress_Admin::link('Help_Whatsnew');
        ?>
">What's New</a> | <a href="http://docs.sendpress.com/" target="_blank">Knowledge Base</a> | <a href="http://sendpress.uservoice.com/" target="_blank">Feedback</a> | SendPress Version: <?php 
        echo SENDPRESS_VERSION;
        ?>
 
		</div>


		<!-- src/templates/metabox.templ.php  -->
 
<!-- Template -->
<script  id="tmpl-my-awesome-template" type="text/template">
 <div class="spnl-modal">
 	test info here....
 </div>
</script>
<!-- End template -->
			<?php 
    }
        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 
        }
    function html($sp)
    {
        ?>
		<?php 
        $template = get_post($_GET['templateID']);
        ?>

		
		
		<h2><?php 
        _e('You are about to delete template', 'sendpress');
        ?>
: <?php 
        echo $template->post_title;
        ?>
</h2>
		<br>
				<a class="btn btn-danger" href="<?php 
        echo SendPress_Admin::link('Emails_Temp', array('templateID' => $_GET['templateID'], 'action' => 'delete'));
        ?>
"><?php 
        _e('Delete Template', 'sendpress');
        ?>
</a>
			
				<a class="btn btn-default" href="<?php 
        echo SendPress_Admin::link('Emails_Temp');
        ?>
"><?php 
        _e('Cancel', 'sendpress');
        ?>
</a>
			

		
		
		<?php 
        //wp_editor($post->post_content,'textversion');
        ?>

		 <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
<br><br>
		 </form>
		 
		<?php 
    }
 function html($sp)
 {
     $count = SendPress_Data::get_bad_post_count();
     echo __("We see", "sendpress") . " " . $count . " " . __("bad posts.", "sendpress");
     $link = SendPress_Admin::link('Settings_Fixposts', array('action' => 'posts-repair'));
     echo "<br><br><a href='{$link}' class='btn btn-primary' >" . __('Attempt to Delete These', 'sendpress') . "</a>";
     /*
     echo "<h2>Attempting to install or repair missing data</h2><br>";
     
     SendPress_Data::install();
     
     echo "<pre>";
     echo SendPress_DB_Tables::check_setup_support();
     echo "</pre>";
     */
 }
    function html($sp)
    {
        global $sendpress_html_templates;
        //print_r($sendpress_html_templates[$_GET['templateID']]);
        $templateID = SPNL()->validate->int($_GET['templateID']);
        $postdata = get_post($templateID);
        //print_r( $postdata );
        ?>
    <form method="post" name="post" >
    <input type="hidden" value="<?php 
        echo $templateID;
        ?>
" name="templateID" />
     
   	<div class="pull-right">
     <a href="<?php 
        echo SendPress_Admin::link('Emails_Tempstyle', array('templateID' => $templateID));
        ?>
"><?php 
        _e('Back to Template', 'sendpress');
        ?>
</a>&nbsp;&nbsp;&nbsp;<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 Header', 'sendpress');
        ?>
</h2><br>
     <div class="tab-pane fade in active" id="home"><?php 
        wp_editor(get_post_meta($postdata->ID, '_header_page', true), 'header-content');
        ?>
</div>

		<?php 
        SendPress_Data::nonce_field();
        ?>
     </form>

<?php 
        $this->popup();
    }
    static function footer()
    {
        ?>
		<div class="sp-footer">
			<a href="<?php 
        echo SendPress_Admin::link('Help_Whatsnew');
        ?>
">What's New</a> | <a href="http://docs.sendpress.com/" target="_blank">Knowledge Base</a> | <a href="http://sendpress.uservoice.com/" target="_blank">Feedback</a> | SendPress Version: <?php 
        echo SENDPRESS_VERSION;
        ?>
 | System <span id="sendpress-system-icon" class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span>
		</div>
		<?php 
        $url = home_url('/');
        ?>
	
		<script>
			jQuery(function() {
				jQuery.getJSON( "<?php 
        echo $url;
        ?>
spnl-api/system-check", function( data ) {
					if(data.status){
						if(data.status === "active"){
							jQuery("#sendpress-system-icon").addClass("glyphicon-ok-sign").removeClass("glyphicon-remove-sign").css("color","#5cb85c");
						} else {
							jQuery("#sendpress-system-icon").removeClass("glyphicon-ok-sign").addClass("glyphicon-remove-sign").css("color","#d9534f");
						}
					}
				});
			});
		</script>

		<!-- src/templates/metabox.templ.php  -->
 
<!-- Template -->
<script  id="tmpl-my-awesome-template" type="text/template">
 <div class="spnl-modal">
 	test info here....
 </div>
</script>
<!-- End template -->
			<?php 
    }
    function html($sp)
    {
        global $post_ID, $post;
        $view = isset($_GET['view']) ? $_GET['view'] : '';
        $list = '';
        if (isset($_GET['emailID'])) {
            $emailID = SPNL()->validate->int($_GET['emailID']);
            $post = get_post($emailID);
            $post_ID = $post->ID;
        }
        ?>
		<form method="post" id="post">
	<br class="clear">
    <!--
<div style="float:right;" >
	<a href="<?php 
        echo SendPress_Admin::link('Settings_Styles');
        ?>
" class="btn btn-default btn-large" ><i class="icon-remove"></i> <?php 
        _e('Cancel', 'sendpress');
        ?>
</a> <a href="#" id="save-update" class="btn btn-primary btn-large"><i class="icon-white icon-ok"></i> <?php 
        _e('Save', 'sendpress');
        ?>
</a>
</div>
-->

<br class="clear">

		<?php 
        define('SENDPRESS_STYLER_PAGE', true);
        require_once SENDPRESS_PATH . 'inc/forms/email-style.2.0.php';
        ?>
		
<br class="clear">

<?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
		</form>
	<?php 
    }
 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'firstname':
         case 'lastname':
             return $item->{$column_name};
         case 'status':
             return $item->{$column_name};
         case 'gravatar':
             return get_avatar($item->email, 30);
         case 'joindate':
             return date_i18n(get_option('date_format'), strtotime($item->join_date));
         case 'actions':
             $a = '<div class="inline-buttons">';
             $a .= '<a class="btn btn-primary" href="' . SendPress_Admin::link('Subscribers_Subscriber', array('subscriberID' => $item->subscriberID)) . '"><span class="glyphicon glyphicon-pencil"></span> ' . __('Edit', 'sendpress') . '</a> ';
             $a .= '</div>';
             return $a;
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
    function html($sp)
    {
        SendPress_Tracking::event('Queue Tab');
        $testListTable = new SendPress_Queue_Errors_Table();
        $testListTable->prepare_items();
        SendPress_Option::set('no_cron_send', 'false');
        $sp->cron_start();
        $open_info = array("id" => 13, "report" => 10, "view" => "open");
        ?>

	<h2><?php 
        _e('Error history for the last 2 Weeks', 'sendpress');
        ?>
.</h2>

	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form id="email-filter" action="<?php 
        echo SendPress_Admin::link('Queue_Errors');
        ?>
" method="get">
		<!-- 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($_REQUEST['page']);
        ?>
" /> 
	    <!-- Now we can render the completed list table -->
	    <?php 
        $testListTable->display();
        ?>
	    <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>
	<br>
	
<?php 
    }
 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         case 'rating':
         case 'director':
             return $item[$column_name];
         case 'count_subscribers':
             $role = get_post_meta($item->ID, 'sync_role', true);
             $add = '';
             if ($role != 'none' && $role != false) {
                 $add = " - <a href='" . SendPress_Admin::link('Subscribers_Sync') . "&listID=" . $item->ID . "'>" . __('Sync', 'sendpress') . "</a>";
             }
             return SendPress_data::get_count_subscribers($item->ID) . $add;
         case 'count_unsubscribes':
             return SendPress_data::get_count_subscribers($item->ID, 3);
         case 'count_bounced':
             return SendPress_data::get_count_subscribers($item->ID, 4);
         case 'last_send_date':
             return date('Y-m-d');
         case 'actions':
             $role = get_post_meta($item->ID, 'sync_role', true);
             $add = '';
             if ($role != 'none' && $role != false) {
                 $add = " - <a href='" . SendPress_Admin::link('Subscribers_Sync') . "&listID=" . $item->ID . "'>" . __('Sync', 'sendpress') . "</a>";
             }
             $str = '<div class="inline-buttons">
                 <a class="btn btn-info" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=subscribers&listID=' . $item->ID . '"><span class="glyphicon glyphicon-edit"></span> ' . __('View', 'sendpress') . '/' . __('Edit', 'sendpress') . '</a> ';
             $role = get_post_meta($item->ID, 'sync_role', true);
             $add = '';
             if ($role != 'none' && $role != false) {
                 $str .= "<a class='btn btn-primary' href='" . SendPress_Admin::link('Subscribers_Sync') . "&listID=" . $item->ID . "'><span class='glyphicon glyphicon-refresh'></span> " . __('Sync', 'sendpress') . "</a> ";
             } else {
                 if (apply_filters('sendpress_show_import_button', true, $this->_sendpress)) {
                     $str .= '<a class="list-import btn btn-primary" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=csvimport&listID=' . $item->ID . '"><span class="glyphicon glyphicon-upload"></span> ' . __('Import', 'sendpress') . '</a> ';
                 }
                 $str .= '<a class="btn btn-primary" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=add&listID=' . $item->ID . '"><span class="glyphicon glyphicon-user"></span> ' . __('Add', 'sendpress') . '</a> ';
                 $str .= '<a class="btn btn-primary" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&action=export-list&listID=' . $item->ID . '"><span class="glyphicon glyphicon-download"></span> ' . __('Export', 'sendpress') . '</a> ';
                 $str .= '<a class="btn btn-primary" href="' . SendPress_Admin::link('Subscribers_Listform', array('listID' => $item->ID)) . '"><span class="glyphicon glyphicon-list"></span> ' . __('Form', 'sendpress') . '</a> ';
             }
             $str .= '<a class="btn " href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=listedit&listID=' . $item->ID . '"><i class="icon-cog"></i></a>
                 </div>';
             return $str;
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
    function sub_menu($sp = false)
    {
        SendPress_Tracking::event('Settings Tab');
        ?>

	<div class="navbar navbar-default" >

		<div class="pull-right  top-action-buttons navbar-right btn-group">
			<?php 
        $this->view_buttons();
        ?>
		</div>
		<div class="navbar-header">

		<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
		 <span class="sr-only"><?php 
        _e('Toggle navigation', 'sendpress');
        ?>
</span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>
		<span class="icon-bar"></span>

		</button>
		<a class="navbar-brand" href="#"><?php 
        _e('Settings', 'sendpress');
        ?>
</a>
		</div>
		 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		<ul class="nav navbar-nav">
			<!--
		  <li <?php 
        if ($sp->_current_view == '') {
            ?>
class="active"<?php 
        }
        ?>
 ><a href="<?php 
        echo SendPress_Admin::link('Settings');
        ?>
"><i class="icon-envelope"></i> <?php 
        _e('Basic Setup', 'sendpress');
        ?>
</a></li>
		 -->
		  <!--
		   <li <?php 
        if ($sp->_current_view == 'shared') {
            ?>
class="active"<?php 
        }
        ?>
 >
		    <a href="<?php 
        echo SendPress_Admin::link('Settings_Shared');
        ?>
"><i class="icon-pencil "></i> <?php 
        _e('Shared Content', 'sendpress');
        ?>
</a>
		  </li>
		  -->
		<li <?php 
        if ($sp->_current_view == 'account') {
            ?>
class="active"<?php 
        }
        ?>
 ><a href="<?php 
        echo SendPress_Admin::link('Settings_Account');
        ?>
"><i class="icon-envelope "></i> <?php 
        _e('Sending', 'sendpress');
        ?>
</a></li>
		<li <?php 
        if ($sp->_current_view == 'activation') {
            ?>
class="active"<?php 
        }
        ?>
 ><a <?php 
        if ($sp->_current_view == 'activation') {
            ?>
class="wp-ui-primary"<?php 
        }
        ?>
  href="<?php 
        echo SendPress_Admin::link('Settings_Activation');
        ?>
"><i class=" icon-bullhorn"></i> <?php 
        _e('Confirmation', 'sendpress');
        ?>
</a></li>
		<!--
		<li <?php 
        if (strpos($sp->_current_view, 'systememail') !== false) {
            ?>
class="active"<?php 
        }
        ?>
 ><a <?php 
        if (strpos($sp->_current_view, 'systememail') !== false) {
            ?>
class="wp-ui-primary"<?php 
        }
        ?>
  href="<?php 
        echo SendPress_Admin::link('Settings_Systememail');
        ?>
"><i class=" icon-bullhorn"></i> <?php 
        _e('System Email', 'sendpress');
        ?>
</a></li>
		-->
		<li <?php 
        if ($sp->_current_view == 'access') {
            ?>
class="active"<?php 
        }
        ?>
 ><a href="<?php 
        echo SendPress_Admin::link('Settings_Access');
        ?>
"><i class="icon-user "></i> <?php 
        _e('Permissions', 'sendpress');
        ?>
</a></li>
		<li <?php 
        if ($sp->_current_view == 'notifications') {
            ?>
class="active"<?php 
        }
        ?>
 ><a href="<?php 
        echo SendPress_Admin::link('Settings_Notifications');
        ?>
"><i class="icon-bell"></i> <?php 
        _e('Notifications', 'sendpress');
        ?>
</a></li>
		<li <?php 
        if ($sp->_current_view == 'widgets') {
            ?>
class="active"<?php 
        }
        ?>
 ><a href="<?php 
        echo SendPress_Admin::link('Settings_Widgets');
        ?>
"><i class=" icon-wrench "></i> <?php 
        _e('Forms', 'sendpress');
        ?>
</a></li>
		<li <?php 
        if ($sp->_current_view == 'advanced') {
            ?>
class="active"<?php 
        }
        ?>
 ><a href="<?php 
        echo SendPress_Admin::link('Settings_Advanced');
        ?>
"><i class=" icon-wrench "></i> <?php 
        _e('Advanced', 'sendpress');
        ?>
</a></li>
		<li <?php 
        if ($sp->_current_view == 'styles') {
            ?>
class="active wp-ui-primary"<?php 
        }
        ?>
 >
		    <a href="<?php 
        echo SendPress_Admin::link('Settings_Styles');
        ?>
"><i class="icon-pencil "></i> <?php 
        _e('Styles', 'sendpress');
        ?>
</a>
		 </li>
		 
		<?php 
        do_action('sendpress_view_settings_menu', $sp->_current_view);
        ?>

		</ul>

	</div>
</div>
	<?php 
    }
    function sub_menu($sp = false)
    {
        ?>
		<div class="navbar navbar-default" >
			<div class="navbar-header">
			  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
      <span class="sr-only"><?php 
        _e('Toggle navigation', 'sendpress');
        ?>
</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>

    </button>
    <a class="navbar-brand" href="#"><?php 
        _e('Subscribers', 'sendpress');
        ?>
</a>
</div>
		 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		<ul class="nav navbar-nav">
					<li <?php 
        if (!isset($_GET['view'])) {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Subscribers');
        ?>
"><i class="icon-list "></i> <?php 
        _e('Lists', 'sendpress');
        ?>
</a>
				  	</li>
				  	<?php 
        do_action('sendpress-add-submenu-item', $sp);
        ?>
					<li <?php 
        if (isset($_GET['view']) && $_GET['view'] === 'all') {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Subscribers_All');
        ?>
"><i class="icon-user "></i> <?php 
        _e('All Subscribers', 'sendpress');
        ?>
</a>
				  	</li>
				  	<?php 
        if (SendPress_Option::get('beta')) {
            ?>
				  	<li <?php 
            if (isset($_GET['view']) && $_GET['view'] === 'custom') {
                ?>
class="active"<?php 
            }
            ?>
 >
				    	<a href="<?php 
            echo SendPress_Admin::link('Subscribers_Custom');
            ?>
"><i class="icon-list "></i> <?php 
            _e('Custom Fields', 'sendpress');
            ?>
</a>
				  	</li>
				  	<?php 
        }
        ?>

				</ul>
			</div>
		</div>
		
		<?php 
        do_action('sendpress-subscribers-sub-menu');
    }
    function sub_menu($sp = false)
    {
        ?>
		<div class="navbar navbar-default" >
			<div class="navbar-header">
			  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
       <span class="sr-only"><?php 
        _e('Toggle navigation', 'sendpress');
        ?>
</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>

    </button>
    <a class="navbar-brand" href="#"><?php 
        _e('Reports', 'sendpress');
        ?>
</a>
	</div>
		 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		<ul class="nav navbar-nav">
					<li <?php 
        if (!isset($_GET['view'])) {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Reports');
        ?>
"><?php 
        _e('Newsletters', 'sendpress');
        ?>
</a>
				  	</li>
				  	<li <?php 
        if (isset($_GET['view']) && $_GET['view'] === 'tests') {
            ?>
class="active"<?php 
        }
        ?>
 >
				    	<a href="<?php 
        echo SendPress_Admin::link('Reports_Tests');
        ?>
"><?php 
        _e('Tests', 'sendpress');
        ?>
</a>
				  	</li>
				  	
				</ul>

				
			</div>
		</div>
		
		<?php 
        do_action('sendpress-reports-sub-menu');
    }
    function html($sp)
    {
        global $is_IE;
        global $post_ID, $post;
        /*
        if (  wp_is_mobile() &&
        	 ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) ) {
        
        	wp_enqueue_script('editor-expand');
        	$_wp_autoresize_on = true;
        }
        */
        $view = isset($_GET['view']) ? $_GET['view'] : '';
        if (isset($_GET['emailID'])) {
            $emailID = $_GET['emailID'];
            $post = get_post($_GET['emailID']);
            $post_ID = $post->ID;
        }
        if ($post->post_type !== 'sp_newsletters') {
            SendPress_Admin::redirect('Emails');
        }
        $options = SendPress_Option::email_get('autoresponder_' . $post_ID);
        ?>
     <form method="post" id="post" role="form">
        <input type="hidden" name="post_ID" id="post_ID" value="<?php 
        echo $post->ID;
        ?>
" />
        <input type="hidden" name="action" id="action" value="save-email" />
       <div  >
       <div style="float:right;" class="btn-toolbar">
            <div id="sp-cancel-btn" class="btn-group">
               <?php 
        if ($post->post_status != 'sp-autoresponder') {
            ?>
                <a href="?page=<?php 
            echo $_GET['page'];
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
            
            <?php 
        } else {
            ?>
     		<a href="<?php 
            echo SendPress_Admin::link('Emails_Autoresponder');
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
           
            <?php 
        }
        ?>
            </div>
            <div class="btn-group">
            
            <button class="btn btn-primary " type="submit" value="save-next" name="submit"><i class="icon-envelope icon-white"></i> <?php 
        echo __('Save', 'sendpress');
        ?>
</button>
            </div>
        </div>
	

</div>
        <h2>Autoresponder Settings</h2>
        <br>
        <h4>Subject: <?php 
        echo esc_attr(htmlspecialchars(get_post_meta($post->ID, '_sendpress_subject', true)));
        ?>
</h4>
        
        <div class="sp-row">
<div class="sp-75 sp-first">
<br>
<select name="sp-autoresponder-type" id="params-auto" >
<option value="subscribe"  <?php 
        if ($options['type'] == 'subscribe') {
            echo "selected";
        }
        ?>
 >When someone subscribes to the list...</option>
<!--<option value="user-new" <?php 
        if ($options['type'] == 'user-new') {
            echo "selected";
        }
        ?>
 >When a new WordPress user is added to your site...</option>-->
</select>
<select name="" id="params-list">
<?php 
        $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 = '';
            echo "<option value=" . $list->ID . "> " . $list->post_title . " <small>(" . SendPress_Data::get_count_subscribers($list->ID) . ")</small></option>";
        }
        ?>
</select>
<input type="text"  name="sp-delay" style="width:30px; <?php 
        if ($options['when'] == 'immediate') {
            echo "display:none;";
        }
        ?>
"   class="text" id="timer" value="<?php 
        echo $options['delay'];
        ?>
" />
<select name="sp-timing"  id="when-to-send" >
<option value="immediate" <?php 
        if ($options['when'] == 'immediate') {
            echo "selected";
        }
        ?>
  >immediately.</option>
<option value="hours" <?php 
        if ($options['when'] == 'hours') {
            echo "selected";
        }
        ?>
  >hour(s) after.</option>
<option value="days" <?php 
        if ($options['when'] == 'days') {
            echo "selected";
        }
        ?>
  >day(s) after.</option>
<option value="weeks" <?php 
        if ($options['when'] == 'weeks') {
            echo "selected";
        }
        ?>
  >week(s) after.</option>
</select>

<br><br>
</div>
<div class="sp-25">
<br><br>

</div>
</div>
<script>
(function($){
	$(document).ready(function($){
		$('#params-auto').change(function(){
			var it = $(this);
			var v = it.val();
			
		});


		$('#when-to-send').change(function(){
			var it = $(this);
			var v = it.val();
			if(v !== 'immediate'){
				$('#timer').show();
			} else {
				$('#timer').hide();
			}


		});
	});


}(jQuery));


</script>




	<?php 
        SendPress_Data::nonce_field();
        ?>
        </form>
	<?php 
    }
    function html($sp)
    {
        SendPress_Tracking::event('Queue Tab');
        if (isset($_GET['cron'])) {
            $sp->fetch_mail_from_queue();
        }
        //Create an instance of our package class...
        $testListTable = new SendPress_Queue_Table();
        //Fetch, prepare, sort, and filter our data...
        $testListTable->prepare_items();
        SendPress_Option::set('no_cron_send', 'false');
        //$sp->fetch_mail_from_queue();
        $sp->cron_start();
        //echo $sp->get_key(). "<br>";
        $open_info = array("id" => 13, "report" => 10, "view" => "open");
        /*
        		$x = $sp->encrypt_data($open_info);
        
        	echo $x."<br>";
        	$x = $sp->decrypt_data($x);
        
        	print_r($x);
        		echo "<br>";
        
        	$d = $_GET['t'];
        	$x = $sp->decrypt_data($d);
        
        	print_r($x->id);
        		echo "<br>";
        	
        	
        	//echo wp_get_schedule('sendpress_cron_action_run');
        	//
        	$time_delay =  SendPress_Option::get('time-delay');
        	echo $time_delay;
        	echo date('l jS \of F Y H:i:s A',$time_delay );
        	echo "<br>";
        	$time = date('H:i:s');
        
        echo $time;//11:09
        	$time = date('H:i:s', $time_delay);
        
        echo $time;//11:09
        */
        $autocron = SendPress_Option::get('autocron', 'no');
        if ($autocron == 'yes') {
            $api_info = json_decode(SendPress_Cron::get_info());
            if (isset($api_info->active) && $api_info->active === 0) {
                echo "<p class='alert alert-danger'><strong>Oh no!</strong> It looks like AutoCron disconnected itself. To get max send speed please re-enable it <a href='" . SendPress_Admin::link('Settings_Account') . "'>here</a>.</p>";
                delete_transient('sendpress_autocron_cache');
                SendPress_Option::set('autocron', 'no');
            } else {
                if (isset($api_info->lastcheck)) {
                    echo "<p class='alert alert-success'><strong>Looking good!</strong> Autocron is running and last checked your site at:&nbsp;" . $api_info->lastcheck . " UTC</p>";
                }
            }
        } else {
            echo "<p class='alert alert-info'><strong>Howdy.</strong> It looks like AutoCron was not enabled or it disconnected itself. To get max send speed please re-enable it <a href='" . SendPress_Admin::link('Settings_Account') . "'>here</a>.</p>";
        }
        ?>

<br>
	<div id="taskbar" class="lists-dashboard rounded group"> 

	<div id="button-area">  
	<?php 
        $pause_sending = SendPress_Option::get('pause-sending', 'no');
        $txt = __('Pause Sending', 'sendpress');
        //Stop Sending for now
        if ($pause_sending == 'yes') {
            $txt = __('Resume Sending', 'sendpress');
        }
        ?>
	<div class="btn-group">
	<a class="btn btn-large btn-default " href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
&action=pause-queue" ><i class="icon-repeat icon-white "></i> <?php 
        echo $txt;
        ?>
</a>

	<a id="send-now" class="btn btn-primary btn-large " data-toggle="modal" href="#sendpress-sending"   ><i class="icon-white icon-refresh"></i> <?php 
        _e('Send Emails Now', 'sendpress');
        ?>
</a>
	</div>
	</div>
	<?php 
        $emails_per_day = SendPress_Option::get('emails-per-day');
        if ($emails_per_day == 0) {
            $emails_per_day = __('Unlimited', 'sendpress');
        }
        $emails_per_hour = SendPress_Option::get('emails-per-hour');
        $hourly_emails = SendPress_Data::emails_sent_in_queue("hour");
        $emails_so_far = SendPress_Data::emails_sent_in_queue("day");
        //print_r(SendPress_Data::emails_stuck_in_queue());
        ?>

		
		<h2><strong><?php 
        echo $emails_so_far;
        ?>
</strong> <?php 
        _e('of a possible', 'sendpress');
        ?>
 <strong><?php 
        echo $emails_per_day;
        ?>
</strong> <?php 
        _e('emails sent in the last 24 hours', 'sendpress');
        ?>
.</h2>
		<h2><strong><?php 
        echo $hourly_emails;
        ?>
</strong> <?php 
        _e('of a possible', 'sendpress');
        ?>
 <strong><?php 
        echo $emails_per_hour;
        ?>
</strong> <?php 
        _e('emails sent in the last hour', 'sendpress');
        ?>
.</h2>
		<small><?php 
        _e('You can adjust these settings here', 'sendpress');
        ?>
: <a href="<?php 
        echo SendPress_Admin::link('Settings_Account');
        ?>
"><?php 
        _e('Settings', 'sendpress');
        ?>
 > <?php 
        _e('Sending Account', 'sendpress');
        ?>
</a>.</small>
 		<?php 
        if ($autocron == 'no') {
            $offset = get_option('gmt_offset') * 60 * 60;
            // Time offset in seconds
            $local_timestamp = wp_next_scheduled('sendpress_cron_action') + $offset;
            ?>
<br><small><?php 
            _e('The cron will run again around', 'sendpress');
            ?>
: <?php 
            echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $local_timestamp);
            ?>
</small>
<?php 
        }
        ?>
 		<br><br>
		</div>
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form id="email-filter" action="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
" method="get">
		<!-- 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($_REQUEST['page']);
        ?>
" /> 
	    <!-- Now we can render the completed list table -->
	    <?php 
        $testListTable->display();
        ?>
	    <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>
	<br>
	<!--
		<a class="btn btn-large btn-success " href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
&action=reset-queue" ><i class="icon-repeat icon-white "></i> <?php 
        _e('Re-queue All Emails', 'sendpress');
        ?>
</a><br><br>
	-->
	<form  method='get'>
		<input type='hidden' value="<?php 
        echo SPNL()->validate->page($_GET['page']);
        ?>
" name="page" />
		
		<input type='hidden' value="empty-queue" name="action" />
		<a class="btn btn-large  btn-danger" data-toggle="modal" href="#sendpress-empty-queue" ><i class="icon-warning-sign "></i> <?php 
        _e('Delete All Emails in the Queue', 'sendpress');
        ?>
</a>
		<?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>
<div class="modal fade" id="sendpress-empty-queue" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
  	<div class="modal-content">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3><?php 
        _e('Really? Delete All Emails in the Queue.', 'sendpress');
        ?>
</h3>
	</div>
	<div class="modal-body">
		<p><?php 
        _e('This will remove all emails from the queue without attempting to send them', 'sendpress');
        ?>
.</p>
	</div>
	<div class="modal-footer">
	<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('No! I was Joking', 'sendpress');
        ?>
</a><a href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
&action=empty-queue" id="confirm-delete" class="btn btn-danger" ><?php 
        _e('Yes! Delete All Emails', 'sendpress');
        ?>
</a>
	</div>
</div></div>
</div>

<div class="modal fade" id="sendpress-sending" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
	<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">×</button>
    <h3><?php 
        _e('Sending Emails', 'sendpress');
        ?>
</h3>
  </div>
  <div class="modal-body">
    <div id="sendbar" class="progress progress-striped
     active">
  <div id="sendbar-inner" class="progress-bar"
       style="width: 40%;"></div>
</div>
	<span id="queue-sent">-</span> <?php 
        _e('of', 'sendpress');
        ?>
 <span id="queue-total">-</span> <?php 
        _e('emails left to send', 'sendpress');
        ?>
.<br>
	<br>
	<?php 
        _e('You are also limited to', 'sendpress');
        ?>
 <?php 
        echo $hour;
        ?>
 <?php 
        _e('emails per hour', 'sendpress');
        ?>
.<br>
	<?php 
        _e('To change these settings go to', 'sendpress');
        ?>
 <a href="<?php 
        echo SendPress_Admin::link('Settings_Account');
        ?>
"> <?php 
        _e('Settings', 'sendpress');
        ?>
 > <?php 
        _e('Sending Account', 'sendpress');
        ?>
</a>.
  </div>
  <div class="modal-footer">
   <?php 
        _e('If you close this window sending will stop. ', 'sendpress');
        ?>
<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('Close', 'sendpress');
        ?>
</a>
  </div>
</div>
</div></div>
<?php 
    }
    function html($sp)
    {
        $list = '';
        if (isset($_GET['listID']) && $_GET['listID'] > 0) {
            //$listinfo = $this->getDetail( $this->lists_table(),'listID', $_GET['listID'] );
            $listinfo = get_post($_GET['listID']);
            $list = '&listID=' . $_REQUEST['listID'];
            $listname = 'for ' . $listinfo->post_title;
        }
        //Create an instance of our package class...
        $testListTable = new SendPress_Subscribers_Table();
        //Fetch, prepare, sort, and filter our data...
        $testListTable->prepare_items();
        ?>
	<div id="taskbar" class="lists-dashboard rounded group"> 
		<div id="button-area">  
			
			<a class="btn btn-primary btn-large" href="?page=<?php 
        echo $_REQUEST['page'];
        ?>
&view=add<?php 
        echo $list;
        ?>
"><?php 
        _e('Add Subscriber', 'sendpress');
        ?>
</a>
		</div>
		<h2><?php 
        _e('Subscribers', 'sendpress');
        ?>
 <?php 
        if (isset($listname)) {
            echo $listname;
        }
        ?>
 </h2>
	</div>
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form id="movies-filter" method="get">
		<!-- For plugins, we also need to ensure that the form posts back to our current page -->
	    <input type="hidden" name="page" value="<?php 
        echo $_REQUEST['page'];
        ?>
" />
	    <?php 
        if (isset($_GET['listID']) && $_GET['listID'] > 0) {
            ?>
	    <input type="hidden" name="listID" value="<?php 
            echo $_GET['listID'];
            ?>
" />
	    <?php 
        }
        ?>
	    <input type="hidden" name="view" value="<?php 
        echo $_GET['view'];
        ?>
" />

	    <!-- Now we can render the completed list table -->
	    <?php 
        $testListTable->display();
        ?>
	    <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>
	<form  method='get'>
		<input type='hidden' value="<?php 
        echo $_GET['page'];
        ?>
" name="page" />
		
		<input type='hidden' value="unlink-lisk" name="action" />
		<?php 
        if (isset($_GET['listID'])) {
            ?>
		<input type='hidden' name="listid" value="<?php 
            echo $_GET['listID'];
            ?>
" />
		<?php 
        }
        ?>

		<br>
		<a class="btn btn-danger " data-toggle="modal" href="#sendpress-empty-list" ><i class="icon-warning-sign "></i> <?php 
        _e('Remove All Subscribers from List', 'sendpress');
        ?>
</a>
		<?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>
<div class="modal  fade" id="sendpress-empty-list" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">×</button>
				<h3><?php 
        _e('Really? Remove All Subscribers from this list.', 'sendpress');
        ?>
</h3>
			</div>
			<div class="modal-body">
				<p><?php 
        _e('This will remove all subscribers from the list', 'sendpress');
        ?>
.</p>
			</div>
			<div class="modal-footer">
			<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('No! I was Joking', 'sendpress');
        ?>
</a><a href="<?php 
        echo SendPress_Admin::link('Subscribers_Subscribers') . $list;
        ?>
&action=remove-subscribers" id="confirm-delete" class="btn btn-danger" ><?php 
        _e('Yes! Remove All Subscribers', 'sendpress');
        ?>
</a>
			</div>
		</div>
	</div>
</div>
	<?php 
    }
    function html($sp)
    {
        ?>
<form method="post" id="post">
		<!--
		<div style="float:right;" >
			<a href="<?php 
        echo SendPress_Admin::link('Settings_Advanced');
        ?>
" class="btn btn-large btn-default" ><i class="icon-remove"></i> <?php 
        _e('Cancel', 'sendpress');
        ?>
</a> <a href="#" id="save-update" class="btn btn-primary btn-large"><i class="icon-white icon-ok"></i> <?php 
        _e('Save', 'sendpress');
        ?>
</a>
		</div>
		-->
		<br class="clear">
				<br class="clear">
		<div class="sp-row">
			<div class="sp-50 sp-first">
			<?php 
        $this->panel_start(__('Database Repair', 'sendpress'));
        ?>
				<p><?php 
        _e('Reset our new template system back to default and fix some postmeta issues', 'sendpress');
        ?>
.</p>
				<a class="btn btn-primary btn-block" href="<?php 
        echo SendPress_Admin::link('Settings_Dbfix');
        ?>
"><?php 
        _e('Data Fix Options', 'sendpress');
        ?>
</a>
			<?php 
        $this->panel_end();
        ?>
			<div class="panel panel-default">
			  <div class="panel-heading">
			    <h3 class="panel-title"><?php 
        _e('Javascript', 'sendpress');
        ?>
 & <?php 
        _e('CSS', 'sendpress');
        ?>
</h3>
			  </div>
			  <div class="panel-body">

				<?php 
        $widget_options = SendPress_Option::get('widget_options');
        //print_r($widget_options);
        ?>
					<input class="turnoff-css-checkbox sendpress_checkbox" value="<?php 
        echo $widget_options['load_css'];
        ?>
" type="checkbox" <?php 
        if ($widget_options['load_css'] == 1) {
            echo 'checked';
        }
        ?>
 id="load_css" name="load_css"/>  <?php 
        _e('Disable front end CSS', 'sendpress');
        ?>
<br>
					
					<input class="turnoff-ajax-checkbox sendpress_checkbox" value="<?php 
        echo $widget_options['load_ajax'];
        ?>
" type="checkbox" <?php 
        if ($widget_options['load_ajax'] == 1) {
            echo 'checked';
        }
        ?>
 id="load_ajax" name="load_ajax"/>  <?php 
        _e('Disable signup form ajax', 'sendpress');
        ?>
<br>

					
					<input class="footer-scripts-checkbox sendpress_checkbox" value="<?php 
        echo $widget_options['load_scripts_in_footer'];
        ?>
" type="checkbox" <?php 
        if ($widget_options['load_scripts_in_footer'] == 1) {
            echo 'checked';
        }
        ?>
 id="load_scripts_in_footer" name="load_scripts_in_footer"/>  <?php 
        _e('Load Javascript in Footer', 'sendpress');
        ?>
 
				
				</div>
			</div>

			<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('Use Shortcodes in Widgets', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
					<p><?php 
        _e('Want to use Shortcodes in your Widgets, but all you get is', 'sendpress');
        ?>
 [shortcode]?  <?php 
        _e('Turn on this option and we\'ll make sure your shortcodes work in widgets', 'sendpress');
        ?>
.</p>
					
					<?php 
        $ctype = SendPress_Option::get('sp_widget_shortdoces');
        ?>
					<input type="checkbox" name="sp_widget_shortdoces" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> Turn on Widget Shortcodes
				</div>
			</div>

			<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('Optional Settings', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
				<?php 
        $ctype = SendPress_Option::get('old_permalink');
        ?>
				<input type="checkbox" name="old_permalink" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Use old permalink with', 'sendpress');
        ?>
 ?sendpress=.
				<br><br>
				<?php 
        $ctype = SendPress_Option::get('skip_mailto');
        ?>
				<input type="checkbox" name="skip_mailto" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Do not track mailto links in email', 'sendpress');
        ?>
.
				<br><br>
				<?php 
        $ctype = SendPress_Option::get('enable_email_template_edit');
        ?>
				<input type="checkbox" name="enable_email_template_edit" value="true" <?php 
        if ($ctype) {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Override email template settings', 'sendpress');
        ?>
.
				

				</div>
			</div>


			<h2><?php 
        _e('Table Info', 'sendpress');
        ?>
</h2>
				<pre><?php 
        echo SendPress_DB_Tables::check_setup_support();
        ?>
</pre>
				<a class="btn btn-danger" href="<?php 
        echo SendPress_Admin::link('Settings_Install');
        ?>
"><?php 
        _e('Install Missing Tables', 'sendpress');
        ?>
</a>
				<a class="btn btn-warning" href="<?php 
        echo SendPress_Admin::link('Settings_Install', array('action' => 'events-repair'));
        ?>
"><?php 
        _e('Repair Events Tables', 'sendpress');
        ?>
</a>
				<a class="btn btn-primary" href="<?php 
        echo SendPress_Admin::link('Settings_Fixposts');
        ?>
"><?php 
        _e('Templates Check', 'sendpress');
        ?>
</a>

			</div>	
			<div class="sp-50">
				<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('Tracking', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
				<?php 
        $ctype = SendPress_Option::get('allow_tracking');
        ?>
			<input type="checkbox" name="allow_tracking" value="yes" <?php 
        if ($ctype == 'yes') {
            echo "checked='checked'";
        }
        ?>
 /> <?php 
        _e('Allow tracking of this WordPress installs anonymous data', 'sendpress');
        ?>
.
				<p>	
			<?php 
        _e('To maintain a plugin as big as SendPress, we need to know what we\'re dealing: what kinds of other plugins our users are using, what themes, etc. Please allow us to track that data from your install. It will add your email to our support system to assist in AutoCron problems.', 'sendpress');
        ?>
.</p>
		</div></div>
			<div class="panel panel-default">
			  <div class="panel-heading">
					<h3 class="panel-title"><?php 
        _e('System Limits', 'sendpress');
        ?>
</h3>
			  </div>
				<div class="panel-body">
					<p><?php 
        _e('Please take care when changing these settings. We have attempted to set these to work on almost all servers. If you have a faster server you may be able to increase the limits below or if you are having troubles you may need to decrease the settings', 'sendpress');
        ?>
.</p>
					<hr>
					<?php 
        _e('Users to Sync per ajax call', 'sendpress');
        ?>
: <?php 
        $this->select('sync-per-call', SendPress_Option::get('sync-per-call', 250));
        ?>
 <?php 
        _e('Default', 'sendpress');
        ?>
: 250
					<hr>
					<?php 
        _e('Emails sent per AutoCron execution', 'sendpress');
        ?>
: <?php 
        $this->select('autocron-per-call', SendPress_Option::get('autocron-per-call', 25), array(1, 5, 10, 15, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100));
        ?>
 <?php 
        _e('Default', 'sendpress');
        ?>
: 25<br>
					<small><?php 
        _e('If AutoCron errors it will shut itself off', 'sendpress');
        ?>
.</small>
					<hr>
					<?php 
        _e('WordPress cron emails sent per execution', 'sendpress');
        ?>
: <?php 
        $this->select('wpcron-per-call', SendPress_Option::get('wpcron-per-call', 25), array(1, 5, 10, 15, 25, 30, 35, 40, 45, 50, 100, 250, 500, 1000));
        ?>
 <?php 
        _e('Default', 'sendpress');
        ?>
: 25<br>
					<hr>
					<?php 
        _e('Queue History', 'sendpress');
        ?>
:  <?php 
        $this->select('queue-history', SendPress_Option::get('queue-history', 7), array(7, 14, 21, 28, 35, 42, 49));
        ?>
 <?php 
        _e('Days', 'sendpress');
        ?>
 <br><small><?php 
        _e('Default', 'sendpress');
        ?>
: 7 Days</small>
					<hr>
					<?php 
        _e('Add Emails to Queue', 'sendpress');
        ?>
:  <?php 
        $this->select('queue-per-call', SendPress_Option::get('queue-per-call', 1000), array(50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000));
        ?>
 <?php 
        _e('Emails', 'sendpress');
        ?>
 <br><small><?php 
        _e('Default', 'sendpress');
        ?>
: 1000 <?php 
        _e('Emails', 'sendpress');
        ?>
</small>
				</div>
			</div>
			<?php 
        do_action('sendpress_advanced_settings');
        ?>
				
			


			
			
			</div>

		</div>
		<?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
		</form>
		<?php 
    }
    function html()
    {
        SendPress_Tracking::event('Queue Tab');
        if (SPNL()->validate->_isset('cron')) {
            SPNL()->fetch_mail_from_queue();
        }
        //Create an instance of our package class...
        $testListTable = new SendPress_Queue_Table();
        //Fetch, prepare, sort, and filter our data...
        $testListTable->prepare_items();
        SendPress_Option::set('no_cron_send', 'false');
        SPNL()->cron_start();
        $open_info = array("id" => 13, "report" => 10, "view" => "open");
        $autocron = SendPress_Option::get('autocron', 'no');
        ?>

<br>
	<div id="taskbar" class="lists-dashboard rounded group"> 

	<div id="button-area">  
	<?php 
        $pause_sending = SendPress_Option::get('pause-sending', 'no');
        $txt = __('Pause Sending', 'sendpress');
        //Stop Sending for now
        if ($pause_sending == 'yes') {
            $txt = __('Resume Sending', 'sendpress');
        }
        ?>
	<div class="btn-group">

       <?php 
        if (SendPress_Option::get('emails-credits') && SendPress_Option::get('sendmethod') === 'Jaiminho_Sender_NetWork' || SendPress_Option::get('sendmethod') != 'Jaiminho_Sender_NetWork') {
            SendPress_Option::set('pause-sending', 'no');
            ?>
          <a class="btn btn-large btn-default " href="<?php 
            echo SendPress_Admin::link('Queue');
            ?>
&action=pause-queue" ><i class="icon-repeat icon-white "></i> <?php 
            echo $txt;
            ?>
</a>
          <a id="send-now" class="btn btn-primary btn-large " data-toggle="modal" href="#sendpress-sending"   ><i class="icon-white icon-refresh"></i> <?php 
            _e('Send Emails Now', 'sendpress');
            ?>
</a>
	</div>
	</div>
	<?php 
        } else {
            SendPress_Option::set('pause-sending', 'yes');
        }
        $emails_per_day = SendPress_Option::get('emails-per-day');
        if ($emails_per_day == 0) {
            $emails_per_day = __('Unlimited', 'sendpress');
        }
        $emails_per_hour = SendPress_Option::get('emails-per-hour');
        $hourly_emails = SendPress_Data::emails_sent_in_queue("hour");
        $emails_so_far = SendPress_Data::emails_sent_in_queue("day");
        $credits = SendPress_Option::get('emails-credits');
        //print_r(SendPress_Data::emails_stuck_in_queue());
        global $wpdb;
        $table = SendPress_Data::queue_table();
        $date = getdate();
        // Maurilio TODO: fazer com os créditos sejam contados a partir da 00:00:00 do primeiro dia do mês atual
        $hour_ago = strtotime('-' . $date["mday"] . ' day');
        $time = date('Y-m-d H:i:s', $hour_ago);
        $query = $wpdb->prepare("SELECT COUNT(*) FROM {$table} where last_attempt > %s and success = %d", $time, 1);
        $credits_so_far = $wpdb->get_var($query);
        $result_credits = $credits - $credits_so_far;
        if ($credits <= 0) {
            echo "<p class='alert alert-danger' style='width:70%;'>" . __("Vixe! Você não tem créditos. Para enviar emails em sua fila ou enviar novos emails, você precisa obter mais créditos.", "jaiminho") . "</p>";
        } else {
            ?>
        <h2><?php 
            echo $credits ? __('Você tem', 'jaiminho') : "";
            ?>
        <strong><?php 
            echo $result_credits ? $result_credits : "";
            ?>
</strong> <?php 
            echo $credits ? __('créditos', 'jaiminho') : "";
            ?>
.
        </h2>
        <?php 
        }
        ?>
       
      <h2><strong><?php 
        echo $emails_so_far;
        ?>
</strong> <?php 
        _e('of a possible', 'sendpress');
        ?>
 <strong><?php 
        echo $emails_per_day;
        ?>
</strong> <?php 
        _e('emails sent in the last 24 hours', 'sendpress');
        ?>
.</h2>
      <h2><strong><?php 
        echo $hourly_emails;
        ?>
</strong> <?php 
        _e('of a possible', 'sendpress');
        ?>
 <strong><?php 
        echo $emails_per_hour;
        ?>
</strong> <?php 
        _e('emails sent in the last hour', 'sendpress');
        ?>
.</h2>
      <?php 
        if (is_multisite() && is_super_admin() || !is_multisite()) {
            ?>
      <small><?php 
            _e('You can adjust these settings here', 'sendpress');
            ?>
: <a href="<?php 
            echo SendPress_Admin::link('Settings_Account');
            ?>
"><?php 
            _e('Settings', 'sendpress');
            ?>
 > <?php 
            _e('Sending Account', 'sendpress');
            ?>
</a>.</small>
                 <?php 
        }
        ?>
 		<?php 
        if ($autocron == 'no') {
            $offset = get_option('gmt_offset') * 60 * 60;
            // Time offset in seconds
            $local_timestamp = wp_next_scheduled('sendpress_cron_action') + $offset;
            ?>
<br><small><?php 
            _e('The cron will run again around', 'sendpress');
            ?>
: <?php 
            echo date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $local_timestamp);
            ?>
</small>
<?php 
        }
        ?>
 		<br><br>
		</div>
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form id="email-filter" action="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
" method="get">
		<!-- 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 class="btn btn-large btn-success " href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
&action=reset-queue" ><i class="icon-repeat icon-white "></i> <?php 
        _e('Re-queue All Emails', 'sendpress');
        ?>
</a><br><br>
	-->
	<form  method='get'>
		<input type='hidden' value="<?php 
        echo SPNL()->validate->page();
        ?>
" name="page" />
		
		<input type='hidden' value="empty-queue" name="action" />
		<a class="btn btn-large  btn-danger" data-toggle="modal" href="#sendpress-empty-queue" ><i class="icon-warning-sign "></i> <?php 
        _e('Delete All Emails in the Queue', 'sendpress');
        ?>
</a>
		<?php 
        wp_nonce_field($this->_nonce_value);
        ?>
	</form>
<div class="modal fade" id="sendpress-empty-queue" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
  	<div class="modal-content">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3><?php 
        _e('Really? Delete All Emails in the Queue.', 'sendpress');
        ?>
</h3>
	</div>
	<div class="modal-body">
		<p><?php 
        _e('This will remove all emails from the queue without attempting to send them', 'sendpress');
        ?>
.</p>
	</div>
	<div class="modal-footer">
	<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('No! I was Joking', 'sendpress');
        ?>
</a><a href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
&action=empty-queue" id="confirm-delete" class="btn btn-danger" ><?php 
        _e('Yes! Delete All Emails', 'sendpress');
        ?>
</a>
	</div>
</div></div>
</div>

<div class="modal fade" id="sendpress-sending" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
	<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">×</button>
    <h3><?php 
        _e('Sending Emails', 'sendpress');
        ?>
</h3>
  </div>
  <div class="modal-body">
    <div id="sendbar" class="progress progress-striped
     active">
  <div id="sendbar-inner" class="progress-bar"
       style="width: 40%;"></div>
</div>
	<span id="queue-sent">-</span> <?php 
        _e('of', 'sendpress');
        ?>
 <span id="queue-total">-</span> <?php 
        _e('emails left to send', 'sendpress');
        ?>
.<br>
	<br>
	<?php 
        _e('You are also limited to', 'sendpress');
        ?>
 <?php 
        echo $emails_per_hour;
        ?>
 <?php 
        _e('emails per hour', 'sendpress');
        ?>
.<br>
	<?php 
        _e('To change these settings go to', 'sendpress');
        ?>
 <a href="<?php 
        echo SendPress_Admin::link('Settings_Account');
        ?>
"> <?php 
        _e('Settings', 'sendpress');
        ?>
 > <?php 
        _e('Sending Account', 'sendpress');
        ?>
</a>.
  </div>
  <div class="modal-footer">
   <?php 
        _e('If you close this window sending will stop. ', 'sendpress');
        ?>
<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('Close', 'sendpress');
        ?>
</a>
  </div>
</div>
</div></div>
<?php 
    }
    function html($sp)
    {
        SendPress_Tracking::event('Queue Tab');
        if (isset($_GET['cron'])) {
            $sp->fetch_mail_from_queue();
        }
        //Create an instance of our package class...
        $testListTable = new SendPress_Queue_All_Table();
        //Fetch, prepare, sort, and filter our data...
        $testListTable->prepare_items();
        SendPress_Option::set('no_cron_send', 'false');
        //$sp->fetch_mail_from_queue();
        $sp->cron_start();
        //echo $sp->get_key(). "<br>";
        $open_info = array("id" => 13, "report" => 10, "view" => "open");
        /*
        		$x = $sp->encrypt_data($open_info);
        
        	echo $x."<br>";
        	$x = $sp->decrypt_data($x);
        
        	print_r($x);
        		echo "<br>";
        
        	$d = $_GET['t'];
        	$x = $sp->decrypt_data($d);
        
        	print_r($x->id);
        		echo "<br>";
        	
        	
        	//echo wp_get_schedule('sendpress_cron_action_run');
        	//
        	$time_delay =  SendPress_Option::get('time-delay');
        	echo $time_delay;
        	echo date('l jS \of F Y H:i:s A',$time_delay );
        	echo "<br>";
        	$time = date('H:i:s');
        
        echo $time;//11:09
        	$time = date('H:i:s', $time_delay);
        
        echo $time;//11:09
        */
        ?>
<h2><?php 
        _e('Queue history for the last ', 'sendpress');
        ?>
 <strong><?php 
        echo SendPress_Option::get('queue-history', 7);
        ?>
</strong> <?php 
        _e('Days', 'sendpress');
        ?>
.</h2>
		<small><?php 
        _e('You can adjust these settings here', 'sendpress');
        ?>
: <a href="<?php 
        echo SendPress_Admin::link('Settings_Advanced');
        ?>
"><?php 
        _e('Settings', 'sendpress');
        ?>
 > <?php 
        _e('Advanced', 'sendpress');
        ?>
</a>.</small>
 		<br><br>
	<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
	<form id="email-filter" action="<?php 
        echo SendPress_Admin::link('Queue_All');
        ?>
" method="get">
		<!-- For plugins, we also need to ensure that the form posts back to our current page -->
	     <input type="hidden" name="page" value="<?php 
        echo $_REQUEST['page'];
        ?>
" /> 
	       <?php 
        if (isset($_GET['listID']) && $_GET['listID'] > 0) {
            ?>
	    <input type="hidden" name="listID" value="<?php 
            echo $_GET['listID'];
            ?>
" />
	    <?php 
        }
        ?>
	    <input type="hidden" name="view" value="<?php 
        echo $_GET['view'];
        ?>
" />
	    <!-- Now we can render the completed list table -->
	    <?php 
        $testListTable->display();
        ?>
	    <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>
	<br>
	
	<form  method='get'>
		<input type='hidden' value="<?php 
        echo $_GET['page'];
        ?>
" name="page" />
		
		
		<?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
	</form>

<?php 
    }
    function html()
    {
        global $is_IE;
        global $post_ID, $post;
        /*
        if (  wp_is_mobile() &&
        	 ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) ) {
        
        	wp_enqueue_script('editor-expand');
        	$_wp_autoresize_on = true;
        }
        */
        $emailID = SPNL()->validate->_int('emailID');
        if ($emailID > 0) {
            $post = get_post($emailID);
            $post_ID = $post->ID;
        }
        if ($post->post_type !== 'sp_newsletters') {
            SendPress_Admin::redirect('Emails');
        }
        $template_id = get_post_meta($post->ID, '_sendpress_template', true);
        ?>
     <form method="post" id="post" role="form">
        <input type="hidden" name="post_ID" id="post_ID" value="<?php 
        echo $post->ID;
        ?>
" />
        <input type="hidden" name="post_type" id="post_type" value="sp_newsletters" />
        <input type="hidden" name="action" id="action" value="save-email" />
       <div  >
       <div style="float:right;" class="btn-toolbar">
            <div id="sp-cancel-btn" class="btn-group">
               <?php 
        if ($post->post_status != 'sp-autoresponder') {
            ?>
                <a href="?page=<?php 
            echo SPNL()->validate->page();
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
            
            <?php 
        } else {
            ?>
     		<a href="<?php 
            echo SendPress_Admin::link('Emails_Autoresponder');
            ?>
" id="cancel-update" class="btn btn-default"><?php 
            echo __('Cancel', 'sendpress');
            ?>
</a>&nbsp;
           
            <?php 
        }
        ?>
            </div>
            <div class="btn-group">
            
             <button class="btn btn-default " type="submit" value="save" name="submit"><i class="icon-white icon-ok"></i> <?php 
        echo __('Update', 'sendpress');
        ?>
</button>
           
            <?php 
        if (SendPress_Admin::access('Emails_Send') && $post->post_status != 'sp-autoresponder') {
            ?>
            <button class="btn btn-primary " type="submit" value="save-next" name="submit"><i class="icon-envelope icon-white"></i> <?php 
            echo __('Send', 'sendpress');
            ?>
</button>
            <?php 
        }
        ?>
            </div>
        </div>
	

</div>
        <h2><?php 
        _e('Edit Email Content', 'sendpress');
        ?>
</h2>
        <br>
        <?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-75 sp-first">
<!-- Nav tabs -->
<?php 
        $enable_edits = SendPress_Option::get('enable_email_template_edit');
        ?>
<ul class="nav nav-tabs">
  <li class="active"><a href="#content-area-one-tab" data-toggle="tab"><?php 
        _e('Main Content', 'sendpress');
        ?>
</a></li>
  <?php 
        if ($enable_edits) {
            ?>
  	<li><a href="#header-content" data-toggle="tab"><?php 
            _e('Header', 'sendpress');
            ?>
</a></li>
  	<li><a href="#footer-content" data-toggle="tab"><?php 
            _e('Footer', 'sendpress');
            ?>
</a></li>
  	<?php 
        }
        ?>
 
  <!--
  <li><a href="#messages" data-toggle="tab">Messages</a></li>
  <li><a href="#settings" data-toggle="tab">Settings</a></li>
  -->
</ul>

<div class="tab-content" style="display:block;">
  <div class="tab-pane in active" id="content-area-one-tab">
  <?php 
        wp_editor($post->post_content, 'content_area_one_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
        //wp_editor($post->post_content,'content_area_one_edit');
        ?>
</div>

	<?php 
        if ($enable_edits) {
            ?>
		<div class="tab-pane" id="header-content">
			<?php 
            wp_editor(get_post_meta($post->ID, '_header_content', true), 'header_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
            ?>

		</div>
		<div class="tab-pane" id="footer-content">
			<?php 
            wp_editor(get_post_meta($post->ID, '_footer_content', true), 'footer_content_edit', array('dfw' => true, 'drag_drop_upload' => true, 'tabfocus_elements' => 'insert-media-button-1,save-post', 'editor_height' => 360, 'tinymce' => array('resize' => false, 'wp_autoresize_on' => !empty($_wp_autoresize_on) && get_user_setting('editor_expand', 'on') === 'on', 'add_unload_trigger' => false)));
            ?>

		</div>
		<?php 
        }
        ?>
   <!--
  <div class="tab-pane fade" id="messages"><?php 
        wp_editor($post->post_content, 'content-3');
        ?>
</div>
  <div class="tab-pane fade" id="settings"><?php 
        wp_editor($post->post_content, 'content-4');
        ?>
</div>
  -->
</div>

</div>
<div class="sp-25">
<br><br>

	<?php 
        $this->panel_start(__('Template', 'sendpress'));
        ?>
	<select name="template" class="form-control">
	<?php 
        $args = array('post_type' => 'sp_template', 'post_status' => array('sp-standard'), 'posts_per_page' => -1);
        $the_query = new WP_Query($args);
        if ($the_query->have_posts()) {
            echo '<optgroup label="SendPress Templates">';
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $temp_id = $the_query->post->ID;
                $s = '';
                if ($temp_id == $template_id) {
                    $s = 'selected';
                }
                echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
            }
            echo '</optgroup>';
        } else {
            echo '<option value="0" ></option>';
        }
        $args = array('post_type' => 'sp_template', 'post_status' => array('sp-custom'), 'posts_per_page' => -1);
        $the_query = new WP_Query($args);
        if ($the_query->have_posts()) {
            echo '<optgroup label="Custom Templates">';
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $temp_id = $the_query->post->ID;
                $s = '';
                if ($temp_id == $template_id) {
                    $s = 'selected';
                }
                echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
            }
            echo '</optgroup>';
        }
        ?>
	
	</select>
	<?php 
        $this->panel_end();
        ?>
</div>
</div>
<div class="well clear">
            <h2><?php 
        _e('Test This Email', 'sendpress');
        ?>
</h2>
            <p><input type="text" name="test-email" value="" class="sp-text" placeholder="<?php 
        echo __('Insira um email para o envio de teste.', 'jaiminho');
        ?>
." /></p>
            <button class="btn btn-success" name="submit" type="submit" value="send-test"><i class=" icon-white icon-inbox"></i> <?php 
        _e('Send Test', 'sendpress');
        ?>
</button>
        </div>


<div class="modal fade bs-modal-lg" id="sendpress-helper" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
	<div class="modal-content">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<ul class="nav nav-tabs" id="myTab">
			<li class="active tabs-first"><a href="#posts"><?php 
        _e('Single Post', 'sendpress');
        ?>
</a></li>
		  	<li ><a href="#merge"><?php 
        _e('Personalize', 'sendpress');
        ?>
</a></li>
		 
		  	<!--
		  <li><a href="#messages">Messages</a></li>
		  <li><a href="#settings">Settings</a></li>
			-->
		</ul>
	</div>
	<div class="modal-body">

 
<div class="tab-content">
	 <div class="tab-pane active" id="posts">

  	<div id="search-header"><?php 
        _e('Search Posts', 'sendpress');
        ?>
: <input type="text" name="q" id="sp-single-query"></div>
  	<div  id="sp-post-preview" class="well">
  		<?php 
        _e('No Post Selected', 'sendpress');
        ?>
  	</div>

  	<p><?php 
        _e('Header HTML', 'sendpress');
        ?>
:&nbsp;
	  	<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios1" value="h1" >
		  H1
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h2">
		  H2
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h3" checked>
		  H3
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h4">
		  H4
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h5">
		  H5
		</label>
		<label class="radio">
		  <input type="radio" name="headerOptions" id="optionsRadios2" value="h6">
		  H6
		</label>
	</p>
	<p><?php 
        _e('Header Link', 'sendpress');
        ?>
:&nbsp;
	  	<label class="radio">
		  <input type="radio" name="headerlinkOptions" id="optionsRadios2" value="link" checked>
		  <?php 
        _e('Link Header to Post', 'sendpress');
        ?>
		</label>
		<label class="radio">
		  <input type="radio" name="headerlinkOptions" id="optionsRadios2" value="nolink">
		  <?php 
        _e('Don\'t Link Header to Post', 'sendpress');
        ?>
		</label>
	</p>
  	<p><?php 
        _e('Post Content', 'sendpress');
        ?>
:&nbsp;
	  	<label class="radio">
		  <input type="radio" name="optionsRadios" id="optionsRadios1" value="excerpt" checked>
		  <?php 
        _e('Excerpt', 'sendpress');
        ?>
		</label>
		<label class="radio">
		  <input type="radio" name="optionsRadios" id="optionsRadios2" value="full">
		  <?php 
        _e('Full Post', 'sendpress');
        ?>
		</label>
	</p>
  	<button class="btn btn-mini btn-success sp-insert-code" id="sp-post-preview-insert" data-code=""><?php 
        _e('Insert', 'sendpress');
        ?>
</button>
  </div>
 	<div class="tab-pane " id="merge">
 		<h3><?php 
        _e('Subscriber specific content', 'sendpress');
        ?>
</h3>
  		<table class="table table-condensed table-striped">
  			
  <thead>
    <tr>
      <th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
      <th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td><?php 
        _e('First Name', 'sendpress');
        ?>
</td>
      	<td>*|FNAME|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|FNAME|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Last Name', 'sendpress');
        ?>
</td>
      	<td>*|LNAME|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|LNAME|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Email', 'sendpress');
        ?>
</td>
      	<td>*|EMAIL|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code"  data-code="*|EMAIL|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>

  </tbody>
</table>
	<h3><?php 
        _e('Site specific content', 'sendpress');
        ?>
</h3>
  		<table class="table table-condensed table-striped">
  			
  <thead>
    <tr>
      <th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
      <th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td><?php 
        _e('Website URL', 'sendpress');
        ?>
</td>
      	<td>*|SITE:URL|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:URL|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Website Title', 'sendpress');
        ?>
</td>
      	<td>*|SITE:TITLE|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|SITE:TITLE|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Website Description', 'sendpress');
        ?>
</td>
      	<td>*|SITE:DECRIPTION|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code"  data-code="*|SITE:DESCRIPTION|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    
  </tbody>
</table>
<h3><?php 
        _e('Date and Time', 'sendpress');
        ?>
</h3>
  		<table class="table table-condensed table-striped">
  			
  <thead>
    <tr>
      <th><?php 
        _e('Description', 'sendpress');
        ?>
</th>
      <th><?php 
        _e('Code', 'sendpress');
        ?>
</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
    	<td><?php 
        _e('Current Date', 'sendpress');
        ?>
<br><small><?php 
        _e('Format based on WordPress settings', 'sendpress');
        ?>
.</small></td>
      	<td>*|DATE|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
     <tr>
    	<td><?php 
        _e('Current Time', 'sendpress');
        ?>
<br><small>5:16 pm</small></td>
      	<td>*|DATE:g:i a|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:g:i a|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
    <tr>
    	<td><?php 
        _e('Custom Date', 'sendpress');
        ?>
<br><small>March 10, 2001, 5:16 pm</small></td>
      	<td>*|DATE:F j, Y, g:i a|*</td>
      	<td class="text-right"><button class="btn btn-xs btn-success sp-insert-code" data-code="*|DATE:F j, Y, g:i a|*"><?php 
        _e('Insert', 'sendpress');
        ?>
</button></td>
    </tr>
  
    
  </tbody>
</table>

  </div>
 
  <div class="tab-pane" id="messages">...</div>
  <div class="tab-pane" id="settings">...</div>
</div>
		
	</div>
	<div class="modal-footer">
	 	<a href="#" class="btn btn-primary" data-dismiss="modal"><?php 
        _e('Close', 'sendpress');
        ?>
</a>
	</div>
</div>
</div>
	<?php 
        SendPress_Data::nonce_field();
        ?>
        </form>
	<?php 
    }
 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     switch ($column_name) {
         /* case 'firstname':
         			case 'lastname':
         				return $item->$column_name;
         			case 'status':
         			   return $item->$column_name;
         		   
         		   */
         case 'subject':
             $sub = get_post_meta($item->ID, "_sendpress_subject", true);
             return $sub;
         case 'lastsend':
             $date = get_post_meta($item->ID, "send_date", true);
             if (!empty($date)) {
                 return date_i18n(get_option('date_format'), strtotime($date));
             }
             return '';
         case 'created':
             return date_i18n(get_option('date_format'), strtotime($item->post_date));
         case 'actions':
             $a = '<div class="inline-buttons">';
             $a .= '<a class="btn btn-default view-btn" title="' . get_post_meta($item->ID, "_sendpress_subject", true) . '" href="' . get_permalink($item->ID) . '"><span class="glyphicon  glyphicon-eye-open"></span> ' . __('View', 'sendpress') . '</a> ';
             $editwindow = 'style';
             if (get_post_meta($item->ID, '_sendpress_system', true) == 'new') {
                 $editwindow = 'edit';
             }
             $a .= '<a class="btn btn-primary" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=' . $editwindow . '&emailID=' . $item->ID . '"><span class="glyphicon glyphicon-edit"></span> ' . __('Edit', 'sendpress') . '</a> ';
             $a = apply_filters('sendpress_email_table', $a, $item);
             if (SendPress_Admin::access('Emails_Send')) {
                 $a .= '<a class="btn  btn-success " href="' . SendPress_Admin::link('Emails_Send') . '&emailID=' . $item->ID . '"><span class="glyphicon glyphicon-send"></span> ' . __('Send', 'sendpress') . '</a>';
             }
             $a .= '</div>';
             return $a;
         default:
             return print_r($item, true);
             //Show the whole array for troubleshooting purposes
     }
 }
    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">
&lt;form method="post" action="<?php 
        echo trailingslashit(site_url());
        ?>
">
	&lt;input type="hidden" name="sp_list" value="<?php 
        echo $list_id;
        ?>
"/>
	&lt;input type="hidden" name="sendpress" value="post" />
	<div id="form-wrap">
		<p name="email">
			<label for="email">EMail:</label>
			&lt;input type="text" value="" name="sp_email"/>
		</p>
		<p name="firstname">
			<label for="email">First Name:</label>
			&lt;input type="text" value="" name="sp_firstname"/>
		</p>
		<p name="lastname">
			<label for="email">Last Name:</label>
			&lt;input type="text" value="" name="sp_lastname"/>
		</p>
		<p class="submit">
			&lt;input value="Submit" class="sendpress-submit" type="submit" id="submit" name="submit">
		</p>
	</div>
&lt;/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&amp;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 
    }
 /** ************************************************************************
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * @return string Text or HTML to be placed inside the column <td>
  **************************************************************************/
 function column_default($item, $column_name)
 {
     $stat_type = get_post_meta($item->ID, '_stat_type', true);
     switch ($column_name) {
         /* case 'firstname':
             case 'lastname':
                 return $item->$column_name;
             case 'status':
                return $item->$column_name;
            
            */
         case 'bounces':
             return '<span class="label">Coming Soon</span>';
             break;
         case 'count':
             $rec = get_post_meta($item->ID, '_send_count', true) + get_post_meta($item->ID, '_send_last_count', true) . '';
             $sentold = get_post_meta($item->ID, '_sent_total', true);
             $queue = 0;
             $sent = get_post_meta($item->ID, '_send_total', true);
             $inqueue = get_post_meta($item->ID, '_in_queue', true);
             if ($inqueue !== 'none') {
                 $queue = SendPress_Data::emails_in_queue($item->ID);
                 $sentindb = SendPress_Data::emails_sent_in_queue_for_report($item->ID);
                 if ($sentindb > $sent) {
                     update_post_meta($item->ID, '_send_total', $sentindb);
                     $sent = $sentindb;
                 }
                 if ($queue == 0) {
                     update_post_meta($item->ID, '_in_queue', 'none');
                 }
             }
             $string = "Recipients: " . $rec . "<br>";
             $string .= "Sent: " . $sent . "<br>";
             $string .= "In Queue: " . $queue . "<br>";
             return $string;
             break;
         case 'sentto':
             $display = '';
             $info = get_post_meta($item->ID, '_send_data', true);
             if (!empty($info['listIDS'])) {
                 foreach ($info['listIDS'] as $list_id) {
                     $list = get_post($list_id);
                     if ($list && $list->post_type == 'sendpress_list') {
                         $display .= $list->post_title . '<br>';
                     }
                 }
             } else {
                 $lists = get_post_meta($item->ID, '_send_lists', true);
                 $list = explode(",", $lists);
                 foreach ($list as $list_id) {
                     $list = get_post($list_id);
                     if ($list && $list->post_type == 'sendpress_list') {
                         $display .= $list->post_title . '<br>';
                     }
                 }
             }
             return $display;
             break;
         case 'opens':
             //if( $stat_type == 'new'){
             $opens = SPNL()->load("Subscribers_Tracker")->get_opens($item->ID);
             $opens_total = SPNL()->load("Subscribers_Tracker")->get_opens_total($item->ID);
             $opens = $opens == 0 ? '-' : $opens;
             $opens_total = $opens_total == 0 ? '-' : $opens_total;
             return '<span class="label label-success">' . $opens . '</span> <span class="label label-info">' . $opens_total . '</span>';
             /*
             } else {
                 $ou = $this->_sendpress->get_opens_unique_count($item->ID);
                 $ou = $ou ? $ou : '-';
             
                
                 $ot = $this->_sendpress->get_opens_count($item->ID);
                 $ot = $ot ? $ot : '-';
             
                 return '<span class="label label-success">'. $ou .'</span> <span class="label label-info">'. $ot .'</span>';
             } 
             */
             break;
         case 'clicks':
             //if( $stat_type == 'new'){
             $clicks = SPNL()->load("Subscribers_Url")->clicks_email_id($item->ID);
             $clicks_total = SPNL()->load("Subscribers_Url")->clicks_total_email_id($item->ID);
             $clicks = $clicks == 0 ? '-' : $clicks;
             $clicks_total = $clicks_total == 0 ? '-' : $clicks_total;
             return '<span class="label label-success">' . $clicks . '</span> <span class="label label-info">' . $clicks_total . '</span>';
             /*
             } else {
             
                 $ou = $this->_sendpress->get_clicks_unique_count($item->ID);
                 $ou = $ou ? $ou : '-';
             
                 $ot = $this->_sendpress->get_clicks_count($item->ID);
                 $ot = $ot ? $ot : '-';
             
                 return '<span class="label label-success">'. $ou .'</span> <span class="label label-info">'. $ot .'</span>';
             }
             */
             break;
         case 'unsubscribe':
             //if( $stat_type == 'new'){
             $clicks = SPNL()->load("Subscribers_Tracker")->get_unsubs($item->ID);
             $clicks = $clicks == 0 ? '-' : $clicks;
             return '<span class="label label-danger">' . $clicks . '</span>';
             /*
                                 } else {
                $clicks = get_post_meta($item->ID, '_unsubscribe_count', true);
                if($clicks) { 
                    return '<span class="label label-danger">'. $clicks .'</span>';
                 }
             }
             */
             // return '<span class="label label-danger">0</span>';
             break;
         case 'subject':
             $sub = get_post_meta($item->ID, "_sendpress_subject", true);
             return $sub;
             break;
         case 'lastsend':
             $date = get_post_meta($item->ID, "send_date", true);
             if (!empty($date)) {
                 return date_i18n(get_option('date_format'), strtotime($date));
             }
             return '';
             break;
         case 'created':
             $canceled = get_post_meta($item->ID, '_canceled', true);
             if ($canceled == true) {
                 return "CANCELED";
             }
             $info = get_post_meta($item->ID, '_send_time', true);
             if ($info == false || $info == '0000-00-00 00:00:00' || date_i18n('Y-m-d H:i:s', strtotime($info)) < date_i18n('Y-m-d H:i:s')) {
                 return date_i18n(get_option('date_format'), strtotime($item->post_date));
             }
             return "Scheduled for " . date_i18n('Y/m/d @ h:i A', strtotime($info)) . "<br><a href='" . SendPress_Admin::link('Emails_Send_Cancel', array('emailID' => $item->ID)) . "'>Cancel Send</a>";
             break;
         case 'actions':
             return '<div class="inline-buttons"><a class="spbutton left" href="' . get_permalink($item->ID) . '">View</a><a class="spbutton right" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=edit-email&emailID=' . $item->ID . '">Edit</a><a class="spbutton bluebtn" href="?page=' . SPNL()->validate->page($_REQUEST['page']) . '&view=send-email&emailID=' . $item->ID . '">Send</a></div>';
             break;
         default:
             return apply_filters('sendpress_reports_column_' . $column_name, $item);
             //Show the whole array for troubleshooting purposes
     }
 }
    function html()
    {
        global $sendpress_html_templates;
        //print_r($sendpress_html_templates[$_GET['templateID']]);
        $postdata = get_post($_GET['templateID']);
        ?>
		<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_Templates');
        ?>
" id="cancel-update" class="btn btn-default"><?php 
        echo __('Cancel', 'sendpress');
        ?>
</a>&nbsp;
			</div>
		</div>
		
		<h2><?php 
        _e('Clone Template', 'sendpress');
        ?>
 - <?php 
        echo $postdata->post_title;
        ?>
</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>
		-->
	
			<?php 
        $this->panel_start('<span class="glyphicon glyphicon-list-alt"></span> ' . __('Template Name', 'sendpress'));
        ?>
			<input type="text" class="form-control" name="post_title" size="30" tabindex="1" value="" id="post_title" autocomplete="off" />
<?php 
        $this->panel_end();
        ?>
		<!--
			
<div class="sp-row">
	<div class="sp-25 sp-first">
		<?php 
        $this->panel_start('<input type="radio" name="starter" value="orginal" checked /> SP Original');
        ?>
		<?php 
        $this->panel_end();
        ?>
	</div>
	<div class="sp-25">
		<?php 
        $this->panel_start('<input type="radio" name="starter" value="blank"  /> Blank Template');
        ?>
		<?php 
        $this->panel_end();
        ?>
	</div>
	
	<div class="sp-25">
		<?php 
        $this->panel_start('<input type="radio" name="starter" value="default"  /> SP Original');
        ?>
		<?php 
        $this->panel_end();
        ?>
	</div>
	<div class="sp-25">
		<?php 
        $this->panel_start('<input type="radio" name="starter" value="default"  /> SP Original');
        ?>
		<?php 
        $this->panel_end();
        ?>
	</div>
	
</div>-->


		
		
		<?php 
        //wp_editor($post->post_content,'textversion');
        ?>

		 <?php 
        wp_nonce_field($this->_nonce_value);
        ?>
<br><br>
		 </form>
		 
		<?php 
    }
    function html($sp)
    {
        ?>
			
		<div class="wrap about-wrap">
<!--
<h1>Welcome to SendPress <?php 
        echo SENDPRESS_VERSION;
        ?>
</h1>

<div class="about-text">Thank you for helping us reach 100K+ downloads and using SendPress.</div>
<div class="changelog point-releases">
	<h3>Maintenance & Bug Fix Release</h3>
	<p><strong>Version <?php 
        echo SENDPRESS_VERSION;
        ?>
</strong> addressed several bugs. For more information, see <a href="http://wordpress.org/plugins/sendpress/changelog/">the changelog</a>.</p>
</div>
-->
<div class="changelog">
	<h2 class="about-headline-callout">Introducing Custom HTML Templates</h2>

<p style="text-align:center;">Custom Templates Requires SendPress Pro v1.0+</p>
	<img class="about-overview-img" src="<?php 
        echo SENDPRESS_URL;
        ?>
img/customedit.png">
	<div class="feature-section col three-col about-updates">
		<div class="col-1">
			<!--<img src="<?php 
        echo SENDPRESS_URL;
        ?>
/img/sending-errors.png?1">-->
			<h3>Send Any Template</h3>
			<p>SendPress allows you to send any HTML email template you wish.</p>
		</div>
		<div class="col-2">
			<!--<img src="<?php 
        echo SENDPRESS_URL;
        ?>
/img/sendhistory.png?1">-->
			<h3>Template Tags</h3>
			<p>Quickly insert email content, subscriber information and social icons with our new tag system.</p>
		</div>
		<div class="col-3 last-feature">
			<!--<img src="<?php 
        echo SENDPRESS_URL;
        ?>
/img/autocron.png?1">-->
			<h3>Upgrade to Pro</h3>
			<p>Go to <a href="https://sendpress.com/purchase-pricing/">SendPress.com</a> to get a liscense for SendPress Pro. Also if you enable AutoCron you should recive a 20% discount.</p>
		</div>
	</div>
</div>
<!--
<hr>

<div class="changelog">
	<div class="feature-section col two-col">
		<div>
			<h3>Give us a Review</h3>
			<p>We love feedback so please let us know how we are doing.<br>Add your <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/sendpress">★★★★★</a> on <a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/sendpress">wordpress.org</a></p>
			<h4>Help Translate</h4>
			<p>You can help translate on <a href="https://www.transifex.com/projects/p/sendpress/">Transifex</a>.</p>
			<h4>Report and Fix bugs</h4>
			<p>SendPress is on <a href="http://wordpress.org/support/plugin/sendpress">GitHub</a> feel free to patch bugs you find or please report them on the <a href="http://wordpress.org/support/plugin/sendpress">forum</a>.</p>
		
		</div>
		<div class="last-feature about-colors-img">
			<a href="http://wordpress.org/support/view/plugin-reviews/sendpress" target="_blank"><img class="about-overview-img" src="<?php 
        echo SENDPRESS_URL;
        ?>
/img/review-us.png"></a>
		</div>
	</div>
</div>

<hr>



<div class="changelog">

	<div class="feature-section col three-col">
	<h3>Whats Ahead</h3>
		<div>
			<h4>Post Notifications</h4>
			<p>Subscribers will be able to get your new post's via email. Post Notifications will only be available with SendPress Pro.</p>
		</div>
		<div>
			<h4>Autoresponders</h4>
			<p>Automatically send emails to subscribers based on actions like link clicks, subscribe to list or email opens.</p>
		</div>
		<div class="last-feature">
			<h4>Custom fields</h4>
			<p>Add your own information to subscribers and collect the data you need.</p>
	
		</div>
	</div>

	
</div>


<div class="return-to-dashboard">
		SendPress: <a href="<?php 
        echo SendPress_Admin::link('Emails');
        ?>
">Emails</a> |
		<a href="<?php 
        echo SendPress_Admin::link('Reports');
        ?>
">Reports</a> |
		<a href="<?php 
        echo SendPress_Admin::link('Subscribers');
        ?>
">Subscribers</a> |
		<a href="<?php 
        echo SendPress_Admin::link('Queue');
        ?>
">Queue</a> |
		<a href="<?php 
        echo SendPress_Admin::link('Settings');
        ?>
">Settings</a> 
		
		|
		<a href="<?php 
        echo SendPress_Admin::link('Pro');
        ?>
">Pro</a>
</div>
<br>
</div>
-->
		<?php 
    }
    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>&nbsp;
			</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()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $temp_id = $the_query->post->ID;
                $s = '';
                if ($temp_id == $template_id) {
                    $s = 'selected';
                }
                echo '<option value="' . $temp_id . '" ' . $s . '>' . get_the_title() . '</option>';
            }
        }
        ?>
			
			</select>
			<?php 
        $this->panel_end();
        ?>
			</div>
			<div class="sp-50">
			<?php 
        $this->panel_start(__('Original Template', 'sendpress'));
        ?>
			<?php 
        $this->panel_end();
        ?>
			</div>
			</div>

			
		<br><br>
		<?php 
        //wp_editor($post->post_content,'textversion');
        ?>

		 <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
<br><br>
		 </form>
		 
		<?php 
    }
    function html($sp)
    {
        //SendPress_Option::set('pro_plugins','');
        SendPress_Tracking::event('Pro Tab');
        ?>
        <div class="pro-header" >
            <form method="post" id="post" style="float:right;">
            <?php 
        $sppro = new SendPress_Module_Pro();
        $sppro->buttons('sendpress-pro/sendpress-pro.php');
        ?>
 
            <input type="hidden" name="plugin_path" value="sendpress-pro/sendpress-pro.php" />
            <input class="action" type="hidden" name="action" value="module-activate-sendpress-pro" />
            <?php 
        wp_nonce_field($sp->_nonce_value);
        ?>
        </form>
    <h1 style="font-size:35px;">SendPress Pro
    <?php 
        if (defined('SENDPRESS_PRO_VERSION')) {
            echo "<small>v" . SENDPRESS_PRO_VERSION . "</small>";
        }
        ?>
    </h1>
    <?php 
        if (is_plugin_active('sendpress-pro/sendpress-pro.php')) {
            ?>
        <p class="lead">Thanks for using <b>SendPress Pro</b>.</p>
    <?php 
        } else {
            ?>
 
        <p class="lead">Take your emails to the next level. <b>SendPress Pro</b> allows you to build an email marketing system tailored to your needs. All within WordPress with no need for an external system.</p>
    <?php 
        }
        ?>
    </div>
                <?php 
        $modules = apply_filters('sendpress_pro_modules', array('sendgrid', 'mailjet', 'customsmtp', 'amazonses', 'mandrill', 'elastic', 'empty', 'empty', 'empty'));
        echo '<div class="sendpress-addons">';
        $p = new SendPress_Module_Pro();
        $p->index(0);
        $p->render($this);
        $i = 1;
        echo "<h2 class='clear' style='padding-left: 18px; padding-top: 30px; padding-bottom: 10px;'>Sending Options</h2>";
        foreach ($modules as $mod) {
            $mod_class = $this->get_module_class($mod);
            if ($mod_class) {
                $mod_class = new $mod_class();
                $mod_class->index($i);
                $mod_class->render($this);
                $i++;
            }
        }
        echo '<br class="clear"><br></div>';
        ?>
        <!--
        <h2 class="clear" style="padding-left: 18px; padding-top: 30px; padding-bottom: 10px;">Addons</h2>
        <div class="sendpress-module  mod-first"><div class="inner-module">
        <h4>WordPress Emails</h4>
            <form method="post" id="post">
            <div class="description">
                Wrap WordPress system emails in a SendPress template and send them via your sending settings.
                <br><br>
                
            </div>
            <?php 
        $d = get_option('sendpress_wp_mail', false);
        $sp = is_plugin_active('sendpress-pro/sendpress-pro.php');
        ?>


            <div class="inline-buttons">
            <?php 
        if ($sp) {
            if ($d === false) {
                ?>
                    <a class=" btn-success btn-activate btn" href="<?php 
                echo SendPress_Admin::link('Pro', array('action' => 'wp-mail', 'enable' => true));
                ?>
">Activate</a>
                <?php 
            } else {
                ?>
                    <a class="btn btn-default " href="<?php 
                echo SendPress_Admin::link('Pro', array('action' => 'wp-mail', 'enable' => false));
                ?>
">Deactivate</a>&nbsp;<a class="btn btn-default module-deactivate-plugin" href="#">Settings</a>
                <?php 
            }
            ?>
            <?php 
        } else {
            ?>
                <a class="btn disabled btn-default btn-activate" href="#">Activate</a>
            <?php 
        }
        ?>
            </div>         
            
            </div>
        </div>
        -->
          <br class="clear">
        <br><br>

        <?php 
    }
        function sub_menu($sp = false)
        {
            ?>
		<div class="navbar navbar-default" >
			<div class="navbar-header">
			  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
       <span class="sr-only"><?php 
            _e('Toggle navigation', 'sendpress');
            ?>
</span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>

    </button>
   <a class="navbar-brand" href="#"><?php 
            _e('Emails', 'sendpress');
            ?>
</a>
	</div>
		 <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		<ul class="nav navbar-nav">
					<li <?php 
            if (!isset($_GET['view']) || isset($_GET['view']) && $_GET['view'] === 'style' || isset($_GET['view']) && $_GET['view'] === 'create' || isset($_GET['view']) && $_GET['view'] === 'send' || isset($_GET['view']) && $_GET['view'] === 'send-confirm' || isset($_GET['view']) && $_GET['view'] === 'send-queue') {
                ?>
class="active"<?php 
            }
            ?>
 >
				    	<a href="<?php 
            echo SendPress_Admin::link('Emails');
            ?>
"><?php 
            _e('Newsletters', 'sendpress');
            ?>
</a>
				  	</li>
				  	<?php 
            if (false == true) {
                //if(SendPress_Option::get('prerelease_templates') == 'yes') {
                ?>
				 	
				  	<li <?php 
                if (isset($_GET['view']) && $_GET['view'] === 'all') {
                    ?>
class="active"<?php 
                }
                ?>
 >
				    	<a href="<?php 
                echo SendPress_Admin::link('Emails_Auto');
                ?>
"><?php 
                _e('Autoresponders', 'sendpress');
                ?>
</a>
				  	</li>
				  	  	<!--	-->
				  	<?php 
            }
            ?>

				  	<li <?php 
            if (isset($_GET['view']) && ($_GET['view'] === 'temp' || $_GET['view'] === 'tempstyle')) {
                ?>
class="active"<?php 
            }
            ?>
 >
				    	<a href="<?php 
            echo SendPress_Admin::link('Emails_Temp');
            ?>
"><?php 
            _e('Templates', 'sendpress');
            ?>
</a>
				  	</li>
				  	<li <?php 
            if (isset($_GET['view']) && ($_GET['view'] === 'templates' || $_GET['view'] === 'tempedit')) {
                ?>
class="active"<?php 
            }
            ?>
 >
				    	<a href="<?php 
            echo SendPress_Admin::link('Emails_Templates');
            ?>
"><?php 
            _e('Custom Templates', 'sendpress');
            ?>
</a>
				  	</li>
				  	<?php 
            //}
            ?>
				  	<li <?php 
            if (isset($_GET['view']) && $_GET['view'] === 'social') {
                ?>
class="active"<?php 
            }
            ?>
 >
				    	<a href="<?php 
            echo SendPress_Admin::link('Emails_Social');
            ?>
"><?php 
            _e('Social Icons', 'sendpress');
            ?>
</a>
				  	</li>
				  	<li <?php 
            if (isset($_GET['view']) && in_array($_GET['view'], array('postnotifications'))) {
                ?>
class="active"<?php 
            }
            ?>
 >
              <a href="<?php 
            echo SendPress_Admin::link('Emails_Postnotifications');
            ?>
"><?php 
            _e('Post Notifications', 'sendpress');
            ?>
</a>
            </li>
				  	
            
            <?php 
            if (SendPress_Option::get('beta')) {
                ?>
         
              <li <?php 
                if (isset($_GET['view']) && in_array($_GET['view'], array('autoresponder', 'autoedit'))) {
                    ?>
class="active"<?php 
                }
                ?>
 >
                <a href="<?php 
                echo SendPress_Admin::link('Emails_Autoresponder');
                ?>
"><?php 
                _e('Automation', 'sendpress');
                ?>
</a>
              </li>
           
              
            <?php 
            }
            ?>

            <li <?php 
            if (strpos($sp->_current_view, 'systememail') !== false) {
                ?>
class="active"<?php 
            }
            ?>
 ><a <?php 
            if (strpos($sp->_current_view, 'systememail') !== false) {
                ?>
class="wp-ui-primary"<?php 
            }
            ?>
  href="<?php 
            echo SendPress_Admin::link('Emails_Systememail');
            ?>
"><i class=" icon-bullhorn"></i> <?php 
            _e('System Email', 'sendpress');
            ?>
</a></li>
				</ul>
			</div>
		</div>

		<?php 
        }