/**
  * @param array $args
  */
 function __construct($args = array())
 {
     // incoming args could be a mix of WP query args + EE shortcode args
     foreach ($args as $key => $value) {
         $property = '_' . $key;
         // if the arg is a property of this class, then it's an EE shortcode arg
         if (property_exists($this, $property)) {
             // set the property value
             $this->{$property} = $value;
             // then remove it from the array of args that will later be passed to WP_Query()
             unset($args[$key]);
         }
     }
     // parse orderby attribute
     if ($this->_order_by !== NULL) {
         $this->_order_by = explode(',', $this->_order_by);
         $this->_order_by = array_map('trim', $this->_order_by);
     }
     $this->_sort = in_array($this->_sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($this->_sort) : 'ASC';
     // setup the events list query
     EE_Registry::instance()->load_helper('Event_Query');
     //add query filters
     EEH_Event_Query::add_query_filters();
     // set params that will get used by the filters
     EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort);
     // the current "page" we are viewing
     $paged = max(1, get_query_var('paged'));
     // Force these args
     $args = array_merge($args, array('post_type' => 'espresso_events', 'posts_per_page' => $this->_limit, 'update_post_term_cache' => FALSE, 'update_post_meta_cache' => FALSE, 'paged' => $paged, 'offset' => ($paged - 1) * $this->_limit));
     // run the query
     parent::__construct($args);
 }
 /**
  *    run - initial module setup - this gets called by the EE_Front_Controller if the module route is found in the incoming request
  *
  * @access    public
  * @param WP $WP
  * @return    void
  */
 public function run($WP)
 {
     do_action('AHEE__EED_Events_Archive__before_run');
     // ensure valid EE_Events_Archive_Config() object exists
     $this->set_config();
     /** @type EE_Events_Archive_Config $config */
     $config = $this->config();
     // load other required components
     $this->load_event_list_assets();
     // filter the WP posts_join, posts_where, and posts_orderby SQL clauses
     EE_Registry::instance()->load_helper('Event_Query');
     //add query filters
     EEH_Event_Query::add_query_filters();
     // set params that will get used by the filters
     EEH_Event_Query::set_query_params('', '', $config->display_expired_events, 'start_date', 'ASC');
     // check what template is loaded
     add_filter('template_include', array($this, 'template_include'), 999, 1);
 }
 /**
  * EE_Event_List_Query Constructor	 *
  * sets up a WordPress query
  *
  * @param array $args
  * @return \EE_Event_List_Query
  */
 function __construct($args = array())
 {
     //		EEH_Debug_Tools::printr( $args, '$args  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
     // incoming args could be a mix of WP query args + EE shortcode args
     foreach ($args as $key => $value) {
         $property = '_' . $key;
         // if the arg is a property of this class, then it's an EE shortcode arg
         if (property_exists($this, $property)) {
             // set the property value
             $this->{$property} = $value;
             // then remove it from the array of args that will later be passed to WP_Query()
             unset($args[$key]);
         }
     }
     // setup the events list query
     EE_Registry::instance()->load_helper('Event_Query');
     //add query filters
     EEH_Event_Query::add_query_filters();
     // set params that will get used by the filters
     EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort);
     // first off, let's remove any filters from previous queries
     remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'));
     remove_all_filters('FHEE__content_espresso_events__event_class');
     // Event List Title ?
     add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1);
     // add the css class
     add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1);
     // the current "page" we are viewing
     $paged = max(1, get_query_var('paged'));
     // Force these args
     $args = array_merge($args, array('post_type' => 'espresso_events', 'posts_per_page' => $this->_limit, 'update_post_term_cache' => FALSE, 'update_post_meta_cache' => FALSE, 'paged' => $paged, 'offset' => ($paged - 1) * $this->_limit));
     // run the query
     parent::__construct($args);
 }