예제 #1
0
파일: gantry5.php 프로젝트: naka211/myloyal
 /**
  * Load Gantry framework before dispatching to the component.
  */
 private function onAfterRouteSite()
 {
     $template = $this->app->getTemplate(true);
     if (!file_exists(JPATH_THEMES . "/{$template->template}/gantry/theme.yaml")) {
         return;
     }
     $gantryPath = JPATH_THEMES . "/{$template->template}/includes/gantry.php";
     if (is_file($gantryPath)) {
         // Manually setup Gantry 5 Framework from the template.
         include_once $gantryPath;
     } else {
         // Setup Gantry 5 Framework or throw exception.
         Gantry5\Loader::setup();
         // Get Gantry instance.
         $gantry = Gantry\Framework\Gantry::instance();
         // Initialize the template.
         $gantry['theme.path'] = JPATH_THEMES . "/{$template->template}";
         $gantry['theme.name'] = $template->template;
         $themePath = $gantry['theme.path'] . '/includes/theme.php';
         include_once $themePath;
     }
     /** @var Gantry\Framework\Theme $theme */
     $theme = $gantry['theme'];
     /** @var \Gantry\Framework\Outlines $configurations */
     $configurations = $gantry['configurations'];
     $theme->setLayout($configurations->current());
     if (!$this->params->get('production', 0) || $this->params->get('asset_timestamps', 1)) {
         $age = (int) ($this->params->get('asset_timestamps_period', 7) * 86400);
         Gantry\Framework\Document::$timestamp_age = $age > 0 ? $age : PHP_INT_MAX;
     } else {
         Gantry\Framework\Document::$timestamp_age = 0;
     }
 }