angelovcom.net

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-wp-user-request.php (2196B)


      1 <?php
      2 /**
      3  * WP_User_Request class.
      4  *
      5  * Represents user request data loaded from a WP_Post object.
      6  *
      7  * @since 4.9.6
      8  */
      9 final class WP_User_Request {
     10 	/**
     11 	 * Request ID.
     12 	 *
     13 	 * @since 4.9.6
     14 	 * @var int
     15 	 */
     16 	public $ID = 0;
     17 
     18 	/**
     19 	 * User ID.
     20 	 *
     21 	 * @since 4.9.6
     22 	 * @var int
     23 	 */
     24 	public $user_id = 0;
     25 
     26 	/**
     27 	 * User email.
     28 	 *
     29 	 * @since 4.9.6
     30 	 * @var string
     31 	 */
     32 	public $email = '';
     33 
     34 	/**
     35 	 * Action name.
     36 	 *
     37 	 * @since 4.9.6
     38 	 * @var string
     39 	 */
     40 	public $action_name = '';
     41 
     42 	/**
     43 	 * Current status.
     44 	 *
     45 	 * @since 4.9.6
     46 	 * @var string
     47 	 */
     48 	public $status = '';
     49 
     50 	/**
     51 	 * Timestamp this request was created.
     52 	 *
     53 	 * @since 4.9.6
     54 	 * @var int|null
     55 	 */
     56 	public $created_timestamp = null;
     57 
     58 	/**
     59 	 * Timestamp this request was last modified.
     60 	 *
     61 	 * @since 4.9.6
     62 	 * @var int|null
     63 	 */
     64 	public $modified_timestamp = null;
     65 
     66 	/**
     67 	 * Timestamp this request was confirmed.
     68 	 *
     69 	 * @since 4.9.6
     70 	 * @var int|null
     71 	 */
     72 	public $confirmed_timestamp = null;
     73 
     74 	/**
     75 	 * Timestamp this request was completed.
     76 	 *
     77 	 * @since 4.9.6
     78 	 * @var int|null
     79 	 */
     80 	public $completed_timestamp = null;
     81 
     82 	/**
     83 	 * Misc data assigned to this request.
     84 	 *
     85 	 * @since 4.9.6
     86 	 * @var array
     87 	 */
     88 	public $request_data = array();
     89 
     90 	/**
     91 	 * Key used to confirm this request.
     92 	 *
     93 	 * @since 4.9.6
     94 	 * @var string
     95 	 */
     96 	public $confirm_key = '';
     97 
     98 	/**
     99 	 * Constructor.
    100 	 *
    101 	 * @since 4.9.6
    102 	 *
    103 	 * @param WP_Post|object $post Post object.
    104 	 */
    105 	public function __construct( $post ) {
    106 		$this->ID                  = $post->ID;
    107 		$this->user_id             = $post->post_author;
    108 		$this->email               = $post->post_title;
    109 		$this->action_name         = $post->post_name;
    110 		$this->status              = $post->post_status;
    111 		$this->created_timestamp   = strtotime( $post->post_date_gmt );
    112 		$this->modified_timestamp  = strtotime( $post->post_modified_gmt );
    113 		$this->confirmed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_confirmed_timestamp', true );
    114 		$this->completed_timestamp = (int) get_post_meta( $post->ID, '_wp_user_request_completed_timestamp', true );
    115 		$this->request_data        = json_decode( $post->post_content, true );
    116 		$this->confirm_key         = $post->post_password;
    117 	}
    118 }