/**
  * Creates the output of the RSS feed.
  * 
  * @param boolean $comment ( ignored )
  */
 public function create_feed_output($comment)
 {
     global $ai1ec_calendar_helper, $ai1ec_view_helper, $ai1ec_events_helper, $ai1ec_settings;
     $number_of_posts = Ai1ec_Meta::get_option('posts_per_rss');
     // Get the request parser
     $request = new Ai1ec_Arguments_Parser(NULL, 'ai1ec_' . $ai1ec_settings->default_calendar_view);
     $request->parse();
     // Create the filter
     $filter = array('cat_ids' => $request->get('cat_ids'), 'tag_ids' => $request->get('tag_ids'), 'post_ids' => $request->get('post_ids'));
     $event_results = $ai1ec_calendar_helper->get_events_relative_to($ai1ec_events_helper->gmt_to_local(Ai1ec_Time_Utility::current_time()), $number_of_posts, 0, $filter, 0);
     require_once AI1EC_VIEW_PATH . '/event-feed-rss2.php';
 }
 /**
  * get_cache_key method
  *
  * Check if given request needs to be cached, and if yes - return the cache
  * key to use with it
  *
  * @param Ai1ec_Abstract_Query $request Request to check
  *
  * @return string|bool Cache key, if request is cacheable, or false
  */
 public function get_cache_key(Ai1ec_Abstract_Query $request)
 {
     if (!AI1EC_CACHE) {
         return false;
     }
     $curr_page = Ai1ec_Arguments_Parser::get_current_page();
     if ($curr_page < 1) {
         return false;
     }
     $user = wp_get_current_user();
     if (0 !== (int) $user->ID) {
         return false;
     }
     $post = get_post($curr_page);
     if (!empty($post->post_password)) {
         return false;
         // do not cache password protected posts
     }
     $excluders = array('page_offset', 'month_offset', 'oneday_offset', 'week_offset', 'time_limit', 'post_ids', 'auth_ids');
     foreach ($excluders as $key) {
         if (false !== ($value = $request->get($key)) && !empty($value)) {
             return false;
         }
     }
     $this_month = date('Y-m');
     // mind the dashes to avoid int comparison
     if (false !== ($exact = $request->get('exact_date'))) {
         if ((string) (int) $exact !== (string) $exact) {
             $exact = strtotime($exact);
         }
         if ($this_month !== date('Y-m', $exact)) {
             return false;
         }
     }
     // check terms
     $terms = array();
     foreach (array('cat_ids', 'tag_ids', 'term_ids') as $name) {
         $local = $request->get($name);
         foreach ($local as $tid) {
             $tid = (int) $tid;
             if ($tid > 0) {
                 $terms[$tid] = $tid;
             }
         }
     }
     if (count($terms) > 0) {
         global $ai1ec_settings;
         $default_terms = $ai1ec_settings->get_default_terms();
         $diff_terms = array_diff($default_terms, $terms);
         if (!empty($diff_terms)) {
             return false;
         }
         unset($diff_terms, $default_terms);
     }
     // generate hash
     $options = array('action' => $request->get('action'), 'type' => $request->get('request_type'), 'today' => $this_month, 'terms' => implode('|', $terms));
     return 'ai1ec-response/' . implode('/', $options);
 }
 /**
  * set_current_page method
  *
  * Set ID of currently open page
  *
  * @param int $page_id ID of page currently open
  *
  * @return void Method does not return
  */
 public static function set_current_page($page_id)
 {
     self::$current_page = $page_id;
 }
 /**
  * @param array $arguments
  * @return Ai1ec_Arguments_Parser
  */
 public static function create_argument_parser_instance(array $arguments = NULL)
 {
     $request = new Ai1ec_Arguments_Parser($arguments, self::$ai1ec_settings->default_calendar_view);
     $request->parse();
     return $request;
 }
 /**
  * is_calendar_page method
  *
  * Check if current page matches calendar page, as selected by user, or
  * it's one of page relatives
  *
  * @return int|bool Matching calendar page ID, or false if this is not a
  *                  calendar page
  */
 public function is_calendar_page()
 {
     global $ai1ec_settings, $ai1ec_localization_helper;
     if (empty($ai1ec_settings->calendar_page_id)) {
         return false;
     }
     $page_ids_to_match = array($ai1ec_settings->calendar_page_id) + $ai1ec_localization_helper->get_translations_of_page($ai1ec_settings->calendar_page_id);
     foreach ($page_ids_to_match as $page_id) {
         if (is_page($page_id)) {
             Ai1ec_Arguments_Parser::set_current_page($page_id);
             return $page_id;
         }
     }
     return false;
 }