public static function get_instance() { if (!self::$instance) { self::$instance = new EPL_router(); } return self::$instance; }
/** * Depending on the uri parameters, this function determines which controller to load. * * @since 1.0.0 * @param none * @return Only when called from the front end, returns short code process result. */ function _route($resource = null) { epl_log("init", "<pre>" . print_r($resource, true) . "</pre>"); if (self::$routed) { return; } epl_log("init", "<pre>" . print_r($resource, true) . "</pre>"); global $valid_controllers, $post; //When the shortcode is processed, the page id is ready if (!array_key_exists($resource, $valid_controllers)) { return false; } $epl = EPL_Base::get_instance(); $controller_location = $valid_controllers[$resource]['location']; $controller = $epl->load_controller($controller_location); self::$routed = true; if (!EPL_IS_ADMIN && !isset($_REQUEST['epl_action'])) { return $controller->run(); //doing this for the shortcode } }
function shortcode_route($args = array()) { return EPL_router::get_instance()->shortcode_route($args); }