[ Index ]

MailPress 7.2

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

title

Body

[close]

/mp-includes/meta_boxes/post/ -> test.php (source)

   1  <?php
   2  
   3  $fields = array( 'toemail' => __( 'Email: ', 'MailPress' ), 'newsletter' => __( 'Newsletter: ', 'MailPress' ), 'theme' => __( 'Theme: ', 'MailPress' ) );
   4  
   5  $meta = get_user_meta( MP_WP_User::get_id(), '_MailPress_post_' . $post->ID, true );
   6  $test    = get_option( MailPress::option_name_test );
   7  
   8  $xnewsletters = array();
   9  global $mp_registered_newsletters;
  10  foreach ( $mp_registered_newsletters as $id => $data ) if ( !isset( $data['params']['post_type'] ) || 'post' == $data['params']['post_type'] ) $xnewsletters[$id] = $data['descriptions']['admin'];
  11  
  12  $th = new MP_Themes();
  13  $themes = $th->themes;
  14  
  15  foreach( $themes as $key => $theme )
  16  {
  17      if ( 'plaintext' == $theme['Stylesheet'] ) unset( $themes[$key] );
  18      if ( '_' == $theme['Stylesheet'][0] )     unset( $themes[$key] );
  19  }
  20  
  21  $xthemes = array( '' => __( 'current', 'MailPress' ) );
  22  foreach ( $themes as $theme ) $xthemes[$theme['Stylesheet']] = $theme['Stylesheet'];
  23  
  24  $current_theme = $themes[$th->current_theme]['Stylesheet'];
  25  
  26  if ( $meta )
  27  {
  28      $toemail    = $meta['toemail'];
  29      $newsletter    = $meta['newsletter'];
  30      $theme     = ( isset( $xthemes[$meta['theme']] ) ) ? $meta['theme'] : '';
  31  }
  32  else
  33  {
  34      $toemail    = $test['toemail'];
  35      $newsletter = 'new_post';
  36      $theme     = '';
  37  }
  38  ?>
  39  <div id="MailPress_test">
  40      <div> <!-- minor -->
  41          <div id="MailPress_minor-publishing-actions"> <!-- minor actions -->
  42              <div class="mp-left">
  43                  <div id="MailPress_post_test_loading"><img src="images/wpspin_light.gif" alt="" /><?php _e( 'Sending ...', 'MailPress' ); ?></div>
  44                  <div id="MailPress_post_test_ajax"><br /></div>
  45              </div>
  46              <div>
  47                  <a id="MailPress_post_test_button" class="mp_meta_box_post_test button" href="#mp_send"><?php _e( 'Test', 'MailPress' ); ?></a>
  48              </div>
  49              <div class="clear"></div>
  50          </div>
  51          <div id="MailPress_post_test_misc"> <!-- minor actions -->
  52  <?php
  53  foreach ( $fields as $field => $label )
  54  {
  55      if ( 'newsletter' == $field ) $lib = $xnewsletters[$$field];
  56      elseif ( 'theme' == $field ) $lib = $xthemes[$$field];
  57      else $lib = $$field;
  58  ?>
  59              <!-- <?php echo $field; ?> -->
  60              <div class="misc-pub-section misc-pub-mp-<?php echo $field; ?>">
  61                  <?php echo $label; ?>
  62                  <span id="span_<?php echo $field; ?>"> <?php echo $lib; ?></span>
  63                  <a href="#mp_<?php echo $field; ?>" class="mp-edit-<?php echo $field; ?> hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span></a>
  64                  <div id="mp_div_<?php echo $field; ?>" class="hide-if-js">
  65  
  66  <?php
  67      switch ( $field )
  68      {
  69          case 'toemail' :
  70  ?>
  71                      <input type="hidden" name="mp_hidden_<?php echo $field; ?>" id="mp_hidden_<?php echo $field; ?>" value="<?php echo $$field; ?>" />
  72                      <input type="text"   name="mp_<?php echo $field; ?>"        id="mp_<?php echo $field; ?>"        value="<?php echo $$field; ?>" /> 
  73  <?php
  74          break;
  75          case 'toname' :
  76  ?>
  77                      <input type="hidden" name="mp_hidden_<?php echo $field; ?>" id="mp_hidden_<?php echo $field; ?>" value="<?php echo esc_attr( $$field ); ?>" />
  78                      <input type="text"   name="mp_<?php echo $field; ?>"        id="mp_<?php echo $field; ?>"        value="<?php echo esc_attr( $$field ); ?>" />
  79  <?php
  80          break;
  81          case 'newsletter' :
  82  
  83  ?>
  84                      <input type="hidden" name="mp_hidden_<?php echo $field; ?>"     id="mp_hidden_<?php echo $field; ?>"     value="<?php echo esc_attr( $$field ); ?>" />
  85                      <input type="hidden" name="mp_hidden_lib_<?php echo $field; ?>" id="mp_hidden_lib_<?php echo $field; ?>" value="<?php echo esc_attr( $xnewsletters[$$field] ); ?>" />
  86                      <select name="mp_<?php echo $field ?>" id="mp_<?php echo $field ?>">
  87  <?php MP_::select_option( $xnewsletters, $$field );?>
  88                      </select>
  89  <?php
  90          break;
  91          case 'theme' :
  92  ?>
  93                      <input type="hidden" name="mp_hidden_<?php echo $field; ?>"     id="mp_hidden_<?php echo $field; ?>"     value="<?php echo esc_attr( $$field ); ?>" />
  94                      <input type="hidden" name="mp_hidden_lib_<?php echo $field; ?>" id="mp_hidden_lib_<?php echo $field; ?>" value="<?php echo esc_attr( $xthemes[$$field] ); ?>" />
  95                      <select name="mp_<?php echo $field ?>" id="mp_<?php echo $field; ?>">
  96  <?php MP_::select_option( $xthemes, $theme );?>
  97                      </select>
  98  <?php
  99          break;
 100      }
 101  ?>
 102                      <br />
 103                      <a class="mp-save-<?php echo $field; ?> hide-if-no-js button" href="#mp_<?php echo $field; ?>"><?php _e( 'OK' ); ?></a>
 104                      <a class="mp-cancel-<?php echo $field; ?> hide-if-no-js" href="#mp_<?php echo $field; ?>"><?php _e( 'Cancel' ); ?></a>
 105                  </div>
 106              </div>
 107              <div class="clear"></div>
 108  <?php
 109  }
 110  ?>
 111          </div>
 112      </div>
 113  </div>


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1