本文整理汇总了PHP中c::set方法的典型用法代码示例。如果您正苦于以下问题:PHP c::set方法的具体用法?PHP c::set怎么用?PHP c::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c
的用法示例。
在下文中一共展示了c::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
s::start();
c::set('home.keepurl', true);
// auto-detect the url if it is not set
if (!c::get('url')) {
c::set('url', c::get('scheme') . server::get('http_host'));
}
// setup the thumb plugin
c::set('thumb.cache.root', c::get('root') . '/thumbs');
c::set('thumb.cache.url', c::get('url') . '/thumbs');
c::set('url', c::get('url') . '/' . c::get('panel.folder'));
// remove the panel folder name from the uri
c::set('subfolder', ltrim(c::get('subfolder') . '/' . c::get('panel.folder'), '/'));
// attach the uri after caching
$this->uri = new paneluri();
if (c::get('lang.support')) {
$path = $this->uri->path->toArray();
$first = array_shift($path);
if (!in_array($first, c::get('lang.available', array()))) {
$first = c::get('lang.default');
}
// set the current language
c::set('lang.current', $first);
$this->uri->path = new uriPath($path);
}
// get the first set of pages
$this->rootPages();
// get the additional site info from content/site.txt
$this->siteInfo();
}
示例2: lib
static function lib()
{
$root = c::get('root.kirby');
$rootPanel = c::get('root.panel');
require_once $root . '/defaults.php';
c::set('root.snippets', $rootPanel . '/snippets');
require_once $root . '/lib/cache.php';
require_once $root . '/lib/obj.php';
require_once $root . '/lib/pagination.php';
require_once $root . '/lib/files.php';
require_once $root . '/lib/variables.php';
require_once $root . '/lib/pages.php';
require_once $root . '/lib/site.php';
require_once $root . '/lib/uri.php';
require_once $root . '/lib/helpers.php';
require_once $root . '/lib/template.php';
// load panel stuff
require_once $rootPanel . '/lib/uri.php';
require_once $rootPanel . '/lib/data.php';
require_once $rootPanel . '/lib/check.php';
require_once $rootPanel . '/lib/actions.php';
require_once $rootPanel . '/lib/user.php';
require_once $rootPanel . '/lib/helpers.php';
require_once $rootPanel . '/lib/settings.php';
require_once $rootPanel . '/lib/thumb.php';
require_once $rootPanel . '/lib/form.php';
require_once $rootPanel . '/lib/panel.php';
require_once $rootPanel . '/lib/upload.php';
}
示例3: ct
function ct($n, $m)
{
$ct = c::get($n, $m);
if (!is_null($ct)) {
return $ct;
}
if ($n === $m) {
$ct = 0.0;
} elseif ($n === 1 && $m === 0) {
$ct = 2.0;
} elseif ($m === 0) {
$ct = (1 + ct($n - 1, 0)) * 2;
} else {
for ($i = $m + 1; $i != $n; ++$i) {
$ct0 = c::get($n, $i);
if (!is_null($ct0)) {
break;
}
}
for ($i -= 1; $i != $m; --$i) {
$ct1 = 1 + $ct0 / 2 + ct($n, 0) / 2;
c::set($n, $i, $ct1);
$ct0 = $ct1;
}
$ct = 1 + ct($n, $m + 1) / 2 + ct($n, 0) / 2;
}
c::set($n, $m, $ct);
return $ct;
}
示例4: testSet
public function testSet()
{
c::set('anothervar', 'anothervalue');
c::set('testvar', 'overwrittenvalue');
$this->assertEquals('anothervalue', c::get('anothervar'));
$this->assertEquals('overwrittenvalue', c::get('testvar'));
c::set(array('var1' => 'value1', 'var2' => 'value2'));
$this->assertEquals('value1', c::get('var1'));
$this->assertEquals('value2', c::get('var2'));
}
示例5: config
static function config()
{
parent::config();
// load the default panel config file
self::file(c::get('root.panel') . '/defaults/config/config.php');
$root = c::get('root.site') . '/' . c::get('panel.folder') . '/config';
self::file($root . '/config.php');
self::file($root . '/config.' . server::get('server_name') . '.php');
if (c::get('panel.rewrite') === false) {
c::set('rewrite', false);
}
}
示例6: __construct
function __construct()
{
// auto-detect the url if it is not set
if (!c::get('url')) {
c::set('url', c::get('scheme') . server::get('http_host'));
}
// check if the cache is enabled at all
$this->cacheEnabled = c::get('cache') && (c::get('cache.html') || c::get('cache.data')) ? true : false;
if ($this->cacheEnabled) {
$this->dataCacheEnabled = c::get('cache.data');
$this->htmlCacheEnabled = c::get('cache.html');
if (c::get('cache.autoupdate')) {
$this->modified = dir::modified(c::get('root.content'));
} else {
$this->modified = 0;
}
}
$cacheID = 'site.php';
$cacheModified = time();
$cacheData = null;
// data cache
if ($this->dataCacheEnabled) {
// find the latest modifed date from all content subdirs
// if the cache is enabled and autoupdate is activated.
// otherwise the last modified date will be false so the cache
// will stay valid forever
// check when the data cache has been modified
$cacheModified = cache::modified($cacheID);
// check if the cache is still valid
if ($cacheModified >= $this->modified) {
$cacheData = cache::get($cacheID);
}
}
if (empty($cacheData)) {
// get the first set of pages
$this->rootPages();
// get the additional site info from content/site.txt
$this->siteInfo();
if ($this->dataCacheEnabled) {
cache::set($cacheID, $this->_);
}
} else {
$this->_ = $cacheData;
}
// attach the uri after caching
// this will definitely be variable :)
$this->uri = new uri();
}
示例7:
<?php
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
c::set('license', 'put your license key here');
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
c::set('timezone', 'America/Montreal');
c::set('disqus_username', 'USERNAME');
示例8:
<?php
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
c::set('license', 'put your license key here');
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
c::set('home', 'cover');
示例9:
with loads of information about your setup.
It's there to help you out when things don't work
as expected. Set it to true to activate it and
go to your homepage afterwards to display it on refresh.
*/
c::set('troubleshoot', false);
/*
---------------------------------------
Debug
---------------------------------------
Set this to true to enable php errors.
Make sure to keep this disabled for your
production site, so you won't get nasty
php errors there.
*/
c::set('debug', false);
/*
---------------------------------------
Your custom config file
---------------------------------------
this is your custom config file for your site.
you can set any variable here, which you want to reuse later.
setting custom config variables works like this:
c::set('yourvar', 'yourvalue');
you can access them later in your code like this
c::get('yourvar', 'some default value if the var is not set');
please be careful with existing config rules to not
overwrite them accidentally. Maybe just namespace them
in doubt like:
c::set('yourproject.yourvar', 'yourvalue');
*/
示例10:
Gifbot Slack Integration
---------------------------------------
You need to change the following values in order to get Gifbot working
with your Slack channel.
webhook_token: (String) The url from your incoming webhook integration.
*/
c::set('webhook_url', 'https://hooks.slack.com/services/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');
/*
---------------------------------------
Gifbot Config
---------------------------------------
Feel free to change these defaults that control how gifbot is
displayed in the Slack channel as well as what gifs it picks.
translate: (Boolean) Whether to use the Translation API or the
standard search API. More information about the
difference can be found on Giphy's site:
https://github.com/giphy/GiphyAPI#translate-endpoint
botname: (String) The name displayed in Slack for the bot.
Defaults to 'gifbot'.
show_name: (Boolean) Whether or not to show the name of the Slack
user that requested the gif after the botname. Eg.
'gifbot :: joe'.
giphy_api_key: Giphy API key. Defaults to the public Giphy API key
but if you run into their usage limits you might
need to register for your own.
*/
c::set('translate', true);
c::set('botname', 'gifbot');
c::set('show_name', true);
c::set('giphy_api_key', 'dc6zaTOxFJmzC');
示例11: array
<?php
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
c::set('license', '');
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
// c::set('debug','true');
c::set('content.file.extension', 'md');
c::set('locale', 'de_DE.utf8');
c::set('markdown.extra', true);
/* Routing (Short-URLs) */
c::set('routes', array(array('pattern' => '([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])', 'action' => function ($idx) {
$to = page('blog')->children()->findBy('idx', $idx);
/* echo $to;*/
go($to);
})));
示例12: header
<?php
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
header('Content-Security-Policy: default-src https: \'unsafe-inline\' \'unsafe-eval\'');
header('strict-transport-security: max-age=31536000; includeSubdomains');
c::set('cdn.assets', 'https://assets.getkirby.com/assets');
c::set('cdn.content', 'https://assets.getkirby.com/content');
c::set('cdn.thumbs', 'https://assets.getkirby.com/thumbs');
c::set('cachebuster', true);
c::set('cache.cheatsheet', true);
示例13:
You must also set the right url then:
c::set('url', 'http://yoururl.com/subfolder');
if you are using the .htaccess file, make sure to
set the right RewriteBase there as well:
RewriteBase /subfolder
*/
c::set('subfolder', false);
/*
---------------------------------------
Homepage Setup
---------------------------------------
By default the folder/uri for your homepage is "home".
Sometimes it makes sense to change that to make your blog
your homepage for example. Just change it here in that case.
*/
c::set('home', 'blog');
/*
---------------------------------------
Markdown Setup
---------------------------------------
You can globally switch Markdown parsing
on or off here.
To disable automatic line breaks in markdown
set markdown.breaks to false.
You can also switch between regular markdown
or markdown extra: http://michelf.com/projects/php-markdown/extra/
*/
c::set('markdown', true);
c::set('markdown.breaks', true);
c::set('markdown.extra', true);
示例14: elseif
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
if ($_SERVER['SERVER_NAME'] == 'local.xxx.de') {
c::set('url', 'http://local.xxx.de');
c::set('cache', false);
c::set('debug', true);
} elseif ($_SERVER['SERVER_NAME'] == 'preview.xxxx.de') {
c::set('url', 'http://preview.xxxx.de');
} else {
c::set('url', 'http://www.xxxxx.de');
c::set('cache', true);
}
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
c::set('panel.install', true);
示例15: env
<?php
/*
---------------------------------------
License Setup
---------------------------------------
Please add your license key, which you've received
via email after purchasing Kirby on http://getkirby.com/buy
It is not permitted to run a public website without a
valid license key. Please read the End User License Agreement
for more information: http://getkirby.com/license
*/
c::set('license', env('KIRBY_LICENSE'));
/*
---------------------------------------
Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
of the system, please check out http://getkirby.com/docs/advanced/options
*/
# Mailgun & Contact Form
c::set('mailgun.key', env('MAILGUN_KEY'));
c::set('mailgun.domain', env('MAILGUN_DOMAIN'));