[ 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 ( property_exists( $translation, 'root_translation_set_id' ) ) : ?>
  63      <dl>
  64          <dt><?php _e( 'Root Translation:', 'glotpress' ); ?></dt>
  65      <?php if ( $translation->translation_set_id === $translation->root_translation_set_id ) : ?>
  66          <dd>
  67  <?php
  68              gp_link(
  69                  gp_url_project_locale(
  70                      $project,
  71                      $root_locale->slug,
  72                      $root_translation_set->slug,
  73                      array(
  74                          'filters[status]'         => 'either',
  75                          'filters[original_id]'    => $translation->original_id,
  76                          'filters[translation_id]' => $translation->id,
  77                      )
  78                  ),
  79                  $root_translation_set->name_with_locale()
  80              );
  81  ?>
  82          </dd>
  83      <?php else : ?>
  84          <dd><?php _e( 'False', 'glotpress' ); ?></dd>
  85      <?php endif; ?>
  86      </dl>
  87      <?php endif; ?>
  88      <?php if ( $translation->context ) : ?>
  89          <dl>
  90              <dt><?php _e( 'Context:', 'glotpress' ); ?></dt>
  91              <dd><span class="context bubble"><?php echo esc_translation( $translation->context ); ?></span></dd>
  92          </dl>
  93      <?php endif; ?>
  94      <?php if ( $translation->extracted_comments ) : ?>
  95          <dl>
  96              <dt><?php _e( 'Comment:', 'glotpress' ); ?></dt>
  97              <dd>
  98                  <?php
  99                  /**
 100                   * Filters the extracted comments of an original.
 101                   *
 102                   * @param string         $extracted_comments Extracted comments of an original.
 103                   * @param GP_Translation $translation        Translation object.
 104                   */
 105                  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
 106                  echo apply_filters( 'gp_original_extracted_comments', $translation->extracted_comments, $translation );
 107                  ?>
 108              </dd>
 109          </dl>
 110      <?php endif; ?>
 111      <?php if ( $translation->translation_added && '0000-00-00 00:00:00' !== $translation->translation_added ) : ?>
 112          <dl>
 113              <dt><?php _e( 'Date added (GMT):', 'glotpress' ); ?></dt>
 114              <dd id="gmt-date-added-<?php echo esc_attr( $translation->row_id ); ?>"><?php echo esc_html( $translation->translation_added ); ?></dd>
 115          </dl>
 116          <dl>
 117              <dt><?php _e( 'Date added (local):', 'glotpress' ); ?></dt>
 118              <dd id="local-date-added-<?php echo esc_attr( $translation->row_id ); ?>"><?php _e( 'Calculating...', 'glotpress' ); ?></dd>
 119          </dl>
 120      <?php endif; ?>
 121      <?php if ( $translation->user ) : ?>
 122          <dl>
 123              <dt><?php _e( 'Translated by:', 'glotpress' ); ?></dt>
 124              <dd><?php gp_link_user( $translation->user ); ?></dd>
 125          </dl>
 126      <?php endif; ?>
 127      <?php if ( $translation->user_last_modified && ( ! $translation->user || $translation->user->ID !== $translation->user_last_modified->ID ) ) : ?>
 128          <dl>
 129              <dt>
 130              <?php
 131              if ( 'current' === $translation->translation_status ) {
 132                  _e( 'Approved by:', 'glotpress' );
 133              } elseif ( 'rejected' === $translation->translation_status ) {
 134                  _e( 'Rejected by:', 'glotpress' );
 135              } else {
 136                  _e( 'Last updated by:', 'glotpress' );
 137              }
 138              ?>
 139              </dt>
 140              <dd><?php gp_link_user( $translation->user_last_modified ); ?></dd>
 141          </dl>
 142      <?php endif; ?>
 143      <?php references( $project, $translation ); ?>
 144  
 145      <dl>
 146          <dt><?php _e( 'Priority:', 'glotpress' ); ?></dt>
 147          <?php if ( $can_write ) : ?>
 148              <dd>
 149                  <?php
 150                  echo gp_select(
 151                      'priority-' . $translation->original_id,
 152                      GP::$original->get_static( 'priorities' ),
 153                      $translation->priority,
 154                      array(
 155                          'class'      => 'priority',
 156                          'tabindex'   => '-1',
 157                          'data-nonce' => wp_create_nonce( 'set-priority_' . $translation->original_id ),
 158                      )
 159                  );
 160                  ?>
 161              </dd>
 162          <?php else : ?>
 163              <dd>
 164                  <?php
 165                  echo esc_html(
 166                      gp_array_get(
 167                          GP::$original->get_static( 'priorities' ),
 168                          $translation->priority,
 169                          _x( 'Unknown', 'priority', 'glotpress' )
 170                      )
 171                  );
 172                  ?>
 173              </dd>
 174          <?php endif; ?>
 175      </dl>
 176  
 177      <dl>
 178          <dt><?php _e( 'More links:', 'glotpress' ); ?>
 179              <ul>
 180                  <?php foreach ( $more_links as $more_link ) : ?>
 181                      <li>
 182                          <?php
 183                          // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
 184                          echo $more_link;
 185                          ?>
 186                      </li>
 187                  <?php endforeach; ?>
 188              </ul>
 189          </dt>
 190      </dl>
 191  </div>


Generated: Mon Jul 6 01:01:46 2020 Cross-referenced by PHPXref 0.7.1