[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> translation-row-preview.php (source)

   1  <?php
   2  /**
   3   * Template for the preview part of a single translation row in a translation set display
   4   *
   5   * @package    GlotPress
   6   * @subpackage Templates
   7   */
   8  
   9  $priority_char = array(
  10      '-2' => array( '&times;', 'transparent', '#ccc' ),
  11      '-1' => array( '&darr;', 'transparent', 'blue' ),
  12      '0'  => array( '', 'transparent', 'white' ),
  13      '1'  => array( '&uarr;', 'transparent', 'green' ),
  14  );
  15  
  16  ?>
  17  
  18  <tr class="preview <?php gp_translation_row_classes( $translation ); ?>" id="preview-<?php echo esc_attr( $translation->row_id ); ?>" row="<?php echo esc_attr( $translation->row_id ); ?>">
  19      <?php if ( $can_approve_translation ) : ?>
  20          <th scope="row" class="checkbox"><input type="checkbox" name="selected-row[]"/></th>
  21      <?php elseif ( $can_approve ) : ?>
  22          <th scope="row"></th>
  23      <?php endif; ?>
  24      <?php /* translators: %s: Priority of original */ ?>
  25      <td class="priority" title="<?php echo esc_attr( sprintf( __( 'Priority: %s', 'glotpress' ), gp_array_get( GP::$original->get_static( 'priorities' ), $translation->priority ) ) ); ?>">
  26          <?php echo $priority_char[ $translation->priority ][0]; // WPCS: XSS OK. ?>
  27      </td>
  28      <td class="original">
  29          <?php echo prepare_original( $translation_singular ); // WPCS: XSS OK. ?>
  30          <?php if ( $translation->context ) : ?>
  31              <?php /* translators: %s: Context of original */ ?>
  32              <span class="context bubble" title="<?php echo esc_attr( sprintf( __( 'Context: %s', 'glotpress' ), $translation->context ) ); ?>"><?php echo esc_html( $translation->context ); ?></span>
  33          <?php endif; ?>
  34      </td>
  35      <td class="translation foreign-text">
  36          <?php
  37          if ( $can_edit ) {
  38              $edit_text = __( 'Double-click to add', 'glotpress' );
  39          } elseif ( is_user_logged_in() ) {
  40              $edit_text = __( 'You are not allowed to add a translation.', 'glotpress' );
  41          } else {
  42              /* translators: %s: url */
  43              $edit_text = sprintf( __( 'You <a href="%s">have to log in</a> to add a translation.', 'glotpress' ), esc_url( wp_login_url( gp_url_current() ) ) ); // WPCS: XSS OK.
  44          }
  45  
  46          $missing_text = "<span class='missing'>$edit_text</span>"; // WPCS: XSS OK.
  47          if ( ! count( array_filter( $translation->translations, 'gp_is_not_null' ) ) ) :
  48              echo $missing_text; // WPCS: XSS OK.
  49          elseif ( ! $translation->plural ) :
  50              echo esc_translation( $translation->translations[0] ); // WPCS: XSS OK.
  51          else :
  52          ?>
  53              <ul>
  54                  <?php foreach ( $translation->translations as $translation ) : ?>
  55                      <li>
  56                      <?php echo gp_is_empty_string( $translation ) ? $missing_text : esc_translation( $translation ); // WPCS: XSS OK. ?>
  57                      </li>
  58                  <?php endforeach; ?>
  59              </ul>
  60          <?php endif; ?>
  61      </td>
  62      <td class="actions">
  63          <a href="#" row="<?php echo $translation->row_id; // WPCS: XSS OK. ?>" class="action edit"><?php _e( 'Details', 'glotpress' ); ?></a>
  64      </td>
  65  </tr>


Generated: Tue Mar 19 01:01:50 2019 Cross-referenced by PHPXref 0.7.1