[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> settings-edit.php (source)

   1  <?php
   2  /**
   3   * The user settings block
   4   *
   5   * A single table that contains all of the user settings, which is included as part of gp-templates/settings.php.
   6   *
   7   * @link http://glotpress.org
   8   *
   9   * @package GlotPress
  10   * @since 2.0.0
  11   */
  12  
  13  $per_page = (int) get_user_option( 'gp_per_page' );
  14  if ( 0 === $per_page ) {
  15      $per_page = 15;
  16  }
  17  
  18  $default_sort = get_user_option( 'gp_default_sort' );
  19  if ( ! is_array( $default_sort ) ) {
  20      $default_sort = array(
  21          'by'  => 'priority',
  22          'how' => 'desc',
  23      );
  24  }
  25  ?>
  26      <table class="form-table">
  27          <tr>
  28              <th><label for="per_page"><?php _e( 'Number of items per page:', 'glotpress' ); ?></label></th>
  29              <td><input type="number" id="per_page" name="per_page" value="<?php echo $per_page; // WPCS: xss ok. ?>"/></td>
  30          </tr>
  31          <tr>
  32              <th><label for="default_sort[by]"><?php _e( 'Default Sort By:', 'glotpress' ) ?></label></th>
  33              <td><?php
  34                  $sort_bys = wp_list_pluck( gp_get_sort_by_fields(), 'title' );
  35  
  36                  echo gp_radio_buttons( 'default_sort[by]', $sort_bys, gp_array_get( $default_sort, 'by', 'priority' ) );
  37              ?></td>
  38          </tr>
  39          <tr>
  40              <th><label for="default_sort[how]"><?php _e( 'Default Sort Order:', 'glotpress' ) ?></label></th>
  41              <td><?php
  42                  echo gp_radio_buttons(
  43                      'default_sort[how]',
  44                      array(
  45                          'asc' => __( 'Ascending', 'glotpress' ),
  46                          'desc' => __( 'Descending', 'glotpress' ),
  47                      ),
  48                      gp_array_get( $default_sort, 'how', 'desc' )
  49                  );
  50              ?></td>
  51          </tr>
  52      </table>
  53  


Generated: Mon Oct 14 01:01:57 2019 Cross-referenced by PHPXref 0.7.1