function route($args = null) { //if ( self::$routed ) // return; //ajax also ends up in admin if (!defined('EPL_TIME')) { define("EPL_TIME", strtotime(current_time('mysql'))); define('EPL_DATE', strtotime('00:00:00', EPL_TIME)); } if (!defined('EPL_IS_ADMIN')) { define('EPL_IS_ADMIN', is_admin()); } if (EPL_IS_ADMIN) { //is_admin is true for ajax requests if (isset($_REQUEST['epl_action']) && epl_get_element('epl_controller', $_REQUEST) == 'epl_front' && $GLOBALS['epl_ajax']) { $resource = 'epl_front'; return $this->_route($resource); die; } $post_type = ''; $trashing = strpos('trash', epl_get_element('action', $_GET)) !== false; if (isset($_GET['post']) && ($_GET['action'] == 'edit' || $trashing)) { if ($trashing && is_array($_GET['post'])) { $post_ID = current($_GET['post']); } else { $post_ID = $_GET['post']; } $post_type = get_post_type(intval($post_ID)); } else { $post_type = isset($_REQUEST['post_type']) ? $_REQUEST['post_type'] : ''; } $resource = $post_type; if ('epl_event' == $post_type && isset($_REQUEST['page']) || strpos(epl_get_element('page', $_REQUEST, ''), 'epl_') !== false) { $resource = $_REQUEST['page']; } if (isset($_REQUEST['epl_controller'])) { $resource = $_REQUEST['epl_controller']; } return $this->_route($resource); } elseif (!isset($_REQUEST['epl_action'])) { if ('single_template' == current_filter()) { epl_is_single('set'); $resource = 'epl_front'; return $this->_route($resource, array('epl_action' => 'single_default_template', 'template' => $args)); } } $epl_action = epl_get_element('epl_action', $_REQUEST); //something new to play with if (!EPL_IS_ADMIN && ('the_content' == current_filter() || current_filter() == '')) { $resource = 'epl_front'; return $this->_route($resource); } elseif ($epl_action == 'ical' || $epl_action == 'invoice' || $epl_action == 'custom_pdf' || $epl_action == 'custom_html') { $resource = 'epl_front'; $this->_route($resource); exit; } }
function refresh_data($clear_session = false) { if (epl_is_single()) { return; } //if ( !$this->on_admin || (epl_is_waitlist_record() && epl_is_valid_waitlist_hash()) ) if (!$this->on_admin) { $_SESSION['__epl'] = !$clear_session && is_array($_SESSION['__epl']) ? $_SESSION['__epl'] : array(); $_SESSION['__epl'] = array_merge((array) $_SESSION['__epl'], (array) $this->current_data); } }