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


Generated: Fri Nov 22 01:01:58 2019 Cross-referenced by PHPXref 0.7.1