/usr
/www
/users
/stadtgb
/production
/site
/plugins
/imageset
/snippets
/imageset.php
<?php else: /* image set with single ratio */ ?>
<img <?= $imageset->srcAttributes(['lazyload' => false]) ?>
<?= $imageset->sizesAttributes() ?>
<?= $imageset->imgClassAttribute() ?>
<?= $imageset->altAttribute(['output.xhtml' => true]) ?>
style="max-width: 100%; height: auto;" />
<?php endif ?>
<?php else: /* Full-featured output mode */ ?>
<span class="<?= $imageset->wrapperClass() ?>">
<?php if($imageset->hasCssRules()): ?>
<style<?= $imageset->styleIdentifierAttribute() ?>><?= $imageset->cssRules() ?></style>
<?php endif ?>
<?php if($imageset->option('ratio') || $imageset->option('lazyload') || $imageset->option('placeholder')): ?>
<span class="imageset-ratio-fill"<?= (!$imageset->hasCssRules()) ? ' style="padding-top: ' . utils::formatFloat(1 / $imageset->ratio() * 100, 10) . '%;"' : '' ?>></span>
<?php endif ?>
<?php if($placeholder = $imageset->placeholder()) echo $placeholder->html(); ?>
<?php if($imageset->count() > 1): /* image set with multiple ratios */ ?>
<picture>
<?php foreach($imageset->sources() as $source): ?>
<?= $source->tag() ?>
<?php endforeach ?>
<img <?= $imageset->srcAttributes() ?>
<?= $imageset->sizesAttributes() ?>
<?= $imageset->altAttribute() ?>
class="<?= $imageset->elementClass() ?>"
<?= $imageset->trailingSlash() ?>>
</picture>
<?php else: /* image set with single ratio */ ?>
/usr
/www
/users
/stadtgb
/production
/site
/plugins
/imageset
/snippets
/imageset.php
<?php else: /* image set with single ratio */ ?>
<img <?= $imageset->srcAttributes(['lazyload' => false]) ?>
<?= $imageset->sizesAttributes() ?>
<?= $imageset->imgClassAttribute() ?>
<?= $imageset->altAttribute(['output.xhtml' => true]) ?>
style="max-width: 100%; height: auto;" />
<?php endif ?>
<?php else: /* Full-featured output mode */ ?>
<span class="<?= $imageset->wrapperClass() ?>">
<?php if($imageset->hasCssRules()): ?>
<style<?= $imageset->styleIdentifierAttribute() ?>><?= $imageset->cssRules() ?></style>
<?php endif ?>
<?php if($imageset->option('ratio') || $imageset->option('lazyload') || $imageset->option('placeholder')): ?>
<span class="imageset-ratio-fill"<?= (!$imageset->hasCssRules()) ? ' style="padding-top: ' . utils::formatFloat(1 / $imageset->ratio() * 100, 10) . '%;"' : '' ?>></span>
<?php endif ?>
<?php if($placeholder = $imageset->placeholder()) echo $placeholder->html(); ?>
<?php if($imageset->count() > 1): /* image set with multiple ratios */ ?>
<picture>
<?php foreach($imageset->sources() as $source): ?>
<?= $source->tag() ?>
<?php endforeach ?>
<img <?= $imageset->srcAttributes() ?>
<?= $imageset->sizesAttributes() ?>
<?= $imageset->altAttribute() ?>
class="<?= $imageset->elementClass() ?>"
<?= $imageset->trailingSlash() ?>>
</picture>
<?php else: /* image set with single ratio */ ?>
/usr
/www
/users
/stadtgb
/production
/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;
}
}
/usr
/www
/users
/stadtgb
/production
/kirby
/kirby
/component
/snippet.php
* Returns a snippet file path by name
*
* @param string $name
* @return string
*/
public function file($name) {
return $this->kirby->roots()->snippets() . DS . str_replace('/', DS, $name) . '.php';
}
/**
* Renders the snippet with the given data
*
* @param string $name
* @param array $data
* @param boolean $return
* @return string
*/
public function render($name, $data = [], $return = false) {
if(is_object($data)) $data = ['item' => $data];
return tpl::load($this->kirby->registry->get('snippet', $name), $data, $return);
}
}
/usr
/www
/users
/stadtgb
/production
/site
/plugins
/imageset
/lib
/imageset.php
* Returns the HTML representation of this Imageset
*
* @return string The HTML represenation of this ImageSet.
*/
public function html() {
if(isset($this->cache['html'])) {
// If cached ImageSet is available, return the cached
// HTML.
return $this->cache['html'];
}
$sources = [];
$image = null;
$data = [
'imageset' => $this,
];
$html = utils::compressHTML($this->kirby->component('snippet')->render('imageset', $data, true));
if(!$this->kirby->option('imageset.styles.consolidate')) {
$html = str_replace(' ' . static::STYLES_IDENTIFIER_ATTRIBUTE . '>', '>', $html);
}
// Store in cache
if($this->option('cache')) {
static::$fileCache->set($this->image, $this->hash(), [
'imageset.version' => static::$plugin->version(),
'html' => $html,
'site.url' => $this->kirby->roots()->index(), // Store Kirby’s index URL to detect if the site was moved to another domain or server.
]);
}
$this->cache['html'] = $html;
// Compress all HTML output from snippet into one line
return $html;
}
/usr
/www
/users
/stadtgb
/production
/site
/plugins
/imageset
/lib
/imageset.php
static::$fileCache->set($this->image, $this->hash(), [
'imageset.version' => static::$plugin->version(),
'html' => $html,
'site.url' => $this->kirby->roots()->index(), // Store Kirby’s index URL to detect if the site was moved to another domain or server.
]);
}
$this->cache['html'] = $html;
// Compress all HTML output from snippet into one line
return $html;
}
/**
* Returns the HTML representation of this Imageset
*
* @return string The HTML represenation of this ImageSet.
*/
public function __toString() {
return $this->html();
}
/**
* Returns the output style of this ImageSet.
* If `output` option was not set to `plain`, this method
* will return `img`, if the ImageSet has only one size or
* `picture`, if this ImageSet has multiple different
* sizes.
*
* @return string Either 'picture', 'img' or 'plain'
*/
public function outputStyle() {
$style = $this->option('output');
return ($style !== 'auto' ? $style : 'normal');
}
/**
* Returns the class name of this ImageSet’s main `<img>` tag.
*
* @return string The class string of this ImageSet’s main image.
/usr
/www
/users
/stadtgb
/production
/kirby
/vendor
/getkirby
/toolkit
/lib
/html.php
* @param mixed $content The content if availble. Pass null to generate a self-closing tag, Pass an empty string to generate empty content
* @param array $attr An associative array with additional attributes for the tag
* @return string The generated Html
*/
public static function tag($name, $content = null, $attr = array()) {
if(is_array($content)) {
$attr = $content;
$content = null;
}
$html = '<' . $name;
$attr = static::attr($attr);
if(!empty($attr)) $html .= ' ' . $attr;
if(static::isVoid($name)) {
$html .= static::$void;
} else {
$html .= '>' . $content . '</' . $name . '>';
}
return $html;
}
/**
* Generates a single attribute or a list of attributes
*
* @param string $name mixed string: a single attribute with that name will be generated. array: a list of attributes will be generated. Don't pass a second argument in that case.
* @param string $value if used for a single attribute, pass the content for the attribute here
* @return string the generated html
*/
public static function attr($name, $value = null) {
if(is_array($name)) {
$attributes = array();
foreach($name as $key => $val) {
$a = static::attr($key, $val);
if($a) $attributes[] = $a;
}
/usr
/www
/users
/stadtgb
/production
/kirby
/vendor
/getkirby
/toolkit
/lib
/html.php
}
}
/**
* Generates an a tag
*
* @param string $href The url for the a tag
* @param mixed $text The optional text. If null, the url will be used as text
* @param array $attr Additional attributes for the tag
* @return string the generated html
*/
public static function a($href, $text = null, $attr = array()) {
$attr = array_merge(array('href' => $href), $attr);
if(empty($text)) $text = $href;
// add rel=noopener to target blank links to improve security
if(a::get($attr, 'target') === '_blank' && empty($attr['rel'])) {
$attr['rel'] = 'noopener noreferrer';
}
return static::tag('a', $text, $attr);
}
/**
* Generates an "a mailto" tag
*
* @param string $email The url for the a tag
* @param mixed $text The optional text. If null, the url will be used as text
* @param array $attr Additional attributes for the tag
* @return string the generated html
*/
public static function email($email, $text = null, $attr = array()) {
if(empty($text)) {
// show only the eMail address without additional parameters (if the 'text' argument is empty)
$text = str::encode(a::first(str::split($email, '?')));
}
$email = str::encode($email);
$attr = array_merge([
'href' => [
'value' => 'mailto:' . $email,
'escape' => false
/usr
/www
/users
/stadtgb
/production
/site
/templates
/event.php
<?php if ($page->seat_reservation()->bool()) : ?>
<p>
<?= l::get('seat_reservation') ?>
</p>
<?php endif; ?>
<?php if ($page->seat_configuration()->isNotEmpty()) : ?>
<p>
<?= l::get('seat_configuration_' . $page->seat_configuration()) ?>
</p>
<?php endif; ?>
<?php if (sizeof($page->sponsors()->toStructure()) > 0) : ?>
<span class="block mono"><?= l::get('sponsors') ?></span>
<?php foreach ($page->sponsors()->toStructure() as $sponsor) : ?>
<p class="sponsor">
<?php if ($image = $sponsor->image()->toFile()) : ?>
<?php if ($sponsor->website_url()->isNotEmpty()) : ?>
<?php echo html::a($sponsor->website_url(), $image->imageset("default"), array("target" => "_blank")); ?>
<?php else : ?>
<?php echo $image->imageset("default"); ?>
<?php endif; ?>
<?php endif; ?>
</p>
<?php endforeach; ?>
<?php endif; ?>
<?php if (sizeof($page->collaborators()->toStructure()) > 0) : ?>
<span class="block mono"><?= l::get('collaborators') ?></span>
<?php foreach ($page->collaborators()->toStructure() as $sponsor) : ?>
<p class="sponsor">
<?php if ($image = $sponsor->image()->toFile()) : ?>
<?php if ($sponsor->website_url()->isNotEmpty()) : ?>
<?php echo html::a($sponsor->website_url(), $image->imageset("default"), array("target" => "_blank")); ?>
<?php else : ?>
<?php echo $image->imageset("default"); ?>
<?php endif; ?>
<?php endif; ?>
</p>
/usr
/www
/users
/stadtgb
/production
/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;
}
}
/usr
/www
/users
/stadtgb
/production
/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;
}
}
/usr
/www
/users
/stadtgb
/production
/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
*/
/usr
/www
/users
/stadtgb
/production
/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
*/
/usr
/www
/users
/stadtgb
/production
/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;
}
}
}
/usr
/www
/users
/stadtgb
/production
/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
*/
/usr
/www
/users
/stadtgb
/production
/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();