本文整理汇总了PHP中l::data方法的典型用法代码示例。如果您正苦于以下问题:PHP l::data方法的具体用法?PHP l::data怎么用?PHP l::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类l
的用法示例。
在下文中一共展示了l::data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
public static function configure()
{
if (is_null(static::$site)) {
static::$site = kirby::panelsetup();
}
// load all available routes
static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'api.php');
static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'views.php');
// setup the blueprint root
blueprint::$root = c::get('root.site') . DS . 'blueprints';
// start the router
static::$router = new Router();
static::$router->register(static::$routes);
// content language switcher variable
if (static::$site->multilang()) {
if ($language = server::get('http_language') or $language = s::get('lang')) {
static::$site->visit('/', $language);
}
app::$language = static::$site->language()->code();
s::set('lang', app::$language);
}
// load the interface language file
if (static::$site->user()) {
$languageCode = static::$site->user()->language();
} else {
$languageCode = c::get('panel.language', 'en');
}
// validate the language code
if (!in_array($languageCode, static::languages()->keys())) {
$languageCode = 'en';
}
// store the interface language
app::$interfaceLanguage = $languageCode;
$language = (require root('panel.app.languages') . DS . $languageCode . '.php');
// set all language variables
l::$data = $language['data'];
// register router filters
static::$router->filter('auth', function () {
if (!app::$site->user()) {
go('panel/login');
}
});
// check for a completed installation
static::$router->filter('isInstalled', function () {
if (app::$site->users()->count() == 0) {
go('panel/install');
}
});
// only use the fragments of the path without params
static::$path = implode('/', (array) url::fragments(detect::path()));
}
示例2: localize
/**
* Load language files if available.
*/
protected function localize()
{
$finder = $this->finder();
$config = $this->config();
$base = 'en';
$root = $finder->languages();
$current = $this->site->multilang() ? $this->site->language() : $config->get('language', $base);
if (file_exists($root . DS . $base . '.php')) {
$localization = $finder->load($base, 'languages');
$localization = $localization['data'];
if ($current !== 'en' && file_exists($root . DS . $current . '.php')) {
$translation = $finder->load($current, 'languages');
$localization = array_merge($localization, $translation['data']);
}
l::$data = array_merge(l::$data, $localization);
}
}
示例3: i18n
public function i18n()
{
// load the interface language file
if ($user = $this->site()->user()) {
$this->language = $user->language();
} else {
$this->language = $this->kirby()->option('panel.language', 'en');
}
$translation = (require $this->roots()->languages() . DS . 'en.php');
$translation = array_merge($translation, require $this->roots()->languages() . DS . $this->language . '.php');
// set all language variables
l::$data = $translation['data'];
}
示例4: i18n
public function i18n()
{
// load the interface language file
if ($user = $this->site()->user()) {
$this->language = $user->language();
} else {
$this->language = $this->kirby()->option('panel.language', 'en');
}
$translation = (require $this->roots()->languages() . DS . 'en.php');
$translation = a::merge($translation, require $this->roots()->languages() . DS . $this->language . '.php');
// set all language variables
l::$data = $translation['data'];
// set language direction (ltr is default)
if (isset($translation['direction']) and $translation['direction'] == 'rtl') {
l::set('language.direction', 'rtl');
} else {
l::set('language.direction', 'ltr');
}
}
示例5: load
public function load()
{
return l::$data = data::read($this->root . DS . 'core.json');
}