Пример #1
0
define('CP_SITE_DIR', CP_ROOT_DIR . '/site');
define('CP_BASE_URL', $CP_BASE_URL);
define('CP_BASE_ROUTE', CP_BASE_URL);
define('CP_CURRENT_ROUTE', $CP_ROUTE);
// allow cockpit to autoload from cocopi modules
$app->retrieve('autoload')->append(CP_SITE_DIR . '/modules');
// include helper functions
include __DIR__ . '/functions.php';
/**
 * create Lime\App
 */
$site = new Lime\App(array_replace_recursive(['debug' => $app['debug'], 'offline' => false, 'app.name' => 'copilot', 'site.title' => 'Copilot', 'base_url' => CP_BASE_URL, 'base_route' => CP_BASE_ROUTE, 'docs_root' => CP_DOCS_ROOT, 'route' => CP_CURRENT_ROUTE, 'session.name' => $app['session.name'], 'sec-key' => $app['sec-key'], 'helpers' => ["acl" => "Lime\\Helper\\SimpleAcl", "assets" => "Lime\\Helper\\Assets", "fs" => "Lime\\Helper\\Filesystem", "image" => "Lime\\Helper\\Image", "i18n" => "Lime\\Helper\\I18n", "utils" => "Lime\\Helper\\Utils", "coockie" => "Lime\\Helper\\Cookie", "yaml" => "Lime\\Helper\\YAML", "markdown" => "Lime\\Helper\\Markdown"]], $CP_CONFIG));
// cache config for later access
$site["site.config"] = $CP_CONFIG;
// init static site helper
copi::init($site);
/**
 * register path namespaces
 */
# base
$site->path('site', CP_ROOT_DIR);
$site->path('docroot', CP_DOCS_ROOT);
$site->path('tmp', CP_TMP_DIR);
$site->path('content', CP_CONTENT_DIR);
$site->path('theme', CP_SITE_DIR . '/theme');
# menu
$site->path('menu', CP_SITE_DIR . '/menu');
# assets
$site->path('assets', __DIR__ . '/assets');
$site->path('assets', CP_SITE_DIR . '/assets');
# modules
Пример #2
0
define('CP_BASE_ROUTE', $CP_BASE_ROUTE);
define('CP_CURRENT_ROUTE', $CP_ROUTE);
define('CP_TMP_DIR', $CP_ROOT_DIR . '/storage/tmp');
$CP_CONFIG = Spyc::YAMLLoad($CP_ROOT_DIR . '/site/config/config.yaml');
// include helper functions
include __DIR__ . '/functions.php';
/**
 * create Lime\App
 */
$copilot = new Lime\App(array_replace_recursive(include $CP_ROOT_DIR . '/system/config/config.php', $CP_CONFIG));
// set default timezone
date_default_timezone_set($copilot['timezone']);
// cache config for later access
$copilot["site.config"] = $CP_CONFIG;
// init static copilot helper
copi::init($copilot);
/**
 * register path namespaces
 */
# base
$copilot->path('site', CP_ROOT_DIR);
$copilot->path('docroot', CP_DOCS_ROOT);
$copilot->path('storage', CP_ROOT_DIR . '/storage');
$copilot->path('tmp', CP_TMP_DIR);
$copilot->path('content', CP_ROOT_DIR . '/content');
$copilot->path('uploads', CP_ROOT_DIR . '/storage/uploads');
$copilot->path('theme', CP_ROOT_DIR . '/site/theme');
# config
$copilot->path('config', CP_ROOT_DIR . '/system/config');
$copilot->path('config', CP_ROOT_DIR . '/site/config');
# assets