/**
  * 视图路径配置
  *
  * @param array $options
  * @return \Ku\Layout
  */
 public function initView(array $options = NULL)
 {
     parent::initView($options);
     $view = $this->getView();
     if (!empty($this->layout)) {
         $config = \Bootstrap::getConfig();
         $prePath = $config->get('application.directory');
         if ($this->layoutFollowModule and 'Index' !== $this->getModuleName()) {
             $prePath .= 'modules' . DS . $this->getModuleName() . DS;
         }
         $view->setLayoutPath($prePath . 'views' . DS . 'layouts');
         $view->setLayout($this->layout);
     }
     return $view;
 }
Ejemplo n.º 2
0
<?php

$_SERVER['backend_start'] = microtime(true);
include __DIR__ . '/backend/include/all.php';
autoload([__DIR__ . '/classes', __DIR__ . '/controllers']);
$config = json_config(__DIR__ . '/config/application.json');
$bootstrap = new Bootstrap($config);
$root = $bootstrap->getRoot();
$uri = $_SERVER['REQUEST_URI'];
if ($pos = strpos($uri, '?')) {
    $uri = substr($uri, 0, $pos);
}
$uri = substr($uri, strlen($root));
$q = urldecode(trim(str_replace(['-', '/', "'"], ' ', $uri)));
$google_part = '';
$description = $q ? str_replace('{q}', $q, $bootstrap->getConfig('page.description')) : $bootstrap->getConfig('page.description0');
if (isset($_GET['_google']) || isset($_SERVER['HTTP_USER_AGENT']) && strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'google')) {
    if ($q) {
        $google_part = '<h1>' . $q . '</h1>' . "\n";
        $template = new templateController();
        $template->init();
        $holidays = new holidaysController(0, ['q' => $q]);
        $holidays->init();
        $tmpl = $template->get(false);
        $tmpl = preg_replace('~\\[if:[^\\]]+\\]~', '', $tmpl);
        $tmpl = preg_replace('~\\[endif:[^\\]]+\\]~', '', $tmpl);
        $tmpl = preg_replace('~\\[loop:[^\\]]+\\]~', '', $tmpl);
        $tmpl = preg_replace('~\\[endloop:[^\\]]+\\]~', '', $tmpl);
        $tmpl = str_replace('style="display:none"', '', $tmpl);
        $result = $holidays->get(10);
        foreach ($result['data'] as $rec) {
Ejemplo n.º 3
0
        echo $js;
    } else {
        include __DIR__ . '/html.php';
    }
    die;
}
foreach (['facebook', 'google', 'twitterbot', 'pinterest', 'msnbot'] as $agent) {
    if (isset($_SERVER['HTTP_USER_AGENT']) && strstr(strtolower($_SERVER['HTTP_USER_AGENT']), $agent)) {
        include __DIR__ . '/html.php';
        die;
    }
}
include __DIR__ . '/rest/library/backend/include/all.php';
if ($pass) {
    simple_pass($pass);
}
autoload([__DIR__ . '/rest/class', __DIR__ . '/rest/models', __DIR__ . '/rest/controllers']);
$config = json_config(__DIR__ . '/rest/config/application.json');
$bootstrap = new Bootstrap($config);
$geo = Tools::geoip();
$locale = 'i18n/angular-locale_' . $bootstrap->lang . '-' . strtolower($geo['location']['country']) . '.js';
if (isset($_SERVER['SERVER_SOFTWARE']) && strstr(strtolower($_SERVER['SERVER_SOFTWARE']), 'engine') && substr($_SERVER['REQUEST_URI'], 0, 6) != '/test/') {
    $html = file_get_contents(__DIR__ . '/index.html');
    $html = str_replace('facebook.net/en_US/sdk.js', 'facebook.net/' . $bootstrap->lang . '_' . strtoupper($geo['location']['country']) . '/sdk.js', $html);
    $html = str_replace('bower_components/angular-i18n/angular-locale_en-us.js', $locale, $html);
    $html = str_replace('<title>epapu</title>', '<title>' . Tools::translate('page-title') . '</title>', $html);
    $html = str_replace('AIzaSyB7iQMqTOfotqClUkAgVp6_w46-f0F7VEc', $bootstrap->getConfig('maps.api_key'), $html);
    die($html);
} else {
    include __DIR__ . '/test.php';
}