Deprecated: Kirby\Cms\App::bakeRoots(): Implicitly marking parameter $roots as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 288
Deprecated: Kirby\Cms\App::bakeUrls(): Implicitly marking parameter $urls as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 300
Deprecated: Kirby\Cms\App::call(): Implicitly marking parameter $path as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 334
Deprecated: Kirby\Cms\App::call(): Implicitly marking parameter $method as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 334
Deprecated: Kirby\Cms\App::instance(): Implicitly marking parameter $instance as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 699
Deprecated: Kirby\Cms\App::kirbytags(): Implicitly marking parameter $text as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 855
Deprecated: Kirby\Cms\App::kirbytext(): Implicitly marking parameter $text as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 875
Deprecated: Kirby\Cms\App::language(): Implicitly marking parameter $code as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 894
Deprecated: Kirby\Cms\App::languageCode(): Implicitly marking parameter $languageCode as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 912
Deprecated: Kirby\Cms\App::markdown(): Implicitly marking parameter $text as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 955
Deprecated: Kirby\Cms\App::markdown(): Implicitly marking parameter $options as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 955
Deprecated: Kirby\Cms\App::render(): Implicitly marking parameter $path as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1183
Deprecated: Kirby\Cms\App::render(): Implicitly marking parameter $method as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1183
Deprecated: Kirby\Cms\App::setLanguages(): Implicitly marking parameter $languages as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1444
Deprecated: Kirby\Cms\App::setPath(): Implicitly marking parameter $path as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1465
Deprecated: Kirby\Cms\App::setRequest(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1476
Deprecated: Kirby\Cms\App::setRoles(): Implicitly marking parameter $roles as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1490
Deprecated: Kirby\Cms\App::setSite(): Implicitly marking parameter $site as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1504
Deprecated: Kirby\Cms\App::smartypants(): Implicitly marking parameter $text as nullable is deprecated, the explicit nullable type must be used instead in /home/theatredsv/dev/kirby/src/Cms/App.php on line 1531
rray $validators): array
{
return $this->extensions['validators'] = V::$validators = array_merge(V::$validators, $validators);
}
/**
* Returns a given extension by type and name
*
* @internal
* @param string $type i.e. `'hooks'`
* @param string $name i.e. `'page.delete:before'`
*/
public function extension(
string $type,
string $name,
mixed $fallback = null
): mixed {
return $this->extensions($type)[$name] ?? $fallback;
}
/**
* Returns the extensions registry
*
* @internal
*/
public function extensions(string $type = null): array
{
if ($type === null) {
return $this->extensions;
}
return $this->extensions[$type] ?? [];
}
/**
* Load extensions from site folders.
* This is only used for models for now, but
* could be extended later
*/
protected function extensionsFromFolders(): void
{
$models = [];
foreach (glob($this->root('models') . '/*.php') as $model) {
$name = F::name($model);
$class = str_replace(['.', '-', '_'], '', $name) . 'Page';
// load the model class
F::loadOnce($model, allowOutput: false);
if (class_exists($class) === true) {
$models[$name] = $class;
}
}
$this->extendPageModels($models);
}
/**
* Register extensions that could be located in
* the options array. I.e. hooks and routes can be
* setup from the config.
*/
protected function extensionsFromOptions(): void
{
// register routes and hooks from options
$this->extend([
'api' => $this->options['api'] ?? [],
'routes' => $this->options['routes'] ?? [],
'hooks' => $this->options['hooks'] ?? []
]);
}
/**
* Apply all plugin extensions
*/
protected function extensionsFromPlugins(): void
{
// register all their extensions
foreach ($this->plugins() as $plugin) {
$extends = $plugin->extends();
if (empty($extends) === false) {
$this->extend($extends, $plugin);
}
}
}
/**
* Apply all passed extensions
*/
protected function extensionsFromProps(array $props): void
{
$this->extend($props);
}
/**
* Apply all default extensions
*/
protected function extensionsFromSystem(): void
{
// Always start with fresh fields and sections
// from the core and add plugins on top of that
FormField::$types = [];
Section::$types = [];
// mixins
FormField::$mixins = $this->core->fieldMixins();
Section::$mixins = $this->core->sectionMixins();
// aliases
KirbyTag::$aliases = $this->core->kirbyTagAliases();
Field::$aliases = $this->core->fieldMethodAliases();
// blueprint presets
PageBlueprint::$presets = $this->core->blueprintPresets();
$this->extendAuthChallenges($this->core->authChallenges());
$this->extendCacheTypes($this->core->cacheTypes());
$this->extendComponents($this->core->components());
$this->extendBlueprints($this->core->blueprints());
$this->extendFieldMethods($this->core->fieldMethods());
$this->extendFields($this->core->fields());
$this->extendSections($this->core->sections());
$this->extendSnippets($this->core->snippets());
$this->extendTags($this->core->kirbyTags());
$this->extendTemplates($this->core->templates());
}
/**
* Checks if a native component was extended
* @since 3.7.0
*/
public function isNativeComponent(string $component): bool
{
return $this->component($component) === $this->nativeComponent($component);
}
/**
* Returns the native implementation
* of a core component
*/
public function nativeComponent(string $component): Closure|false
{
return $this->core->components()[$component] ?? false;
}
/**
* Kirby plugin factory and getter
*
* @param array|null $extends If null is passed it will be used as getter. Otherwise as factory.
* @throws \Kirby\Exception\DuplicateException
*/
public static function plugin(
string $name,
array $extends = null,
array $info = [],
string|null $root = null,
string|null $version = null
): PLugin|null {
if ($extends === null) {
return static::$plugins[$name] ?? null;
}
$plugin = new Plugin(
name: $name,
extends: $extends,
info: $info,
// TODO: Remove fallback to $extends in v7
root: $root ?? $extends['root'] ?? dirname(debug_backtrace()[0]['file']),
version: $version
);
$name = $plugin->name();
if (isset(static::$plugins[$name]) === true) {
throw new DuplicateException('The plugin "' . $name . '" has already been registered');
}
return static::$plugins[$name] = $plugin;
}
/**
* Loads and returns all plugins in the site/plugins directory
* Loading only happens on the first call.
*
* @internal
* @param array|null $plugins Can be used to overwrite the plugins registry
*/
public function plugins(array $plugins = null): array
{
// overwrite the existing plugins registry
if ($plugins !== null) {
$this->pluginsAreLoaded = true;
return static::$plugins = $plugins;
}
// don't load plugins twice
if ($this->pluginsAreLoaded === true) {
return static::$plugins;
}
// load all plugins from site/plugins
$this->pluginsLoader();
// mark plugins as loaded to stop doing it twice
$this->pluginsAreLoaded = true;
return static::$plugins;
}
/**
* Loads all plugins from site/plugins
*
* @return array Array of loaded directories
*/
protected function pluginsLoader(): array
{
$root = $this->root('plugins');
$loaded = [];
foreach (Dir::read($root) as $dirname) {
if (in_array(substr($dirname, 0, 1), ['.', '_']) === true) {
continue;
}
$dir = $root . '/' . $dirname;
if (is_dir($dir) !== true) {
continue;
}
$entry = $dir . '/index.php';
$script = $dir . '/index.js';
$styles = $dir . '/index.css';
if (is_file($entry) === true) {
F::loadOnce($entry, allowOutput: false);
} elseif (is_file($script) === true || is_file($styles) === true) {
// if no PHP file is present but an index.js or index.css,
// register as anonymous plugin (without actual extensions)
// to be picked up by the Panel\Document class when
// rendering the Panel view
static::plugin(
name: 'plugins/' . $dirname,
extends: [],
root: $dir
);
} else {
continue;
}
$loaded[] = $dir;
}
return $loaded;
}
}
Fatal error: Trait "Kirby\Cms\AppPlugins" not found in /home/theatredsv/dev/kirby/src/Cms/App.php on line 51