本文整理汇总了PHP中CMS::env方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::env方法的具体用法?PHP CMS::env怎么用?PHP CMS::env使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::env方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_laravel_3
private static function load_laravel_3($lar_path)
{
// ----------- Grab The Database Config ----------------- //
// We grab the array for detecting if this is a local or production env.
// We assume the path.php file is one directory above the applications
// directory. If it is not you will have to configure the CMS by hand.
require $lar_path . '/../paths.php';
// The require above screws up the current working directory. So we fix.
chdir(self::$_root_path);
// Figure out what env we are in.
if (!(self::$env = self::detect_env($environments, $_SERVER['HTTP_HOST']))) {
self::$env = 'production';
}
// Grab the default configs.
$tmp = (require $lar_path . '/config/database.php');
$default = $tmp['default'];
$database = $tmp['connections'][$default];
// If we are in a local dev env we look for a local folder and merge.
$file = $lar_path . '/config/' . self::$env . '/database.php';
if (is_file($file)) {
$tmp = (require $file);
if (isset($tmp['connections'][$default])) {
$database = array_merge($database, $tmp['connections'][$default]);
}
}
// Set the database configs we sucked out of Laravel
CMS\Libraries\Config::set('db_host', $database['host']);
CMS\Libraries\Config::set('db_database', $database['database']);
CMS\Libraries\Config::set('db_username', $database['username']);
CMS\Libraries\Config::set('db_password', $database['password']);
}
示例2: run
/**
* Производит запуск веб-приложения
*
*/
public function run()
{
try {
if (!isset(self::$component_names['CMSStockroom'])) {
Core::load('CMS.Stockroom');
}
if (!isset(self::$component_names['CMSFSPages'])) {
Core::load('CMS.FSPages');
}
self::before_run(CMS::env());
// Если скрипт запущен из командной строки, то веб-приложение не запускается
//TODO: create cli_application
if (!isset($_SERVER['HTTP_HOST']) && !isset($_SERVER['REQUEST_URI'])) {
CMS::$is_cli = true;
Core::load('CMS.CLI');
CMS_CLI::run();
return;
}
if (self::$enable_rest) {
self::application()->dispatcher();
}
return WS::run(self::application()->cms_action());
} catch (Exception $e) {
self::root_catcher($e);
}
}
示例3: file
static function file($id)
{
if (!isset(CMS::env()->files)) {
return false;
}
if (!Core_Types::is_iterable(CMS::env()->files)) {
return false;
}
if (isset(CMS::env()->files[$id])) {
return CMS::env()->files[$id];
}
foreach (CMS::env()->files as $file) {
if ($file['alias'] == $id) {
return $file;
}
}
return false;
}
示例4: run
public function run(WS_Environment $env)
{
CMS::$env = $env;
CMS::$page = $env;
$env->cms = new stdClass();
Core::load('Templates.HTML');
$env->meta = Templates_HTML::meta();
$env->mappers = CMS::mappers();
$env->auth = new stdClass();
$env->auth->user = false;
CMS::$cfg = $env->config;
if ($env->db->default) {
CMS::$db = $env->db->default;
}
Templates_HTML::use_helper('fields', 'CMS.Fields.Helper');
Templates_HTML::use_helper('cms', 'CMS.Helper');
Templates::option('templates_root', array_merge(Templates::option('templates_root'), array(CMS::$views_path)));
return $this->application->run($env);
}