[ Index ]

MailPress 7.2

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

title

Body

[close]

/mp-admin/includes/settings/test/ -> form.php (source)

   1  <?php // test
   2  
   3  if ( !isset( $test ) ) $test = get_option( MailPress::option_name_test );
   4  
   5  $th = new MP_Themes();
   6  $themes = $th->themes; 
   7  if ( empty( $test['theme'] ) ) $test['theme'] = $themes[$th->current_theme]['Stylesheet']; 
   8  
   9  $xtheme = $xtemplates = array();
  10  foreach ( $themes as $key => $theme )
  11  {
  12      if ( 'plaintext' == $theme['Stylesheet'] ) unset( $themes[$key] );
  13      if ( '_' == $theme['Stylesheet'][0] )     unset( $themes[$key] );
  14  }
  15  foreach ( $themes as $key => $theme )
  16  {
  17      $xtheme[$theme['Stylesheet']] = $theme['Stylesheet'];
  18      if ( !$templates = $th->get_page_templates( $theme['Stylesheet'] ) ) $templates = $th->get_page_templates( $theme['Stylesheet'], true );
  19  
  20      $xtemplates[$theme['Stylesheet']] = array();
  21      foreach ( $templates as $key => $value )
  22      {
  23          $xtemplates[$theme['Stylesheet']][$key] = $key;
  24      }
  25      if ( !empty( $xtemplates[$theme['Stylesheet']] ) ) ksort( $xtemplates[$theme['Stylesheet']] );
  26  
  27      array_unshift( $xtemplates[$theme['Stylesheet']], __( 'none', 'MailPress' ) );
  28  }
  29  
  30  ?>
  31  <form name="<?php echo basename(__DIR__); ?>" method="post" class="mp_settings">
  32      <input type="hidden" name="_tab" value="<?php echo basename(__DIR__); ?>" />
  33      <table class="form-table">
  34  
  35          <tr>
  36              <th><label for="test_toemail"><?php _e( 'To', 'MailPress' ); ?></label></th>
  37              <td class="nopad">
  38                  <table class="subscriptions">
  39                      <tr>
  40                          <td class="pr10<?php if ( isset( MP_AdminPage::$err_mess['toemail'] ) ) echo ' form-invalid'; ?>">
  41                              <?php _e( 'Email : ', 'MailPress' ); ?>
  42                              <input type="text" name="test[toemail]" value="<?php if ( isset( $test['toemail'] ) ) echo esc_attr( $test['toemail'] ); ?>" class="regular-text" id="test_toemail" />
  43                          </td>
  44                          <td class="pr10<?php if ( isset( MP_AdminPage::$err_mess['toname'] ) ) echo ' form-invalid'; ?>">
  45                              <?php _e( 'Name : ', 'MailPress' ); ?> 
  46                              <input type="text" name="test[toname]"  value="<?php if ( isset( $test['toname'] ) ) echo esc_attr( $test['toname'] ); ?>" class="regular-text" />
  47                          </td>
  48                      </tr>
  49                  </table>
  50              </td>
  51          </tr>
  52          <tr>
  53              <th><label for="test_theme"><?php _e( "Advanced Options", 'MailPress' ); ?></label></th>
  54              <td> 
  55                  <?php _e( 'Theme', 'MailPress' ); ?>
  56                  &#160;
  57                  <select name="test[theme]" id="test_theme">
  58  <?php MP_AdminPage::select_option( $xtheme, $test['theme'] ?? false );?>
  59                  </select>
  60                  &#160;
  61                  <?php _e( 'Template', 'MailPress' ); ?>
  62                  &#160;
  63  <?php 
  64  foreach ( $xtemplates as $key => $xtemplate )
  65  {
  66      $xx = ( isset( $test['theme'], $test['template'] ) && $key == $test['theme'] ) ? $test['template'] : '0';
  67  ?>
  68                  <select name="test[th][<?php echo $key; ?>][tm]" id="<?php echo $key; ?>" class="<?php if ( $key != $test['theme'] ) echo 'mask ';?>template">
  69  <?php MP_AdminPage::select_option( $xtemplate, $xx ?? false );?>
  70                  </select>
  71  <?php
  72  }
  73  ?>
  74                  <br /><br />
  75  <?php
  76  $count = 0;
  77  $checks = array( 'forcelog' => __( 'Log it', 'MailPress' ), 'fakeit' => __( 'Send it', 'MailPress' ), 'archive' => __( 'Save it', 'MailPress' ), 'stats' => __( 'Include it in statistics', 'MailPress' ) );
  78  foreach( $checks as $k => $v ) {
  79      $count++;
  80      echo "\t\t\t\t" . '<input type="checkbox" name="test[' . $k . ']" id="' . $k . '"' . checked( isset( $test[$k] ), true, false ) . ' />' . "\n\t\t\t\t&#160;\n\t\t\t\t" . '<label for="' . $k . '">' . $v . '</label>' . "\n";
  81      if ( $count != count( $checks ) ) echo "\t\t\t\t<br />\n";
  82  }
  83  ?>
  84              </td>
  85          </tr>
  86  
  87      </table>
  88  
  89      <p class="submit">
  90          <input type="submit" name="Submit" class="button-primary" value="<?php  _e( 'Save', 'MailPress' ); ?>" />
  91          <input type="submit" name="Test"   class="button-primary" value="<?php  _e( 'Save &amp; Test', 'MailPress' ); ?>" />
  92      </p>
  93  
  94  </form>


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