/**
  * Retrieve the posts based on query variables.
  *
  * @access public
  *
  * @return array List of posts.
  */
 public function get_posts()
 {
     // Set up query variables.
     $this->parse_query();
     // Restore `paged` if changed to `page` (in the case of index pagination).
     if (!empty($this->query_vars['page'])) {
         $this->query_vars['paged'] = $this->query_vars['page'];
         unset($this->query_vars['page']);
     }
     // Set any required parameters for the API request based on the query vars.
     $params = $this->set_api_params();
     // Determine which endpoint is needed. Do we want just a single event?
     if (!empty($this->query_vars['p'])) {
         $this->api_results = eventbrite()->get_event($this->query_vars['p']);
     } elseif (isset($this->query_vars['display_private']) && true === $this->query_vars['display_private']) {
         $this->api_results = eventbrite()->get_user_owned_events($params);
     } else {
         $this->api_results = eventbrite()->do_event_search($params);
     }
     // Do any post-API query processing.
     $this->post_api_filters();
     // Set properties based on the results.
     $this->set_properties();
     // Return what we have for posts.
     return $this->posts;
 }
Пример #2
0
 /**
  * Search Eventbrite public events by any user.
  * Note that not limiting the scope of the search somehow will likely result in timeout errors.
  *
  * @param  array $params Parameters for the event_search endpoint, to be passed during the API call.
  * @param  bool $force Force an API call, don't use cache.
  * @return object API results
  */
 function eventbrite_search($params = array(), $force = false)
 {
     return eventbrite()->do_event_search($params, $force);
 }