Пример #1
0
 /**
  * Execute main routine of an action
  *
  * @param $method The action to be executed
  * @param $args The arguments to pass to action
  * @return void
  */
 public function execute($method, $args = array())
 {
     $view_path = $this->view_path($method);
     if (!method_exists($this, $method) && !file_exists($view_path)) {
         dispatch_error(new Exception("Not found {$method} in " . $this->classname()), 404);
     }
     if (method_exists($this, $method)) {
         call_user_func_array(array($this, $method), $args);
     }
     if ($this->_render) {
         $this->render($method);
     }
     if ($this->_page_cache) {
         $data = ob_get_flush();
         $file = Ra_Cache::cache(Ra_Uri::get_querystring(), $data);
     }
 }
Пример #2
0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
//set some system definitios
define('RA_SYSTEM_CLASS_PREFIX', 'Ra_');
//load core exceptions
require_once RA_SYSTEM_CORE_PATH . '/core_exceptions.php';
//some simple usefull helpers functions
require_once RA_SYSTEM_CORE_PATH . '/core_helpers.php';
//autoloader for classes
include_once RA_SYSTEM_CORE_PATH . '/autoloader.php';
//load uri
$current_uri = Ra_Uri::get_querystring();
//load configuration basics
$conf = (include RA_CONFIG_PATH . '/config.php');
define('RA_BASE_URL', $conf->base_url);
define('RA_INDEX_PAGE', $conf->index_page);
//load router configuration
$router_conf = (require_once RA_CONFIG_PATH . '/router.php');
$ROUTER = new UserRouter();
//load slice routes
foreach (glob(RA_SLICES_PATH . "/*/config/router.php") as $router) {
    include_once $router;
}
try {
    $current_route = $ROUTER->match($current_uri);
} catch (Ra_RouterException $e) {
    dispatch_error($e, 404);