示例#1
0
 function base_url($path = null)
 {
     if (is_null($path)) {
         if (BASE_DIR == '/') {
             return request_scheme() . http_host();
         } else {
             return request_scheme() . http_host() . BASE_DIR;
         }
     } else {
         if (BASE_DIR == '/') {
             return request_scheme() . http_host() . '/' . $path;
         } else {
             return request_scheme() . http_host() . BASE_DIR . '/' . $path;
         }
     }
 }
示例#2
0
Sitemap: http://<?php 
echo http_host();
?>
/sitemap.txt
示例#3
0
<form action="<?php 
print h($router->login_url());
?>
" method="POST" role="form">
    <input type="hidden" name="_csrf" value="<?php 
echo csrf_token();
?>
">

    <h1><?php 
print http_host() . ': ' . t('User login');
?>
</h1>

    <div class="form-group">
        <label for="login-form-email"><?php 
print t('email');
?>
</label>
        <input id="login-form-email" class="form-control" type="email" name="email" required>
        <label for="login-form-password"><?php 
print t('Password');
?>
</label>
        <div class="input-group">
            <input id="login-form-password" class="form-control" type="password" name="cleartext" required>
            <span class="input-group-btn">
                <button type="submit" class="btn btn-primary">
                    <?php 
print t('Login');
?>
$env = strtolower(getenv('ENV'));
$apiVersion = 'v1';
$apiHost = 'https://api.phpreactboilerplate.com';
// Perhaps S3 or CDN url:
$assetsUrl = '';
$assetsPath = $assetsUrl;
$assets = json_decode(file_get_contents('../asset-manifest.json'), true);
switch ($env) {
    case 'stage':
        $apiHost = 'https://stage-api.phpreactboilerplate.com';
        break;
    case 'dev':
        $apiHost = 'http://dev-api.phpreactboilerplate.com';
        $assets = array_combine(array_keys($assets), array_keys($assets));
        $assetsPath = '/build';
        break;
}
$container = new Slim\Container(['settings' => ['env' => $env, 'base_path' => realpath(__DIR__ . '/../'), 'app.name' => 'PHP React Boilerplate', 'app.description' => 'A boilerplate for PHP-React JS web apps.', 'app.keywords' => 'php,reactjs,web apps', 'api.version' => $apiVersion, 'api.host' => $apiHost, 'api.base' => $apiHost . '/' . $apiVersion . '/', 'api.key' => '', 'app.urls.assets' => $assetsUrl, 'app.paths.js' => $assetsPath . '/js', 'app.paths.css' => $assetsPath . '/css', 'app.assets' => $assets, 'ga.tracking_id' => '']]);
/***** Service Definitions *****/
$container['view'] = function ($c) {
    $view = new \Slim\Views\Twig($c['settings']['base_path'] . '/resources/templates');
    $view->addExtension(new \Slim\Views\TwigExtension($c['router'], $c['request']->getUri()));
    return $view;
};
$container['api_client'] = function ($c) {
    return new GuzzleHttp\Client(['base_uri' => $c['settings']['api.base'], 'http_errors' => false, 'headers' => ['Api-Key' => $c['settings']['api.key']]]);
};
$container['ga'] = function ($c) {
    return new Core\Analytics\Google($c['settings']['ga.tracking_id'], http_host());
};
return $container;
示例#5
0
/**
 * Getting base url of application
 * @return string
 */
function base_url()
{
    return request_scheme() . http_host() . BASE_DIR;
}
示例#6
0
<?php

is_need_cache(true);
$links = array();
foreach (explode("\n", `cd data; find * -type f -name '[0-9]*'`) as $v) {
    $links[] = $v;
}
foreach (explode("\n", `cd data; find * -type d`) as $v) {
    $links[] = $v;
}
$links = array_unique($links);
echo implode("\n", map(function ($v) {
    return "http://" . http_host() . '/' . $v;
}, $links));
示例#7
0
require_once 'vendor/autoload.php';
ob_start();
require_once 'lib/prj/cache.php';
include 'base.php';
include 'boot/spyc.php';
#библиотека для парсинга конфигов
include 'boot/bu_core.php';
include 'boot/bu_cache.php';
include 'boot/bu.php';
#магический класс который управляет всем-всем
include 'boot/bu_route.php';
include 'boot/bu_loader.php';
include 'boot/bu_url.php';
include 'boot/bu_statistic.php';
include 'boot/bu_logger.php';
bu::timer('init', 'system');
bu::hook(['preload', 'blank']);
BuLoader::setHttpString(RAW_HTTP_STRING);
bu::timer('Aplication start.', 'system');
BuLoader::doIt();
bu::timer('Aplication end.', 'system');
bu::hook(['postload', 'blank']);
$content = ob_get_contents();
ob_end_clean();
if (http_host() == 'local.bubujka.org:3000') {
    is_need_cache(false);
}
if (is_need_cache()) {
    cache_it(query_path(), $content);
}
echo $content;