本文整理汇总了PHP中c::data方法的典型用法代码示例。如果您正苦于以下问题:PHP c::data方法的具体用法?PHP c::data怎么用?PHP c::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c
的用法示例。
在下文中一共展示了c::data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kirbyInstance
public function kirbyInstance($options = array())
{
c::$data = array();
$kirby = new Kirby($options);
$kirby->roots->content = TEST_ROOT_ETC . DS . 'content';
return $kirby;
}
示例2: configure
/**
* Sets all defaults and loads the user configuration
*
* @param array $config
*/
protected static function configure($config = array())
{
// start with a fresh configuration
c::$data = array();
// set some defaults
c::$data['root'] = dirname(__DIR__);
c::$data['root.kirby'] = __DIR__;
c::$data['root.content'] = c::$data['root'] . DS . 'content';
c::$data['root.site'] = c::$data['root'] . DS . 'site';
// the default timezone
c::$data['timezone'] = 'UTC';
// tinyurl handling
c::$data['tinyurl.enabled'] = true;
c::$data['tinyurl.folder'] = 'x';
// disable the cache by default
c::$data['cache'] = false;
c::$data['cache.driver'] = 'file';
c::$data['cache.options'] = array();
// set the default license code
c::$data['license'] = null;
// url rewriting
c::$data['rewrite'] = true;
// markdown defaults
c::$data['markdown'] = true;
c::$data['markdown.extra'] = false;
c::$data['markdown.breaks'] = true;
// pass the config vars from the constructor
// to be able to set all roots
c::$data = array_merge(c::$data, $config);
// set the subroots for site
c::$data['root.cache'] = c::$data['root.site'] . DS . 'cache';
c::$data['root.plugins'] = c::$data['root.site'] . DS . 'plugins';
c::$data['root.templates'] = c::$data['root.site'] . DS . 'templates';
c::$data['root.snippets'] = c::$data['root.site'] . DS . 'snippets';
c::$data['root.controllers'] = c::$data['root.site'] . DS . 'controllers';
c::$data['root.config'] = c::$data['root.site'] . DS . 'config';
c::$data['root.tags'] = c::$data['root.site'] . DS . 'tags';
c::$data['root.accounts'] = c::$data['root.site'] . DS . 'accounts';
// auto css and js setup
c::$data['auto.css.url'] = 'assets/css/templates';
c::$data['auto.css.root'] = c::$data['root'] . DS . 'assets' . DS . 'css' . DS . 'templates';
c::$data['auto.js.url'] = 'assets/js/templates';
c::$data['auto.js.root'] = c::$data['root'] . DS . 'assets' . DS . 'js' . DS . 'templates';
// load all available config files
$configs = array('main' => c::$data['root.config'] . DS . 'config.php', 'host' => c::$data['root.config'] . DS . 'config.' . server::get('HTTP_HOST') . '.php', 'addr' => c::$data['root.config'] . DS . 'config.' . server::get('SERVER_ADDR') . '.php');
foreach ($configs as $confile) {
if (file_exists($confile)) {
include_once $confile;
}
}
// pass the config vars from the constructor again to overwrite
// stuff from the user config
c::$data = array_merge(c::$data, $config);
// detect and store the url
static::url();
// default url handler
if (empty(c::$data['url.to'])) {
c::$data['url.to'] = function ($url = '') {
if (url::isAbsolute($url)) {
return $url;
}
$start = substr($url, 0, 1);
switch ($start) {
case '#':
return $url;
break;
case '.':
return page()->url() . '/' . $url;
break;
default:
// don't convert absolute urls
return url::makeAbsolute($url);
break;
}
};
}
// connect the url class with its handlers
url::$home = c::$data['url'];
url::$to = c::$data['url.to'];
// setup the thumbnail generator
thumb::$defaults['root'] = isset(c::$data['thumb.root']) ? c::$data['thumb.root'] : c::$data['root'] . DS . 'thumbs';
thumb::$defaults['url'] = isset(c::$data['thumb.url']) ? c::$data['thumb.url'] : 'thumbs';
thumb::$defaults['driver'] = isset(c::$data['thumb.driver']) ? c::$data['thumb.driver'] : 'gd';
thumb::$defaults['filename'] = isset(c::$data['thumb.filename']) ? c::$data['thumb.filename'] : '{safeName}-{hash}.{extension}';
// build absolute urls
c::$data['auto.css.url'] = url::makeAbsolute(c::$data['auto.css.url'], url::$home);
c::$data['auto.js.url'] = url::makeAbsolute(c::$data['auto.js.url'], url::$home);
thumb::$defaults['url'] = url::makeAbsolute(thumb::$defaults['url'], url::$home);
// cache setup
if (c::$data['cache']) {
if (c::$data['cache.driver'] == 'file' and empty(c::$data['cache.options'])) {
c::$data['cache.options'] = array('root' => c::get('root.cache'));
}
cache::setup(c::$data['cache.driver'], c::$data['cache.options']);
} else {
//.........这里部分代码省略.........