[ 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, $locale->slug, $translation_set->slug, array(
  31          'filters[status]'      => 'either',
  32          'filters[original_id]' => $translation->original_id,
  33          'sort[by]'             => 'translation_date_added',
  34          'sort[how]'            => 'asc',
  35      )
  36  );
  37  
  38  $more_links['history'] = '<a tabindex="-1" href="' . esc_url( $original_history ) . '">' . __( 'All translations of this original', 'glotpress' ) . '</a>';
  39  
  40  /**
  41   * Allows to modify the more links in the translation editor.
  42   *
  43   * @since 2.3.0
  44   *
  45   * @param array $more_links The links to be output.
  46   * @param GP_Project $project Project object.
  47   * @param GP_Locale $locale Locale object.
  48   * @param GP_Translation_Set $translation_set Translation Set object.
  49   * @param GP_Translation $translation Translation object.
  50   */
  51  $more_links = apply_filters( 'gp_translation_row_template_more_links', $more_links, $project, $locale, $translation_set, $translation );
  52  
  53  ?>
  54  <div class="meta">
  55      <h3><?php _e( 'Meta', 'glotpress' ); ?></h3>
  56  
  57      <?php gp_tmpl_load( 'translation-row-editor-meta-status', get_defined_vars() ); ?>
  58  
  59      <?php if ( property_exists( $translation, 'root_translation_set_id' ) ) : ?>
  60      <dl>
  61          <dt><?php _e( 'Root Translation:', 'glotpress' ); // phpcs:ignore WordPress.Security.EscapeOutput. ?></dt>
  62      <?php if ( $translation->translation_set_id === $translation->root_translation_set_id ) : ?>
  63          <dd>
  64  <?php
  65              gp_link(
  66                  gp_url_project_locale(
  67                      $project,
  68                      $root_locale->slug,
  69                      $root_translation_set->slug,
  70                      array(
  71                          'filters[status]'         => 'either',
  72                          'filters[original_id]'    => $translation->original_id,
  73                          'filters[translation_id]' => $translation->id,
  74                      )
  75                  ),
  76                  $root_translation_set->name_with_locale()
  77              );
  78  ?>
  79          </dd>
  80      <?php else : ?>
  81          <dd><?php _e( 'False', 'glotpress' ); // phpcs:ignore WordPress.Security.EscapeOutput. ?></dd>
  82      <?php endif; ?>
  83      </dl>
  84      <?php endif; ?>
  85      <?php if ( $translation->context ) : ?>
  86          <dl>
  87              <dt><?php _e( 'Context:', 'glotpress' ); ?></dt>
  88              <dd><span class="context bubble"><?php echo esc_translation( $translation->context ); // WPCS: XSS OK. ?></span></dd>
  89          </dl>
  90      <?php endif; ?>
  91      <?php if ( $translation->extracted_comments ) : ?>
  92          <dl>
  93              <dt><?php _e( 'Comment:', 'glotpress' ); ?></dt>
  94              <dd><?php echo make_clickable( nl2br( esc_translation( $translation->extracted_comments ) ) ); // WPCS: XSS OK. ?></dd>
  95          </dl>
  96      <?php endif; ?>
  97      <?php if ( $translation->translation_added && '0000-00-00 00:00:00' !== $translation->translation_added ) : ?>
  98          <dl>
  99              <dt><?php _e( 'Date added (GMT):', 'glotpress' ); ?></dt>
 100              <dd id="gmt-date-added-<?php echo esc_attr( $translation->row_id ); ?>"><?php echo esc_html( $translation->translation_added ); ?></dd>
 101          </dl>
 102          <dl>
 103              <dt><?php _e( 'Date added (local):', 'glotpress' ); ?></dt>
 104              <dd id="local-date-added-<?php echo esc_attr( $translation->row_id ); ?>"><?php _e( 'Calculating...', 'glotpress' ); ?></dd>
 105          </dl>
 106      <?php endif; ?>
 107      <?php if ( $translation->user ) : ?>
 108          <dl>
 109              <dt><?php _e( 'Translated by:', 'glotpress' ); ?></dt>
 110              <dd><?php gp_link_user( $translation->user ); ?></dd>
 111          </dl>
 112      <?php endif; ?>
 113      <?php if ( $translation->user_last_modified && ( ! $translation->user || $translation->user->ID !== $translation->user_last_modified->ID ) ) : ?>
 114          <dl>
 115              <dt>
 116              <?php
 117              if ( 'current' === $translation->translation_status ) {
 118                  _e( 'Approved by:', 'glotpress' );
 119              } elseif ( 'rejected' === $translation->translation_status ) {
 120                  _e( 'Rejected by:', 'glotpress' );
 121              } else {
 122                  _e( 'Last updated by:', 'glotpress' );
 123              }
 124              ?>
 125              </dt>
 126              <dd><?php gp_link_user( $translation->user_last_modified ); ?></dd>
 127          </dl>
 128      <?php endif; ?>
 129      <?php references( $project, $translation ); ?>
 130  
 131      <dl>
 132          <dt><?php _e( 'Priority:', 'glotpress' ); ?></dt>
 133          <?php if ( $can_write ) : ?>
 134              <dd>
 135                  <?php
 136                  echo gp_select(
 137                      'priority-' . $translation->original_id,
 138                      GP::$original->get_static( 'priorities' ),
 139                      $translation->priority,
 140                      array(
 141                          'class'      => 'priority',
 142                          'tabindex'   => '-1',
 143                          'data-nonce' => wp_create_nonce( 'set-priority_' . $translation->original_id ),
 144                      )
 145                  );
 146                  ?>
 147              </dd>
 148          <?php else : ?>
 149              <dd><?php echo gp_array_get( GP::$original->get_static( 'priorities' ), $translation->priority, 'unknown' ); // WPCS: XSS ok. ?></dd>
 150          <?php endif; ?>
 151      </dl>
 152  
 153      <dl>
 154          <dt><?php _e( 'More links:', 'glotpress' ); ?>
 155              <ul>
 156                  <?php foreach ( $more_links as $link ) : ?>
 157                      <li><?php echo $link; // WPCS: XSS ok. ?></li>
 158                  <?php endforeach; ?>
 159              </ul>
 160          </dt>
 161      </dl>
 162  </div>


Generated: Thu Mar 21 01:01:48 2019 Cross-referenced by PHPXref 0.7.1