Upgrade to 3.1.3

This commit is contained in:
Bastian Allgeier
2019-04-23 16:13:26 +02:00
parent eb29ef6d6c
commit 066913cb6e
53 changed files with 606 additions and 261 deletions

View File

@@ -8,6 +8,14 @@ return [
'default' => function ($default = null) {
return $default;
},
/**
* Defines a custom format that is used when the field is saved
*/
'format' => function (string $format = null) {
return $format;
},
/**
* Changes the calendar icon to something custom
*/

View File

@@ -4,6 +4,7 @@ use Kirby\Api\Api;
use Kirby\Cms\App;
use Kirby\Cms\Media;
use Kirby\Cms\Panel;
use Kirby\Cms\PanelPlugins;
use Kirby\Cms\PluginAssets;
use Kirby\Cms\Response;
use Kirby\Exception\NotFoundException;
@@ -16,6 +17,16 @@ use Kirby\Toolkit\View;
return function ($kirby) {
$api = $kirby->option('api.slug', 'api');
$panel = $kirby->option('panel.slug', 'panel');
$index = $kirby->url('index');
$media = $kirby->url('media');
if (Str::startsWith($media, $index) === true) {
$media = Str::after($media, $index);
} else {
// media URL is outside of the site, we can't make routing work;
// fall back to the standard media route
$media = 'media';
}
/**
* Before routes are running before the
@@ -43,17 +54,31 @@ return function ($kirby) {
}
],
[
'pattern' => 'media/plugins/index.(css|js)',
'pattern' => $media . '/panel/(:any)/plugins/(css|js)/(:any)/index.(css|js)',
'env' => 'media',
'action' => function (string $extension) use ($kirby) {
'action' => function (string $version, string $type) use ($kirby) {
$plugins = new PanelPlugins($type);
$plugins->publish();
return $kirby
->response()
->type($extension)
->body(PluginAssets::index($extension));
->type($type)
->body($plugins->read());
}
],
[
'pattern' => 'media/plugins/(:any)/(:any)/(:all).(css|gif|js|jpg|png|svg|webp|woff2|woff)',
'pattern' => $media . '/panel/plugins/index.(css|js)',
'env' => 'media',
'action' => function (string $type) use ($kirby) {
$plugins = new PanelPlugins($type);
return $kirby
->response()
->redirect($plugins->url(), 302);
}
],
[
'pattern' => $media . '/plugins/(:any)/(:any)/(:all).(css|gif|js|jpg|png|svg|webp|woff2|woff)',
'env' => 'media',
'action' => function (string $provider, string $pluginName, string $filename, string $extension) use ($kirby) {
return PluginAssets::resolve($provider . '/' . $pluginName, $filename . '.' . $extension);
@@ -71,28 +96,28 @@ return function ($kirby) {
}
],
[
'pattern' => 'media/pages/(:all)/(:any)/(:any)',
'pattern' => $media . '/pages/(:all)/(:any)/(:any)',
'env' => 'media',
'action' => function ($path, $hash, $filename) use ($kirby) {
return Media::link($kirby->page($path), $hash, $filename);
}
],
[
'pattern' => 'media/site/(:any)/(:any)',
'pattern' => $media . '/site/(:any)/(:any)',
'env' => 'media',
'action' => function ($hash, $filename) use ($kirby) {
return Media::link($kirby->site(), $hash, $filename);
}
],
[
'pattern' => 'media/users/(:any)/(:any)/(:any)',
'pattern' => $media . '/users/(:any)/(:any)/(:any)',
'env' => 'media',
'action' => function ($id, $hash, $filename) use ($kirby) {
return Media::link($kirby->user($id), $hash, $filename);
}
],
[
'pattern' => 'media/assets/(:all)/(:any)/(:any)',
'pattern' => $media . '/assets/(:all)/(:any)/(:any)',
'env' => 'media',
'action' => function ($path, $hash, $filename) use ($kirby) {
return Media::thumb($path, $hash, $filename);

View File

@@ -14,7 +14,7 @@ return [
* Sets the default page for the pagination. This will overwrite default pagination.
*/
'page' => function (int $page = null) {
return $page ?? get('page', 1);
return get('page', $page ?? 1);
},
],
'methods' => [

View File

@@ -249,9 +249,7 @@ return [
$templates = empty($this->create) === false ? $this->create : $this->templates;
if (empty($templates) === true) {
foreach (glob(App::instance()->root('blueprints') . '/pages/*.yml') as $blueprint) {
$templates[] = F::name($blueprint);
}
$templates = $this->kirby()->blueprints();
}
// convert every template to a usable option array
@@ -285,6 +283,8 @@ return [
'headline' => $this->headline,
'layout' => $this->layout,
'link' => $this->link,
'max' => $this->max,
'min' => $this->min,
'size' => $this->size,
'sortable' => $this->sortable
],