[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> locales.php (source)

   1  <?php
   2  gp_title( __( 'Locales &lt; GlotPress', 'glotpress' ) );
   3  
   4  gp_enqueue_scripts( array( 'gp-common', 'tablesorter' ) );
   5  gp_breadcrumb( array( __( 'Locales', 'glotpress' ) ) );
   6  gp_tmpl_header();
   7  ?>
   8  
   9      <h2><?php _e( 'Locales and Languages', 'glotpress' ); ?></h2>
  10      <div class="locales-filter">
  11          <label for="locales-filter"><?php _e( 'Filter:', 'glotpress' ); ?> <input id="locales-filter" type="text" placeholder="<?php esc_attr_e( 'search', 'glotpress' ); ?>" /> </label>
  12      </div>
  13  
  14      <table class="gp-table locales">
  15          <thead>
  16              <tr>
  17                  <th class="gp-column-english-name"><?php _e( 'Name (in English)', 'glotpress' ); ?></th>
  18                  <th class="gp-column-native-name"><?php _e( 'Native name', 'glotpress' ); ?></th>
  19                  <th class="gp-column-language-code"><?php _e( 'Language code', 'glotpress' ); ?></th>
  20              </tr>
  21          </thead>
  22          <tbody>
  23              <?php
  24              // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
  25              foreach ( $locales as $locale ) :
  26                  ?>
  27                  <tr>
  28                      <?php echo '<td>' . gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->english_name ) . '</td>'; ?>
  29                      <?php echo '<td>' . gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->native_name ) . '</td>'; ?>
  30                      <?php echo '<td>' . gp_link_get( gp_url_join( gp_url_current(), $locale->slug ), $locale->slug ) . '</td>'; ?>
  31                  </tr>
  32                  <?php
  33              endforeach;
  34              ?>
  35          </tbody>
  36      </table>
  37  
  38      <script type="text/javascript" charset="utf-8">
  39          jQuery(document).ready(function($) {
  40              $('.locales').tablesorter({
  41                  theme: 'glotpress',
  42                  sortList: [[0,0]],
  43                  headers: {
  44                      0: {
  45                          sorter: 'text'
  46                      }
  47                  }
  48              });
  49  
  50              $rows = $('.locales tbody').find('tr');
  51              $('#locales-filter').bind("change keyup input",function() {
  52                  var words = this.value.toLowerCase().split(' ');
  53  
  54                  if ( '' == this.value.trim() ) {
  55                      $rows.show();
  56                  } else {
  57                      $rows.hide();
  58                      $rows.filter(function (i, v) {
  59                          var $t = $(this);
  60                          for ( var d = 0; d < words.length; ++d ) {
  61                              if ( $t.text().toLowerCase().indexOf( words[d] )  != -1 ) {
  62                                  return true;
  63                              }
  64                          }
  65                          return false;
  66                      }).show();
  67                  }
  68              });
  69          });
  70      </script>
  71  
  72  <?php
  73  gp_tmpl_footer();


Generated: Sat Nov 23 01:01:06 2024 Cross-referenced by PHPXref 0.7.1