/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/lib
/str.php
/**
* Converts a string to UTF-8
*
* @param string $string
* @return string
*/
public static function utf8($string) {
return static::convert($string, 'utf-8');
}
/**
* A better way to strip slashes
*
* @param string $string
* @return string
*/
public static function stripslashes($string) {
if(is_array($string)) return $string;
return get_magic_quotes_gpc() ? stripslashes($string) : $string;
}
/**
* A super simple string template engine,
* which replaces tags like {mytag} with any other string
*
* @param string $string
* @param array $data An associative array with keys, which should be replaced and values.
* @return string
*/
public static function template($string, $data = array()) {
$replace = array();
foreach($data as $key => $value) $replace['{' . $key . '}'] = $value;
return str_replace(array_keys($replace), array_values($replace), $string);
}
/**
* Convert a string to 7-bit ASCII.
*
* @param string $string
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/lib
/str.php
/**
* Converts a string to UTF-8
*
* @param string $string
* @return string
*/
public static function utf8($string) {
return static::convert($string, 'utf-8');
}
/**
* A better way to strip slashes
*
* @param string $string
* @return string
*/
public static function stripslashes($string) {
if(is_array($string)) return $string;
return get_magic_quotes_gpc() ? stripslashes($string) : $string;
}
/**
* A super simple string template engine,
* which replaces tags like {mytag} with any other string
*
* @param string $string
* @param array $data An associative array with keys, which should be replaced and values.
* @return string
*/
public static function template($string, $data = array()) {
$replace = array();
foreach($data as $key => $value) $replace['{' . $key . '}'] = $value;
return str_replace(array_keys($replace), array_values($replace), $string);
}
/**
* Convert a string to 7-bit ASCII.
*
* @param string $string
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/lib
/r.php
/**
* Only returns post data
*
* @return array
*/
public static function postData($key = null, $default = null) {
return a::get((array)static::sanitize($_POST), $key, $default);
}
/**
* Private method to sanitize incoming request data
*
* @param array $data
* @return array
*/
protected static function sanitize($data) {
if(!is_array($data)) {
return trim(str::stripslashes($data));
}
foreach($data as $key => $value) {
$data[$key] = static::sanitize($value);
}
return $data;
}
/**
* Sets or overwrites a variable in the data array
*
* <code>
*
* r::set('username', 'bastian');
*
* dump($request);
*
* // sample output: array(
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/lib
/r.php
* @return array
*/
public static function postData($key = null, $default = null) {
return a::get((array)static::sanitize($_POST), $key, $default);
}
/**
* Private method to sanitize incoming request data
*
* @param array $data
* @return array
*/
protected static function sanitize($data) {
if(!is_array($data)) {
return trim(str::stripslashes($data));
}
foreach($data as $key => $value) {
$data[$key] = static::sanitize($value);
}
return $data;
}
/**
* Sets or overwrites a variable in the data array
*
* <code>
*
* r::set('username', 'bastian');
*
* dump($request);
*
* // sample output: array(
* // 'username' => 'bastian'
* // ... other stuff from the request
* // );
*
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/lib
/r.php
* Returns either the entire data array or parts of it
*
* <code>
*
* echo r::data('username');
* // sample output 'bastian'
*
* echo r::data('username', 'peter');
* // if no username is found in the request peter will be echoed
*
* </code>
*
* @param string $key An optional key to receive only parts of the data array
* @param mixed $default A default value, which will be returned if nothing can be found for a given key
* @param mixed
*/
public static function data($key = null, $default = null) {
if(is_null(static::$data)) {
static::$data = static::sanitize(static::raw());
if(!static::is('GET')) {
$body = static::body();
parse_str($body, $parsed);
if(!is_array($parsed)) {
$parsed = json_decode($body, false);
if(!is_array($parsed)) $parsed = array();
}
static::$data = array_merge($parsed, static::$data);
}
}
if(is_null($key)) {
return static::$data;
} else if(isset(static::$data[$key])) {
return static::$data[$key];
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/helpers.php
/**
* Redirects the user to a new URL
* This uses the URL::to() method and can be super
* smart with the custom url::to() handler. Check out
* the URL class for more information
*/
function go() {
call_user_func_array('redirect::to', func_get_args());
}
/**
* Shortcut for r::get()
*
* @param mixed $key The key to look for. Pass false or null to return the entire request array.
* @param mixed $default Optional default value, which should be returned if no element has been found
* @return mixed
*/
function get($key = null, $default = null) {
return r::data($key, $default);
}
/**
* Returns all params from the current url
*
* @return array
*/
function params() {
return url::params();
}
/**
* Get a parameter from the current URI object
*
* @param mixed $key The key to look for. Pass false or null to return the entire params array.
* @param mixed $default Optional default value, which should be returned if no element has been found
* @return mixed
*/
function param($key = null, $default = null) {
static $params;
/home
/kwaliti
/vbs-dewaaier.be
/site
/templates
/albumlist.php
function TagEncode($string) {
$entities = array('%3A', '%40', '%3D', '%5B', '%5D', '%26');
$replacements = array(":", "@", "=", "[", "]", "&");
return str_replace($entities, $replacements, urlencode($string));
}
if ( date('n', time()) > 7 ) {
$startyear = date('Y', time());
$endyear = date('Y', time()) + 1;
} else {
$startyear = date('Y', time()) - 1;
$endyear = date('Y', time());
}
// fetch all blog post of 2015 using beginning and end dates
// $collection = page('blog')->children()->visible()->filterBy('date', '>', strtotime($startyear . '-08-01'))->filterBy('date', '<', strtotime($endyear . '-08-01'))
// fetch all tags and albums
$showarchive = get('archive',false);
if ($showarchive) {
$archive = '?archive=true';
$archivebutton = '<a href="' . url('/fotos/') . '" class="btn btn-toranj btn-xs">Fotoarchief actief</a>';
$tags = $page->children()->visible()->filterBy('date', '<', strtotime($startyear . '-08-01'))->pluck('tags', ',', true);
$fotoalbums = page()->children()->visible()->filterBy('date', '<', strtotime($startyear . '-08-01'))->sortBy('date', 'desc')->limit(500);
} else {
$archive = '';
$archivebutton = '<a href="' . url('/fotos/?archive=true') . '" class="btn btn-toranj btn-xs alt">Fotoarchief bekijken</a>';
$tags = $page->children()->visible()->filterBy('date', '>', strtotime($startyear . '-08-01'))->filterBy('date', '<', strtotime($endyear . '-08-01'))->pluck('tags', ',', true);
$fotoalbums = page()->children()->visible()->filterBy('date', '>', strtotime($startyear . '-08-01'))->filterBy('date', '<', strtotime($endyear . '-08-01'))->sortBy('date', 'desc')->limit(500);
}
natcasesort($tags);
$currenttag = param('tag');
if (!$currenttag) {
$tagcloud = '<a href="' . url('/fotos/'.$archive) . '" class="btn btn-toranj btn-xs">Alles</a>';
} else {
$tagcloud = '<a href="' . url('/fotos/'.$archive) . '" class="btn btn-toranj btn-xs alt">Alles</a>';
}
foreach($tags as $tag) {
if ($currenttag == $tag) {
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/vendor
/getkirby
/toolkit
/lib
/tpl.php
/**
* Tpl
*
* Super simple template engine
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
class Tpl extends Silo {
public static $data = array();
public static function load($_file, $_data = array(), $_return = true) {
if(!file_exists($_file)) return false;
ob_start();
extract(array_merge(static::$data, (array)$_data));
require($_file);
$_content = ob_get_contents();
ob_end_clean();
if($_return) return $_content;
echo $_content;
}
}
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/kirby
/component
/template.php
if($template instanceof Page) {
$page = $template;
$file = $page->templateFile();
$data = $this->data($page, $data);
} else {
$file = $template;
$data = $this->data(null, $data);
}
// check for an existing template
if(!file_exists($file)) {
throw new Exception('The template could not be found');
}
// merge and register the template data globally
$tplData = tpl::$data;
tpl::$data = array_merge(tpl::$data, $data);
// load the template
$result = tpl::load($file, null, $return);
// reset the template data
tpl::$data = $tplData;
return $result;
}
}
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/kirby.php
}
return $template;
}
// return a fresh template
return $this->template($page, $data);
}
/**
* Template configuration
*
* @param Page $page
* @param array $data
* @return string
*/
public function template(Page $page, $data = array()) {
return $this->component('template')->render($page, $data);
}
public function request() {
if(!is_null($this->request)) return $this->request;
return $this->request = new Request($this);
}
public function router() {
return $this->router;
}
public function route() {
return $this->route;
}
/**
* Starts the router, renders the page and returns the response
*
* @return mixed
*/
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/kirby.php
// check for modified content within the content folder
// and auto-expire the page cache in such a case
if($this->options['cache.autoupdate'] and $this->cache()->exists($cacheId)) {
// get the creation date of the cache file
$created = $this->cache()->created($cacheId);
// make sure to kill the cache if the site has been modified
if($this->site->wasModifiedAfter($created)) {
$this->cache()->remove($cacheId);
}
}
// try to fetch the template from cache
$template = $this->cache()->get($cacheId);
// fetch fresh content if the cache is empty
if(empty($template)) {
$template = $this->template($page, $data);
// store the result for the next round
$this->cache()->set($cacheId, $template);
}
return $template;
}
// return a fresh template
return $this->template($page, $data);
}
/**
* Template configuration
*
* @param Page $page
* @param array $data
* @return string
*/
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/kirby
/component
/response.php
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://getkirby.com/license
*/
class Response extends \Kirby\Component {
/**
* Builds and return the response by various input
*
* @param mixed $response
* @return mixed
*/
public function make($response) {
if(is_string($response)) {
return $this->kirby->render(page($response));
} else if(is_array($response)) {
return $this->kirby->render(page($response[0]), $response[1]);
} else if(is_a($response, 'Page')) {
return $this->kirby->render($response);
} else if(is_a($response, 'Response')) {
return $response;
} else {
return null;
}
}
}
/home
/kwaliti
/vbs-dewaaier.be
/kirby
/kirby.php
// check for a valid route
if(is_null($this->route)) {
header::status('500');
header::type('json');
die(json_encode(array(
'status' => 'error',
'message' => 'Invalid route or request method'
)));
}
// call the router action with all arguments from the pattern
$response = call($this->route->action(), $this->route->arguments());
// load all language variables
// this can only be loaded once the router action has been called
// otherwise the current language is not yet available
$this->localize();
// build the response
$this->response = $this->component('response')->make($response);
// store the current language in the session
if(
$this->option('language.detect') &&
$this->site()->multilang() &&
$this->site()->language()
) {
s::set('kirby_language', $this->site()->language()->code());
}
return $this->response;
}
/**
* Register a new hook
*
* @param string/array $hook The name of the hook
* @param closure $callback
*/
/home
/kwaliti
/vbs-dewaaier.be
/index.php
<?php
define('DS', DIRECTORY_SEPARATOR);
// load kirby
require(__DIR__ . DS . 'kirby' . DS . 'bootstrap.php');
// check for a custom site.php
if(file_exists(__DIR__ . DS . 'site.php')) {
require(__DIR__ . DS . 'site.php');
} else {
$kirby = kirby();
}
// render
echo $kirby->launch();