[ 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  $gp_per_page = (int) get_user_option( 'gp_per_page' );
  14  if ( 0 === $gp_per_page ) {
  15      $gp_per_page = 15;
  16  }
  17  
  18  $gp_default_sort = get_user_option( 'gp_default_sort' );
  19  if ( ! is_array( $gp_default_sort ) ) {
  20      $gp_default_sort = array(
  21          'by'  => 'priority',
  22          'how' => 'desc',
  23      );
  24  }
  25  ?>
  26  
  27  <table class="form-table">
  28      <tr>
  29          <th><label for="per_page"><?php _e( 'Number of items per page:', 'glotpress' ); ?></label></th>
  30          <td><input type="number" id="per_page" name="per_page" value="<?php echo esc_attr( $gp_per_page ); ?>"/></td>
  31      </tr>
  32      <tr>
  33          <th><label for="default_sort[by]"><?php _e( 'Default Sort By:', 'glotpress' ); ?></label></th>
  34          <td>
  35              <?php
  36              $sort_bys = wp_list_pluck( gp_get_sort_by_fields(), 'title' );
  37  
  38              echo gp_radio_buttons( 'default_sort[by]', $sort_bys, gp_array_get( $gp_default_sort, 'by', 'priority' ) );
  39              ?>
  40          </td>
  41      </tr>
  42      <tr>
  43          <th><label for="default_sort[how]"><?php _e( 'Default Sort Order:', 'glotpress' ); ?></label></th>
  44          <td>
  45              <?php
  46              echo gp_radio_buttons(
  47                  'default_sort[how]',
  48                  array(
  49                      'asc'  => __( 'Ascending', 'glotpress' ),
  50                      'desc' => __( 'Descending', 'glotpress' ),
  51                  ),
  52                  gp_array_get( $gp_default_sort, 'how', 'desc' )
  53              );
  54              ?>
  55          </td>
  56      </tr>
  57  </table>


Generated: Tue Dec 3 01:01:05 2024 Cross-referenced by PHPXref 0.7.1