[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/routes/ -> original.php (source)

   1  <?php
   2  /**
   3   * Routes: GP_Route_Original class
   4   *
   5   * @package GlotPress
   6   * @subpackage Routes
   7   * @since 1.0.0
   8   */
   9  
  10  /**
  11   * Core class used to implement the original route.
  12   *
  13   * @since 1.0.0
  14   */
  15  class GP_Route_Original extends GP_Route_Main {
  16  
  17  	public function set_priority( $original_id ) {
  18          $original = GP::$original->get( $original_id );
  19  
  20          if ( ! $original ) {
  21              return $this->die_with_404();
  22          }
  23  
  24          if ( ! $this->verify_nonce( 'set-priority_' . $original_id ) ) {
  25              return $this->die_with_error( __( 'An error has occurred. Please try again.', 'glotpress' ), 403 );
  26          }
  27  
  28          $project = GP::$project->get( $original->project_id );
  29  
  30          if ( ! $project ) {
  31              return $this->die_with_404();
  32          }
  33  
  34          $this->can_or_forbidden( 'write', 'project', $project->id );
  35          $original->priority = gp_post( 'priority' );
  36  
  37          if ( ! $original->validate() ) {
  38              return $this->die_with_error( 'Invalid priority value!' );
  39          }
  40  
  41          if ( ! $original->save() ) {
  42              return $this->die_with_error( 'Error in saving original!' );
  43          }
  44      }
  45  
  46  }


Generated: Tue Sep 22 01:01:55 2020 Cross-referenced by PHPXref 0.7.1