[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Template for the meta section of the editor row in a translation set display
   4   *
   5   * @package    GlotPress
   6   * @subpackage Templates
   7   */
   8  
   9  $more_links = array();
  10  if ( $translation->translation_status ) {
  11      $translation_permalink = gp_url_project_locale(
  12          $project,
  13          $locale->slug,
  14          $translation_set->slug,
  15          array(
  16              'filters[status]'         => 'either',
  17              'filters[original_id]'    => $translation->original_id,
  18              'filters[translation_id]' => $translation->id,
  19          )
  20      );
  21  
  22      $more_links['translation-permalink'] = '<a tabindex="-1" href="' . esc_url( $translation_permalink ) . '">' . __( 'Permalink to this translation', 'glotpress' ) . '</a>';
  23  } else {
  24      $original_permalink = gp_url_project_locale( $project, $locale->slug, $translation_set->slug, array( 'filters[original_id]' => $translation->original_id ) );
  25  
  26      $more_links['original-permalink'] = '<a tabindex="-1" href="' . esc_url( $original_permalink ) . '">' . __( 'Permalink to this original', 'glotpress' ) . '</a>';
  27  }
  28  
  29  $original_history = gp_url_project_locale(
  30      $project,
  31      $locale->slug,
  32      $translation_set->slug,
  33      array(
  34          'filters[status]'      => 'either',
  35          'filters[original_id]' => $translation->original_id,
  36          'sort[by]'             => 'translation_date_added',
  37          'sort[how]'            => 'asc',
  38      )
  39  );
  40  
  41  $more_links['history'] = '<a tabindex="-1" href="' . esc_url( $original_history ) . '">' . __( 'All translations of this original', 'glotpress' ) . '</a>';
  42  
  43  /**
  44   * Allows to modify the more links in the translation editor.
  45   *
  46   * @since 2.3.0
  47   *
  48   * @param array $more_links The links to be output.
  49   * @param GP_Project $project Project object.
  50   * @param GP_Locale $locale Locale object.
  51   * @param GP_Translation_Set $translation_set Translation Set object.
  52   * @param GP_Translation $translation Translation object.
  53   */
  54  $more_links = apply_filters( 'gp_translation_row_template_more_links', $more_links, $project, $locale, $translation_set, $translation );
  55  
  56  ?>
  57  <div class="meta">
  58      <h3><?php _e( 'Meta', 'glotpress' ); ?></h3>
  59  
  60      <?php gp_tmpl_load( 'translation-row-editor-meta-status', get_defined_vars() ); ?>
  61  
  62      <?php if ( $translation->context ) : ?>
  63          <dl>
  64              <dt><?php _e( 'Context:', 'glotpress' ); ?></dt>
  65              <dd><?php echo esc_translation( $translation->context ); ?></dd>
  66          </dl>
  67      <?php endif; ?>
  68      <?php if ( $translation->extracted_comments ) : ?>
  69          <dl>
  70              <dt><?php _e( 'Comment:', 'glotpress' ); ?></dt>
  71              <dd>
  72                  <?php
  73                  /**
  74                   * Filters the extracted comments of an original.
  75                   *
  76                   * @param string         $extracted_comments Extracted comments of an original.
  77                   * @param GP_Translation $translation        Translation object.
  78                   */
  79                  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  80                  echo apply_filters( 'gp_original_extracted_comments', $translation->extracted_comments, $translation );
  81                  ?>
  82              </dd>
  83          </dl>
  84      <?php endif; ?>
  85      <?php if ( $translation->translation_added && '0000-00-00 00:00:00' !== $translation->translation_added ) : ?>
  86          <dl>
  87              <dt><?php _e( 'Date added (GMT):', 'glotpress' ); ?></dt>
  88              <dd id="gmt-date-added-<?php echo esc_attr( $translation->row_id ); ?>"><?php echo esc_html( $translation->translation_added ); ?></dd>
  89          </dl>
  90          <dl>
  91              <dt><?php _e( 'Date added (local):', 'glotpress' ); ?></dt>
  92              <dd id="local-date-added-<?php echo esc_attr( $translation->row_id ); ?>"><?php _e( 'Calculating...', 'glotpress' ); ?></dd>
  93          </dl>
  94      <?php endif; ?>
  95      <?php if ( $translation->user ) : ?>
  96          <dl>
  97              <dt><?php _e( 'Translated by:', 'glotpress' ); ?></dt>
  98              <dd><?php gp_link_user( $translation->user ); ?></dd>
  99          </dl>
 100      <?php endif; ?>
 101      <?php if ( $translation->user_last_modified && ( ! $translation->user || $translation->user->ID !== $translation->user_last_modified->ID ) ) : ?>
 102          <dl>
 103              <dt>
 104              <?php
 105              if ( 'current' === $translation->translation_status ) {
 106                  _e( 'Approved by:', 'glotpress' );
 107              } elseif ( 'rejected' === $translation->translation_status ) {
 108                  _e( 'Rejected by:', 'glotpress' );
 109              } else {
 110                  _e( 'Last updated by:', 'glotpress' );
 111              }
 112              ?>
 113              </dt>
 114              <dd><?php gp_link_user( $translation->user_last_modified ); ?></dd>
 115          </dl>
 116      <?php endif; ?>
 117      <?php references( $project, $translation ); ?>
 118  
 119      <dl>
 120          <dt><?php _e( 'Priority:', 'glotpress' ); ?></dt>
 121          <?php if ( $can_write ) : ?>
 122              <dd>
 123                  <?php
 124                  echo gp_select(
 125                      'priority-' . $translation->original_id,
 126                      GP::$original->get_static( 'priorities' ),
 127                      $translation->priority,
 128                      array(
 129                          'class'      => 'priority',
 130                          'tabindex'   => '-1',
 131                          'data-nonce' => wp_create_nonce( 'set-priority_' . $translation->original_id ),
 132                      )
 133                  );
 134                  ?>
 135              </dd>
 136          <?php else : ?>
 137              <dd>
 138                  <?php
 139                  echo esc_html(
 140                      gp_array_get(
 141                          GP::$original->get_static( 'priorities' ),
 142                          $translation->priority,
 143                          _x( 'Unknown', 'priority', 'glotpress' )
 144                      )
 145                  );
 146                  ?>
 147              </dd>
 148          <?php endif; ?>
 149      </dl>
 150  
 151      <dl>
 152          <dt><?php _e( 'More links:', 'glotpress' ); ?>
 153              <ul>
 154                  <?php foreach ( $more_links as $more_link ) : ?>
 155                      <li>
 156                          <?php
 157                          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
 158                          echo $more_link;
 159                          ?>
 160                      </li>
 161                  <?php endforeach; ?>
 162              </ul>
 163          </dt>
 164      </dl>
 165  </div>


Generated: Sun Jun 26 01:01:05 2022 Cross-referenced by PHPXref 0.7.1