116 lines
1.5 KiB
PHP
116 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* Class WPDesk_Paczkomaty_Ajax_Request
|
|
*/
|
|
class WPDesk_Paczkomaty_Ajax_Request {
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @var string
|
|
*/
|
|
private $city;
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @var string
|
|
*/
|
|
private $code;
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @var string
|
|
*/
|
|
private $cod;
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @var string
|
|
*/
|
|
private $end_of_week_collection;
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @var array
|
|
*/
|
|
private $request;
|
|
|
|
/**
|
|
* Query arg is also defined in JS var
|
|
*
|
|
* @var string
|
|
*/
|
|
const NONCE_ARG = 'security';
|
|
|
|
/**
|
|
* WPDesk_WooCommerce_DHL_Ajax_Request constructor.
|
|
*
|
|
* @param array $request .
|
|
*/
|
|
public function __construct( $request ) {
|
|
$this->request = $request;
|
|
|
|
$this->city = $this->validate( 'city' );
|
|
$this->code = $this->validate( 'code' );
|
|
$this->cod = $this->validate( 'cod' );
|
|
|
|
$this->end_of_week_collection = $this->validate( 'end_of_week_collection' );
|
|
}
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @param string $name .
|
|
*
|
|
* @return string
|
|
*/
|
|
private function validate( $name ) {
|
|
if ( isset( $this->request[ $name ] ) ) {
|
|
return sanitize_text_field( wp_unslash( $this->request[ $name ] ) );
|
|
}
|
|
return '';
|
|
}
|
|
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_city() {
|
|
return $this->city;
|
|
}
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_code() {
|
|
return $this->code;
|
|
}
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_cod() {
|
|
return $this->cod;
|
|
}
|
|
|
|
/**
|
|
* .
|
|
*
|
|
* @return string
|
|
*/
|
|
public function get_end_of_week_collection() {
|
|
return $this->end_of_week_collection;
|
|
}
|
|
|
|
}
|