[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-admin/includes/ -> mails.php (source)

   1  <?php
   2  
   3  if ( !( function_exists( 'current_user_can' ) && current_user_can( MP_AdminPage::capability ) ) ) die( 'Access denied' );
   4  
   5  $url_parms = MP_AdminPage::get_url_parms();
   6  
   7  //
   8  // MANAGING H1
   9  //
  10  
  11  $h1 = __( 'Mails', 'MailPress' );
  12  $subtitle = '';
  13  
  14  if ( isset( $url_parms['author'] ) ) 
  15  {
  16      $author_user = get_userdata( $url_parms['author'] );
  17      $subtitle .= ' ' . sprintf( __( 'by %s' ), esc_html( $author_user->display_name ) );
  18  }
  19  
  20  //
  21  // MANAGING MESSAGE / CHECKBOX RESULTS
  22  //
  23  
  24  $results = array(     'deleted'    =>     array(     's' => __( '%s mail deleted', 'MailPress' ), 
  25                                      'p' => __( '%s mails deleted', 'MailPress' ) 
  26                              ),
  27                  'sent'    =>     array(     's' => __( '%s mail sent', 'MailPress' ),
  28                                      'p' => __( '%s mails sent', 'MailPress' )
  29                              ),
  30                  'notsent'    =>     array(     's' => __( '%s mail NOT sent', 'MailPress' ),
  31                                      'p' => __( '%s mails NOT sent', 'MailPress' )
  32                              ),
  33                  'archived'    =>     array(     's' => __( '%s mail archived', 'MailPress' ),
  34                                      'p' => __( '%s mails archived', 'MailPress' )
  35                              ),
  36                  'unarchived'=>     array(     's' => __( '%s mail unarchived', 'MailPress' ),
  37                                      'p' => __( '%s mails unarchived', 'MailPress' )
  38                              ),
  39                  'paused'    =>     array(     's' => __( '%s mail paused', 'MailPress' ),
  40                                      'p' => __( '%s mails paused', 'MailPress' )
  41                              ),
  42                  'restartd'    =>     array(     's' => __( '%s mail restarted', 'MailPress' ),
  43                                      'p' => __( '%s mails restarted', 'MailPress' )
  44                              ),
  45                  'saved'    =>     array(     's' => __( 'Mail saved', 'MailPress' ),
  46                                      'p' => __( 'Mail saved', 'MailPress' )
  47                              ),
  48   );
  49  
  50  foreach ( $results as $k => $v )
  51  {
  52      if ( isset( MP_AdminPage::$get_[$k] ) && ( MP_AdminPage::$get_[$k] !== false ) )
  53      {
  54          if ( !isset( $message ) ) 
  55          {
  56              $message = '';
  57          }
  58          $message .= sprintf( _n( $v['s'], $v['p'], MP_AdminPage::$get_[$k] ), MP_AdminPage::$get_[$k] );
  59          $message .=  '<br />';
  60      }
  61  }
  62  
  63  //
  64  // MANAGING DETAIL/LIST URL
  65  //
  66  
  67  if ( isset( $url_parms['mode'] ) ) $wmode = $url_parms['mode'];
  68  $url_parms['mode'] = 'detail';
  69  $detail_url = esc_url( MP_AdminPage::url( MailPress_mails, $url_parms ) );
  70  $url_parms['mode'] = 'list';
  71  $list_url = esc_url( MP_AdminPage::url( MailPress_mails, $url_parms ) );
  72  if ( isset( $wmode ) ) $url_parms['mode'] = $wmode; 
  73  
  74  //
  75  // MANAGING BULK ACTIONS
  76  //
  77  
  78  $bulk_actions[''] = __( 'Bulk Actions' );
  79  if ( isset( $url_parms['status'] ) )
  80  {
  81      switch( $url_parms['status'] )
  82      {
  83          case 'draft' :
  84              $bulk_actions['send']        = __( 'Send', 'MailPress' );
  85          break;
  86          case 'sent' :
  87              $bulk_actions['archive']    = __( 'Archive', 'MailPress' );
  88          break;
  89          case 'archived' :
  90              $bulk_actions['unarchive']    = __( 'Unarchive', 'MailPress' );
  91          break;
  92      }
  93  }
  94  if ( current_user_can( 'MailPress_delete_mails' ) ) $bulk_actions['delete']      = __( 'Delete', 'MailPress' );
  95  
  96  //
  97  // MANAGING LIST
  98  //
  99  
 100  $url_parms['paged'] = isset( $url_parms['paged'] ) ? $url_parms['paged'] : 1;
 101  $_per_page = MP_AdminPage::get_per_page();
 102  
 103  do
 104  {
 105      $start = ( $url_parms['paged'] - 1 ) * $_per_page;
 106      list( $items, $total, $subsubsub_urls ) = MP_AdminPage::get_list( array( 'start' => $start, '_per_page' => $_per_page, 'url_parms' => $url_parms ) );
 107      $url_parms['paged']--;        
 108  } while ( $total <= $start );
 109  $url_parms['paged']++;
 110  
 111  ?>
 112  <div class="wrap">
 113      <h1>
 114          <?php echo esc_html( $h1 ); ?>
 115          <a href="<?php echo MailPress_write; ?>" class="add-new-h2"><?php echo esc_html( __( 'Add New', 'MailPress' ) ); ?></a> 
 116  <?php if ( isset( $url_parms['s'] ) ) printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_attr( $url_parms['s'] ) ); ?>
 117  <?php if ( !empty( $subtitle ) )      echo    '<span class="subtitle">' . $subtitle . '</span>'; ?>
 118      </h1>
 119  <?php if ( isset( $message ) ) MP_AdminPage::message( $message ); ?>
 120  
 121      <ul class="subsubsub"><?php echo $subsubsub_urls; ?></ul>
 122  
 123      <form id="posts-filter" method="get">
 124  
 125          <input type="hidden" name="page" value="<?php echo MP_AdminPage::screen; ?>" />
 126  <?php MP_AdminPage::post_url_parms( $url_parms, array( 'mode', 'status' ) ); ?>
 127  
 128          <p class="search-box">
 129              <input type="text" name="s" class="search-input" value="<?php if ( isset( $url_parms['s'] ) ) echo esc_attr( $url_parms['s'] ); ?>" />
 130              <input type="submit" class="button" value="<?php _e( 'Search', 'MailPress' ); ?>" />
 131          </p>
 132  <?php
 133  if ( $items )
 134  {
 135  ?>
 136          <div class="tablenav top">
 137              <div class="alignleft actions bulkactions">
 138  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions ); ?>
 139              </div>
 140  
 141  <?php MP_AdminPage::pagination( $total ); ?>
 142  <!--
 143              <div class="view-switch">
 144                  <a href="<?php echo $list_url;   ?>"><img id="view-switch-list"    height="20" width="20" <?php if ( 'list'   == $url_parms['mode'] ) echo 'class="current"' ?> alt="<?php echo esc_attr( __( 'List View', 'MailPress' ) );  ?>"  title="<?php esc_attr( __( 'List View', 'MailPress' ) );   ?>" src="../wp-includes/images/blank.gif" /></a>
 145                  <a href="<?php echo $detail_url; ?>"><img id="view-switch-excerpt" height="20" width="20" <?php if ( 'detail' == $url_parms['mode'] ) echo 'class="current"' ?> alt="<?php echo esc_attr( __( 'Detail View', 'MailPress' ) ); ?>" title="<?php esc_attr( __( 'Detail View', 'MailPress' ) ); ?>" src="../wp-includes/images/blank.gif" /></a>
 146              </div>
 147  -->
 148              <br class="clear" />
 149          </div>
 150          <div class="clear"></div>
 151  
 152          <table class="wp-list-table widefat fixed striped posts">
 153              <thead>
 154                  <tr>
 155  <?php MP_AdminPage::columns_list(); ?>
 156                  </tr>
 157              </thead>
 158              <tbody id="the-mail-list" class="list:mail">
 159  <?php foreach ( $items as $item ) { echo MP_AdminPage::get_row( $item->id, $url_parms ); } ?>
 160              </tbody>
 161              <tfoot>
 162                  <tr>
 163  <?php MP_AdminPage::columns_list( false ); ?>
 164                  </tr>
 165              </tfoot>
 166          </table>
 167          <div class="tablenav bottom">
 168  <?php MP_AdminPage::pagination( $total, 'bottom' ); ?>
 169              <div class="alignleft actions bulkactions">
 170  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions, 'action2' ); ?>
 171              </div>
 172              <br class="clear" />
 173          </div>
 174      </form>
 175  
 176      <form id="get-extra-mails" method="post" class="hidden add:the-extra-mail-list:">
 177  
 178  <?php MP_AdminPage::post_url_parms( ( array ) $url_parms ); ?>
 179  <?php wp_nonce_field( 'add-mail', '_ajax_nonce', false ); ?>
 180  
 181      </form>
 182  
 183      <div id="ajax-response"></div>
 184  
 185  <?php
 186  }
 187  else
 188  {
 189  ?>
 190      </form>
 191      <div class="clear"></div>
 192      <p>
 193          <?php _e( 'No results found.', 'MailPress' ) ?>
 194      </p>
 195  <?php
 196  }
 197  ?>
 198  </div>


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1