class-event-grouped.php
5 years ago
class-event-single.php
5 years ago
class-event.php
5 years ago
class-events-custom.php
5 years ago
class-events-edd.php
5 years ago
class-events-fdp.php
5 years ago
class-events-signal.php
5 years ago
class-events-woo.php
5 years ago
interface-events.php
5 years ago
class-event-single.php
60 lines
| 1 | <?php |
| 2 | namespace PixelYourSite; |
| 3 | class SingleEvent extends PYSEvent{ |
| 4 | |
| 5 | public $params = array( |
| 6 | ); |
| 7 | public $payload = array( |
| 8 | 'delay' => 0 |
| 9 | ); |
| 10 | |
| 11 | public function __construct($id,$type){ |
| 12 | parent::__construct($id,$type); |
| 13 | $this->payload['type'] = $type; |
| 14 | } |
| 15 | |
| 16 | |
| 17 | /** |
| 18 | * Insert Array params for event |
| 19 | * @param array $data |
| 20 | */ |
| 21 | function addParams($data) { |
| 22 | |
| 23 | if(is_array($data)) { |
| 24 | $this->params = array_merge($this->params,$data); |
| 25 | } else { |
| 26 | error_log("addParams no array ".print_r($data,true)); |
| 27 | } |
| 28 | |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Insert additional Array data for event |
| 33 | * @param array $data |
| 34 | */ |
| 35 | function addPayload($data) { |
| 36 | if(is_array($data)) { |
| 37 | $this->payload = array_merge($this->payload,$data); |
| 38 | } else { |
| 39 | error_log("addPayload no array ".print_r($data,true)); |
| 40 | } |
| 41 | |
| 42 | } |
| 43 | |
| 44 | function getData() { |
| 45 | $data = $this->payload; |
| 46 | $data['params'] = sanitizeParams($this->params); |
| 47 | |
| 48 | $data['delay'] = isset( $this->payload['delay'] ) ? $this->payload['delay'] : 0; |
| 49 | $data['ids'] = isset( $this->payload['ids'] ) ? $this->payload['ids'] : array(); |
| 50 | $data['hasTimeWindow'] = isset( $this->payload['hasTimeWindow'] ) ? $this->payload['hasTimeWindow'] : false; |
| 51 | $data['timeWindow'] = isset( $this->payload['timeWindow'] ) ? $this->payload['timeWindow'] : 0; |
| 52 | $data['pixelIds'] = isset( $this->payload['pixelIds'] ) ? $this->payload['pixelIds'] : array(); |
| 53 | $data['eventID'] = isset( $this->payload['eventID'] ) ? $this->payload['eventID'] : ""; |
| 54 | $data['woo_order'] = isset( $this->payload['woo_order'] ) ? $this->payload['woo_order'] : ""; |
| 55 | $data['edd_order'] = isset( $this->payload['edd_order'] ) ? $this->payload['edd_order'] : ""; |
| 56 | |
| 57 | return $data; |
| 58 | } |
| 59 | } |
| 60 |