[ Index ]

MailPress 7.1

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

title

Body

[close]

/mp-admin/includes/ -> wp_cron.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 = __( 'Wp_cron', 'MailPress' );
  12  
  13  //
  14  // MANAGING MESSAGE
  15  //
  16  
  17  $messages[1] = __( 'Cron added.', 'MailPress' );
  18  $messages[2] = __( 'Cron updated.', 'MailPress' );
  19  $messages[3] = __( 'Cron deleted.', 'MailPress' );
  20  $messages[4] = __( 'Crons deleted.', 'MailPress' );
  21  $messages[5] = __( 'Cron executed.', 'MailPress' );
  22  $messages[91] = __( 'Cron NOT added.', 'MailPress' );
  23  $messages[92] = __( 'Cron NOT updated.', 'MailPress' );
  24  $messages[95] = __( 'Cron NOT executed.', 'MailPress' );
  25  
  26  if ( isset( MP_AdminPage::$get_['message'] ) )
  27  {
  28      $message = $messages[MP_AdminPage::$get_['message']];
  29      $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] );
  30  }
  31  
  32  //
  33  // MANAGING CONTENT
  34  //
  35  
  36  global $action;
  37  wp_reset_vars( array( 'action' ) );
  38  if ( 'edit' == $action ) 
  39  {
  40      $action = 'edited';
  41      $cancel = '<input type="submit" class="button" name="cancel" value="' . __( 'Cancel', 'MailPress' ) . '" />';
  42  
  43      $id = MP_AdminPage::$get_['id'];
  44      $sig = MP_AdminPage::$get_['sig'];
  45      $next_run = MP_AdminPage::$get_['next_run'];
  46      $wpcron = MP_AdminPage::get( $id, $sig, $next_run );
  47  
  48      $h3 = __( 'Edit cron', 'MailPress' );
  49  
  50      $hidden = '<input type="hidden" name="id" value="' . $id . '::' . $sig . '::' . $next_run . '" />';
  51  
  52      $flipflops = array( 2, 1 );
  53  }
  54  else 
  55  {
  56      $action = MP_AdminPage::add_form_id;
  57      $cancel = '';
  58  
  59      $wpcron = array();
  60  
  61      $h3 = __( 'Add cron', 'MailPress' );
  62  
  63      $hidden = '';
  64      $flipflops = array( 1, 2 );
  65  }
  66  
  67  //
  68  // MANAGING BULK ACTIONS
  69  //
  70  
  71  $bulk_actions[''] = __( 'Bulk Actions' );
  72  $bulk_actions['delete'] = __( 'Delete', 'MailPress' );
  73  
  74  //
  75  // MANAGING LIST
  76  //
  77  
  78  $url_parms['paged'] = ( isset( $url_parms['paged'] ) ) ? $url_parms['paged'] : 1;
  79  $_per_page = MP_AdminPage::get_per_page();
  80  
  81  do
  82  {
  83      $start = ( $url_parms['paged'] - 1 ) * $_per_page;
  84      list( $items, $total ) = MP_AdminPage::get_list( array( 'start' => $start, '_per_page' => $_per_page, 'url_parms' => $url_parms ) );
  85      $url_parms['paged']--;
  86  } while ( $total <= $start );
  87  $url_parms['paged']++;
  88  
  89  ?>
  90  <div class="wrap">
  91      <h1>
  92          <?php echo esc_html( $h1 ); ?>
  93      </h1>
  94  <?php if ( isset( $message ) ) MP_AdminPage::message( $message, ( MP_AdminPage::$get_['message'] < 90 ) ); ?>
  95      <br class="clear" />
  96  <?php
  97  foreach ( $flipflops as $flipflop )
  98  {
  99      switch( $flipflop )
 100      {
 101          case 1 :
 102  ?>
 103      <form id="posts-filter" method="get">
 104  
 105          <input type="hidden" name="page" value="<?php echo MP_AdminPage::screen; ?>" />
 106  
 107          <div class="tablenav top">
 108              <div class="alignleft actions bulkactions">
 109  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions ); ?>
 110              </div>
 111  
 112  <?php MP_AdminPage::pagination( $total ); ?>
 113  
 114              <br class="clear" />
 115          </div>
 116          <div class="clear"></div>
 117  
 118          <table class="wp-list-table widefat fixed striped zyxw">
 119              <thead>
 120                  <tr>
 121  <?php MP_AdminPage::columns_list(); ?>
 122                    </tr>
 123              </thead>
 124              <tbody id="<?php echo MP_AdminPage::list_id; ?>" class="list:<?php echo MP_AdminPage::tr_prefix_id; ?>">
 125  <?php    foreach ( $items as $item ) { echo MP_AdminPage::get_row( $item, $url_parms ); } ?>
 126              </tbody>
 127              <tfoot>
 128                  <tr>
 129  <?php MP_AdminPage::columns_list( false ); ?>
 130                  </tr>
 131              </tfoot>
 132          </table>
 133          <div class="tablenav bottom">
 134  <?php MP_AdminPage::pagination( $total, 'bottom' ); ?>
 135              <div class="alignleft actions bulkactions">
 136  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions, 'action2' ); ?>
 137              </div>
 138              <br class="clear" />
 139          </div>
 140      </form>
 141  <?php
 142          break;
 143          case 2 :
 144  ?>
 145      <form name="<?php echo $action; ?>" id="<?php echo $action; ?>" method="post" class="<?php echo $action; ?>:<?php echo MP_AdminPage::list_id; ?>: validate">
 146          <table class="wp-list-table widefat fixed striped zyxw">
 147              <thead>
 148                  <tr>
 149  <?php
 150      foreach ( array( 'name' => __( 'Hook name', 'MailPress' ), 'next' => __( 'Next&#160;run',  'MailPress' ), 'rec' => __( 'Recurrence','MailPress' ), 'args' => __( 'Arguments', 'MailPress' ) ) as $key => $display_name ) 
 151      {
 152          $display_name = ( 'next' != $key ) ? $display_name : '<abbr title="' . esc_attr( __( 'e.g., "now", "tomorrow", "+2 days", or "06/04/08 15:27:09"', 'MailPress' ) )     . '">' . $display_name . '</abbr>';
 153          $display_name = ( 'args' != $key ) ? $display_name : '<abbr title="' . esc_attr( __( 'JSON encoded string', 'MailPress' ) )                                . '">' . $display_name . '</abbr>';
 154          echo "<th>$display_name</th>";
 155      } 
 156  ?>
 157                  </tr>
 158              </thead>
 159              <tbody>
 160                  <tr>
 161                      <td>
 162  <input type="text" name="name" id="wpcron_name" size="40" value="<?php if ( isset( $wpcron['hookname'] ) ) echo esc_attr( $wpcron['hookname'] ); ?>" />
 163                      </td>
 164                      <td>
 165  <input type="text" name="next_run" id="wpcron_next_run" size="40" value="<?php if ( isset( $wpcron['next_run'] ) ) echo date( 'Y/m/d H:i:s', $wpcron['next_run'] ); else echo "now"; ?>" />
 166                      </td>
 167                      <td>
 168  <select name="schedule" id="wpcron_schedule">
 169      <?php MP_AdminPage::select_option( MP_AdminPage::get_schedules(), ( isset( $wpcron['schedule'] ) ) ? $wpcron['schedule'] : '_oneoff' ); ?>
 170  </select>
 171                      </td>
 172                      <td>
 173  <input type="text" name="args" id="wpcron_args" size="40" value="<?php if ( isset( $wpcron['args'] ) ) echo htmlentities( json_encode( $wpcron['args'] ) ); ?>" />
 174                      </td>
 175                  </tr>
 176              </tbody>
 177          </table>
 178          <div class="tablenav bottom">
 179              <div class="alignright actions">
 180                  <input type="submit" name="submit" id="wpcron_submit" class="button" value="<?php echo $h3; ?>" />
 181                  <?php echo $cancel; ?>
 182                  <input type="hidden" name="action"   value="<?php echo $action; ?>" />
 183                  <input type="hidden" name="formname" value="wp_cron_form" />
 184                  <?php echo $hidden; ?>
 185                  <?php wp_nonce_field( 'update-' . MP_AdminPage::tr_prefix_id ); ?>
 186              </div>
 187              <br class="clear" />
 188          </div>
 189          <br class="clear" />
 190      </form>
 191  <?php
 192          break;
 193      }
 194  }
 195  ?>
 196  </div>


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