public function get_events($client_id = null, $event_id = null)
 {
     if (!$client_id) {
         $client_id = $this->client_id;
     }
     if (!$event_id) {
         $event_id = null;
     }
     /**
      * Get Event List Setting Options
      *
      */
     $show_dates = get_option('_bpt_show_dates');
     $show_prices = get_option('_bpt_show_prices');
     $show_past_dates = get_option('_bpt_show_past_dates');
     $show_sold_out_dates = get_option('_bpt_show_sold_out_dates');
     $show_sold_out_prices = get_option('_bpt_show_sold_out_prices');
     $event_info = new \BrownPaperTickets\APIv2\EventInfo($this->dev_id);
     if ($event_id) {
         $client_id = null;
         $event_id = explode(' ', $event_id);
         $events = array();
         foreach ($event_id as $id) {
             $events[] = $event_info->getEvents($client_id, $id, $show_dates, $show_prices);
         }
         foreach ($events as $event) {
             $event_list[] = $event[0];
         }
     }
     if (!$event_id) {
         $event_list = $event_info->getEvents($client_id, $event_id, $show_dates, $show_prices);
     }
     if (isset($event_list['error'])) {
         $event_list;
     }
     $event_list = Utilities::remove_bad_events($event_list);
     $event_list = Utilities::sort_prices($event_list);
     if ($show_dates === 'true') {
         $remove_past = true;
         if ($show_past_dates === 'false') {
             $remove_past = false;
         }
         $event_list = Utilities::remove_bad_dates($event_list, true, $remove_past);
     }
     if ($show_prices === 'true' && $show_sold_out_prices === 'false') {
         $event_list = Utilities::remove_bad_prices($event_list);
     }
     return $event_list;
 }
 /**
  * Simple Get Account Call for testing that the settings are correct.
  * $dev_id and $client_id must be passed to the function.
  */
 public function test_account($dev_id, $client_id)
 {
     $account_info = new \BrownPaperTickets\APIv2\AccountInfo($dev_id);
     $event_list = new \BrownPaperTickets\APIv2\EventInfo($dev_id);
     $response = array('account' => $account_info->getAccount($client_id), 'events' => $event_list->getEvents($client_id));
     $response['events'] = Utilities::remove_bad_events($response['events']);
     return $response;
 }
      * @var BrownPaperTickets
      */
     $api = new BrownPaperTickets\APIv2\EventInfo(DEV_ID);
     /**
      * The getEvents method takes a few examples. The first and most important is the Client ID.
      * The second param is the event ID, it's optional.
      *
      * The third param would be whether or not you want to get the event's dates.
      * It's a boolean and by default its set to false.
      *
      * The fourth param is whether or not you want to get the prices for each of the event's dates.
      * It's a boolean and by default its set to fasle.
      *
      * Since we don't need the event's dates and prices, we'll just pass in the client.
      */
     $events = $api->getEvents($query['client']);
     /**
      * Now we'll render the template and pass some data along to it.
      *
      * The first argument in this is the $res object that is passed to this route..
      *
      * The second argument tells the view where to find the template we want
      * to render. (the base template/ dir is setup in index.php).
      *
      * The third argument is an associate array containing the data we want to pass.
      */
     return $this->view->render($res, 'orders/events.html', ['client' => $query['client'], 'events' => $events]);
 }
 /**
  * If both the client is passed, as well as some events, we can then get the orders for those events.
  * The events variable is an array containing Event IDs.
 /**
  * If there aren't any events in the events variable...
  */
 if (!$events) {
     // Load array of producer client logins.
     $producers = (require_once ROOT_DIR . '/config/producers.php');
     // Set the events variable to an empty array.
     $events = [];
     // Loop through each producer login and get their events.
     foreach ($producers as $producer) {
         /**
          * The getEvents method takes a producer client login, an event ID
          * (which is set to null because we don't want a single event)
          * and whether to get the dates (true) and prices (also true).
          */
         if ($results = $info->getEvents($producer, null, true, true)) {
             // The getEvents returns an array of events so merge the results
             // into the events array.
             $events = array_merge($events, $results);
         }
     }
 }
 // Let's grab each event's image.
 foreach ($events as &$event) {
     // The getImages method needs the event ID.
     // This will return an array of images. Each image has a 'large',
     // 'medium', 'small' field.
     $image = $info->getImages($event['id']);
     // If the getImages method returns a false value, generate a gravatar
     // to use a placeholder image.
     if (!$image || $image === '') {