Exemplo n.º 1
0
 /**
  * @param array $record
  *
  * @return bool
  */
 public function match_existing_post(array $record)
 {
     $event = $this->get_event_from($record);
     if (empty($event)) {
         return false;
     }
     $ticket_name = $this->get_value_by_key($record, 'ticket_name');
     $cache_key = $ticket_name . '-' . $event->ID;
     if (isset(self::$ticket_name_cache[$cache_key])) {
         return self::$ticket_name_cache[$cache_key];
     }
     $ticket_post = get_page_by_title($ticket_name, OBJECT, $this->rsvp_tickets->ticket_object);
     if (empty($ticket_post)) {
         return false;
     }
     $ticket = $this->rsvp_tickets->get_ticket($event->ID, $ticket_post->ID);
     $match = $ticket->get_event() == $event ? true : false;
     self::$ticket_name_cache[$cache_key] = $match;
     return $match;
 }