/** * Run the main process * * @param string|null $page Optional. Fake a certain page. */ public function run($page = null) { if (empty($page) || !is_string($page)) { $page = Stencil_Environment::get_page(); } // Add to template. $this->set('page', $page); // Get actions that need to be run. $actions = self::$flow->get_page_actions($page); // Execute actions. if (is_array($actions) && array() !== $actions) { foreach ($actions as $action) { // Apply variables. Stencil_Handler_Factory::run_page_type_handler($action, $this); Stencil_Handler_Factory::run_page_type_hook($action, $this); } } // Get available views. $options = self::$flow->get_view_hierarchy($page); $view = self::$handler->get_usable_view($options); // Display the view. self::$handler->display($view); }