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(); }
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'; }
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; }
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')); }
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); } }
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(); }
<?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');
<?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');
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'); */
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');
<?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); })));
<?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);
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);
/* --------------------------------------- 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);
<?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'));
// Resrc default quality param value (also for generating noscript fallback images) c::set('resrc.dpi', 1); // Resrc default pixel density value (or image width multiplier) /* ----------------------------------------------------------------------------- Twitter -------------------------------------------------------------------------------- Public and private keys, used by the Twitter API (from v1.1 and up). */ c::set('twitter.key', 'your api key'); c::set('twitter.secret', 'your api secret'); /* ----------------------------------------------------------------------------- Analytics, tracking, site stats -------------------------------------------------------------------------------- Set analytics method first [1] (ga-classic, ga-universal, gosquared or segment-io) and then make sure the associated tracking ID/API KEY [2] is set to start tracking/measuring for production environment only (tracking is disabled for local and staging environments as long as no tracking code is added to these environment specific config files!). */ c::set('analytics.tool', 'ga-universal'); // [1] Set tracking method c::set('google.analytics.id', 'TRACKING ID IS NOT SET'); // [2] Google Analytics ID c::set('gosquared.id', 'TRACKING ID IS NOT SET'); // [2] GoSquared ID c::set('segment.io.api.key', 'TRACKING API KEY IS NOT SET'); // [2] Segment.io API Key
default language. Use c::set('lang.locale', 'en_US'); for example to set the default locale settings for all PHP functions */ c::set('lang.support', false); c::set('lang.default', 'en'); c::set('lang.available', array('en', 'de')); c::set('lang.detect', true); c::set('lang.locale', false); /* --------------------------------------- Content File Extension --------------------------------------- Change the default file extension for your content files here if you'd rather use something else than txt. For example md or mdown. */ c::set('content.file.extension', 'txt'); /* --------------------------------------- Ignore Content Files --------------------------------------- Sometimes it's necessary to ignore particular content files/folders in all content folders. Just add them to the array here. By default the following files are being ignored: array('.', '..', '.DS_Store', '.svn', '.git', '.htaccess'); …so you don't have to add them. */ c::set('content.file.ignore', 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('languages', array(array('code' => 'fr', 'name' => 'Français', 'default' => true, 'locale' => 'fr_FR', 'url' => '/'), array('code' => 'en', 'name' => 'English', 'locale' => 'en_EN', 'url' => '/en'))); c::set('language.detect', true); c::set('sitemap.exclude', array('error')); c::set('sitemap.important', array('home'));
<?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', 'K2-PRO-d3443f5ca785a5a9ef345be4ac96b21c'); /* --------------------------------------- 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('kirbytext.image.figure',true); c::set('languages', array(array('code' => 'en', 'name' => 'English', 'locale' => 'en_US', 'default' => true, 'url' => '/')));
<?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('bydate.limit', 1000); c::set('cache', false);
<?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', 'K2-PRO-acd2fcdaf28e028194aa83e5cb0abbc2'); /* --------------------------------------- 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 */
require_once $rootKirby . '/lib/kirby.php'; require_once $rootPanel . '/lib/load.php'; // set the root c::set('root', $root); c::set('root.kirby', $rootKirby); c::set('root.site', $rootSite); c::set('root.content', $rootContent); c::set('root.panel', $rootPanel); // panel version c::set('panel.version.string', '0.5'); c::set('panel.version.number', 0.5); c::set('panel.min.kirby.version', 1.08); c::set('panel.folder', $folder); paneload::lib(); paneload::config(); // set the admin url c::set('panel.url', c::get('url') . '/' . $folder); paneload::parsers(); // switch on errors if (c::get('debug')) { error_reporting(E_ALL); ini_set('display_errors', 1); } else { error_reporting(0); ini_set('display_errors', 0); } // set the timezone to make sure we // avoid errors in php 5.3 @date_default_timezone_set(c::get('timezone')); $site = new panel(); $site->load();
<?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('uniform.language', 'en'); c::set('debug', true);
function urlSetup() { // auto-detect the url if it is not set $url = c::get('url') === false ? c::get('scheme') . server::get('http_host') : rtrim(c::get('url'), '/'); // try to detect the subfolder $subfolder = c::get('subfolder') ? trim(c::get('subfolder'), '/') : trim(dirname($_SERVER['SCRIPT_NAME']), '/\\'); if ($subfolder) { c::set('subfolder', $subfolder); // check if the url already contains the subfolder // so it's not included twice if (!preg_match('!' . preg_quote($subfolder) . '$!i', $url)) { $url .= '/' . $subfolder; } } // set the final url c::set('url', $url); }
<?php /** * Kirby -- A stripped down and easy to use toolkit for PHP * * @version 0.95 * @author Bastian Allgeier <*****@*****.**> * @link http://toolkit.getkirby.com * @copyright Copyright 2009-2012 Bastian Allgeier * @license http://www.opensource.org/licenses/mit-license.php MIT License * @package Kirby */ c::set('version', 0.9399999999999999); c::set('language', 'en'); c::set('charset', 'utf-8'); c::set('root', dirname(__FILE__)); /** * Redirects the user to a new URL * * @param string $url The URL to redirect to * @param boolean $code The HTTP status code, which should be sent (301, 302 or 303) * @package Kirby */ function go($url = false, $code = false) { if (empty($url)) { $url = c::get('url', '/'); } // send an appropriate header if ($code) { switch ($code) {
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 */ /* --------------------------------------- Theme Configuration --------------------------------------- */ /* Homepage */ c::set('home', 'home'); /* The default page that is displayed when going to your Kirby page (e.g. 'home', 'blog' or 'projects') */ /* Theme flavour selection */ c::set('navbar', 'default'); /* Bootstrap Default Navbar ('default') or Minimal, collapsed Navbar ('minimal')? */ c::set('submenu', 'projects'); /* Only for Default Navbar: Choose which pages with children are displayed with a dropdown menu */ /* Settings for Default Theme */ c::set('nav-right', true); /* Show the Button on the right side of the Navbar (only in Default Navbar) */ c::set('nav-right-link', 'https://github.com/opafritz/KirbyBootstrap'); /* If nav-right is enabled, you can put the link it should lead to here */ c::set('nav-right-text', 'View Code on Github'); /* If nav-right is enabled, you can put the text it should display here */ /* Blog */ c::set('excerpt', false); /* If set to 'true', only excerpts of blog posts will be shown in /blog */ c::set('excerpt-length', '300'); /* Number of characters that is shown as an excerpt for every post in /blog */
<?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 */
<?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', 'K2-PERSONAL-71749f7e6ac4370a60c020ed77a4492e'); /* --------------------------------------- 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 */
/* Custom Panel Stylesheet --------------------------------------- Define a custom stylesheet to load in to the panel. See: getkirby.com/docs/cheatsheet/options/panel.stylesheet */ c::set('panel.stylesheet', 'assets/css/panel.css'); /* Kirby Configuration --------------------------------------- By default you don't have to configure anything to make Kirby work. For more fine-grained configuration please check out getkirby.com/docs/advanced/options and getkirby.com/blog/multi-environment-setup */ // Routes // c::set('routes', array(array('pattern' => '(:any)', 'method' => 'ALL', 'action' => function ($path) { if (!r::ajax()) { header::notfound(); return site()->visit($path); } $page = page($path); $has_api_method = method_exists($page, 'api'); return response::json(array('has_api_method' => $has_api_method)); }), array('pattern' => 'get/users.json', 'method' => 'ALL', 'action' => function () { // if(!r::ajax()) { // return header::forbidden(); // } // $users = site()->users()->toArray(); // $r = array_combine($users,site()->users()->toArray()); // format for kirby select field return response::json(array("first" => 'Rafe', "middle" => 'Jackson', "last" => 'Goldberg')); })));
<?php /* --------------------------------------- Kirby Configuration For Localhost --------------------------------------- Please check out http://getkirby.com/blog/multi-environment-setup for more informations. */ c::set('environment', 'local');