public function do_execute()
 {
     // get the event html
     $instance = false;
     if (isset($_REQUEST['instance_id'])) {
         $instance = (int) $_REQUEST['instance_id'];
     }
     $event = $this->_registry->get('model.event', get_the_ID(), $instance);
     $event_page = null;
     $footer_html = '';
     if (is_single()) {
         $event_page = $this->_registry->get('view.event.single');
         $footer_html = $event_page->get_footer($event);
     } else {
         // return nothing for now
         return array('data' => '', 'is_event' => true);
     }
     $css = $this->_registry->get('css.frontend')->add_link_to_html_for_frontend();
     $js = $this->_registry->get('controller.javascript')->load_frontend_js(false);
     if ('html' !== $this->_request_type) {
         return array('data' => array('html' => $event_page->get_full_article($event)), 'callback' => Ai1ec_Request_Parser::get_param('callback', null));
     }
     $to_return = array('data' => $event_page->get_content($event), 'is_event' => true);
     if (!empty($footer_html)) {
         $to_return['footer'] = $event_page->get_footer($event);
     }
     return $to_return;
 }
Exemplo n.º 2
0
 public function do_execute()
 {
     // get the calendar html
     $calendar = $this->_registry->get('view.calendar.page');
     $css = $this->_registry->get('css.frontend')->add_link_to_html_for_frontend();
     $js = $this->_registry->get('controller.javascript')->load_frontend_js(true);
     return array('data' => $calendar->get_content($this->_request), 'callback' => Ai1ec_Request_Parser::get_param('callback', null), 'caller' => 'calendar');
 }
Exemplo n.º 3
0
 /**
  * Gets parameters from the request object.
  * 
  * @return array|boolean
  */
 public function get_parameters()
 {
     $plugin = $controller = $action = null;
     $plugin = Ai1ec_Request_Parser::get_param('plugin', $plugin);
     $controller = Ai1ec_Request_Parser::get_param('controller', $controller);
     $action = Ai1ec_Request_Parser::get_param('action', $action);
     if ((string) AI1EC_PLUGIN_NAME === (string) $plugin && null !== $controller && null !== $action) {
         return array('controller' => $controller, 'action' => $action);
     }
     return false;
 }
Exemplo n.º 4
0
 public function is_this_to_execute()
 {
     $params = $this->get_parameters();
     if (false === $params) {
         return false;
     }
     if ($params['action'] === self::EXPORT_METHOD && $params['controller'] === self::EXPORT_CONTROLLER) {
         $params['tag_ids'] = Ai1ec_Request_Parser::get_param('ai1ec_tag_ids', false);
         $params['cat_ids'] = Ai1ec_Request_Parser::get_param('ai1ec_cat_ids', false);
         $params['post_ids'] = Ai1ec_Request_Parser::get_param('ai1ec_post_ids', false);
         $params['lang'] = Ai1ec_Request_Parser::get_param('lang', false);
         $params['no_html'] = (bool) Ai1ec_Request_Parser::get_param('no_html', false);
         $this->_params = $params;
         return true;
     }
     return false;
 }
Exemplo n.º 5
0
 public function do_execute()
 {
     // If not on the single event page, return nothing.
     if (!is_single()) {
         return array('data' => '', 'is_event' => true);
     }
     // Else proceed with rendering valid event. Fetch all relevant details.
     $instance = false;
     if (isset($_REQUEST['instance_id'])) {
         $instance = (int) $_REQUEST['instance_id'];
     }
     $event = $this->_registry->get('model.event', get_the_ID(), $instance);
     $event_page = $this->_registry->get('view.event.single');
     $footer_html = $event_page->get_footer($event);
     $css = $this->_registry->get('css.frontend')->add_link_to_html_for_frontend();
     $js = $this->_registry->get('controller.javascript')->load_frontend_js(false);
     // If requesting event by JSON (remotely), return fully rendered event.
     if ('html' !== $this->_request_type) {
         return array('data' => array('html' => $event_page->get_full_article($event, $footer_html)), 'callback' => Ai1ec_Request_Parser::get_param('callback', null));
     }
     // Else return event details as components.
     return array('data' => $event_page->get_content($event), 'is_event' => true, 'footer' => $footer_html);
 }