[ 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
  27          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  28          echo $priority_char[ $translation->priority ][0];
  29          ?>
  30      </td>
  31      <td class="original">
  32          <span class="original-text"><?php echo prepare_original( $translation_singular ); ?></span>
  33          <?php if ( $translation->context ) : ?>
  34              <?php /* translators: %s: Context of original */ ?>
  35              <span class="context bubble" title="<?php echo esc_attr( sprintf( __( 'Context: %s', 'glotpress' ), $translation->context ) ); ?>"><?php echo esc_html( $translation->context ); ?></span>
  36          <?php endif; ?>
  37      </td>
  38      <td class="translation foreign-text">
  39          <?php
  40          if ( $can_edit ) {
  41              $edit_text = __( 'Double-click to add', 'glotpress' );
  42          } elseif ( is_user_logged_in() ) {
  43              $edit_text = __( 'You are not allowed to add a translation.', 'glotpress' );
  44          } else {
  45              /* translators: %s: url */
  46              $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() ) ) );
  47          }
  48  
  49          $missing_text = "<span class='missing'>$edit_text</span>";
  50          if ( ! count( array_filter( $translation->translations, 'gp_is_not_null' ) ) ) :
  51              // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  52              echo $missing_text;
  53          elseif ( ! $translation->plural ) :
  54              echo '<span class="translation-text">' . esc_translation( $translation->translations[0] ) . '</span>';
  55          else :
  56          ?>
  57              <ul>
  58                  <?php foreach ( $translation->translations as $current_translation ) : ?>
  59                      <li>
  60                      <?php
  61                      // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  62                      echo gp_is_empty_string( $current_translation ) ? $missing_text : '<span class="translation-text">' . esc_translation( $current_translation ) . '</span>';
  63                      ?>
  64                      </li>
  65                  <?php endforeach; ?>
  66              </ul>
  67          <?php endif; ?>
  68      </td>
  69      <td class="actions">
  70          <a href="#" class="action edit"><?php _e( 'Details', 'glotpress' ); ?></a>
  71      </td>
  72  </tr>


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