示例#1
0
 private function _process()
 {
     // Let dispatcher populate request with the node and other information used
     $request = $this->dispatcher->get_request();
     $request->add_component_to_chain($this->component->get('midgardmvc_core'));
     // TODO: We give it to context to emulate legacy functionality
     $this->context->create($request);
     // Load the head helper
     $this->head = new midgardmvc_core_helpers_head();
     // Check authentication
     $this->authentication->check_session();
     // Disable cache for now
     $request->set_data_item('cache_enabled', false);
     $this->log('Midgard MVC', 'Serving ' . $request->get_method() . ' ' . $request->get_path() . ' at ' . gmdate('r'), 'info');
     // Let injectors do their work
     $this->component->inject($request, 'process');
     try {
         $this->dispatcher->dispatch($request);
     } catch (midgardmvc_exception_unauthorized $exception) {
         // Pass the exception to authentication handler
         $this->authentication->handle_exception($exception);
     }
     $this->dispatcher->header('Content-Type: ' . $request->get_data_item('mimetype'));
     return $request;
 }
示例#2
0
 private function _process()
 {
     $this->context->create();
     date_default_timezone_set($this->configuration->get('default_timezone'));
     $this->dispatcher->get_midgard_connection()->set_loglevel($this->configuration->get('log_level'));
     // Let dispatcher populate request with the page and other information used
     $request = $this->dispatcher->get_request();
     $request->populate_context();
     if (isset($this->context->page->guid)) {
         // Load per-folder configuration
         $this->configuration->load_instance($this->context->component, $this->context->page);
     }
     $this->log('Midgard MVC', "Serving " . $request->get_method() . " {$this->context->uri} at " . gmdate('r'), 'info');
     // Let injectors do their work
     $this->componentloader = new midgardmvc_core_component_loader();
     $this->componentloader->inject_process();
     // Load the cache service and check for content cache
     self::$instance->context->cache_enabled = false;
     /*
     if (self::$instance->context->cache_enabled)
     {
         $request->generate_identifier();
         $this->cache->register_object($this->context->page);
         $this->cache->content->check($this->context->cache_request_identifier);
     }
     */
     // Show the world this is Midgard
     $this->head->add_meta(array('name' => 'generator', 'content' => "Midgard/" . mgd_version() . " MidgardMVC/{$this->componentloader->manifests['midgardmvc_core']['version']} PHP/" . phpversion()));
     if ($this->configuration->enable_attachment_cache) {
         $classname = $this->configuration->attachment_handler;
         $handler = new $classname();
         $handler->connect_to_signals();
     }
     // Then initialize the component, so it also goes to template stack
     $this->dispatcher->initialize($request);
     try {
         $this->dispatcher->dispatch();
     } catch (midgardmvc_exception_unauthorized $exception) {
         // Pass the exception to authentication handler
         $this->authentication->handle_exception($exception);
     }
     $this->dispatcher->header('Content-Type: ' . $this->context->mimetype);
 }