/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Text
/Markdown.php
/**
* Creates a new Markdown parser
* with the given options
*
* @param array $options
*/
public function __construct(array $options = [])
{
$this->options = array_merge($this->defaults(), $options);
}
/**
* Parses the given text and returns the HTML
*
* @param string $text
* @param bool $inline
* @return string
*/
public function parse(string $text, bool $inline = false): string
{
if ($this->options['extra'] === true) {
$parser = new ParsedownExtra;
} else {
$parser = new Parsedown;
}
$parser->setBreaksEnabled($this->options['breaks']);
if ($inline === true) {
return @$parser->line($text);
} else {
return @$parser->text($text);
}
}
}
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/config
/components.php
*/
'js' => function (App $kirby, string $url, $options = null): string {
return $url;
},
/**
* Add your own Markdown parser
*
* @param Kirby\Cms\App $kirby Kirby instance
* @param string $text Text to parse
* @param array $options Markdown options
* @param bool $inline Whether to wrap the text in `<p>` tags
* @return string
*/
'markdown' => function (App $kirby, string $text = null, array $options = [], bool $inline = false): string {
static $markdown;
$markdown = $markdown ?? new Markdown($options);
return $markdown->parse($text, $inline);
},
/**
* Add your own SmartyPants parser
*
* @param Kirby\Cms\App $kirby Kirby instance
* @param string $text Text to parse
* @param array $options SmartyPants options
* @return string
*/
'smartypants' => function (App $kirby, string $text = null, array $options = []): string {
static $smartypants;
$smartypants = $smartypants ?? new Smartypants($options);
return $smartypants->parse($text);
},
/**
* Add your own snippet loader
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/App.php
* Returns all available site languages
*
* @return Languages
*/
public function languages(): Languages
{
return $this->languages = $this->languages ?? Languages::load();
}
/**
* Parses Markdown
*
* @internal
* @param string $text
* @param bool $inline
* @return string
*/
public function markdown(string $text = null, bool $inline = false): string
{
return $this->component('markdown')($this, $text, $this->options['markdown'] ?? [], $inline);
}
/**
* Check for a multilang setup
*
* @return boolean
*/
public function multilang(): bool
{
if ($this->multilang !== null) {
return $this->multilang;
}
return $this->multilang = $this->languages()->count() !== 0;
}
/**
* Load a specific configuration option
*
* @param string $key
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/config
/methods.php
'parent' => $field->parent(),
'field' => $field
]);
return $field;
},
/**
* Converts the field content to lowercase
*/
'lower' => function (Field $field) {
$field->value = Str::lower($field->value);
return $field;
},
/**
* Converts markdown to valid HTML
*/
'markdown' => function (Field $field) use ($app) {
$field->value = $app->markdown($field->value);
return $field;
},
/**
* Converts the field content to valid XML
*/
'xml' => function (Field $field) {
$field->value = Xml::encode($field->value);
return $field;
},
/**
* Cuts the string after the given length and adds "…" if it is longer
*
* @param int $length The number of characters in the string
* @param string $appendix An optional replacement for the missing rest
* @return Field
*/
'short' => function (Field $field, int $length, string $appendix = '…') {
$field->value = Str::short($field->value, $length, $appendix);
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/Field.php
/**
* The value of the field
*
* @var mixed
*/
public $value;
/**
* Magic caller for field methods
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments = [])
{
$method = strtolower($method);
if (isset(static::$methods[$method]) === true) {
return static::$methods[$method](clone $this, ...$arguments);
}
if (isset(static::$aliases[$method]) === true) {
$method = strtolower(static::$aliases[$method]);
if (isset(static::$methods[$method]) === true) {
return static::$methods[$method](clone $this, ...$arguments);
}
}
return $this;
}
/**
* Creates a new field object
*
* @param object $parent
* @param string $key
* @param mixed $value
*/
/kunden
/heuerundsachse.de
/markenkundendienst
/site
/templates
/default.php
<?php snippet('header') ?>
<main>
<section class="hs-content">
<h1 class="hs-page__headline hs-page__headline-default"><?php echo $page->title()->html() ?></h1>
<div class="hs-text__default">
<?= $page->text()->markdown() ?>
</div>
</section>
</main>
<?php snippet('footer') ?>
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Toolkit
/Tpl.php
/**
* Renders the template
*
* @param string $__file
* @param array $__data
* @return string
*/
public static function load(string $__file = null, array $__data = []): string
{
if (file_exists($__file) === false) {
return '';
}
$exception = null;
ob_start();
extract($__data);
try {
require $__file;
} catch (Throwable $e) {
$exception = $e;
}
$content = ob_get_contents();
ob_end_clean();
if ($exception === null) {
return $content;
}
throw $exception;
}
}
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/Template.php
}
}
/**
* Returns the template name
*
* @return string
*/
public function name(): string
{
return $this->name;
}
/**
* @param array $data
* @return string
*/
public function render(array $data = []): string
{
return Tpl::load($this->file(), $data);
}
/**
* Returns the root to the templates directory
*
* @return string
*/
public function root(): string
{
return App::instance()->root($this->store());
}
/**
* Returns the template type
*
* @return string
*/
public function type(): string
{
return $this->type;
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/Page.php
}
// fetch the page regularly
if ($html === null) {
$kirby->data = $this->controller($data, $contentType);
if ($contentType === 'html') {
$template = $this->template();
} else {
$template = $this->representation($contentType);
}
if ($template->exists() === false) {
throw new NotFoundException([
'key' => 'template.default.notFound'
]);
}
// render the page
$html = $template->render($kirby->data);
// convert the response configuration to an array
$response = $kirby->response()->toArray();
// cache the result
if ($cache !== null) {
$cache->set($cacheId, [
'html' => $html,
'response' => $response
]);
}
}
return $html;
}
/**
* @internal
* @return Template
*/
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/App.php
// any direct exception will be turned into an error page
if (is_a($input, 'Throwable') === true) {
if (is_a($input, 'Kirby\Exception\Exception') === true) {
$code = $input->getHttpCode();
$message = $input->getMessage();
} else {
$code = $input->getCode();
$message = $input->getMessage();
}
if ($code < 400 || $code > 599) {
$code = 500;
}
if ($errorPage = $this->site()->errorPage()) {
return $response->code($code)->send($errorPage->render([
'errorCode' => $code,
'errorMessage' => $message,
'errorType' => get_class($input)
]));
}
return $response
->code($code)
->type('text/html')
->send($message);
}
// Empty input
if (empty($input) === true) {
return $this->io(new NotFoundException());
}
// Response Configuration
if (is_a($input, 'Kirby\Cms\Responder') === true) {
return $input->send();
}
// Responses
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/App.php
$code = 500;
}
if ($errorPage = $this->site()->errorPage()) {
return $response->code($code)->send($errorPage->render([
'errorCode' => $code,
'errorMessage' => $message,
'errorType' => get_class($input)
]));
}
return $response
->code($code)
->type('text/html')
->send($message);
}
// Empty input
if (empty($input) === true) {
return $this->io(new NotFoundException());
}
// Response Configuration
if (is_a($input, 'Kirby\Cms\Responder') === true) {
return $input->send();
}
// Responses
if (is_a($input, 'Kirby\Http\Response') === true) {
return $input;
}
// Pages
if (is_a($input, 'Kirby\Cms\Page')) {
$html = $input->render();
if ($input->isErrorPage() === true) {
if ($response->code() === null) {
$response->code(404);
}
/kunden
/heuerundsachse.de
/markenkundendienst
/kirby
/src
/Cms
/App.php
$requestUri = '/' . $this->request()->url()->path();
$scriptName = $_SERVER['SCRIPT_NAME'];
$scriptFile = basename($scriptName);
$scriptDir = dirname($scriptName);
$scriptPath = $scriptFile === 'index.php' ? $scriptDir : $scriptName;
$requestPath = preg_replace('!^' . preg_quote($scriptPath) . '!', '', $requestUri);
return $this->setPath($requestPath)->path;
}
/**
* Returns the Response object for the
* current request
*
* @return Response
*/
public function render(string $path = null, string $method = null)
{
return $this->io($this->call($path, $method));
}
/**
* Returns the Request singleton
*
* @return Request
*/
public function request(): Request
{
return $this->request = $this->request ?? new Request;
}
/**
* Path resolver for the router
*
* @internal
* @param string $path
* @param string|null $language
* @return mixed
*/
/kunden
/heuerundsachse.de
/markenkundendienst
/index.php
<?php
require 'kirby/bootstrap.php';
$kirby = new Kirby([
'urls' => [
'dist' => '../dist',
],
]);
echo $kirby->render();