Skip to content

Instantly share code, notes, and snippets.

@rasteiner
Created August 14, 2021 16:03
Show Gist options
  • Save rasteiner/fc5c6de87530da7aee0da987e3751b29 to your computer and use it in GitHub Desktop.
Save rasteiner/fc5c6de87530da7aee0da987e3751b29 to your computer and use it in GitHub Desktop.
Stubs for Kirby 3 aliased classes
<?php
/**
* @copyright Copyright (c) 2021 Bastian Allgeier
* @author Bastian Allgeier
* @link http://getkirby.com/
* @license http://getkirby.com/license/
*/
/**
* Anything in your public path can be converted
* to an Asset object to use the same handy file
* methods and thumbnail generation as for any other
* Kirby files. Pass a relative path to the Asset
* object to create the asset.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Asset
{
use Kirby\Cms\FileFoundation, Kirby\Cms\FileModifications, Kirby\Toolkit\Properties;
/**
* Creates a new Asset object
* for the given path.
*
* @param string $path
*/
public function __construct(string $path) {}
/**
* Returns the alternative text for the asset
*
* @return null
*/
public function alt() : void {}
/**
* Returns a unique id for the asset
*
* @return string
*/
public function id() : string {}
/**
* Create a unique media hash
*
* @return string
*/
public function mediaHash() : string {}
/**
* Returns the relative path starting at the media folder
*
* @return string
*/
public function mediaPath() : string {}
/**
* Returns the absolute path to the file in the public media folder
*
* @return string
*/
public function mediaRoot() : string {}
/**
* Returns the absolute Url to the file in the public media folder
*
* @return string
*/
public function mediaUrl() : string {}
/**
* Returns the path of the file from the web root,
* excluding the filename
*
* @return string
*/
public function path() : string {}
/**
* Magic caller for asset methods
*
* @param string $method
* @param array $arguments
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function __call(string $method, array $arguments) : void {}
/**
* Converts the file object to a string
* In case of an image, it will create an image tag
* Otherwise it will return the url
*
* @return string
*/
public function __toString() : string {}
/**
* Returns the Image object
*
* @return \Kirby\Image\Image
*/
public function asset() : void {}
/**
* Checks if the file exists on disk
*
* @return bool
*/
public function exists() : bool {}
/**
* Returns the file extension
*
* @return string
*/
public function extension() : string {}
/**
* Converts the file to html
*
* @param array $attr
* @return string
*/
public function html(array $attr) : string {}
/**
* Checks if the file is a resizable image
*
* @return bool
*/
public function isResizable() : bool {}
/**
* Checks if a preview can be displayed for the file
* in the panel or in the frontend
*
* @return bool
*/
public function isViewable() : bool {}
/**
* Returns the app instance
*
* @return \Kirby\Cms\App
*/
public function kirby() : void {}
/**
* Get the file's last modification time.
*
* @param string $format
* @param string|null $handler date or strftime
* @return mixed
*/
public function modified(string $format, string $handler) : void {}
/**
* Returns the absolute path to the file root
*
* @return string|null
*/
public function root() : string {}
/**
* Convert the object to an array
*
* @return array
*/
public function toArray() : array {}
/**
* Returns the file type
*
* @return string|null
*/
public function type() : string {}
/**
* Returns the absolute url for the file
*
* @return string
*/
public function url() : string {}
/**
* Blurs the image by the given amount of pixels
*
* @param bool $pixels
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function blur(mixed $pixels = true) : void {}
/**
* Converts the image to black and white
*
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function bw() : void {}
/**
* Crops the image by the given width and height
*
* @param int $width
* @param int|null $height
* @param string|array $options
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function crop(int $width, int $height, mixed $options) : void {}
/**
* Alias for File::bw()
*
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function grayscale() : void {}
/**
* Alias for File::bw()
*
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function greyscale() : void {}
/**
* Sets the JPEG compression quality
*
* @param int $quality
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function quality(int $quality) : void {}
/**
* Resizes the file with the given width and height
* while keeping the aspect ratio.
*
* @param int|null $width
* @param int|null $height
* @param int|null $quality
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function resize(int $width, int $height, int $quality) : void {}
/**
* Create a srcset definition for the given sizes
* Sizes can be defined as a simple array. They can
* also be set up in the config with the thumbs.srcsets option.
* @since 3.1.0
*
* @param array|string|null $sizes
* @return string|null
*/
public function srcset(mixed $sizes) : string {}
/**
* Creates a modified version of images
* The media manager takes care of generating
* those modified versions and putting them
* in the right place. This is normally the
* `/media` folder of your installation, but
* could potentially also be a CDN or any other
* place.
*
* @param array|null|string $options
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function thumb(mixed $options) : void {}
/**
* Creates an instance with the same
* initial properties.
*
* @param array $props
* @return static
*/
public function clone(array $props) : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
}
/**
* The Collection class serves as foundation
* for the Pages, Files, Users and Structure
* classes. It handles object validation and sets
* the parent collection property for each object.
* The `getAttribute` method is also adjusted to
* handle values from Field objects correctly, so
* those can be used in filters as well.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Collection extends Kirby\Toolkit\Collection implements Stringable, Countable, Traversable, IteratorAggregate
{
use Kirby\Cms\HasMethods;
static public $filters;
public $data;
static public $methods;
/**
* Magic getter function
*
* @param string $key
* @param mixed $arguments
* @return mixed
*/
public function __call(string $key, mixed $arguments) : void {}
/**
* Creates a new Collection with the given objects
*
* @param array $objects
* @param object|null $parent
*/
public function __construct(mixed $objects, mixed $parent) {}
/**
* Internal setter for each object in the Collection.
* This takes care of Component validation and of setting
* the collection prop on each object correctly.
*
* @param string $id
* @param object $object
*/
public function __set(string $id, mixed $object) : void {}
/**
* Adds a single object or
* an entire second collection to the
* current collection
*
* @param mixed $object
*/
public function add(mixed $object) : void {}
/**
* Appends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function append(mixed $args) : void {}
/**
* Groups the items by a given field or callback. Returns a collection
* with an item for each group and a collection for each group.
*
* @param string|Closure $field
* @param bool $i Ignore upper/lowercase for group names
* @return \Kirby\Cms\Collection
* @throws \Kirby\Exception\Exception
*/
public function group(mixed $field, bool $i = true) : void {}
/**
* Checks if the given object or id
* is in the collection
*
* @param string|object $id
* @return bool
*/
public function has(mixed $id) : bool {}
/**
* Correct position detection for objects.
* The method will automatically detect objects
* or ids and then search accordingly.
*
* @param string|object $object
* @return int
*/
public function indexOf(mixed $object) : int {}
/**
* Returns a Collection without the given element(s)
*
* @param mixed ...$keys any number of keys, passed as individual arguments
* @return \Kirby\Cms\Collection
*/
public function not(mixed $keys) : void {}
/**
* Add pagination and return a sliced set of data.
*
* @param mixed ...$arguments
* @return \Kirby\Cms\Collection
*/
public function paginate(mixed $arguments) : void {}
/**
* Returns the parent model
*
* @return \Kirby\Cms\Model
*/
public function parent() : void {}
/**
* Prepends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function prepend(mixed $args) : void {}
/**
* Runs a combination of filter, sort, not,
* offset, limit, search and paginate on the collection.
* Any part of the query is optional.
*
* @param array $query
* @return static
*/
public function query(array $query) : void {}
/**
* Removes an object
*
* @param mixed $key the name of the key
*/
public function remove(mixed $key) : void {}
/**
* Searches the collection
*
* @param string|null $query
* @param array $params
* @return self
*/
public function search(string $query, mixed $params) : void {}
/**
* Converts all objects in the collection
* to an array. This can also take a callback
* function to further modify the array result.
*
* @param \Closure|null $map
* @return array
*/
public function toArray(Closure $map) : array {}
/**
* Improve var_dump() output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Low-level getter for elements
*
* @param mixed $key
* @return mixed
*/
public function __get(mixed $key) : void {}
/**
* Makes it possible to echo the entire object
*
* @return string
*/
public function __toString() : string {}
/**
* Low-level element remover
*
* @param mixed $key the name of the key
*/
public function __unset(mixed $key) : void {}
/**
* Creates chunks of the same size.
* The last chunk may be smaller
*
* @param int $size Number of elements per chunk
* @return static A new collection with an element for each chunk and
* a sub collection in each chunk
*/
public function chunk(int $size) : void {}
/**
* Returns a cloned instance of the collection
*
* @return $this
*/
public function clone() : void {}
/**
* Getter and setter for the data
*
* @param array|null $data
* @return array|$this
*/
public function data(array $data) : void {}
/**
* Clone and remove all elements from the collection
*
* @return static
*/
public function empty() : void {}
/**
* Adds all elements to the collection
*
* @param mixed $items
* @return static
*/
public function extend(mixed $items) : void {}
/**
* Filters elements by one of the
* predefined filter methods, by a
* custom filter function or an array of filters
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filter(mixed $field, mixed $args) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::filter`
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filterBy(mixed $args) : void {}
/**
* Find one or multiple elements by id
*
* @param string ...$keys
* @return mixed
*/
public function find(mixed $keys) : void {}
/**
* Find a single element by an attribute and its value
*
* @param string $attribute
* @param mixed $value
* @return mixed|null
*/
public function findBy(string $attribute, mixed $value) : void {}
/**
* Find a single element by key (id)
*
* @param string $key
* @return mixed
*/
public function findByKey(string $key) : void {}
/**
* Returns the first element
*
* @return mixed
*/
public function first() : void {}
/**
* Returns the elements in reverse order
*
* @return static
*/
public function flip() : void {}
/**
* Getter
*
* @param mixed $key
* @param mixed $default
* @return mixed
*/
public function get(mixed $key, mixed $default) : void {}
/**
* Extracts an attribute value from the given element
* in the collection. This is useful if elements in the collection
* might be objects, arrays or anything else and you need to
* get the value independently from that. We use it for `filter`.
*
* @param array|object $item
* @param string $attribute
* @param bool $split
* @param mixed $related
* @return mixed
*/
public function getAttribute(mixed $item, string $attribute, mixed $split, mixed $related) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::group`
*
* @param string|Closure $field
* @param bool $i
* @return \Kirby\Toolkit\Collection A new collection with an element for
* each group and a sub collection in
* each group
* @throws \Exception
*/
public function groupBy(mixed $args) : void {}
/**
* Returns a Collection with the intersection of the given elements
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return static
*/
public function intersection(mixed $other) : void {}
/**
* Checks if there is an intersection between the given collection and this collection
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return bool
*/
public function intersects(mixed $other) : bool {}
/**
* Checks if the number of elements is zero
*
* @return bool
*/
public function isEmpty() : bool {}
/**
* Checks if the number of elements is even
*
* @return bool
*/
public function isEven() : bool {}
/**
* Checks if the number of elements is more than zero
*
* @return bool
*/
public function isNotEmpty() : bool {}
/**
* Checks if the number of elements is odd
*
* @return bool
*/
public function isOdd() : bool {}
/**
* Returns the last element
*
* @return mixed
*/
public function last() : void {}
/**
* Returns a new object with a limited number of elements
*
* @param int $limit The number of elements to return
* @return static
*/
public function limit(int $limit) : void {}
/**
* Map a function to each element
*
* @param callable $callback
* @return $this
*/
public function map(callable $callback) : void {}
/**
* Returns the nth element from the collection
*
* @param int $n
* @return mixed
*/
public function nth(int $n) : void {}
/**
* Returns a new object starting from the given offset
*
* @param int $offset The index to start from
* @return static
*/
public function offset(int $offset) : void {}
/**
* Get the previously added pagination object
*
* @return \Kirby\Toolkit\Pagination|null
*/
public function pagination() : void {}
/**
* Extracts all values for a single field into
* a new array
*
* @param string $field
* @param string|null $split
* @param bool $unique
* @return array
*/
public function pluck(string $field, string $split, bool $unique) : array {}
/**
* Adds a new element to the collection
*
* @param mixed $key string or array
* @param mixed $value
* @return $this
*/
public function set(mixed $key, mixed $value) : void {}
/**
* Shuffle all elements
*
* @return static
*/
public function shuffle() : void {}
/**
* Returns a slice of the object
*
* @param int $offset The optional index to start the slice from
* @param int|null $limit The optional number of elements to return
* @return $this|static
*/
public function slice(int $offset, int $limit) : void {}
/**
* Get sort arguments from a string
*
* @param string $sort
* @return array
*/
public static function sortArgs(string $sort) : array {}
/**
* Sorts the elements by any number of fields
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sort() : void {}
/**
* Alias for `Kirby\Toolkit\Collection::sort`
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sortBy(mixed $args) : void {}
/**
* Converts the object into a JSON string
*
* @return string
*/
public function toJson() : string {}
/**
* Converts the object to a string
*
* @return string
*/
public function toString() : string {}
/**
* Returns a non-associative array
* with all values. If a mapping Closure is passed,
* all values are processed by the Closure.
*
* @param Closure|null $map
* @return array
*/
public function values(Closure $map) : array {}
/**
* The when method only executes the given Closure when the first parameter
* is true. If the first parameter is false, the Closure will not be executed.
* You may pass another Closure as the third parameter to the when method.
* This Closure will execute if the first parameter evaluates as false
*
* @since 3.3.0
* @param mixed $condition
* @param \Closure $callback
* @param \Closure|null $fallback
* @return mixed
*/
public function when(mixed $condition, Closure $callback, Closure $fallback) : void {}
/**
* Alias for $this->not()
*
* @param string ...$keys any number of keys, passed as individual arguments
* @return static
*/
public function without(mixed $keys) : void {}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator
*/
public function getIterator() : void {}
/**
* Returns the current key
*
* @return string
*/
public function key() : void {}
/**
* Returns an array of all keys
*
* @return array
*/
public function keys() : array {}
/**
* Returns the current element
*
* @return mixed
*/
public function current() : void {}
/**
* Moves the cursor to the previous element
* and returns it
*
* @return mixed
*/
public function prev() : void {}
/**
* Moves the cursor to the next element
* and returns it
*
* @return mixed
*/
public function next() : void {}
/**
* Moves the cusor to the first element
*/
public function rewind() : void {}
/**
* Checks if the current element is valid
*
* @return bool
*/
public function valid() : bool {}
/**
* Counts all elements
*
* @return int
*/
public function count() : int {}
/**
* Tries to find the key for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function keyOf(mixed $needle) : void {}
/**
* Checks if the current key is set
*
* @param mixed $key the key to check
* @return bool
*/
public function __isset(mixed $key) : bool {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
}
/**
* Extension of the Toolkit `Dir` class with a new
* `Dir::inventory` method, that handles scanning directories
* and converts the results into our children, files and
* other page stuff.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Dir extends Kirby\Toolkit\Dir
{
static public $numSeparator;
static public $ignore;
/**
* Scans the directory and analyzes files,
* content, meta info and children. This is used
* in Page, Site and User objects to fetch all
* relevant information.
*
* @param string $dir
* @param string $contentExtension
* @param array|null $contentIgnore
* @param bool $multilang
* @return array
*/
public static function inventory(string $dir, string $contentExtension = 'txt', array $contentIgnore, bool $multilang) : array {}
/**
* Copy the directory to a new destination
*
* @param string $dir
* @param string $target
* @param bool $recursive
* @param array $ignore
* @return bool
*/
public static function copy(string $dir, string $target, bool $recursive = true, array $ignore) : bool {}
/**
* Get all subdirectories
*
* @param string $dir
* @param array $ignore
* @param bool $absolute
* @return array
*/
public static function dirs(string $dir, array $ignore, bool $absolute) : array {}
/**
* Checks if the directory exists on disk
*
* @param string $dir
* @return bool
*/
public static function exists(string $dir) : bool {}
/**
* Get all files
*
* @param string $dir
* @param array $ignore
* @param bool $absolute
* @return array
*/
public static function files(string $dir, array $ignore, bool $absolute) : array {}
/**
* Read the directory and all subdirectories
*
* @param string $dir
* @param bool $recursive
* @param array $ignore
* @param string $path
* @return array
*/
public static function index(string $dir, bool $recursive, array $ignore, string $path) : void {}
/**
* Checks if the folder has any contents
*
* @param string $dir
* @return bool
*/
public static function isEmpty(string $dir) : bool {}
/**
* Checks if the directory is readable
*
* @param string $dir
* @return bool
*/
public static function isReadable(string $dir) : bool {}
/**
* Checks if the directory is writable
*
* @param string $dir
* @return bool
*/
public static function isWritable(string $dir) : bool {}
/**
* Create a (symbolic) link to a directory
*
* @param string $source
* @param string $link
* @return bool
*/
public static function link(string $source, string $link) : bool {}
/**
* Creates a new directory
*
* @param string $dir The path for the new directory
* @param bool $recursive Create all parent directories, which don't exist
* @return bool True: the dir has been created, false: creating failed
* @throws \Exception If a file with the provided path already exists or the parent directory is not writable
*/
public static function make(string $dir, bool $recursive = true) : bool {}
/**
* Recursively check when the dir and all
* subfolders have been modified for the last time.
*
* @param string $dir The path of the directory
* @param string $format
* @param string $handler
* @return int|string
*/
public static function modified(string $dir, string $format, string $handler = 'date') : void {}
/**
* Moves a directory to a new location
*
* @param string $old The current path of the directory
* @param string $new The desired path where the dir should be moved to
* @return bool true: the directory has been moved, false: moving failed
*/
public static function move(string $old, string $new) : bool {}
/**
* Returns a nicely formatted size of all the contents of the folder
*
* @param string $dir The path of the directory
* @return mixed
*/
public static function niceSize(string $dir) : void {}
/**
* Reads all files from a directory and returns them as an array.
* It skips unwanted invisible stuff.
*
* @param string $dir The path of directory
* @param array $ignore Optional array with filenames, which should be ignored
* @param bool $absolute If true, the full path for each item will be returned
* @return array An array of filenames
*/
public static function read(string $dir, array $ignore, bool $absolute) : array {}
/**
* Removes a folder including all containing files and folders
*
* @param string $dir
* @return bool
*/
public static function remove(string $dir) : bool {}
/**
* Gets the size of the directory and all subfolders and files
*
* @param string $dir The path of the directory
* @return mixed
*/
public static function size(string $dir) : void {}
/**
* Checks if the directory or any subdirectory has been
* modified after the given timestamp
*
* @param string $dir
* @param int $time
* @return bool
*/
public static function wasModifiedAfter(string $dir, int $time) : bool {}
}
/**
* Every field in a Kirby content text file
* is being converted into such a Field object.
*
* Field methods can be registered for those Field
* objects, which can then be used to transform or
* convert the field value. This enables our
* daisy-chaining API for templates and other components
*
* ```php
* // Page field example with lowercase conversion
* $page->myField()->lower();
* ```
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Field implements Stringable
{
static public $aliases;
static public $methods;
public $value;
/**
* Magic caller for field methods
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments) : void {}
/**
* Creates a new field object
*
* @param object|null $parent
* @param string $key
* @param mixed $value
*/
public function __construct(object $parent, string $key, mixed $value) {}
/**
* Simplifies the var_dump result
*
* @see Field::toArray
* @return array
*/
public function __debugInfo() : void {}
/**
* Makes it possible to simply echo
* or stringify the entire object
*
* @see Field::toString
* @return string
*/
public function __toString() : string {}
/**
* Checks if the field exists in the content data array
*
* @return bool
*/
public function exists() : bool {}
/**
* Checks if the field content is empty
*
* @return bool
*/
public function isEmpty() : bool {}
/**
* Checks if the field content is not empty
*
* @return bool
*/
public function isNotEmpty() : bool {}
/**
* Returns the name of the field
*
* @return string
*/
public function key() : string {}
/**
* @see Field::parent()
* @return \Kirby\Cms\Model|null
*/
public function model() : void {}
/**
* Provides a fallback if the field value is empty
*
* @param mixed $fallback
* @return $this|static
*/
public function or(mixed $fallback) : void {}
/**
* Returns the parent object of the field
*
* @return \Kirby\Cms\Model|null
*/
public function parent() : void {}
/**
* Converts the Field object to an array
*
* @return array
*/
public function toArray() : array {}
/**
* Returns the field value as string
*
* @return string
*/
public function toString() : string {}
/**
* Returns the field content. If a new value is passed,
* the modified field will be returned. Otherwise it
* will return the field value.
*
* @param string|\Closure $value
* @return mixed
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function value(mixed $value) : void {}
}
/**
* The `$file` object provides a set
* of methods that can be used when
* dealing with a single image or
* other media file, like getting the
* URL or resizing an image. It also
* handles file meta data.
*
* The File class is a wrapper around
* the Kirby\Image\Image class, which
* is used to handle all file methods.
* In addition the File class handles
* File meta data via Kirby\Cms\Content.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class File extends Kirby\Cms\ModelWithContent implements Stringable
{
use Kirby\Cms\FileActions, Kirby\Cms\FileFoundation, Kirby\Cms\FileModifications, Kirby\Cms\HasMethods, Kirby\Cms\HasSiblings;
const CLASS_ALIAS = 'file';
static public $methods;
public $content;
public $translations;
static public $kirby;
/**
* Magic caller for file methods
* and content fields. (in this order)
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments) : void {}
/**
* Creates a new File object
*
* @param array $props
*/
public function __construct(array $props) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Returns the url to api endpoint
*
* @internal
* @param bool $relative
* @return string
*/
public function apiUrl(bool $relative) : string {}
/**
* Returns the Image object
*
* @internal
* @return \Kirby\Image\Image
*/
public function asset() : void {}
/**
* Returns the FileBlueprint object for the file
*
* @return \Kirby\Cms\FileBlueprint
*/
public function blueprint() : void {}
/**
* Store the template in addition to the
* other content.
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return array
*/
public function contentFileData(array $data, string $languageCode) : array {}
/**
* Returns the directory in which
* the content file is located
*
* @internal
* @return string
*/
public function contentFileDirectory() : string {}
/**
* Filename for the content file
*
* @internal
* @return string
*/
public function contentFileName() : string {}
/**
* Provides a kirbytag or markdown
* tag for the file, which will be
* used in the panel, when the file
* gets dragged onto a textarea
*
* @internal
* @param string|null $type (null|auto|kirbytext|markdown)
* @param bool $absolute
* @return string
*/
public function dragText(string $type, bool $absolute) : string {}
/**
* Constructs a File object
*
* @internal
* @param mixed $props
* @return static
*/
public static function factory(mixed $props) : void {}
/**
* Returns the filename with extension
*
* @return string
*/
public function filename() : string {}
/**
* Returns the parent Files collection
*
* @return \Kirby\Cms\Files
*/
public function files() : void {}
/**
* Returns the id
*
* @return string
*/
public function id() : string {}
/**
* Compares the current object with the given file object
*
* @param \Kirby\Cms\File $file
* @return bool
*/
public function is(Kirby\Cms\File $file) : bool {}
/**
* Check if the file can be read by the current user
*
* @return bool
*/
public function isReadable() : bool {}
/**
* Creates a unique media hash
*
* @internal
* @return string
*/
public function mediaHash() : string {}
/**
* Returns the absolute path to the file in the public media folder
*
* @internal
* @return string
*/
public function mediaRoot() : string {}
/**
* Creates a non-guessable token string for this file
*
* @internal
* @return string
*/
public function mediaToken() : string {}
/**
* Returns the absolute Url to the file in the public media folder
*
* @internal
* @return string
*/
public function mediaUrl() : string {}
/**
* Get the file's last modification time.
*
* @param string|null $format
* @param string|null $handler date or strftime
* @param string|null $languageCode
* @return mixed
*/
public function modified(string $format, string $handler, string $languageCode) : void {}
/**
* Returns the parent Page object
*
* @return \Kirby\Cms\Page|null
*/
public function page() : void {}
/**
* Panel icon definition
*
* @internal
* @param array|null $params
* @return array
*/
public function panelIcon(array $params) : array {}
/**
* Returns an array of all actions
* that can be performed in the Panel
*
* @since 3.3.0 This also checks for the lock status
* @since 3.5.1 This also checks for matching accept settings
*
* @param array $unlock An array of options that will be force-unlocked
* @return array
*/
public function panelOptions(array $unlock) : array {}
/**
* Returns the full path without leading slash
*
* @internal
* @return string
*/
public function panelPath() : string {}
/**
* Prepares the response data for file pickers
* and file fields
*
* @param array|null $params
* @return array
*/
public function panelPickerData(array $params) : array {}
/**
* Returns the url to the editing view
* in the panel
*
* @internal
* @param bool $relative
* @return string
*/
public function panelUrl(bool $relative) : string {}
/**
* Returns the parent Model object
*
* @return \Kirby\Cms\Model
*/
public function parent() : void {}
/**
* Returns the parent id if a parent exists
*
* @internal
* @return string|null
*/
public function parentId() : string {}
/**
* Returns a collection of all parent pages
*
* @return \Kirby\Cms\Pages
*/
public function parents() : void {}
/**
* Returns the permissions object for this file
*
* @return \Kirby\Cms\FilePermissions
*/
public function permissions() : void {}
/**
* Returns the absolute root to the file
*
* @return string|null
*/
public function root() : string {}
/**
* Returns the parent Site object
*
* @return \Kirby\Cms\Site
*/
public function site() : void {}
/**
* Returns the final template
*
* @return string|null
*/
public function template() : string {}
/**
* Returns siblings with the same template
*
* @param bool $self
* @return \Kirby\Cms\Files
*/
public function templateSiblings(bool $self = true) : void {}
/**
* Extended info for the array export
* by injecting the information from
* the asset.
*
* @return array
*/
public function toArray() : array {}
/**
* Returns the Url
*
* @return string
*/
public function url() : string {}
/**
* Returns an array with all blueprints that are available
*
* @param string|null $inSection
* @return array
*/
public function blueprints(string $inSection) : array {}
/**
* Returns the content
*
* @param string|null $languageCode
* @return \Kirby\Cms\Content
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function content(string $languageCode) : void {}
/**
* Returns the absolute path to the content file
*
* @internal
* @param string|null $languageCode
* @param bool $force
* @return string
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function contentFile(string $languageCode, bool $force) : string {}
/**
* Returns an array with all content files
*
* @return array
*/
public function contentFiles() : array {}
/**
* Returns the extension of the content file
*
* @internal
* @return string
*/
public function contentFileExtension() : string {}
/**
* Decrement a given field value
*
* @param string $field
* @param int $by
* @param int $min
* @return static
*/
public function decrement(string $field, int $by = 1, int $min) : void {}
/**
* Returns the drag text from a custom callback
* if the callback is defined in the config
*
* @internal
* @param string $type markdown or kirbytext
* @param mixed ...$args
* @return string|null
*/
public function dragTextFromCallback(string $type, mixed $args) : string {}
/**
* Returns the correct drag text type
* depending on the given type or the
* configuration
*
* @internal
* @param string $type (null|auto|kirbytext|markdown)
* @return string
*/
public function dragTextType(string $type) : string {}
/**
* Returns all content validation errors
*
* @return array
*/
public function errors() : array {}
/**
* Increment a given field value
*
* @param string $field
* @param int $by
* @param int|null $max
* @return static
*/
public function increment(string $field, int $by = 1, int $max) : void {}
/**
* Checks if the model is locked for the current user
*
* @return bool
*/
public function isLocked() : bool {}
/**
* Checks if the data has any errors
*
* @return bool
*/
public function isValid() : bool {}
/**
* Returns the lock object for this model
*
* Only if a content directory exists,
* virtual pages will need to overwrite this method
*
* @return \Kirby\Cms\ContentLock|null
*/
public function lock() : void {}
/**
* @internal
* @param string|array|false|null $settings
* @return array|null
*/
public function panelImage(mixed $settings) : array {}
/**
* Creates a string query, starting from the model
*
* @internal
* @param string|null $query
* @param string|null $expect
* @return mixed
*/
public function query(string $query, string $expect) : void {}
/**
* Read the content from the content file
*
* @internal
* @param string|null $languageCode
* @return array
*/
public function readContent(string $languageCode) : array {}
/**
* Stores the content on disk
*
* @internal
* @param array|null $data
* @param string|null $languageCode
* @param bool $overwrite
* @return static
*/
public function save(array $data, string $languageCode, bool $overwrite) : void {}
/**
* String template builder
*
* @param string|null $template
* @param array $data
* @param string $fallback Fallback for tokens in the template that cannot be replaced
* @return string
*/
public function toString(string $template, array $data, string $fallback) : string {}
/**
* Returns a single translation by language code
* If no code is specified the current translation is returned
*
* @param string|null $languageCode
* @return \Kirby\Cms\ContentTranslation|null
*/
public function translation(string $languageCode) : void {}
/**
* Returns the translations collection
*
* @return \Kirby\Cms\Collection
*/
public function translations() : void {}
/**
* Updates the model data
*
* @param array|null $input
* @param string|null $languageCode
* @param bool $validate
* @return static
* @throws \Kirby\Exception\InvalidArgumentException If the input array contains invalid values
*/
public function update(array $input, string $languageCode, bool $validate) : void {}
/**
* Low level data writer method
* to store the given data on disk or anywhere else
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return bool
*/
public function writeContent(array $data, string $languageCode) : bool {}
/**
* Converts the file object to a string
* In case of an image, it will create an image tag
* Otherwise it will return the url
*
* @return string
*/
public function __toString() : string {}
/**
* Returns the app instance
*
* @return \Kirby\Cms\App
*/
public function kirby() : void {}
/**
* Setter for the parent site object
*
* @internal
* @param \Kirby\Cms\Site|null $site
* @return $this
*/
public function setSite(Kirby\Cms\Site $site) : void {}
/**
* Creates an instance with the same
* initial properties.
*
* @param array $props
* @return static
*/
public function clone(array $props) : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
/**
* Renames the file without touching the extension
* The store is used to actually execute this.
*
* @param string $name
* @param bool $sanitize
* @return $this|static
* @throws \Kirby\Exception\LogicException
*/
public function changeName(string $name, bool $sanitize = true) : void {}
/**
* Changes the file's sorting number in the meta file
*
* @param int $sort
* @return static
*/
public function changeSort(int $sort) : void {}
/**
* Copy the file to the given page
*
* @param \Kirby\Cms\Page $page
* @return \Kirby\Cms\File
*/
public function copy(Kirby\Cms\Page $page) : void {}
/**
* Creates a new file on disk and returns the
* File object. The store is used to handle file
* writing, so it can be replaced by any other
* way of generating files.
*
* @param array $props
* @return static
* @throws \Kirby\Exception\InvalidArgumentException
* @throws \Kirby\Exception\LogicException
*/
public static function create(array $props) : void {}
/**
* Deletes the file. The store is used to
* manipulate the filesystem or whatever you prefer.
*
* @return bool
*/
public function delete() : bool {}
/**
* Move the file to the public media folder
* if it's not already there.
*
* @return $this
*/
public function publish() : void {}
/**
* Replaces the file. The source must
* be an absolute path to a file or a Url.
* The store handles the replacement so it
* finally decides what it will support as
* source.
*
* @param string $source
* @return static
* @throws \Kirby\Exception\LogicException
*/
public function replace(string $source) : void {}
/**
* Remove all public versions of this file
*
* @return $this
*/
public function unpublish() : void {}
/**
* Checks if the file exists on disk
*
* @return bool
*/
public function exists() : bool {}
/**
* Returns the file extension
*
* @return string
*/
public function extension() : string {}
/**
* Converts the file to html
*
* @param array $attr
* @return string
*/
public function html(array $attr) : string {}
/**
* Checks if the file is a resizable image
*
* @return bool
*/
public function isResizable() : bool {}
/**
* Checks if a preview can be displayed for the file
* in the panel or in the frontend
*
* @return bool
*/
public function isViewable() : bool {}
/**
* Returns the file type
*
* @return string|null
*/
public function type() : string {}
/**
* Blurs the image by the given amount of pixels
*
* @param bool $pixels
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function blur(mixed $pixels = true) : void {}
/**
* Converts the image to black and white
*
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function bw() : void {}
/**
* Crops the image by the given width and height
*
* @param int $width
* @param int|null $height
* @param string|array $options
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function crop(int $width, int $height, mixed $options) : void {}
/**
* Alias for File::bw()
*
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function grayscale() : void {}
/**
* Alias for File::bw()
*
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function greyscale() : void {}
/**
* Sets the JPEG compression quality
*
* @param int $quality
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
*/
public function quality(int $quality) : void {}
/**
* Resizes the file with the given width and height
* while keeping the aspect ratio.
*
* @param int|null $width
* @param int|null $height
* @param int|null $quality
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function resize(int $width, int $height, int $quality) : void {}
/**
* Create a srcset definition for the given sizes
* Sizes can be defined as a simple array. They can
* also be set up in the config with the thumbs.srcsets option.
* @since 3.1.0
*
* @param array|string|null $sizes
* @return string|null
*/
public function srcset(mixed $sizes) : string {}
/**
* Creates a modified version of images
* The media manager takes care of generating
* those modified versions and putting them
* in the right place. This is normally the
* `/media` folder of your installation, but
* could potentially also be a CDN or any other
* place.
*
* @param array|null|string $options
* @return \Kirby\Cms\FileVersion|\Kirby\Cms\File
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function thumb(mixed $options) : void {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
/**
* Returns the position / index in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return int
*/
public function indexOf(mixed $collection) : int {}
/**
* Returns the next item in the collection if available
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Model|null
*/
public function next(mixed $collection) : void {}
/**
* Returns the end of the collection starting after the current item
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Collection
*/
public function nextAll(mixed $collection) : void {}
/**
* Returns the previous item in the collection if available
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Model|null
*/
public function prev(mixed $collection) : void {}
/**
* Returns the beginning of the collection before the current item
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Collection
*/
public function prevAll(mixed $collection) : void {}
/**
* Returns all sibling elements
*
* @param bool $self
* @return \Kirby\Cms\Collection
*/
public function siblings(bool $self = true) : void {}
/**
* Checks if there's a next item in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasNext(mixed $collection) : bool {}
/**
* Checks if there's a previous item in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasPrev(mixed $collection) : bool {}
/**
* Checks if the item is the first in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function isFirst(mixed $collection) : bool {}
/**
* Checks if the item is the last in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function isLast(mixed $collection) : bool {}
/**
* Checks if the item is at a certain position
*
* @param \Kirby\Cms\Collection|null $collection
* @param int $n
*
* @return bool
*/
public function isNth(int $n, mixed $collection) : bool {}
}
/**
* The `$files` object extends the general
* `Collection` class and refers to a
* collection of files, i.e. images, documents
* etc. Files can be filtered, searched,
* converted, modified or evaluated with the
* following methods:
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Files extends Kirby\Cms\Collection implements IteratorAggregate, Traversable, Countable, Stringable
{
static public $methods;
static public $filters;
public $data;
/**
* Adds a single file or
* an entire second collection to the
* current collection
*
* @param mixed $object
* @return $this
*/
public function add(mixed $object) : void {}
/**
* Sort all given files by the
* order in the array
*
* @param array $files List of file ids
* @param int $offset Sorting offset
* @return $this
*/
public function changeSort(array $files, int $offset) : void {}
/**
* Creates a files collection from an array of props
*
* @param array $files
* @param \Kirby\Cms\Model $parent
* @return static
*/
public static function factory(array $files, Kirby\Cms\Model $parent) : void {}
/**
* Tries to find a file by id/filename
*
* @param string $id
* @return \Kirby\Cms\File|null
*/
public function findById(string $id) : void {}
/**
* Alias for FilesFinder::findById() which is
* used internally in the Files collection to
* map the get method correctly.
*
* @param string $key
* @return \Kirby\Cms\File|null
*/
public function findByKey(string $key) : void {}
/**
* Filter all files by the given template
*
* @param null|string|array $template
* @return $this|static
*/
public function template(mixed $template) : void {}
/**
* Magic getter function
*
* @param string $key
* @param mixed $arguments
* @return mixed
*/
public function __call(string $key, mixed $arguments) : void {}
/**
* Creates a new Collection with the given objects
*
* @param array $objects
* @param object|null $parent
*/
public function __construct(mixed $objects, mixed $parent) {}
/**
* Internal setter for each object in the Collection.
* This takes care of Component validation and of setting
* the collection prop on each object correctly.
*
* @param string $id
* @param object $object
*/
public function __set(string $id, mixed $object) : void {}
/**
* Appends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function append(mixed $args) : void {}
/**
* Groups the items by a given field or callback. Returns a collection
* with an item for each group and a collection for each group.
*
* @param string|Closure $field
* @param bool $i Ignore upper/lowercase for group names
* @return \Kirby\Cms\Collection
* @throws \Kirby\Exception\Exception
*/
public function group(mixed $field, bool $i = true) : void {}
/**
* Checks if the given object or id
* is in the collection
*
* @param string|object $id
* @return bool
*/
public function has(mixed $id) : bool {}
/**
* Correct position detection for objects.
* The method will automatically detect objects
* or ids and then search accordingly.
*
* @param string|object $object
* @return int
*/
public function indexOf(mixed $object) : int {}
/**
* Returns a Collection without the given element(s)
*
* @param mixed ...$keys any number of keys, passed as individual arguments
* @return \Kirby\Cms\Collection
*/
public function not(mixed $keys) : void {}
/**
* Add pagination and return a sliced set of data.
*
* @param mixed ...$arguments
* @return \Kirby\Cms\Collection
*/
public function paginate(mixed $arguments) : void {}
/**
* Returns the parent model
*
* @return \Kirby\Cms\Model
*/
public function parent() : void {}
/**
* Prepends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function prepend(mixed $args) : void {}
/**
* Runs a combination of filter, sort, not,
* offset, limit, search and paginate on the collection.
* Any part of the query is optional.
*
* @param array $query
* @return static
*/
public function query(array $query) : void {}
/**
* Removes an object
*
* @param mixed $key the name of the key
*/
public function remove(mixed $key) : void {}
/**
* Searches the collection
*
* @param string|null $query
* @param array $params
* @return self
*/
public function search(string $query, mixed $params) : void {}
/**
* Converts all objects in the collection
* to an array. This can also take a callback
* function to further modify the array result.
*
* @param \Closure|null $map
* @return array
*/
public function toArray(Closure $map) : array {}
/**
* Improve var_dump() output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Low-level getter for elements
*
* @param mixed $key
* @return mixed
*/
public function __get(mixed $key) : void {}
/**
* Makes it possible to echo the entire object
*
* @return string
*/
public function __toString() : string {}
/**
* Low-level element remover
*
* @param mixed $key the name of the key
*/
public function __unset(mixed $key) : void {}
/**
* Creates chunks of the same size.
* The last chunk may be smaller
*
* @param int $size Number of elements per chunk
* @return static A new collection with an element for each chunk and
* a sub collection in each chunk
*/
public function chunk(int $size) : void {}
/**
* Returns a cloned instance of the collection
*
* @return $this
*/
public function clone() : void {}
/**
* Getter and setter for the data
*
* @param array|null $data
* @return array|$this
*/
public function data(array $data) : void {}
/**
* Clone and remove all elements from the collection
*
* @return static
*/
public function empty() : void {}
/**
* Adds all elements to the collection
*
* @param mixed $items
* @return static
*/
public function extend(mixed $items) : void {}
/**
* Filters elements by one of the
* predefined filter methods, by a
* custom filter function or an array of filters
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filter(mixed $field, mixed $args) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::filter`
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filterBy(mixed $args) : void {}
/**
* Find one or multiple elements by id
*
* @param string ...$keys
* @return mixed
*/
public function find(mixed $keys) : void {}
/**
* Find a single element by an attribute and its value
*
* @param string $attribute
* @param mixed $value
* @return mixed|null
*/
public function findBy(string $attribute, mixed $value) : void {}
/**
* Returns the first element
*
* @return mixed
*/
public function first() : void {}
/**
* Returns the elements in reverse order
*
* @return static
*/
public function flip() : void {}
/**
* Getter
*
* @param mixed $key
* @param mixed $default
* @return mixed
*/
public function get(mixed $key, mixed $default) : void {}
/**
* Extracts an attribute value from the given element
* in the collection. This is useful if elements in the collection
* might be objects, arrays or anything else and you need to
* get the value independently from that. We use it for `filter`.
*
* @param array|object $item
* @param string $attribute
* @param bool $split
* @param mixed $related
* @return mixed
*/
public function getAttribute(mixed $item, string $attribute, mixed $split, mixed $related) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::group`
*
* @param string|Closure $field
* @param bool $i
* @return \Kirby\Toolkit\Collection A new collection with an element for
* each group and a sub collection in
* each group
* @throws \Exception
*/
public function groupBy(mixed $args) : void {}
/**
* Returns a Collection with the intersection of the given elements
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return static
*/
public function intersection(mixed $other) : void {}
/**
* Checks if there is an intersection between the given collection and this collection
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return bool
*/
public function intersects(mixed $other) : bool {}
/**
* Checks if the number of elements is zero
*
* @return bool
*/
public function isEmpty() : bool {}
/**
* Checks if the number of elements is even
*
* @return bool
*/
public function isEven() : bool {}
/**
* Checks if the number of elements is more than zero
*
* @return bool
*/
public function isNotEmpty() : bool {}
/**
* Checks if the number of elements is odd
*
* @return bool
*/
public function isOdd() : bool {}
/**
* Returns the last element
*
* @return mixed
*/
public function last() : void {}
/**
* Returns a new object with a limited number of elements
*
* @param int $limit The number of elements to return
* @return static
*/
public function limit(int $limit) : void {}
/**
* Map a function to each element
*
* @param callable $callback
* @return $this
*/
public function map(callable $callback) : void {}
/**
* Returns the nth element from the collection
*
* @param int $n
* @return mixed
*/
public function nth(int $n) : void {}
/**
* Returns a new object starting from the given offset
*
* @param int $offset The index to start from
* @return static
*/
public function offset(int $offset) : void {}
/**
* Get the previously added pagination object
*
* @return \Kirby\Toolkit\Pagination|null
*/
public function pagination() : void {}
/**
* Extracts all values for a single field into
* a new array
*
* @param string $field
* @param string|null $split
* @param bool $unique
* @return array
*/
public function pluck(string $field, string $split, bool $unique) : array {}
/**
* Adds a new element to the collection
*
* @param mixed $key string or array
* @param mixed $value
* @return $this
*/
public function set(mixed $key, mixed $value) : void {}
/**
* Shuffle all elements
*
* @return static
*/
public function shuffle() : void {}
/**
* Returns a slice of the object
*
* @param int $offset The optional index to start the slice from
* @param int|null $limit The optional number of elements to return
* @return $this|static
*/
public function slice(int $offset, int $limit) : void {}
/**
* Get sort arguments from a string
*
* @param string $sort
* @return array
*/
public static function sortArgs(string $sort) : array {}
/**
* Sorts the elements by any number of fields
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sort() : void {}
/**
* Alias for `Kirby\Toolkit\Collection::sort`
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sortBy(mixed $args) : void {}
/**
* Converts the object into a JSON string
*
* @return string
*/
public function toJson() : string {}
/**
* Converts the object to a string
*
* @return string
*/
public function toString() : string {}
/**
* Returns a non-associative array
* with all values. If a mapping Closure is passed,
* all values are processed by the Closure.
*
* @param Closure|null $map
* @return array
*/
public function values(Closure $map) : array {}
/**
* The when method only executes the given Closure when the first parameter
* is true. If the first parameter is false, the Closure will not be executed.
* You may pass another Closure as the third parameter to the when method.
* This Closure will execute if the first parameter evaluates as false
*
* @since 3.3.0
* @param mixed $condition
* @param \Closure $callback
* @param \Closure|null $fallback
* @return mixed
*/
public function when(mixed $condition, Closure $callback, Closure $fallback) : void {}
/**
* Alias for $this->not()
*
* @param string ...$keys any number of keys, passed as individual arguments
* @return static
*/
public function without(mixed $keys) : void {}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator
*/
public function getIterator() : void {}
/**
* Returns the current key
*
* @return string
*/
public function key() : void {}
/**
* Returns an array of all keys
*
* @return array
*/
public function keys() : array {}
/**
* Returns the current element
*
* @return mixed
*/
public function current() : void {}
/**
* Moves the cursor to the previous element
* and returns it
*
* @return mixed
*/
public function prev() : void {}
/**
* Moves the cursor to the next element
* and returns it
*
* @return mixed
*/
public function next() : void {}
/**
* Moves the cusor to the first element
*/
public function rewind() : void {}
/**
* Checks if the current element is valid
*
* @return bool
*/
public function valid() : bool {}
/**
* Counts all elements
*
* @return int
*/
public function count() : int {}
/**
* Tries to find the key for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function keyOf(mixed $needle) : void {}
/**
* Checks if the current key is set
*
* @param mixed $key the key to check
* @return bool
*/
public function __isset(mixed $key) : bool {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
}
/**
* The `Html` class provides methods for building
* common HTML tags and also contains some helper
* methods.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Html extends Kirby\Toolkit\Html
{
static public $entities;
static public $void;
static public $voidList;
/**
* Generates an `a` tag with an absolute Url
*
* @param string|null $href Relative or absolute Url
* @param string|array|null $text If `null`, the link will be used as link text. If an array is passed, each element will be added unencoded
* @param array $attr Additional attributes for the a tag.
* @return string
*/
public static function link(string $href, mixed $text, array $attr) : string {}
/**
* Generic HTML tag generator
* Can be called like `Html::p('A paragraph', ['class' => 'text'])`
*
* @param string $tag Tag name
* @param array $arguments Further arguments for the Html::tag() method
* @return string
*/
public static function __callStatic(string $tag, array $arguments) : string {}
/**
* Generates an `<a>` tag; automatically supports mailto: and tel: links
*
* @param string $href The URL for the `<a>` tag
* @param string|array|null $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(string $href, mixed $text, array $attr) : string {}
/**
* Generates a single attribute or a list of attributes
*
* @param string|array $name String: A single attribute with that name will be generated.
* Key-value array: A list of attributes will be generated. Don't pass a second argument in that case.
* @param mixed $value If used with a `$name` string, pass the value of the attribute here.
* If used with a `$name` array, this can be set to `false` to disable attribute sorting.
* @return string|null The generated HTML attributes string
*/
public static function attr(mixed $name, mixed $value) : string {}
/**
* Converts lines in a string into HTML breaks
*
* @param string $string
* @return string
*/
public static function breaks(string $string) : string {}
/**
* Generates an `<a>` tag with `mailto:`
*
* @param string $email The email address
* @param string|array|null $text The optional text; if `null`, the email address will be used as text
* @param array $attr Additional attributes for the tag
* @return string The generated HTML
*/
public static function email(string $email, mixed $text, array $attr) : string {}
/**
* Converts a string to an HTML-safe string
*
* @param string|null $string
* @param bool $keepTags If true, existing tags won't be escaped
* @return string The HTML string
*
* @psalm-suppress ParamNameMismatch
*/
public static function encode(string $string, bool $keepTags) : string {}
/**
* Returns the entity translation table
*
* @return array
*/
public static function entities() : array {}
/**
* Creates a `<figure>` tag with optional caption
*
* @param string|array $content Contents of the `<figure>` tag
* @param string|array $caption Optional `<figcaption>` text to use
* @param array $attr Additional attributes for the `<figure>` tag
* @return string The generated HTML
*/
public static function figure(mixed $content, mixed $caption, array $attr) : string {}
/**
* Embeds a GitHub Gist
*
* @param string $url Gist URL
* @param string|null $file Optional specific file to embed
* @param array $attr Additional attributes for the `<script>` tag
* @return string The generated HTML
*/
public static function gist(string $url, string $file, array $attr) : string {}
/**
* Creates an `<iframe>`
*
* @param string $src
* @param array $attr Additional attributes for the `<iframe>` tag
* @return string The generated HTML
*/
public static function iframe(string $src, array $attr) : string {}
/**
* Generates an `<img>` tag
*
* @param string $src The URL of the image
* @param array $attr Additional attributes for the `<img>` tag
* @return string The generated HTML
*/
public static function img(string $src, array $attr) : string {}
/**
* Checks if a tag is self-closing
*
* @param string $tag
* @return bool
*/
public static function isVoid(string $tag) : bool {}
/**
* Add noopener & noreferrer to rels when target is `_blank`
*
* @param string|null $rel Current `rel` value
* @param string|null $target Current `target` value
* @return string|null New `rel` value or `null` if not needed
*/
public static function rel(string $rel, string $target) : string {}
/**
* Builds an HTML tag
*
* @param string $name Tag name
* @param array|string $content Scalar value or array with multiple lines of content; self-closing
* tags are generated automatically based on the `Html::isVoid()` list
* @param array $attr An associative array with additional attributes for the tag
* @param string|null $indent Indentation string, defaults to two spaces or `null` for output on one line
* @param int $level Indentation level
* @return string The generated HTML
*/
public static function tag(string $name, mixed $content, array $attr, string $indent, int $level) : string {}
/**
* Generates an `<a>` tag for a phone number
*
* @param string $tel The phone number
* @param string|array|null $text The optional text; if `null`, the phone number will be used as text
* @param array $attr Additional attributes for the tag
* @return string The generated HTML
*/
public static function tel(string $tel, mixed $text, array $attr) : string {}
/**
* Properly encodes tag contents
*
* @param mixed $value
* @return string|null
*/
public static function value(mixed $value) : string {}
/**
* Creates a video embed via `<iframe>` for YouTube or Vimeo
* videos; the embed URLs are automatically detected from
* the given URL
*
* @param string $url Video URL
* @param array $options Additional `vimeo` and `youtube` options
* (will be used as query params in the embed URL)
* @param array $attr Additional attributes for the `<iframe>` tag
* @return string The generated HTML
*/
public static function video(string $url, array $options, array $attr) : string {}
/**
* Embeds a Vimeo video by URL in an `<iframe>`
*
* @param string $url Vimeo video URL
* @param array $options Query params for the embed URL
* @param array $attr Additional attributes for the `<iframe>` tag
* @return string The generated HTML
*/
public static function vimeo(string $url, array $options, array $attr) : string {}
/**
* Embeds a YouTube video by URL in an `<iframe>`
*
* @param string $url YouTube video URL
* @param array $options Query params for the embed URL
* @param array $attr Additional attributes for the `<iframe>` tag
* @return string The generated HTML
*/
public static function youtube(string $url, array $options, array $attr) : string {}
/**
* Creates an XML string from an array
*
* Supports special array keys `@name` (element name),
* `@attributes` (XML attribute key-value array),
* `@namespaces` (array with XML namespaces) and
* `@value` (element content)
*
* @param array|string $props The source array or tag content (used internally)
* @param string $name The name of the root element
* @param bool $head Include the XML declaration head or not
* @param string $indent Indentation string, defaults to two spaces
* @param int $level The indendation level (used internally)
* @return string The XML string
*/
public static function create(mixed $props, string $name = 'root', bool $head = true, string $indent = ' ', int $level) : string {}
/**
* Removes all HTML/XML tags and encoded chars from a string
*
* ```
* echo Xml::decode('some &uuml;ber <em>crazy</em> stuff');
* // output: some über crazy stuff
* ```
*
* @param string|null $string
* @return string
*/
public static function decode(string $string) : string {}
/**
* Parses an XML string and returns an array
*
* @param string $xml
* @return array|null Parsed array or `null` on error
*/
public static function parse(string $xml) : array {}
/**
* Breaks a SimpleXMLElement down into a simpler tree
* structure of arrays and strings
*
* @param \SimpleXMLElement $element
* @param bool $collectName Whether the element name should be collected (for the root element)
* @return array|string
*/
public static function simplify(SimpleXMLElement $element, bool $collectName = true) : void {}
}
/**
* The `$kirby` object is the app instance of
* your Kirby installation. It's the central
* starting point to get all the different
* aspects of your site, like the options, urls,
* roots, languages, roles, etc.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Kirby
{
use Kirby\Cms\AppCaches, Kirby\Cms\AppErrors, Kirby\Cms\AppPlugins, Kirby\Cms\AppTranslations, Kirby\Cms\AppUsers, Kirby\Toolkit\Properties;
const CLASS_ALIAS = 'kirby';
public $data;
/**
* Creates a new App instance
*
* @param array $props
* @param bool $setInstance If false, the instance won't be set globally
*/
public function __construct(array $props, bool $setInstance = true) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Returns the Api instance
*
* @internal
* @return \Kirby\Cms\Api
*/
public function api() : void {}
/**
* Applies a hook to the given value
*
* @internal
* @param string $name Full event name
* @param array $args Associative array of named event arguments
* @param string $modify Key in $args that is modified by the hooks
* @param \Kirby\Cms\Event|null $originalEvent Event object (internal use)
* @return mixed Resulting value as modified by the hooks
*/
public function apply(string $name, array $args, string $modify, Kirby\Cms\Event $originalEvent) : void {}
/**
* Returns all available blueprints for this installation
*
* @param string $type
* @return array
*/
public function blueprints(string $type = 'pages') : array {}
/**
* Calls any Kirby route
*
* @param string|null $path
* @param string|null $method
* @return mixed
*/
public function call(string $path, string $method) : void {}
/**
* Creates an instance with the same
* initial properties
*
* @param array $props
* @param bool $setInstance If false, the instance won't be set globally
* @return static
*/
public function clone(array $props, bool $setInstance = true) : void {}
/**
* Returns a specific user-defined collection
* by name. All relevant dependencies are
* automatically injected
*
* @param string $name
* @return \Kirby\Cms\Collection|null
*/
public function collection(string $name) : void {}
/**
* Returns all user-defined collections
*
* @return \Kirby\Cms\Collections
*/
public function collections() : void {}
/**
* Returns a core component
*
* @internal
* @param string $name
* @return mixed
*/
public function component(mixed $name) : void {}
/**
* Returns the content extension
*
* @internal
* @return string
*/
public function contentExtension() : string {}
/**
* Returns files that should be ignored when scanning folders
*
* @internal
* @return array
*/
public function contentIgnore() : array {}
/**
* Generates a non-guessable token based on model
* data and a configured salt
*
* @param mixed $model Object to pass to the salt callback if configured
* @param string $value Model data to include in the generated token
* @return string
*/
public function contentToken(mixed $model, string $value) : string {}
/**
* Calls a page controller by name
* and with the given arguments
*
* @internal
* @param string $name
* @param array $arguments
* @param string $contentType
* @return array
*/
public function controller(string $name, array $arguments, string $contentType = 'html') : array {}
/**
* Returns the default language object
*
* @return \Kirby\Cms\Language|null
*/
public function defaultLanguage() : void {}
/**
* Destroy the instance singleton and
* purge other static props
*
* @internal
*/
public static function destroy() : void {}
/**
* Detect the preferred language from the visitor object
*
* @return \Kirby\Cms\Language
*/
public function detectedLanguage() : void {}
/**
* Returns the Email singleton
*
* @param mixed $preset
* @param array $props
* @return \Kirby\Email\PHPMailer
*/
public function email(mixed $preset, array $props) : void {}
/**
* Finds any file in the content directory
*
* @param string $path
* @param mixed $parent
* @param bool $drafts
* @return \Kirby\Cms\File|null
*/
public function file(string $path, mixed $parent, bool $drafts = true) : void {}
/**
* Returns the current App instance
*
* @param \Kirby\Cms\App|null $instance
* @param bool $lazy If `true`, the instance is only returned if already existing
* @return static|null
*/
public static function instance(self $instance, bool $lazy) : void {}
/**
* Takes almost any kind of input and
* tries to convert it into a valid response
*
* @internal
* @param mixed $input
* @return \Kirby\Http\Response
*/
public function io(mixed $input) : void {}
/**
* Renders a single KirbyTag with the given attributes
*
* @internal
* @param string $type
* @param string|null $value
* @param array $attr
* @param array $data
* @return string
*/
public function kirbytag(string $type, string $value, array $attr, array $data) : string {}
/**
* KirbyTags Parser
*
* @internal
* @param string|null $text
* @param array $data
* @return string
*/
public function kirbytags(string $text, array $data) : string {}
/**
* Parses KirbyTags first and Markdown afterwards
*
* @internal
* @param string|null $text
* @param array $data
* @param bool $inline
* @return string
*/
public function kirbytext(string $text, array $data, bool $inline) : string {}
/**
* Returns the current language
*
* @param string|null $code
* @return \Kirby\Cms\Language|null
*/
public function language(string $code) : void {}
/**
* Returns the current language code
*
* @internal
* @param string|null $languageCode
* @return string|null
*/
public function languageCode(string $languageCode) : string {}
/**
* Returns all available site languages
*
* @return \Kirby\Cms\Languages
*/
public function languages() : void {}
/**
* Returns the app's locks object
*
* @return \Kirby\Cms\ContentLocks
*/
public function locks() : Kirby\Cms\ContentLocks {}
/**
* Parses Markdown
*
* @internal
* @param string|null $text
* @param bool $inline
* @return string
*/
public function markdown(string $text, bool $inline) : string {}
/**
* Check for a multilang setup
*
* @return bool
*/
public function multilang() : bool {}
/**
* Returns the nonce, which is used
* in the panel for inline scripts
* @since 3.3.0
*
* @return string
*/
public function nonce() : string {}
/**
* Load a specific configuration option
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function option(string $key, mixed $default) : void {}
/**
* Returns all configuration options
*
* @return array
*/
public function options() : array {}
/**
* Returns any page from the content folder
*
* @param string|null $id
* @param \Kirby\Cms\Page|\Kirby\Cms\Site|null $parent
* @param bool $drafts
* @return \Kirby\Cms\Page|null
*/
public function page(string $id, mixed $parent, bool $drafts = true) : void {}
/**
* Returns the request path
*
* @return string
*/
public function path() : string {}
/**
* Returns the Response object for the
* current request
*
* @param string|null $path
* @param string|null $method
* @return \Kirby\Http\Response
*/
public function render(string $path, string $method) : void {}
/**
* Returns the Request singleton
*
* @return \Kirby\Http\Request
*/
public function request() : void {}
/**
* Path resolver for the router
*
* @internal
* @param string|null $path
* @param string|null $language
* @return mixed
* @throws \Kirby\Exception\NotFoundException if the home page cannot be found
*/
public function resolve(string $path, string $language) : void {}
/**
* Response configuration
*
* @return \Kirby\Cms\Responder
*/
public function response() : void {}
/**
* Returns all user roles
*
* @return \Kirby\Cms\Roles
*/
public function roles() : void {}
/**
* Returns a system root
*
* @param string $type
* @return string
*/
public function root(string $type = 'index') : string {}
/**
* Returns the directory structure
*
* @return \Kirby\Cms\Ingredients
*/
public function roots() : void {}
/**
* Returns the currently active route
*
* @return \Kirby\Http\Route|null
*/
public function route() : void {}
/**
* Returns the Router singleton
*
* @internal
* @return \Kirby\Http\Router
*/
public function router() : void {}
/**
* Returns all defined routes
*
* @internal
* @return array
*/
public function routes() : array {}
/**
* Returns the current session object
*
* @param array $options Additional options, see the session component
* @return \Kirby\Session\Session
*/
public function session(array $options) : void {}
/**
* Returns the session handler
*
* @return \Kirby\Session\AutoSession
*/
public function sessionHandler() : void {}
/**
* Returns the Server object
*
* @return \Kirby\Http\Server
*/
public function server() : void {}
/**
* Initializes and returns the Site object
*
* @return \Kirby\Cms\Site
*/
public function site() : void {}
/**
* Applies the smartypants rule on the text
*
* @internal
* @param string|null $text
* @return string
*/
public function smartypants(string $text) : string {}
/**
* Uses the snippet component to create
* and return a template snippet
*
* @internal
* @param mixed $name
* @param array $data
* @return string|null
*/
public function snippet(mixed $name, array $data) : string {}
/**
* System check class
*
* @return \Kirby\Cms\System
*/
public function system() : void {}
/**
* Uses the template component to initialize
* and return the Template object
*
* @internal
* @return \Kirby\Cms\Template
* @param string $name
* @param string $type
* @param string $defaultType
*/
public function template(string $name, string $type = 'html', string $defaultType = 'html') : void {}
/**
* Thumbnail creator
*
* @param string $src
* @param string $dst
* @param array $options
* @return string
*/
public function thumb(string $src, string $dst, array $options) : string {}
/**
* Trigger a hook by name
*
* @internal
* @param string $name Full event name
* @param array $args Associative array of named event arguments
* @param \Kirby\Cms\Event|null $originalEvent Event object (internal use)
* @return void
*/
public function trigger(string $name, array $args, Kirby\Cms\Event $originalEvent) : void {}
/**
* Returns a system url
*
* @param string $type
* @param bool $object If set to `true`, the URL is converted to an object
* @return string|\Kirby\Http\Uri
*/
public function url(string $type = 'index', bool $object) : void {}
/**
* Returns the url structure
*
* @return \Kirby\Cms\Ingredients
*/
public function urls() : void {}
/**
* Returns the current version number from
* the composer.json (Keep that up to date! :))
*
* @return string|null
* @throws \Kirby\Exception\LogicException if the Kirby version cannot be detected
*/
public static function version() : string {}
/**
* Creates a hash of the version number
*
* @return string
*/
public static function versionHash() : string {}
/**
* Returns the visitor object
*
* @return \Kirby\Http\Visitor
*/
public function visitor() : void {}
/**
* Returns a cache instance by key
*
* @param string $key
* @return \Kirby\Cache\Cache
*/
public function cache(string $key) : void {}
/**
* Register all given extensions
*
* @internal
* @param array $extensions
* @param \Kirby\Cms\Plugin $plugin|null The plugin which defined those extensions
* @return array
*/
public function extend(array $extensions, Kirby\Cms\Plugin $plugin) : array {}
/**
* Returns a given extension by type and name
*
* @internal
* @param string $type i.e. `'hooks'`
* @param string $name i.e. `'page.delete:before'`
* @param mixed $fallback
* @return mixed
*/
public function extension(string $type, string $name, mixed $fallback) : void {}
/**
* Returns the extensions registry
*
* @internal
* @param string|null $type
* @return array
*/
public function extensions(string $type) : void {}
/**
* Returns the native implementation
* of a core component
*
* @param string $component
* @return \Closure|false
*/
public function nativeComponent(string $component) : void {}
/**
* Kirby plugin factory and getter
*
* @param string $name
* @param array|null $extends If null is passed it will be used as getter. Otherwise as factory.
* @return \Kirby\Cms\Plugin|null
* @throws \Kirby\Exception\DuplicateException
*/
public static function plugin(string $name, array $extends) : void {}
/**
* 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
* @return array
*/
public function plugins(array $plugins) : array {}
/**
* Returns the language code that will be used
* for the Panel if no user is logged in or if
* no language is configured for the user
*
* @return string
*/
public function panelLanguage() : string {}
/**
* Load and set the current language if it exists
* Otherwise fall back to the default language
*
* @internal
* @param string|null $languageCode
* @return \Kirby\Cms\Language|null
*/
public function setCurrentLanguage(string $languageCode) : void {}
/**
* Set the current translation
*
* @internal
* @param string|null $translationCode
* @return void
*/
public function setCurrentTranslation(string $translationCode) : void {}
/**
* Set locale settings
*
* @deprecated 3.5.0 Use `\Kirby\Toolkit\Locale::set()` instead
* @todo Remove in 3.6.0
*
* @param string|array $locale
*/
public function setLocale(mixed $locale) : void {}
/**
* Load a specific translation by locale
*
* @param string|null $locale Locale name or `null` for the current locale
* @return \Kirby\Cms\Translation|null
*/
public function translation(string $locale) : void {}
/**
* Returns all available translations
*
* @return \Kirby\Cms\Translations
*/
public function translations() : void {}
/**
* Returns the Authentication layer class
*
* @internal
* @return \Kirby\Cms\Auth
*/
public function auth() : void {}
/**
* Become any existing user or disable the current user
*
* @param string|null $who User ID or email address,
* `null` to use the actual user again,
* `'kirby'` for a virtual admin user or
* `'nobody'` to disable the actual user
* @param Closure|null $callback Optional action function that will be run with
* the permissions of the impersonated user; the
* impersonation will be reset afterwards
* @return mixed If called without callback: User that was impersonated;
* if called with callback: Return value from the callback
* @throws \Throwable
*/
public function impersonate(string $who, Closure $callback) : void {}
/**
* Returns a specific user by id
* or the current user if no id is given
*
* @param string|null $id
* @param bool $allowImpersonation If set to false, only the actually
* logged in user will be returned
* (when `$id` is passed as `null`)
* @return \Kirby\Cms\User|null
*/
public function user(string $id, bool $allowImpersonation = true) : void {}
/**
* Returns all users
*
* @return \Kirby\Cms\Users
*/
public function users() : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
}
/**
* The `$page` object is the heart and
* soul of Kirby. It is used to construct
* pages and all their dependencies like
* children, files, content, etc.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Page extends Kirby\Cms\ModelWithContent implements Stringable
{
use Kirby\Cms\PageActions, Kirby\Cms\PageSiblings, Kirby\Cms\HasChildren, Kirby\Cms\HasFiles, Kirby\Cms\HasMethods, Kirby\Cms\HasSiblings;
const CLASS_ALIAS = 'page';
static public $methods;
static public $models;
public $content;
public $translations;
static public $kirby;
public $children;
public $drafts;
/**
* Magic caller
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments) : void {}
/**
* Creates a new page object
*
* @param array $props
*/
public function __construct(array $props) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Returns the url to the api endpoint
*
* @internal
* @param bool $relative
* @return string
*/
public function apiUrl(bool $relative) : string {}
/**
* Returns the blueprint object
*
* @return \Kirby\Cms\PageBlueprint
*/
public function blueprint() : void {}
/**
* Returns an array with all blueprints that are available for the page
*
* @param string|null $inSection
* @return array
*/
public function blueprints(string $inSection) : array {}
/**
* Prepares the content for the write method
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return array
*/
public function contentFileData(array $data, string $languageCode) : array {}
/**
* Returns the content text file
* which is found by the inventory method
*
* @internal
* @param string|null $languageCode
* @return string
*/
public function contentFileName(string $languageCode) : string {}
/**
* Call the page controller
*
* @internal
* @param array $data
* @param string $contentType
* @return array
* @throws \Kirby\Exception\InvalidArgumentException If the controller returns invalid objects for `kirby`, `site`, `pages` or `page`
*/
public function controller(mixed $data, mixed $contentType = 'html') : array {}
/**
* Returns a number indicating how deep the page
* is nested within the content folder
*
* @return int
*/
public function depth() : int {}
/**
* Sorting number + Slug
*
* @return string
*/
public function dirname() : string {}
/**
* Sorting number + Slug
*
* @return string
*/
public function diruri() : string {}
/**
* Provides a kirbytag or markdown
* tag for the page, which will be
* used in the panel, when the page
* gets dragged onto a textarea
*
* @internal
* @param string|null $type (null|auto|kirbytext|markdown)
* @return string
*/
public function dragText(string $type) : string {}
/**
* Checks if the page exists on disk
*
* @return bool
*/
public function exists() : bool {}
/**
* Constructs a Page object and also
* takes page models into account.
*
* @internal
* @param mixed $props
* @return static
*/
public static function factory(mixed $props) : void {}
/**
* Redirects to this page,
* wrapper for the `go()` helper
*
* @since 3.4.0
*
* @param array $options Options for `Kirby\Http\Uri` to create URL parts
* @param int $code HTTP status code
*/
public function go(array $options, int $code = 302) : void {}
/**
* Checks if the intended template
* for the page exists.
*
* @return bool
*/
public function hasTemplate() : bool {}
/**
* Returns the Page Id
*
* @return string
*/
public function id() : string {}
/**
* Returns the template that should be
* loaded if it exists.
*
* @return \Kirby\Cms\Template
*/
public function intendedTemplate() : void {}
/**
* Returns the inventory of files
* children and content files
*
* @internal
* @return array
*/
public function inventory() : array {}
/**
* Compares the current object with the given page object
*
* @param \Kirby\Cms\Page|string $page
* @return bool
*/
public function is(mixed $page) : bool {}
/**
* Checks if the page is the current page
*
* @return bool
*/
public function isActive() : bool {}
/**
* Checks if the page is a direct or indirect ancestor of the given $page object
*
* @param Page $child
* @return bool
*/
public function isAncestorOf(Kirby\Cms\Page $child) : bool {}
/**
* Checks if the page can be cached in the
* pages cache. This will also check if one
* of the ignore rules from the config kick in.
*
* @return bool
*/
public function isCacheable() : bool {}
/**
* Checks if the page is a child of the given page
*
* @param \Kirby\Cms\Page|string $parent
* @return bool
*/
public function isChildOf(mixed $parent) : bool {}
/**
* Checks if the page is a descendant of the given page
*
* @param \Kirby\Cms\Page|string $parent
* @return bool
*/
public function isDescendantOf(mixed $parent) : bool {}
/**
* Checks if the page is a descendant of the currently active page
*
* @return bool
*/
public function isDescendantOfActive() : bool {}
/**
* Checks if the current page is a draft
*
* @return bool
*/
public function isDraft() : bool {}
/**
* Checks if the page is the error page
*
* @return bool
*/
public function isErrorPage() : bool {}
/**
* Checks if the page is the home page
*
* @return bool
*/
public function isHomePage() : bool {}
/**
* It's often required to check for the
* home and error page to stop certain
* actions. That's why there's a shortcut.
*
* @return bool
*/
public function isHomeOrErrorPage() : bool {}
/**
* Checks if the page has a sorting number
*
* @return bool
*/
public function isListed() : bool {}
/**
* Checks if the page is open.
* Open pages are either the current one
* or descendants of the current one.
*
* @return bool
*/
public function isOpen() : bool {}
/**
* Checks if the page is not a draft.
*
* @return bool
*/
public function isPublished() : bool {}
/**
* Check if the page can be read by the current user
*
* @return bool
*/
public function isReadable() : bool {}
/**
* Checks if the page is sortable
*
* @return bool
*/
public function isSortable() : bool {}
/**
* Checks if the page has no sorting number
*
* @return bool
*/
public function isUnlisted() : bool {}
/**
* Checks if the page access is verified.
* This is only used for drafts so far.
*
* @internal
* @param string|null $token
* @return bool
*/
public function isVerified(string $token) : void {}
/**
* Returns the root to the media folder for the page
*
* @internal
* @return string
*/
public function mediaRoot() : string {}
/**
* The page's base URL for any files
*
* @internal
* @return string
*/
public function mediaUrl() : string {}
/**
* Creates a page model if it has been registered
*
* @internal
* @param string $name
* @param array $props
* @return static
*/
public static function model(string $name, array $props) : void {}
/**
* Returns the last modification date of the page
*
* @param string|null $format
* @param string|null $handler
* @param string|null $languageCode
* @return int|string
*/
public function modified(string $format, string $handler, string $languageCode) : void {}
/**
* Returns the sorting number
*
* @return int|null
*/
public function num() : int {}
/**
* Returns the panel icon definition
* according to the blueprint settings
*
* @internal
* @param array|null $params
* @return array
*/
public function panelIcon(array $params) : array {}
/**
* Returns the escaped Id, which is
* used in the panel to make routing work properly
*
* @internal
* @return string
*/
public function panelId() : string {}
/**
* Returns the full path without leading slash
*
* @internal
* @return string
*/
public function panelPath() : string {}
/**
* Prepares the response data for page pickers
* and page fields
*
* @param array|null $params
* @return array
*/
public function panelPickerData(array $params) : array {}
/**
* Returns the url to the editing view
* in the panel
*
* @internal
* @param bool $relative
* @return string
*/
public function panelUrl(bool $relative) : string {}
/**
* Returns the parent Page object
*
* @return \Kirby\Cms\Page|null
*/
public function parent() : void {}
/**
* Returns the parent id, if a parent exists
*
* @internal
* @return string|null
*/
public function parentId() : string {}
/**
* Returns the parent model,
* which can either be another Page
* or the Site
*
* @internal
* @return \Kirby\Cms\Page|\Kirby\Cms\Site
*/
public function parentModel() : void {}
/**
* Returns a list of all parents and their parents recursively
*
* @return \Kirby\Cms\Pages
*/
public function parents() : void {}
/**
* Returns the permissions object for this page
*
* @return \Kirby\Cms\PagePermissions
*/
public function permissions() : void {}
/**
* Draft preview Url
*
* @internal
* @return string|null
*/
public function previewUrl() : string {}
/**
* Renders the page with the given data.
*
* An optional content type can be passed to
* render a content representation instead of
* the default template.
*
* @param array $data
* @param string $contentType
* @return string
* @throws \Kirby\Exception\NotFoundException If the default template cannot be found
*/
public function render(array $data, mixed $contentType = 'html') : string {}
/**
* @internal
* @param mixed $type
* @return \Kirby\Cms\Template
* @throws \Kirby\Exception\NotFoundException If the content representation cannot be found
*/
public function representation(mixed $type) : void {}
/**
* Returns the absolute root to the page directory
* No matter if it exists or not.
*
* @return string
*/
public function root() : string {}
/**
* Search all pages within the current page
*
* @param string|null $query
* @param array $params
* @return \Kirby\Cms\Pages
*/
public function search(string $query, mixed $params) : void {}
/**
* Returns the slug of the page
*
* @param string|null $languageCode
* @return string
*/
public function slug(string $languageCode) : string {}
/**
* Returns the page status, which
* can be `draft`, `listed` or `unlisted`
*
* @return string
*/
public function status() : string {}
/**
* Returns the final template
*
* @return \Kirby\Cms\Template
*/
public function template() : void {}
/**
* Returns the title field or the slug as fallback
*
* @return \Kirby\Cms\Field
*/
public function title() : void {}
/**
* Converts the most important
* properties to array
*
* @return array
*/
public function toArray() : array {}
/**
* Returns the UID of the page.
* The UID is basically the same as the
* slug, but stays the same on
* multi-language sites. Whereas the slug
* can be translated.
*
* @see self::slug()
* @return string
*/
public function uid() : string {}
/**
* The uri is the same as the id, except
* that it will be translated in multi-language setups
*
* @param string|null $languageCode
* @return string
*/
public function uri(string $languageCode) : string {}
/**
* Returns the Url
*
* @param array|string|null $options
* @return string
*/
public function url(mixed $options) : string {}
/**
* Builds the Url for a specific language
*
* @internal
* @param string|null $language
* @param array|null $options
* @return string
*/
public function urlForLanguage(mixed $language, array $options) : string {}
/**
* Returns the content
*
* @param string|null $languageCode
* @return \Kirby\Cms\Content
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function content(string $languageCode) : void {}
/**
* Returns the absolute path to the content file
*
* @internal
* @param string|null $languageCode
* @param bool $force
* @return string
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function contentFile(string $languageCode, bool $force) : string {}
/**
* Returns an array with all content files
*
* @return array
*/
public function contentFiles() : array {}
/**
* Returns the absolute path to the
* folder in which the content file is
* located
*
* @internal
* @return string|null
*/
public function contentFileDirectory() : string {}
/**
* Returns the extension of the content file
*
* @internal
* @return string
*/
public function contentFileExtension() : string {}
/**
* Decrement a given field value
*
* @param string $field
* @param int $by
* @param int $min
* @return static
*/
public function decrement(string $field, int $by = 1, int $min) : void {}
/**
* Returns the drag text from a custom callback
* if the callback is defined in the config
*
* @internal
* @param string $type markdown or kirbytext
* @param mixed ...$args
* @return string|null
*/
public function dragTextFromCallback(string $type, mixed $args) : string {}
/**
* Returns the correct drag text type
* depending on the given type or the
* configuration
*
* @internal
* @param string $type (null|auto|kirbytext|markdown)
* @return string
*/
public function dragTextType(string $type) : string {}
/**
* Returns all content validation errors
*
* @return array
*/
public function errors() : array {}
/**
* Increment a given field value
*
* @param string $field
* @param int $by
* @param int|null $max
* @return static
*/
public function increment(string $field, int $by = 1, int $max) : void {}
/**
* Checks if the model is locked for the current user
*
* @return bool
*/
public function isLocked() : bool {}
/**
* Checks if the data has any errors
*
* @return bool
*/
public function isValid() : bool {}
/**
* Returns the lock object for this model
*
* Only if a content directory exists,
* virtual pages will need to overwrite this method
*
* @return \Kirby\Cms\ContentLock|null
*/
public function lock() : void {}
/**
* @internal
* @param string|array|false|null $settings
* @return array|null
*/
public function panelImage(mixed $settings) : array {}
/**
* Returns an array of all actions
* that can be performed in the Panel
* This also checks for the lock status
* @since 3.3.0
*
* @param array $unlock An array of options that will be force-unlocked
* @return array
*/
public function panelOptions(array $unlock) : array {}
/**
* Creates a string query, starting from the model
*
* @internal
* @param string|null $query
* @param string|null $expect
* @return mixed
*/
public function query(string $query, string $expect) : void {}
/**
* Read the content from the content file
*
* @internal
* @param string|null $languageCode
* @return array
*/
public function readContent(string $languageCode) : array {}
/**
* Stores the content on disk
*
* @internal
* @param array|null $data
* @param string|null $languageCode
* @param bool $overwrite
* @return static
*/
public function save(array $data, string $languageCode, bool $overwrite) : void {}
/**
* String template builder
*
* @param string|null $template
* @param array $data
* @param string $fallback Fallback for tokens in the template that cannot be replaced
* @return string
*/
public function toString(string $template, array $data, string $fallback) : string {}
/**
* Returns a single translation by language code
* If no code is specified the current translation is returned
*
* @param string|null $languageCode
* @return \Kirby\Cms\ContentTranslation|null
*/
public function translation(string $languageCode) : void {}
/**
* Returns the translations collection
*
* @return \Kirby\Cms\Collection
*/
public function translations() : void {}
/**
* Updates the page data
*
* @param array|null $input
* @param string|null $languageCode
* @param bool $validate
* @return static
*/
public function update(array $input, string $languageCode, bool $validate) : void {}
/**
* Low level data writer method
* to store the given data on disk or anywhere else
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return bool
*/
public function writeContent(array $data, string $languageCode) : bool {}
/**
* Makes it possible to convert the entire model
* to a string. Mostly useful for debugging
*
* @return string
*/
public function __toString() : string {}
/**
* Returns the parent Kirby instance
*
* @return \Kirby\Cms\App
*/
public function kirby() : void {}
/**
* Returns the parent Site instance
*
* @return \Kirby\Cms\Site
*/
public function site() : void {}
/**
* Setter for the parent site object
*
* @internal
* @param \Kirby\Cms\Site|null $site
* @return $this
*/
public function setSite(Kirby\Cms\Site $site) : void {}
/**
* Creates an instance with the same
* initial properties.
*
* @param array $props
* @return static
*/
public function clone(array $props) : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
/**
* Changes the sorting number.
* The sorting number must already be correct
* when the method is called.
* This only affects this page,
* siblings will not be resorted.
*
* @param int|null $num
* @return $this|static
* @throws \Kirby\Exception\LogicException If a draft is being sorted or the directory cannot be moved
*/
public function changeNum(int $num) : void {}
/**
* Changes the slug/uid of the page
*
* @param string $slug
* @param string|null $languageCode
* @return $this|static
* @throws \Kirby\Exception\LogicException If the directory cannot be moved
*/
public function changeSlug(string $slug, string $languageCode) : void {}
/**
* Change the status of the current page
* to either draft, listed or unlisted.
* If changing to `listed`, you can pass a position for the
* page in the siblings collection. Siblings will be resorted.
*
* @param string $status "draft", "listed" or "unlisted"
* @param int|null $position Optional sorting number
* @return static
* @throws \Kirby\Exception\InvalidArgumentException If an invalid status is being passed
*/
public function changeStatus(string $status, int $position) : void {}
/**
* Change the position of the page in its siblings
* collection. Siblings will be resorted. If the page
* status isn't yet `listed`, it will be changed to it.
*
* @param int|null $position
* @return $this|static
*/
public function changeSort(int $position) : void {}
/**
* Changes the page template
*
* @param string $template
* @return $this|static
* @throws \Kirby\Exception\LogicException If the textfile cannot be renamed/moved
*/
public function changeTemplate(string $template) : void {}
/**
* Change the page title
*
* @param string $title
* @param string|null $languageCode
* @return static
*/
public function changeTitle(string $title, string $languageCode) : void {}
/**
* Copies the page to a new parent
*
* @param array $options
* @return \Kirby\Cms\Page
* @throws \Kirby\Exception\DuplicateException If the page already exists
*/
public function copy(array $options) : void {}
/**
* Creates and stores a new page
*
* @param array $props
* @return static
*/
public static function create(array $props) : void {}
/**
* Creates a child of the current page
*
* @param array $props
* @return static
*/
public function createChild(array $props) : void {}
/**
* Create the sorting number for the page
* depending on the blueprint settings
*
* @param int|null $num
* @return int
*/
public function createNum(int $num) : int {}
/**
* Deletes the page
*
* @param bool $force
* @return bool
*/
public function delete(bool $force) : bool {}
/**
* Duplicates the page with the given
* slug and optionally copies all files
*
* @param string|null $slug
* @param array $options
* @return \Kirby\Cms\Page
*/
public function duplicate(string $slug, array $options) : void {}
/**
* @return $this|static
* @throws \Kirby\Exception\LogicException If the folder cannot be moved
*/
public function publish() : void {}
/**
* Clean internal caches
* @return $this
*/
public function purge() : void {}
/**
* @return bool
*/
public function resortSiblingsAfterUnlisting() : bool {}
/**
* @deprecated 3.5.0 Use `Page::changeSort()` instead
* @todo Remove in 3.6.0
*
* @param null $position
* @return $this|static
*/
public function sort(mixed $position) : void {}
/**
* Convert a page from listed or
* unlisted to draft.
*
* @return $this|static
* @throws \Kirby\Exception\LogicException If the folder cannot be moved
*/
public function unpublish() : void {}
/**
* Checks if there's a next listed
* page in the siblings collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasNextListed(mixed $collection) : bool {}
/**
* Checks if there's a next unlisted
* page in the siblings collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasNextUnlisted(mixed $collection) : bool {}
/**
* Checks if there's a previous listed
* page in the siblings collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasPrevListed(mixed $collection) : bool {}
/**
* Checks if there's a previous unlisted
* page in the siblings collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasPrevUnlisted(mixed $collection) : bool {}
/**
* Returns the next listed page if it exists
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Page|null
*/
public function nextListed(mixed $collection) : void {}
/**
* Returns the next unlisted page if it exists
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Page|null
*/
public function nextUnlisted(mixed $collection) : void {}
/**
* Returns the previous listed page
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Page|null
*/
public function prevListed(mixed $collection) : void {}
/**
* Returns the previous unlisted page
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Page|null
*/
public function prevUnlisted(mixed $collection) : void {}
/**
* Returns siblings with the same template
*
* @param bool $self
* @return \Kirby\Cms\Pages
*/
public function templateSiblings(bool $self = true) : void {}
/**
* Returns the Pages collection
*
* @return \Kirby\Cms\Pages
*/
public function children() : void {}
/**
* Returns all children and drafts at the same time
*
* @return \Kirby\Cms\Pages
*/
public function childrenAndDrafts() : void {}
/**
* Searches for a child draft by id
*
* @param string $path
* @return \Kirby\Cms\Page|null
*/
public function draft(string $path) : void {}
/**
* Return all drafts of the model
*
* @return \Kirby\Cms\Pages
*/
public function drafts() : void {}
/**
* Finds one or multiple children by id
*
* @param string ...$arguments
* @return \Kirby\Cms\Page|\Kirby\Cms\Pages|null
*/
public function find(mixed $arguments) : void {}
/**
* Finds a single page or draft
*
* @param string $path
* @return \Kirby\Cms\Page|null
*/
public function findPageOrDraft(string $path) : void {}
/**
* Returns a collection of all children of children
*
* @return \Kirby\Cms\Pages
*/
public function grandChildren() : void {}
/**
* Checks if the model has any children
*
* @return bool
*/
public function hasChildren() : bool {}
/**
* Checks if the model has any drafts
*
* @return bool
*/
public function hasDrafts() : bool {}
/**
* Checks if the page has any listed children
*
* @return bool
*/
public function hasListedChildren() : bool {}
/**
* Checks if the page has any unlisted children
*
* @return bool
*/
public function hasUnlistedChildren() : bool {}
/**
* Creates a flat child index
*
* @param bool $drafts
* @return \Kirby\Cms\Pages
*/
public function index(bool $drafts) : void {}
/**
* Filters the Files collection by type audio
*
* @return \Kirby\Cms\Files
*/
public function audio() : void {}
/**
* Filters the Files collection by type code
*
* @return \Kirby\Cms\Files
*/
public function code() : void {}
/**
* Creates a new file
*
* @param array $props
* @return \Kirby\Cms\File
*/
public function createFile(array $props) : void {}
/**
* Filters the Files collection by type documents
*
* @return \Kirby\Cms\Files
*/
public function documents() : void {}
/**
* Returns a specific file by filename or the first one
*
* @param string|null $filename
* @param string $in
* @return \Kirby\Cms\File|null
*/
public function file(string $filename, string $in = 'files') : void {}
/**
* Returns the Files collection
*
* @return \Kirby\Cms\Files
*/
public function files() : void {}
/**
* Checks if the Files collection has any audio files
*
* @return bool
*/
public function hasAudio() : bool {}
/**
* Checks if the Files collection has any code files
*
* @return bool
*/
public function hasCode() : bool {}
/**
* Checks if the Files collection has any document files
*
* @return bool
*/
public function hasDocuments() : bool {}
/**
* Checks if the Files collection has any files
*
* @return bool
*/
public function hasFiles() : bool {}
/**
* Checks if the Files collection has any images
*
* @return bool
*/
public function hasImages() : bool {}
/**
* Checks if the Files collection has any videos
*
* @return bool
*/
public function hasVideos() : bool {}
/**
* Returns a specific image by filename or the first one
*
* @param string|null $filename
* @return \Kirby\Cms\File|null
*/
public function image(string $filename) : void {}
/**
* Filters the Files collection by type image
*
* @return \Kirby\Cms\Files
*/
public function images() : void {}
/**
* Filters the Files collection by type videos
*
* @return \Kirby\Cms\Files
*/
public function videos() : void {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
/**
* Returns the position / index in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return int
*/
public function indexOf(mixed $collection) : int {}
/**
* Returns the next item in the collection if available
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Model|null
*/
public function next(mixed $collection) : void {}
/**
* Returns the end of the collection starting after the current item
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Collection
*/
public function nextAll(mixed $collection) : void {}
/**
* Returns the previous item in the collection if available
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Model|null
*/
public function prev(mixed $collection) : void {}
/**
* Returns the beginning of the collection before the current item
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Collection
*/
public function prevAll(mixed $collection) : void {}
/**
* Returns all sibling elements
*
* @param bool $self
* @return \Kirby\Cms\Collection
*/
public function siblings(bool $self = true) : void {}
/**
* Checks if there's a next item in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasNext(mixed $collection) : bool {}
/**
* Checks if there's a previous item in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasPrev(mixed $collection) : bool {}
/**
* Checks if the item is the first in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function isFirst(mixed $collection) : bool {}
/**
* Checks if the item is the last in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function isLast(mixed $collection) : bool {}
/**
* Checks if the item is at a certain position
*
* @param \Kirby\Cms\Collection|null $collection
* @param int $n
*
* @return bool
*/
public function isNth(int $n, mixed $collection) : bool {}
}
/**
* The `$pages` object refers to a
* collection of pages. The pages in this
* collection can have the same or different
* parents, they can actually exist as
* subfolders in the content folder or be
* virtual pages created from a database,
* an Excel sheet, any API or any other
* source.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Pages extends Kirby\Cms\Collection implements IteratorAggregate, Traversable, Countable, Stringable
{
static public $methods;
static public $filters;
public $data;
/**
* Adds a single page or
* an entire second collection to the
* current collection
*
* @param mixed $object
* @return $this
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function add(mixed $object) : void {}
/**
* Returns all audio files of all children
*
* @return \Kirby\Cms\Files
*/
public function audio() : void {}
/**
* Returns all children for each page in the array
*
* @return \Kirby\Cms\Pages
*/
public function children() : void {}
/**
* Returns all code files of all children
*
* @return \Kirby\Cms\Files
*/
public function code() : void {}
/**
* Returns all documents of all children
*
* @return \Kirby\Cms\Files
*/
public function documents() : void {}
/**
* Fetch all drafts for all pages in the collection
*
* @return \Kirby\Cms\Pages
*/
public function drafts() : void {}
/**
* Creates a pages collection from an array of props
*
* @param array $pages
* @param \Kirby\Cms\Model|null $model
* @param bool $draft
* @return static
*/
public static function factory(array $pages, Kirby\Cms\Model $model, bool $draft) : void {}
/**
* Returns all files of all children
*
* @return \Kirby\Cms\Files
*/
public function files() : void {}
/**
* Finds a page in the collection by id.
* This works recursively for children and
* children of children, etc.
*
* @param string|null $id
* @return mixed
*/
public function findById(string $id) : void {}
/**
* Finds a child or child of a child recursively.
*
* @param string $id
* @param string|null $startAt
* @param bool $multiLang
* @return mixed
*/
public function findByIdRecursive(string $id, string $startAt, bool $multiLang) : void {}
/**
* Uses the specialized find by id method
*
* @param string|null $key
* @return mixed
*/
public function findByKey(string $key) : void {}
/**
* Alias for Pages::findById
*
* @param string $id
* @return \Kirby\Cms\Page|null
*/
public function findByUri(string $id) : void {}
/**
* Finds the currently open page
*
* @return \Kirby\Cms\Page|null
*/
public function findOpen() : void {}
/**
* Custom getter that is able to find
* extension pages
*
* @param string $key
* @param mixed $default
* @return \Kirby\Cms\Page|null
*/
public function get(mixed $key, mixed $default) : void {}
/**
* Returns all images of all children
*
* @return \Kirby\Cms\Files
*/
public function images() : void {}
/**
* Create a recursive flat index of all
* pages and subpages, etc.
*
* @param bool $drafts
* @return \Kirby\Cms\Pages
*/
public function index(bool $drafts) : void {}
/**
* Returns all listed pages in the collection
*
* @return \Kirby\Cms\Pages
*/
public function listed() : void {}
/**
* Returns all unlisted pages in the collection
*
* @return \Kirby\Cms\Pages
*/
public function unlisted() : void {}
/**
* Include all given items in the collection
*
* @param mixed ...$args
* @return $this|static
*/
public function merge(mixed $args) : void {}
/**
* Filter all pages by excluding the given template
* @since 3.3.0
*
* @param string|array $templates
* @return \Kirby\Cms\Pages
*/
public function notTemplate(mixed $templates) : void {}
/**
* Returns an array with all page numbers
*
* @return array
*/
public function nums() : array {}
public function published() : void {}
/**
* Filter all pages by the given template
*
* @param string|array $templates
* @return \Kirby\Cms\Pages
*/
public function template(mixed $templates) : void {}
/**
* Returns all video files of all children
*
* @return \Kirby\Cms\Files
*/
public function videos() : void {}
/**
* Magic getter function
*
* @param string $key
* @param mixed $arguments
* @return mixed
*/
public function __call(string $key, mixed $arguments) : void {}
/**
* Creates a new Collection with the given objects
*
* @param array $objects
* @param object|null $parent
*/
public function __construct(mixed $objects, mixed $parent) {}
/**
* Internal setter for each object in the Collection.
* This takes care of Component validation and of setting
* the collection prop on each object correctly.
*
* @param string $id
* @param object $object
*/
public function __set(string $id, mixed $object) : void {}
/**
* Appends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function append(mixed $args) : void {}
/**
* Groups the items by a given field or callback. Returns a collection
* with an item for each group and a collection for each group.
*
* @param string|Closure $field
* @param bool $i Ignore upper/lowercase for group names
* @return \Kirby\Cms\Collection
* @throws \Kirby\Exception\Exception
*/
public function group(mixed $field, bool $i = true) : void {}
/**
* Checks if the given object or id
* is in the collection
*
* @param string|object $id
* @return bool
*/
public function has(mixed $id) : bool {}
/**
* Correct position detection for objects.
* The method will automatically detect objects
* or ids and then search accordingly.
*
* @param string|object $object
* @return int
*/
public function indexOf(mixed $object) : int {}
/**
* Returns a Collection without the given element(s)
*
* @param mixed ...$keys any number of keys, passed as individual arguments
* @return \Kirby\Cms\Collection
*/
public function not(mixed $keys) : void {}
/**
* Add pagination and return a sliced set of data.
*
* @param mixed ...$arguments
* @return \Kirby\Cms\Collection
*/
public function paginate(mixed $arguments) : void {}
/**
* Returns the parent model
*
* @return \Kirby\Cms\Model
*/
public function parent() : void {}
/**
* Prepends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function prepend(mixed $args) : void {}
/**
* Runs a combination of filter, sort, not,
* offset, limit, search and paginate on the collection.
* Any part of the query is optional.
*
* @param array $query
* @return static
*/
public function query(array $query) : void {}
/**
* Removes an object
*
* @param mixed $key the name of the key
*/
public function remove(mixed $key) : void {}
/**
* Searches the collection
*
* @param string|null $query
* @param array $params
* @return self
*/
public function search(string $query, mixed $params) : void {}
/**
* Converts all objects in the collection
* to an array. This can also take a callback
* function to further modify the array result.
*
* @param \Closure|null $map
* @return array
*/
public function toArray(Closure $map) : array {}
/**
* Improve var_dump() output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Low-level getter for elements
*
* @param mixed $key
* @return mixed
*/
public function __get(mixed $key) : void {}
/**
* Makes it possible to echo the entire object
*
* @return string
*/
public function __toString() : string {}
/**
* Low-level element remover
*
* @param mixed $key the name of the key
*/
public function __unset(mixed $key) : void {}
/**
* Creates chunks of the same size.
* The last chunk may be smaller
*
* @param int $size Number of elements per chunk
* @return static A new collection with an element for each chunk and
* a sub collection in each chunk
*/
public function chunk(int $size) : void {}
/**
* Returns a cloned instance of the collection
*
* @return $this
*/
public function clone() : void {}
/**
* Getter and setter for the data
*
* @param array|null $data
* @return array|$this
*/
public function data(array $data) : void {}
/**
* Clone and remove all elements from the collection
*
* @return static
*/
public function empty() : void {}
/**
* Adds all elements to the collection
*
* @param mixed $items
* @return static
*/
public function extend(mixed $items) : void {}
/**
* Filters elements by one of the
* predefined filter methods, by a
* custom filter function or an array of filters
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filter(mixed $field, mixed $args) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::filter`
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filterBy(mixed $args) : void {}
/**
* Find one or multiple elements by id
*
* @param string ...$keys
* @return mixed
*/
public function find(mixed $keys) : void {}
/**
* Find a single element by an attribute and its value
*
* @param string $attribute
* @param mixed $value
* @return mixed|null
*/
public function findBy(string $attribute, mixed $value) : void {}
/**
* Returns the first element
*
* @return mixed
*/
public function first() : void {}
/**
* Returns the elements in reverse order
*
* @return static
*/
public function flip() : void {}
/**
* Extracts an attribute value from the given element
* in the collection. This is useful if elements in the collection
* might be objects, arrays or anything else and you need to
* get the value independently from that. We use it for `filter`.
*
* @param array|object $item
* @param string $attribute
* @param bool $split
* @param mixed $related
* @return mixed
*/
public function getAttribute(mixed $item, string $attribute, mixed $split, mixed $related) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::group`
*
* @param string|Closure $field
* @param bool $i
* @return \Kirby\Toolkit\Collection A new collection with an element for
* each group and a sub collection in
* each group
* @throws \Exception
*/
public function groupBy(mixed $args) : void {}
/**
* Returns a Collection with the intersection of the given elements
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return static
*/
public function intersection(mixed $other) : void {}
/**
* Checks if there is an intersection between the given collection and this collection
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return bool
*/
public function intersects(mixed $other) : bool {}
/**
* Checks if the number of elements is zero
*
* @return bool
*/
public function isEmpty() : bool {}
/**
* Checks if the number of elements is even
*
* @return bool
*/
public function isEven() : bool {}
/**
* Checks if the number of elements is more than zero
*
* @return bool
*/
public function isNotEmpty() : bool {}
/**
* Checks if the number of elements is odd
*
* @return bool
*/
public function isOdd() : bool {}
/**
* Returns the last element
*
* @return mixed
*/
public function last() : void {}
/**
* Returns a new object with a limited number of elements
*
* @param int $limit The number of elements to return
* @return static
*/
public function limit(int $limit) : void {}
/**
* Map a function to each element
*
* @param callable $callback
* @return $this
*/
public function map(callable $callback) : void {}
/**
* Returns the nth element from the collection
*
* @param int $n
* @return mixed
*/
public function nth(int $n) : void {}
/**
* Returns a new object starting from the given offset
*
* @param int $offset The index to start from
* @return static
*/
public function offset(int $offset) : void {}
/**
* Get the previously added pagination object
*
* @return \Kirby\Toolkit\Pagination|null
*/
public function pagination() : void {}
/**
* Extracts all values for a single field into
* a new array
*
* @param string $field
* @param string|null $split
* @param bool $unique
* @return array
*/
public function pluck(string $field, string $split, bool $unique) : array {}
/**
* Adds a new element to the collection
*
* @param mixed $key string or array
* @param mixed $value
* @return $this
*/
public function set(mixed $key, mixed $value) : void {}
/**
* Shuffle all elements
*
* @return static
*/
public function shuffle() : void {}
/**
* Returns a slice of the object
*
* @param int $offset The optional index to start the slice from
* @param int|null $limit The optional number of elements to return
* @return $this|static
*/
public function slice(int $offset, int $limit) : void {}
/**
* Get sort arguments from a string
*
* @param string $sort
* @return array
*/
public static function sortArgs(string $sort) : array {}
/**
* Sorts the elements by any number of fields
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sort() : void {}
/**
* Alias for `Kirby\Toolkit\Collection::sort`
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sortBy(mixed $args) : void {}
/**
* Converts the object into a JSON string
*
* @return string
*/
public function toJson() : string {}
/**
* Converts the object to a string
*
* @return string
*/
public function toString() : string {}
/**
* Returns a non-associative array
* with all values. If a mapping Closure is passed,
* all values are processed by the Closure.
*
* @param Closure|null $map
* @return array
*/
public function values(Closure $map) : array {}
/**
* The when method only executes the given Closure when the first parameter
* is true. If the first parameter is false, the Closure will not be executed.
* You may pass another Closure as the third parameter to the when method.
* This Closure will execute if the first parameter evaluates as false
*
* @since 3.3.0
* @param mixed $condition
* @param \Closure $callback
* @param \Closure|null $fallback
* @return mixed
*/
public function when(mixed $condition, Closure $callback, Closure $fallback) : void {}
/**
* Alias for $this->not()
*
* @param string ...$keys any number of keys, passed as individual arguments
* @return static
*/
public function without(mixed $keys) : void {}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator
*/
public function getIterator() : void {}
/**
* Returns the current key
*
* @return string
*/
public function key() : void {}
/**
* Returns an array of all keys
*
* @return array
*/
public function keys() : array {}
/**
* Returns the current element
*
* @return mixed
*/
public function current() : void {}
/**
* Moves the cursor to the previous element
* and returns it
*
* @return mixed
*/
public function prev() : void {}
/**
* Moves the cursor to the next element
* and returns it
*
* @return mixed
*/
public function next() : void {}
/**
* Moves the cusor to the first element
*/
public function rewind() : void {}
/**
* Checks if the current element is valid
*
* @return bool
*/
public function valid() : bool {}
/**
* Counts all elements
*
* @return int
*/
public function count() : int {}
/**
* Tries to find the key for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function keyOf(mixed $needle) : void {}
/**
* Checks if the current key is set
*
* @param mixed $key the key to check
* @return bool
*/
public function __isset(mixed $key) : bool {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
}
/**
* The `$pagination` object divides
* a collection of pages, files etc.
* into discrete pages consisting of
* the number of defined items. The
* pagination object can then be used
* to navigate between these pages,
* create a navigation etc.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Pagination extends Kirby\Toolkit\Pagination
{
static public $validate;
/**
* Creates the pagination object. As a new
* property you can now pass the base Url.
* That Url must be the Url of the first
* page of the collection without additional
* pagination information/query parameters in it.
*
* ```php
* $pagination = new Pagination([
* 'page' => 1,
* 'limit' => 10,
* 'total' => 120,
* 'method' => 'query',
* 'variable' => 'p',
* 'url' => new Uri('https://getkirby.com/blog')
* ]);
* ```
*
* @param array $params
*/
public function __construct(array $params) {}
/**
* Returns the Url for the first page
*
* @return string
*/
public function firstPageUrl() : string {}
/**
* Returns the Url for the last page
*
* @return string
*/
public function lastPageUrl() : string {}
/**
* Returns the Url for the next page.
* Returns null if there's no next page.
*
* @return string|null
*/
public function nextPageUrl() : string {}
/**
* Returns the URL of the current page.
* If the `$page` variable is set, the URL
* for that page will be returned.
*
* @param int|null $page
* @return string|null
*/
public function pageUrl(int $page) : string {}
/**
* Returns the Url for the previous page.
* Returns null if there's no previous page.
*
* @return string|null
*/
public function prevPageUrl() : string {}
/**
* Creates a pagination instance for the given
* collection with a flexible argument api
*
* @param \Kirby\Toolkit\Collection $collection
* @param mixed ...$arguments
* @return static
*/
public static function for(Kirby\Toolkit\Collection $collection, mixed $arguments) : void {}
/**
* Getter for the current page
*
* @return int
*/
public function page() : int {}
/**
* Getter for the total number of items
*
* @return int
*/
public function total() : int {}
/**
* Getter for the number of items per page
*
* @return int
*/
public function limit() : int {}
/**
* Returns the index of the first item on the page
*
* @return int
*/
public function start() : int {}
/**
* Returns the index of the last item on the page
*
* @return int
*/
public function end() : int {}
/**
* Returns the total number of pages
*
* @return int
*/
public function pages() : int {}
/**
* Returns the first page
*
* @return int
*/
public function firstPage() : int {}
/**
* Returns the last page
*
* @return int
*/
public function lastPage() : int {}
/**
* Returns the offset (i.e. for db queries)
*
* @return int
*/
public function offset() : int {}
/**
* Checks if the given page exists
*
* @param int $page
* @return bool
*/
public function hasPage(int $page) : bool {}
/**
* Checks if there are any pages at all
*
* @return bool
*/
public function hasPages() : bool {}
/**
* Checks if there's a previous page
*
* @return bool
*/
public function hasPrevPage() : bool {}
/**
* Returns the previous page
*
* @return int|null
*/
public function prevPage() : void {}
/**
* Checks if there's a next page
*
* @return bool
*/
public function hasNextPage() : bool {}
/**
* Returns the next page
*
* @return int|null
*/
public function nextPage() : void {}
/**
* Checks if the current page is the first page
*
* @return bool
*/
public function isFirstPage() : bool {}
/**
* Checks if the current page is the last page
*
* @return bool
*/
public function isLastPage() : bool {}
/**
* Creates a range of page numbers for Google-like pagination
*
* @param int $range
* @return array
*/
public function range(int $range = 5) : array {}
/**
* Returns the first page of the created range
*
* @param int $range
* @return int
*/
public function rangeStart(int $range = 5) : int {}
/**
* Returns the last page of the created range
*
* @param int $range
* @return int
*/
public function rangeEnd(int $range = 5) : int {}
/**
* Returns an array with all properties
*
* @return array
*/
public function toArray() : array {}
/**
* Creates an instance with the same
* initial properties.
*
* @param array $props
* @return static
*/
public function clone(array $props) : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
}
/**
* Shortcut to the request object
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class R extends Kirby\Toolkit\Facade
{
/**
* @return \Kirby\Http\Request
*/
public static function instance() : void {}
/**
* Proxy for all public instance calls
*
* @param string $method
* @param array $args
* @return mixed
*/
public static function __callStatic(string $method, array $args) : void {}
}
/**
* Custom response object with an optimized
* redirect method to build correct Urls
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Response extends Kirby\Http\Response implements Stringable
{
/**
* Adjusted redirect creation which
* parses locations with the Url::to method
* first.
*
* @param string $location
* @param int $code
* @return static
*/
public static function redirect(string $location = '/', int $code = 302) : void {}
/**
* Creates a new response object
*
* @param string $body
* @param string $type
* @param int $code
* @param array $headers
* @param string $charset
*/
public function __construct(mixed $body, string $type, int $code, array $headers, string $charset) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Makes it possible to convert the
* entire response object to a string
* to send the headers and print the body
*
* @return string
*/
public function __toString() : string {}
/**
* Getter for the body
*
* @return string
*/
public function body() : string {}
/**
* Getter for the content type charset
*
* @return string
*/
public function charset() : string {}
/**
* Getter for the HTTP status code
*
* @return int
*/
public function code() : int {}
/**
* Creates a response that triggers
* a file download for the given file
*
* @param string $file
* @param string $filename
* @param array $props Custom overrides for response props (e.g. headers)
* @return static
*/
public static function download(string $file, string $filename, array $props) : void {}
/**
* Creates a response for a file and
* sends the file content to the browser
*
* @param string $file
* @param array $props Custom overrides for response props (e.g. headers)
* @return static
*/
public static function file(string $file, array $props) : void {}
/**
* Getter for single headers
*
* @param string $key Name of the header
* @return string|null
*/
public function header(string $key) : string {}
/**
* Getter for all headers
*
* @return array
*/
public function headers() : array {}
/**
* Creates a json response with appropriate
* header and automatic conversion of arrays.
*
* @param string|array $body
* @param int $code
* @param bool $pretty
* @param array $headers
* @return static
*/
public static function json(mixed $body, int $code, bool $pretty, array $headers) : void {}
/**
* Sends all registered headers and
* returns the response body
*
* @return string
*/
public function send() : string {}
/**
* Converts all relevant response attributes
* to an associative array for debugging,
* testing or whatever.
*
* @return array
*/
public function toArray() : array {}
/**
* Getter for the content type
*
* @return string
*/
public function type() : string {}
}
/**
* Shortcut to the session object
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class S extends Kirby\Toolkit\Facade
{
/**
* @return \Kirby\Session\Session
*/
public static function instance() : void {}
/**
* Proxy for all public instance calls
*
* @param string $method
* @param array $args
* @return mixed
*/
public static function __callStatic(string $method, array $args) : void {}
}
/**
* The `$site` object is the root element
* for any site with pages. It represents
* the main content folder with its
* `site.txt`.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Site extends Kirby\Cms\ModelWithContent implements Stringable
{
use Kirby\Cms\SiteActions, Kirby\Cms\HasChildren, Kirby\Cms\HasFiles, Kirby\Cms\HasMethods;
const CLASS_ALIAS = 'site';
public $content;
public $translations;
static public $kirby;
public $children;
public $drafts;
static public $methods;
/**
* Modified getter to also return fields
* from the content
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments) : void {}
/**
* Creates a new Site object
*
* @param array $props
*/
public function __construct(array $props) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Makes it possible to convert the site model
* to a string. Mostly useful for debugging.
*
* @return string
*/
public function __toString() : string {}
/**
* Returns the url to the api endpoint
*
* @internal
* @param bool $relative
* @return string
*/
public function apiUrl(bool $relative) : string {}
/**
* Returns the blueprint object
*
* @return \Kirby\Cms\SiteBlueprint
*/
public function blueprint() : void {}
/**
* Builds a breadcrumb collection
*
* @return \Kirby\Cms\Pages
*/
public function breadcrumb() : void {}
/**
* Prepares the content for the write method
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return array
*/
public function contentFileData(array $data, string $languageCode) : array {}
/**
* Filename for the content file
*
* @internal
* @return string
*/
public function contentFileName() : string {}
/**
* Returns the error page object
*
* @return \Kirby\Cms\Page|null
*/
public function errorPage() : void {}
/**
* Returns the global error page id
*
* @internal
* @return string
*/
public function errorPageId() : string {}
/**
* Checks if the site exists on disk
*
* @return bool
*/
public function exists() : bool {}
/**
* Returns the home page object
*
* @return \Kirby\Cms\Page|null
*/
public function homePage() : void {}
/**
* Returns the global home page id
*
* @internal
* @return string
*/
public function homePageId() : string {}
/**
* Creates an inventory of all files
* and children in the site directory
*
* @internal
* @return array
*/
public function inventory() : array {}
/**
* Compares the current object with the given site object
*
* @param mixed $site
* @return bool
*/
public function is(mixed $site) : bool {}
/**
* Returns the root to the media folder for the site
*
* @internal
* @return string
*/
public function mediaRoot() : string {}
/**
* The site's base url for any files
*
* @internal
* @return string
*/
public function mediaUrl() : string {}
/**
* Gets the last modification date of all pages
* in the content folder.
*
* @param string|null $format
* @param string|null $handler
* @return int|string
*/
public function modified(string $format, string $handler) : void {}
/**
* Returns the current page if `$path`
* is not specified. Otherwise it will try
* to find a page by the given path.
*
* If no current page is set with the page
* prop, the home page will be returned if
* it can be found. (see `Site::homePage()`)
*
* @param string|null $path omit for current page,
* otherwise e.g. `notes/across-the-ocean`
* @return \Kirby\Cms\Page|null
*/
public function page(string $path) : void {}
/**
* Alias for `Site::children()`
*
* @return \Kirby\Cms\Pages
*/
public function pages() : void {}
/**
* Returns the full path without leading slash
*
* @internal
* @return string
*/
public function panelPath() : string {}
/**
* Returns the url to the editing view
* in the panel
*
* @internal
* @param bool $relative
* @return string
*/
public function panelUrl(bool $relative) : string {}
/**
* Returns the permissions object for this site
*
* @return \Kirby\Cms\SitePermissions
*/
public function permissions() : void {}
/**
* Preview Url
*
* @internal
* @return string|null
*/
public function previewUrl() : string {}
/**
* Returns the absolute path to the content directory
*
* @return string
*/
public function root() : string {}
/**
* Search all pages in the site
*
* @param string|null $query
* @param array $params
* @return \Kirby\Cms\Pages
*/
public function search(string $query, mixed $params) : void {}
/**
* Sets the current page object
*
* @internal
* @param \Kirby\Cms\Page|null $page
* @return $this
*/
public function setPage(Kirby\Cms\Page $page) : void {}
/**
* Converts the most important site
* properties to an array
*
* @return array
*/
public function toArray() : array {}
/**
* Returns the Url
*
* @param string|null $language
* @return string
*/
public function url(mixed $language) : string {}
/**
* Returns the translated url
*
* @internal
* @param string|null $languageCode
* @param array|null $options
* @return string
*/
public function urlForLanguage(string $languageCode, array $options) : string {}
/**
* Sets the current page by
* id or page object and
* returns the current page
*
* @internal
* @param string|\Kirby\Cms\Page $page
* @param string|null $languageCode
* @return \Kirby\Cms\Page
*/
public function visit(mixed $page, string $languageCode) : void {}
/**
* Checks if any content of the site has been
* modified after the given unix timestamp
* This is mainly used to auto-update the cache
*
* @param mixed $time
* @return bool
*/
public function wasModifiedAfter(mixed $time) : bool {}
/**
* Returns an array with all blueprints that are available
*
* @param string|null $inSection
* @return array
*/
public function blueprints(string $inSection) : array {}
/**
* Returns the content
*
* @param string|null $languageCode
* @return \Kirby\Cms\Content
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function content(string $languageCode) : void {}
/**
* Returns the absolute path to the content file
*
* @internal
* @param string|null $languageCode
* @param bool $force
* @return string
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function contentFile(string $languageCode, bool $force) : string {}
/**
* Returns an array with all content files
*
* @return array
*/
public function contentFiles() : array {}
/**
* Returns the absolute path to the
* folder in which the content file is
* located
*
* @internal
* @return string|null
*/
public function contentFileDirectory() : string {}
/**
* Returns the extension of the content file
*
* @internal
* @return string
*/
public function contentFileExtension() : string {}
/**
* Decrement a given field value
*
* @param string $field
* @param int $by
* @param int $min
* @return static
*/
public function decrement(string $field, int $by = 1, int $min) : void {}
/**
* Returns the drag text from a custom callback
* if the callback is defined in the config
*
* @internal
* @param string $type markdown or kirbytext
* @param mixed ...$args
* @return string|null
*/
public function dragTextFromCallback(string $type, mixed $args) : string {}
/**
* Returns the correct drag text type
* depending on the given type or the
* configuration
*
* @internal
* @param string $type (null|auto|kirbytext|markdown)
* @return string
*/
public function dragTextType(string $type) : string {}
/**
* Returns all content validation errors
*
* @return array
*/
public function errors() : array {}
/**
* Increment a given field value
*
* @param string $field
* @param int $by
* @param int|null $max
* @return static
*/
public function increment(string $field, int $by = 1, int $max) : void {}
/**
* Checks if the model is locked for the current user
*
* @return bool
*/
public function isLocked() : bool {}
/**
* Checks if the data has any errors
*
* @return bool
*/
public function isValid() : bool {}
/**
* Returns the lock object for this model
*
* Only if a content directory exists,
* virtual pages will need to overwrite this method
*
* @return \Kirby\Cms\ContentLock|null
*/
public function lock() : void {}
/**
* Returns the panel icon definition
*
* @internal
* @param array|null $params
* @return array
*/
public function panelIcon(array $params) : array {}
/**
* @internal
* @param string|array|false|null $settings
* @return array|null
*/
public function panelImage(mixed $settings) : array {}
/**
* Returns an array of all actions
* that can be performed in the Panel
* This also checks for the lock status
* @since 3.3.0
*
* @param array $unlock An array of options that will be force-unlocked
* @return array
*/
public function panelOptions(array $unlock) : array {}
/**
* Creates a string query, starting from the model
*
* @internal
* @param string|null $query
* @param string|null $expect
* @return mixed
*/
public function query(string $query, string $expect) : void {}
/**
* Read the content from the content file
*
* @internal
* @param string|null $languageCode
* @return array
*/
public function readContent(string $languageCode) : array {}
/**
* Stores the content on disk
*
* @internal
* @param array|null $data
* @param string|null $languageCode
* @param bool $overwrite
* @return static
*/
public function save(array $data, string $languageCode, bool $overwrite) : void {}
/**
* String template builder
*
* @param string|null $template
* @param array $data
* @param string $fallback Fallback for tokens in the template that cannot be replaced
* @return string
*/
public function toString(string $template, array $data, string $fallback) : string {}
/**
* Returns a single translation by language code
* If no code is specified the current translation is returned
*
* @param string|null $languageCode
* @return \Kirby\Cms\ContentTranslation|null
*/
public function translation(string $languageCode) : void {}
/**
* Returns the translations collection
*
* @return \Kirby\Cms\Collection
*/
public function translations() : void {}
/**
* Updates the model data
*
* @param array|null $input
* @param string|null $languageCode
* @param bool $validate
* @return static
* @throws \Kirby\Exception\InvalidArgumentException If the input array contains invalid values
*/
public function update(array $input, string $languageCode, bool $validate) : void {}
/**
* Low level data writer method
* to store the given data on disk or anywhere else
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return bool
*/
public function writeContent(array $data, string $languageCode) : bool {}
/**
* Each model must return a unique id
*
* @return string|int
*/
public function id() : void {}
/**
* Returns the parent Kirby instance
*
* @return \Kirby\Cms\App
*/
public function kirby() : void {}
/**
* Returns the parent Site instance
*
* @return \Kirby\Cms\Site
*/
public function site() : void {}
/**
* Setter for the parent site object
*
* @internal
* @param \Kirby\Cms\Site|null $site
* @return $this
*/
public function setSite(Kirby\Cms\Site $site) : void {}
/**
* Creates an instance with the same
* initial properties.
*
* @param array $props
* @return static
*/
public function clone(array $props) : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
/**
* Change the site title
*
* @param string $title
* @param string|null $languageCode
* @return static
*/
public function changeTitle(string $title, string $languageCode) : void {}
/**
* Creates a main page
*
* @param array $props
* @return \Kirby\Cms\Page
*/
public function createChild(array $props) : void {}
/**
* Clean internal caches
*
* @return $this
*/
public function purge() : void {}
/**
* Returns the Pages collection
*
* @return \Kirby\Cms\Pages
*/
public function children() : void {}
/**
* Returns all children and drafts at the same time
*
* @return \Kirby\Cms\Pages
*/
public function childrenAndDrafts() : void {}
/**
* Searches for a child draft by id
*
* @param string $path
* @return \Kirby\Cms\Page|null
*/
public function draft(string $path) : void {}
/**
* Return all drafts of the model
*
* @return \Kirby\Cms\Pages
*/
public function drafts() : void {}
/**
* Finds one or multiple children by id
*
* @param string ...$arguments
* @return \Kirby\Cms\Page|\Kirby\Cms\Pages|null
*/
public function find(mixed $arguments) : void {}
/**
* Finds a single page or draft
*
* @param string $path
* @return \Kirby\Cms\Page|null
*/
public function findPageOrDraft(string $path) : void {}
/**
* Returns a collection of all children of children
*
* @return \Kirby\Cms\Pages
*/
public function grandChildren() : void {}
/**
* Checks if the model has any children
*
* @return bool
*/
public function hasChildren() : bool {}
/**
* Checks if the model has any drafts
*
* @return bool
*/
public function hasDrafts() : bool {}
/**
* Checks if the page has any listed children
*
* @return bool
*/
public function hasListedChildren() : bool {}
/**
* Checks if the page has any unlisted children
*
* @return bool
*/
public function hasUnlistedChildren() : bool {}
/**
* Creates a flat child index
*
* @param bool $drafts
* @return \Kirby\Cms\Pages
*/
public function index(bool $drafts) : void {}
/**
* Filters the Files collection by type audio
*
* @return \Kirby\Cms\Files
*/
public function audio() : void {}
/**
* Filters the Files collection by type code
*
* @return \Kirby\Cms\Files
*/
public function code() : void {}
/**
* Creates a new file
*
* @param array $props
* @return \Kirby\Cms\File
*/
public function createFile(array $props) : void {}
/**
* Filters the Files collection by type documents
*
* @return \Kirby\Cms\Files
*/
public function documents() : void {}
/**
* Returns a specific file by filename or the first one
*
* @param string|null $filename
* @param string $in
* @return \Kirby\Cms\File|null
*/
public function file(string $filename, string $in = 'files') : void {}
/**
* Returns the Files collection
*
* @return \Kirby\Cms\Files
*/
public function files() : void {}
/**
* Checks if the Files collection has any audio files
*
* @return bool
*/
public function hasAudio() : bool {}
/**
* Checks if the Files collection has any code files
*
* @return bool
*/
public function hasCode() : bool {}
/**
* Checks if the Files collection has any document files
*
* @return bool
*/
public function hasDocuments() : bool {}
/**
* Checks if the Files collection has any files
*
* @return bool
*/
public function hasFiles() : bool {}
/**
* Checks if the Files collection has any images
*
* @return bool
*/
public function hasImages() : bool {}
/**
* Checks if the Files collection has any videos
*
* @return bool
*/
public function hasVideos() : bool {}
/**
* Returns a specific image by filename or the first one
*
* @param string|null $filename
* @return \Kirby\Cms\File|null
*/
public function image(string $filename) : void {}
/**
* Filters the Files collection by type image
*
* @return \Kirby\Cms\Files
*/
public function images() : void {}
/**
* Filters the Files collection by type videos
*
* @return \Kirby\Cms\Files
*/
public function videos() : void {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
}
/**
* The Structure class wraps
* array data into a nicely chainable
* collection with objects and Kirby-style
* content with fields. The Structure class
* is the heart and soul of our yaml conversion
* method for pages.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Structure extends Kirby\Cms\Collection implements IteratorAggregate, Traversable, Countable, Stringable
{
static public $filters;
public $data;
static public $methods;
/**
* Creates a new Collection with the given objects
*
* @param array $objects Kirby\Cms\StructureObject` objects or props arrays
* @param object|null $parent
*/
public function __construct(mixed $objects, mixed $parent) {}
/**
* The internal setter for collection items.
* This makes sure that nothing unexpected ends
* up in the collection. You can pass arrays or
* StructureObjects
*
* @param string $id
* @param array|StructureObject $props
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function __set(string $id, mixed $props) : void {}
/**
* Magic getter function
*
* @param string $key
* @param mixed $arguments
* @return mixed
*/
public function __call(string $key, mixed $arguments) : void {}
/**
* Adds a single object or
* an entire second collection to the
* current collection
*
* @param mixed $object
*/
public function add(mixed $object) : void {}
/**
* Appends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function append(mixed $args) : void {}
/**
* Groups the items by a given field or callback. Returns a collection
* with an item for each group and a collection for each group.
*
* @param string|Closure $field
* @param bool $i Ignore upper/lowercase for group names
* @return \Kirby\Cms\Collection
* @throws \Kirby\Exception\Exception
*/
public function group(mixed $field, bool $i = true) : void {}
/**
* Checks if the given object or id
* is in the collection
*
* @param string|object $id
* @return bool
*/
public function has(mixed $id) : bool {}
/**
* Correct position detection for objects.
* The method will automatically detect objects
* or ids and then search accordingly.
*
* @param string|object $object
* @return int
*/
public function indexOf(mixed $object) : int {}
/**
* Returns a Collection without the given element(s)
*
* @param mixed ...$keys any number of keys, passed as individual arguments
* @return \Kirby\Cms\Collection
*/
public function not(mixed $keys) : void {}
/**
* Add pagination and return a sliced set of data.
*
* @param mixed ...$arguments
* @return \Kirby\Cms\Collection
*/
public function paginate(mixed $arguments) : void {}
/**
* Returns the parent model
*
* @return \Kirby\Cms\Model
*/
public function parent() : void {}
/**
* Prepends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function prepend(mixed $args) : void {}
/**
* Runs a combination of filter, sort, not,
* offset, limit, search and paginate on the collection.
* Any part of the query is optional.
*
* @param array $query
* @return static
*/
public function query(array $query) : void {}
/**
* Removes an object
*
* @param mixed $key the name of the key
*/
public function remove(mixed $key) : void {}
/**
* Searches the collection
*
* @param string|null $query
* @param array $params
* @return self
*/
public function search(string $query, mixed $params) : void {}
/**
* Converts all objects in the collection
* to an array. This can also take a callback
* function to further modify the array result.
*
* @param \Closure|null $map
* @return array
*/
public function toArray(Closure $map) : array {}
/**
* Improve var_dump() output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Low-level getter for elements
*
* @param mixed $key
* @return mixed
*/
public function __get(mixed $key) : void {}
/**
* Makes it possible to echo the entire object
*
* @return string
*/
public function __toString() : string {}
/**
* Low-level element remover
*
* @param mixed $key the name of the key
*/
public function __unset(mixed $key) : void {}
/**
* Creates chunks of the same size.
* The last chunk may be smaller
*
* @param int $size Number of elements per chunk
* @return static A new collection with an element for each chunk and
* a sub collection in each chunk
*/
public function chunk(int $size) : void {}
/**
* Returns a cloned instance of the collection
*
* @return $this
*/
public function clone() : void {}
/**
* Getter and setter for the data
*
* @param array|null $data
* @return array|$this
*/
public function data(array $data) : void {}
/**
* Clone and remove all elements from the collection
*
* @return static
*/
public function empty() : void {}
/**
* Adds all elements to the collection
*
* @param mixed $items
* @return static
*/
public function extend(mixed $items) : void {}
/**
* Filters elements by one of the
* predefined filter methods, by a
* custom filter function or an array of filters
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filter(mixed $field, mixed $args) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::filter`
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filterBy(mixed $args) : void {}
/**
* Find one or multiple elements by id
*
* @param string ...$keys
* @return mixed
*/
public function find(mixed $keys) : void {}
/**
* Find a single element by an attribute and its value
*
* @param string $attribute
* @param mixed $value
* @return mixed|null
*/
public function findBy(string $attribute, mixed $value) : void {}
/**
* Find a single element by key (id)
*
* @param string $key
* @return mixed
*/
public function findByKey(string $key) : void {}
/**
* Returns the first element
*
* @return mixed
*/
public function first() : void {}
/**
* Returns the elements in reverse order
*
* @return static
*/
public function flip() : void {}
/**
* Getter
*
* @param mixed $key
* @param mixed $default
* @return mixed
*/
public function get(mixed $key, mixed $default) : void {}
/**
* Extracts an attribute value from the given element
* in the collection. This is useful if elements in the collection
* might be objects, arrays or anything else and you need to
* get the value independently from that. We use it for `filter`.
*
* @param array|object $item
* @param string $attribute
* @param bool $split
* @param mixed $related
* @return mixed
*/
public function getAttribute(mixed $item, string $attribute, mixed $split, mixed $related) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::group`
*
* @param string|Closure $field
* @param bool $i
* @return \Kirby\Toolkit\Collection A new collection with an element for
* each group and a sub collection in
* each group
* @throws \Exception
*/
public function groupBy(mixed $args) : void {}
/**
* Returns a Collection with the intersection of the given elements
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return static
*/
public function intersection(mixed $other) : void {}
/**
* Checks if there is an intersection between the given collection and this collection
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return bool
*/
public function intersects(mixed $other) : bool {}
/**
* Checks if the number of elements is zero
*
* @return bool
*/
public function isEmpty() : bool {}
/**
* Checks if the number of elements is even
*
* @return bool
*/
public function isEven() : bool {}
/**
* Checks if the number of elements is more than zero
*
* @return bool
*/
public function isNotEmpty() : bool {}
/**
* Checks if the number of elements is odd
*
* @return bool
*/
public function isOdd() : bool {}
/**
* Returns the last element
*
* @return mixed
*/
public function last() : void {}
/**
* Returns a new object with a limited number of elements
*
* @param int $limit The number of elements to return
* @return static
*/
public function limit(int $limit) : void {}
/**
* Map a function to each element
*
* @param callable $callback
* @return $this
*/
public function map(callable $callback) : void {}
/**
* Returns the nth element from the collection
*
* @param int $n
* @return mixed
*/
public function nth(int $n) : void {}
/**
* Returns a new object starting from the given offset
*
* @param int $offset The index to start from
* @return static
*/
public function offset(int $offset) : void {}
/**
* Get the previously added pagination object
*
* @return \Kirby\Toolkit\Pagination|null
*/
public function pagination() : void {}
/**
* Extracts all values for a single field into
* a new array
*
* @param string $field
* @param string|null $split
* @param bool $unique
* @return array
*/
public function pluck(string $field, string $split, bool $unique) : array {}
/**
* Adds a new element to the collection
*
* @param mixed $key string or array
* @param mixed $value
* @return $this
*/
public function set(mixed $key, mixed $value) : void {}
/**
* Shuffle all elements
*
* @return static
*/
public function shuffle() : void {}
/**
* Returns a slice of the object
*
* @param int $offset The optional index to start the slice from
* @param int|null $limit The optional number of elements to return
* @return $this|static
*/
public function slice(int $offset, int $limit) : void {}
/**
* Get sort arguments from a string
*
* @param string $sort
* @return array
*/
public static function sortArgs(string $sort) : array {}
/**
* Sorts the elements by any number of fields
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sort() : void {}
/**
* Alias for `Kirby\Toolkit\Collection::sort`
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sortBy(mixed $args) : void {}
/**
* Converts the object into a JSON string
*
* @return string
*/
public function toJson() : string {}
/**
* Converts the object to a string
*
* @return string
*/
public function toString() : string {}
/**
* Returns a non-associative array
* with all values. If a mapping Closure is passed,
* all values are processed by the Closure.
*
* @param Closure|null $map
* @return array
*/
public function values(Closure $map) : array {}
/**
* The when method only executes the given Closure when the first parameter
* is true. If the first parameter is false, the Closure will not be executed.
* You may pass another Closure as the third parameter to the when method.
* This Closure will execute if the first parameter evaluates as false
*
* @since 3.3.0
* @param mixed $condition
* @param \Closure $callback
* @param \Closure|null $fallback
* @return mixed
*/
public function when(mixed $condition, Closure $callback, Closure $fallback) : void {}
/**
* Alias for $this->not()
*
* @param string ...$keys any number of keys, passed as individual arguments
* @return static
*/
public function without(mixed $keys) : void {}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator
*/
public function getIterator() : void {}
/**
* Returns the current key
*
* @return string
*/
public function key() : void {}
/**
* Returns an array of all keys
*
* @return array
*/
public function keys() : array {}
/**
* Returns the current element
*
* @return mixed
*/
public function current() : void {}
/**
* Moves the cursor to the previous element
* and returns it
*
* @return mixed
*/
public function prev() : void {}
/**
* Moves the cursor to the next element
* and returns it
*
* @return mixed
*/
public function next() : void {}
/**
* Moves the cusor to the first element
*/
public function rewind() : void {}
/**
* Checks if the current element is valid
*
* @return bool
*/
public function valid() : bool {}
/**
* Counts all elements
*
* @return int
*/
public function count() : int {}
/**
* Tries to find the key for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function keyOf(mixed $needle) : void {}
/**
* Checks if the current key is set
*
* @param mixed $key the key to check
* @return bool
*/
public function __isset(mixed $key) : bool {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
}
/**
* The `Url` class extends the
* `Kirby\Http\Url` class. In addition
* to the methods of that class for dealing
* with URLs, it provides a specific
* `Url::home` method that always creates
* the correct base URL and a template asset
* URL builder.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Url extends Kirby\Http\Url
{
static public $home;
static public $current;
/**
* Returns the Url to the homepage
*
* @return string
*/
public static function home() : string {}
/**
* Creates an absolute Url to a template asset if it exists. This is used in the `css()` and `js()` helpers
*
* @param string $assetPath
* @param string $extension
* @return string|null
*/
public static function toTemplateAsset(string $assetPath, string $extension) : void {}
/**
* Smart resolver for internal and external urls
*
* @param string|null $path
* @param array|string|null $options Either an array of options for the Uri class or a language string
* @return string
*/
public static function to(string $path, mixed $options) : string {}
/**
* Facade for all Uri object methods
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public static function __callStatic(string $method, mixed $arguments) : void {}
/**
* Url Builder
* Actually just a factory for `new Uri($parts)`
*
* @param array $parts
* @param string|null $url
* @return string
*/
public static function build(array $parts, string $url) : string {}
/**
* Returns the current url with all bells and whistles
*
* @return string
*/
public static function current() : string {}
/**
* Returns the url for the current directory
*
* @return string
*/
public static function currentDir() : string {}
/**
* Tries to fix a broken url without protocol
*
* @param string $url
* @return string
*/
public static function fix(string $url) : string {}
/**
* Returns the url to the executed script
*
* @param array $props
* @param bool $forwarded
* @return string
*/
public static function index(array $props, bool $forwarded) : string {}
/**
* Checks if an URL is absolute
*
* @param string $url
* @return bool
*/
public static function isAbsolute(string $url) : bool {}
/**
* Convert a relative path into an absolute URL
*
* @param string $path
* @param string $home
* @return string
*/
public static function makeAbsolute(string $path, string $home) : string {}
/**
* Returns the path for the given url
*
* @param string|array|null $url
* @param bool $leadingSlash
* @param bool $trailingSlash
* @return string
*/
public static function path(mixed $url, bool $leadingSlash, bool $trailingSlash) : string {}
/**
* Returns the query for the given url
*
* @param string|array|null $url
* @return string
*/
public static function query(mixed $url) : string {}
/**
* Return the last url the user has been on if detectable
*
* @return string
*/
public static function last() : string {}
/**
* Shortens the Url by removing all unnecessary parts
*
* @param string $url
* @param int $length
* @param bool $base
* @param string $rep
* @return string
*/
public static function short(mixed $url, int $length, bool $base, string $rep = '…') : string {}
/**
* Removes the path from the Url
*
* @param string $url
* @return string
*/
public static function stripPath(mixed $url) : string {}
/**
* Removes the query string from the Url
*
* @param string $url
* @return string
*/
public static function stripQuery(mixed $url) : string {}
/**
* Removes the fragment (hash) from the Url
*
* @param string $url
* @return string
*/
public static function stripFragment(mixed $url) : string {}
/**
* Converts the Url to a Uri object
*
* @param string $url
* @return \Kirby\Http\Uri
*/
public static function toObject(mixed $url) : void {}
}
/**
* The `$user` object represents a
* single Panel or frontend user.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class User extends Kirby\Cms\ModelWithContent implements Stringable
{
use Kirby\Cms\HasFiles, Kirby\Cms\HasMethods, Kirby\Cms\HasSiblings, Kirby\Cms\UserActions;
const CLASS_ALIAS = 'user';
static public $methods;
static public $models;
public $content;
public $translations;
static public $kirby;
/**
* Modified getter to also return fields
* from the content
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments) : void {}
/**
* Creates a new User object
*
* @param array $props
*/
public function __construct(array $props) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Returns the url to the api endpoint
*
* @internal
* @param bool $relative
* @return string
*/
public function apiUrl(bool $relative) : string {}
/**
* Returns the File object for the avatar or null
*
* @return \Kirby\Cms\File|null
*/
public function avatar() : void {}
/**
* Returns the UserBlueprint object
*
* @return \Kirby\Cms\Blueprint
*/
public function blueprint() : void {}
/**
* Prepares the content for the write method
*
* @internal
* @param array $data
* @param string $languageCode|null Not used so far
* @return array
*/
public function contentFileData(array $data, string $languageCode) : array {}
/**
* Filename for the content file
*
* @internal
* @return string
*/
public function contentFileName() : string {}
/**
* Returns the user email address
*
* @return string
*/
public function email() : string {}
/**
* Checks if the user exists
*
* @return bool
*/
public function exists() : bool {}
/**
* Constructs a User object and also
* takes User models into account.
*
* @internal
* @param mixed $props
* @return static
*/
public static function factory(mixed $props) : void {}
/**
* Hashes the user's password unless it is `null`,
* which will leave it as `null`
*
* @internal
* @param string|null $password
* @return string|null
*/
public static function hashPassword(mixed $password) : string {}
/**
* Returns the user id
*
* @return string
*/
public function id() : string {}
/**
* Returns the inventory of files
* children and content files
*
* @return array
*/
public function inventory() : array {}
/**
* Compares the current object with the given user object
*
* @param \Kirby\Cms\User|null $user
* @return bool
*/
public function is(Kirby\Cms\User $user) : bool {}
/**
* Checks if this user has the admin role
*
* @return bool
*/
public function isAdmin() : bool {}
/**
* Checks if the current user is the virtual
* Kirby user
*
* @return bool
*/
public function isKirby() : bool {}
/**
* Checks if the current user is this user
*
* @return bool
*/
public function isLoggedIn() : bool {}
/**
* Checks if the user is the last one
* with the admin role
*
* @return bool
*/
public function isLastAdmin() : bool {}
/**
* Checks if the user is the last user
*
* @return bool
*/
public function isLastUser() : bool {}
/**
* Checks if the current user is the virtual
* Nobody user
*
* @return bool
*/
public function isNobody() : bool {}
/**
* Returns the user language
*
* @return string
*/
public function language() : string {}
/**
* Logs the user in
*
* @param string $password
* @param \Kirby\Session\Session|array|null $session Session options or session object to set the user in
* @return bool
*/
public function login(string $password, mixed $session) : bool {}
/**
* Logs the user in without checking the password
*
* @param \Kirby\Session\Session|array|null $session Session options or session object to set the user in
* @return void
*/
public function loginPasswordless(mixed $session) : void {}
/**
* Logs the user out
*
* @param \Kirby\Session\Session|array|null $session Session options or session object to unset the user in
* @return void
*/
public function logout(mixed $session) : void {}
/**
* Returns the root to the media folder for the user
*
* @internal
* @return string
*/
public function mediaRoot() : string {}
/**
* Returns the media url for the user object
*
* @internal
* @return string
*/
public function mediaUrl() : string {}
/**
* Creates a user model if it has been registered
*
* @internal
* @param string $name
* @param array $props
* @return \Kirby\Cms\User
*/
public static function model(string $name, array $props) : void {}
/**
* Returns the last modification date of the user
*
* @param string $format
* @param string|null $handler
* @param string|null $languageCode
* @return int|string
*/
public function modified(string $format = 'U', string $handler, string $languageCode) : void {}
/**
* Returns the user's name
*
* @return \Kirby\Cms\Field
*/
public function name() : void {}
/**
* Returns the user's name or,
* if empty, the email address
*
* @return \Kirby\Cms\Field
*/
public function nameOrEmail() : void {}
/**
* Create a dummy nobody
*
* @internal
* @return static
*/
public static function nobody() : void {}
/**
* Panel icon definition
*
* @internal
* @param array $params
* @return array
*/
public function panelIcon(array $params) : array {}
/**
* Returns the full path without leading slash
*
* @internal
* @return string
*/
public function panelPath() : string {}
/**
* Returns prepared data for the panel user picker
*
* @param array|null $params
* @return array
*/
public function panelPickerData(array $params) : array {}
/**
* Returns the url to the editing view
* in the panel
*
* @internal
* @param bool $relative
* @return string
*/
public function panelUrl(bool $relative) : string {}
/**
* Returns the encrypted user password
*
* @return string|null
*/
public function password() : string {}
/**
* @return \Kirby\Cms\UserPermissions
*/
public function permissions() : void {}
/**
* Returns the user role
*
* @return \Kirby\Cms\Role
*/
public function role() : void {}
/**
* Returns all available roles
* for this user, that can be selected
* by the authenticated user
*
* @return \Kirby\Cms\Roles
*/
public function roles() : void {}
/**
* The absolute path to the user directory
*
* @return string
*/
public function root() : string {}
/**
* Converts the most important user properties
* to an array
*
* @return array
*/
public function toArray() : array {}
/**
* String template builder
*
* @param string|null $template
* @param array|null $data
* @param string $fallback Fallback for tokens in the template that cannot be replaced
* @return string
*/
public function toString(string $template, array $data, string $fallback) : string {}
/**
* Returns the username
* which is the given name or the email
* as a fallback
*
* @return string|null
*/
public function username() : string {}
/**
* Compares the given password with the stored one
*
* @param string $password|null
* @return bool
*
* @throws \Kirby\Exception\NotFoundException If the user has no password
* @throws \Kirby\Exception\InvalidArgumentException If the entered password is not valid
* or does not match the user password
*/
public function validatePassword(string $password) : bool {}
/**
* Returns an array with all blueprints that are available
*
* @param string|null $inSection
* @return array
*/
public function blueprints(string $inSection) : array {}
/**
* Returns the content
*
* @param string|null $languageCode
* @return \Kirby\Cms\Content
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function content(string $languageCode) : void {}
/**
* Returns the absolute path to the content file
*
* @internal
* @param string|null $languageCode
* @param bool $force
* @return string
* @throws \Kirby\Exception\InvalidArgumentException If the language for the given code does not exist
*/
public function contentFile(string $languageCode, bool $force) : string {}
/**
* Returns an array with all content files
*
* @return array
*/
public function contentFiles() : array {}
/**
* Returns the absolute path to the
* folder in which the content file is
* located
*
* @internal
* @return string|null
*/
public function contentFileDirectory() : string {}
/**
* Returns the extension of the content file
*
* @internal
* @return string
*/
public function contentFileExtension() : string {}
/**
* Decrement a given field value
*
* @param string $field
* @param int $by
* @param int $min
* @return static
*/
public function decrement(string $field, int $by = 1, int $min) : void {}
/**
* Returns the drag text from a custom callback
* if the callback is defined in the config
*
* @internal
* @param string $type markdown or kirbytext
* @param mixed ...$args
* @return string|null
*/
public function dragTextFromCallback(string $type, mixed $args) : string {}
/**
* Returns the correct drag text type
* depending on the given type or the
* configuration
*
* @internal
* @param string $type (null|auto|kirbytext|markdown)
* @return string
*/
public function dragTextType(string $type) : string {}
/**
* Returns all content validation errors
*
* @return array
*/
public function errors() : array {}
/**
* Increment a given field value
*
* @param string $field
* @param int $by
* @param int|null $max
* @return static
*/
public function increment(string $field, int $by = 1, int $max) : void {}
/**
* Checks if the model is locked for the current user
*
* @return bool
*/
public function isLocked() : bool {}
/**
* Checks if the data has any errors
*
* @return bool
*/
public function isValid() : bool {}
/**
* Returns the lock object for this model
*
* Only if a content directory exists,
* virtual pages will need to overwrite this method
*
* @return \Kirby\Cms\ContentLock|null
*/
public function lock() : void {}
/**
* @internal
* @param string|array|false|null $settings
* @return array|null
*/
public function panelImage(mixed $settings) : array {}
/**
* Returns an array of all actions
* that can be performed in the Panel
* This also checks for the lock status
* @since 3.3.0
*
* @param array $unlock An array of options that will be force-unlocked
* @return array
*/
public function panelOptions(array $unlock) : array {}
/**
* Creates a string query, starting from the model
*
* @internal
* @param string|null $query
* @param string|null $expect
* @return mixed
*/
public function query(string $query, string $expect) : void {}
/**
* Read the content from the content file
*
* @internal
* @param string|null $languageCode
* @return array
*/
public function readContent(string $languageCode) : array {}
/**
* Stores the content on disk
*
* @internal
* @param array|null $data
* @param string|null $languageCode
* @param bool $overwrite
* @return static
*/
public function save(array $data, string $languageCode, bool $overwrite) : void {}
/**
* Returns a single translation by language code
* If no code is specified the current translation is returned
*
* @param string|null $languageCode
* @return \Kirby\Cms\ContentTranslation|null
*/
public function translation(string $languageCode) : void {}
/**
* Returns the translations collection
*
* @return \Kirby\Cms\Collection
*/
public function translations() : void {}
/**
* Updates the user data
*
* @param array|null $input
* @param string|null $languageCode
* @param bool $validate
* @return static
*/
public function update(array $input, string $languageCode, bool $validate) : void {}
/**
* Low level data writer method
* to store the given data on disk or anywhere else
*
* @internal
* @param array $data
* @param string|null $languageCode
* @return bool
*/
public function writeContent(array $data, string $languageCode) : bool {}
/**
* Makes it possible to convert the entire model
* to a string. Mostly useful for debugging
*
* @return string
*/
public function __toString() : string {}
/**
* Returns the parent Kirby instance
*
* @return \Kirby\Cms\App
*/
public function kirby() : void {}
/**
* Returns the parent Site instance
*
* @return \Kirby\Cms\Site
*/
public function site() : void {}
/**
* Setter for the parent site object
*
* @internal
* @param \Kirby\Cms\Site|null $site
* @return $this
*/
public function setSite(Kirby\Cms\Site $site) : void {}
/**
* Creates an instance with the same
* initial properties.
*
* @param array $props
* @return static
*/
public function clone(array $props) : void {}
/**
* Creates a clone and fetches all
* lazy-loaded getters to get a full copy
*
* @return static
*/
public function hardcopy() : void {}
/**
* Filters the Files collection by type audio
*
* @return \Kirby\Cms\Files
*/
public function audio() : void {}
/**
* Filters the Files collection by type code
*
* @return \Kirby\Cms\Files
*/
public function code() : void {}
/**
* Creates a new file
*
* @param array $props
* @return \Kirby\Cms\File
*/
public function createFile(array $props) : void {}
/**
* Filters the Files collection by type documents
*
* @return \Kirby\Cms\Files
*/
public function documents() : void {}
/**
* Returns a specific file by filename or the first one
*
* @param string|null $filename
* @param string $in
* @return \Kirby\Cms\File|null
*/
public function file(string $filename, string $in = 'files') : void {}
/**
* Returns the Files collection
*
* @return \Kirby\Cms\Files
*/
public function files() : void {}
/**
* Checks if the Files collection has any audio files
*
* @return bool
*/
public function hasAudio() : bool {}
/**
* Checks if the Files collection has any code files
*
* @return bool
*/
public function hasCode() : bool {}
/**
* Checks if the Files collection has any document files
*
* @return bool
*/
public function hasDocuments() : bool {}
/**
* Checks if the Files collection has any files
*
* @return bool
*/
public function hasFiles() : bool {}
/**
* Checks if the Files collection has any images
*
* @return bool
*/
public function hasImages() : bool {}
/**
* Checks if the Files collection has any videos
*
* @return bool
*/
public function hasVideos() : bool {}
/**
* Returns a specific image by filename or the first one
*
* @param string|null $filename
* @return \Kirby\Cms\File|null
*/
public function image(string $filename) : void {}
/**
* Filters the Files collection by type image
*
* @return \Kirby\Cms\Files
*/
public function images() : void {}
/**
* Filters the Files collection by type videos
*
* @return \Kirby\Cms\Files
*/
public function videos() : void {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
/**
* Returns the position / index in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return int
*/
public function indexOf(mixed $collection) : int {}
/**
* Returns the next item in the collection if available
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Model|null
*/
public function next(mixed $collection) : void {}
/**
* Returns the end of the collection starting after the current item
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Collection
*/
public function nextAll(mixed $collection) : void {}
/**
* Returns the previous item in the collection if available
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Model|null
*/
public function prev(mixed $collection) : void {}
/**
* Returns the beginning of the collection before the current item
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return \Kirby\Cms\Collection
*/
public function prevAll(mixed $collection) : void {}
/**
* Returns all sibling elements
*
* @param bool $self
* @return \Kirby\Cms\Collection
*/
public function siblings(bool $self = true) : void {}
/**
* Checks if there's a next item in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasNext(mixed $collection) : bool {}
/**
* Checks if there's a previous item in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function hasPrev(mixed $collection) : bool {}
/**
* Checks if the item is the first in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function isFirst(mixed $collection) : bool {}
/**
* Checks if the item is the last in the collection
*
* @param \Kirby\Cms\Collection|null $collection
*
* @return bool
*/
public function isLast(mixed $collection) : bool {}
/**
* Checks if the item is at a certain position
*
* @param \Kirby\Cms\Collection|null $collection
* @param int $n
*
* @return bool
*/
public function isNth(int $n, mixed $collection) : bool {}
/**
* Changes the user email address
*
* @param string $email
* @return static
*/
public function changeEmail(string $email) : void {}
/**
* Changes the user language
*
* @param string $language
* @return static
*/
public function changeLanguage(string $language) : void {}
/**
* Changes the screen name of the user
*
* @param string $name
* @return static
*/
public function changeName(string $name) : void {}
/**
* Changes the user password
*
* @param string $password
* @return static
*/
public function changePassword(string $password) : void {}
/**
* Changes the user role
*
* @param string $role
* @return static
*/
public function changeRole(string $role) : void {}
/**
* Creates a new User from the given props and returns a new User object
*
* @param array|null $props
* @return static
*/
public static function create(array $props) : void {}
/**
* Returns a random user id
*
* @return string
*/
public function createId() : string {}
/**
* Deletes the user
*
* @return bool
* @throws \Kirby\Exception\LogicException
*/
public function delete() : bool {}
}
/**
* The `$users` object refers to a collection
* of users with or without Panel access. Like
* all collections, you can filter, modify,
* convert or check the users collection.
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Users extends Kirby\Cms\Collection implements IteratorAggregate, Traversable, Countable, Stringable
{
static public $methods;
static public $filters;
public $data;
public function create(array $data) : void {}
/**
* Adds a single user or
* an entire second collection to the
* current collection
*
* @param mixed $object
* @return $this
*/
public function add(mixed $object) : void {}
/**
* Takes an array of user props and creates a nice and clean user collection from it
*
* @param array $users
* @param array $inject
* @return static
*/
public static function factory(array $users, array $inject) : void {}
/**
* Finds a user in the collection by id or email address
*
* @param string $key
* @return \Kirby\Cms\User|null
*/
public function findByKey(string $key) : void {}
/**
* Loads a user from disk by passing the absolute path (root)
*
* @param string $root
* @param array $inject
* @return static
*/
public static function load(string $root, array $inject) : void {}
/**
* Shortcut for `$users->filter('role', 'admin')`
*
* @param string $role
* @return static
*/
public function role(string $role) : void {}
/**
* Magic getter function
*
* @param string $key
* @param mixed $arguments
* @return mixed
*/
public function __call(string $key, mixed $arguments) : void {}
/**
* Creates a new Collection with the given objects
*
* @param array $objects
* @param object|null $parent
*/
public function __construct(mixed $objects, mixed $parent) {}
/**
* Internal setter for each object in the Collection.
* This takes care of Component validation and of setting
* the collection prop on each object correctly.
*
* @param string $id
* @param object $object
*/
public function __set(string $id, mixed $object) : void {}
/**
* Appends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function append(mixed $args) : void {}
/**
* Groups the items by a given field or callback. Returns a collection
* with an item for each group and a collection for each group.
*
* @param string|Closure $field
* @param bool $i Ignore upper/lowercase for group names
* @return \Kirby\Cms\Collection
* @throws \Kirby\Exception\Exception
*/
public function group(mixed $field, bool $i = true) : void {}
/**
* Checks if the given object or id
* is in the collection
*
* @param string|object $id
* @return bool
*/
public function has(mixed $id) : bool {}
/**
* Correct position detection for objects.
* The method will automatically detect objects
* or ids and then search accordingly.
*
* @param string|object $object
* @return int
*/
public function indexOf(mixed $object) : int {}
/**
* Returns a Collection without the given element(s)
*
* @param mixed ...$keys any number of keys, passed as individual arguments
* @return \Kirby\Cms\Collection
*/
public function not(mixed $keys) : void {}
/**
* Add pagination and return a sliced set of data.
*
* @param mixed ...$arguments
* @return \Kirby\Cms\Collection
*/
public function paginate(mixed $arguments) : void {}
/**
* Returns the parent model
*
* @return \Kirby\Cms\Model
*/
public function parent() : void {}
/**
* Prepends an element to the data array
*
* @param mixed ...$args
* @param mixed $key Optional collection key, will be determined from the item if not given
* @param mixed $item
* @return \Kirby\Cms\Collection
*/
public function prepend(mixed $args) : void {}
/**
* Runs a combination of filter, sort, not,
* offset, limit, search and paginate on the collection.
* Any part of the query is optional.
*
* @param array $query
* @return static
*/
public function query(array $query) : void {}
/**
* Removes an object
*
* @param mixed $key the name of the key
*/
public function remove(mixed $key) : void {}
/**
* Searches the collection
*
* @param string|null $query
* @param array $params
* @return self
*/
public function search(string $query, mixed $params) : void {}
/**
* Converts all objects in the collection
* to an array. This can also take a callback
* function to further modify the array result.
*
* @param \Closure|null $map
* @return array
*/
public function toArray(Closure $map) : array {}
/**
* Improve var_dump() output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Low-level getter for elements
*
* @param mixed $key
* @return mixed
*/
public function __get(mixed $key) : void {}
/**
* Makes it possible to echo the entire object
*
* @return string
*/
public function __toString() : string {}
/**
* Low-level element remover
*
* @param mixed $key the name of the key
*/
public function __unset(mixed $key) : void {}
/**
* Creates chunks of the same size.
* The last chunk may be smaller
*
* @param int $size Number of elements per chunk
* @return static A new collection with an element for each chunk and
* a sub collection in each chunk
*/
public function chunk(int $size) : void {}
/**
* Returns a cloned instance of the collection
*
* @return $this
*/
public function clone() : void {}
/**
* Getter and setter for the data
*
* @param array|null $data
* @return array|$this
*/
public function data(array $data) : void {}
/**
* Clone and remove all elements from the collection
*
* @return static
*/
public function empty() : void {}
/**
* Adds all elements to the collection
*
* @param mixed $items
* @return static
*/
public function extend(mixed $items) : void {}
/**
* Filters elements by one of the
* predefined filter methods, by a
* custom filter function or an array of filters
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filter(mixed $field, mixed $args) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::filter`
*
* @param string|array|\Closure $field
* @param mixed ...$args
* @return static
*/
public function filterBy(mixed $args) : void {}
/**
* Find one or multiple elements by id
*
* @param string ...$keys
* @return mixed
*/
public function find(mixed $keys) : void {}
/**
* Find a single element by an attribute and its value
*
* @param string $attribute
* @param mixed $value
* @return mixed|null
*/
public function findBy(string $attribute, mixed $value) : void {}
/**
* Returns the first element
*
* @return mixed
*/
public function first() : void {}
/**
* Returns the elements in reverse order
*
* @return static
*/
public function flip() : void {}
/**
* Getter
*
* @param mixed $key
* @param mixed $default
* @return mixed
*/
public function get(mixed $key, mixed $default) : void {}
/**
* Extracts an attribute value from the given element
* in the collection. This is useful if elements in the collection
* might be objects, arrays or anything else and you need to
* get the value independently from that. We use it for `filter`.
*
* @param array|object $item
* @param string $attribute
* @param bool $split
* @param mixed $related
* @return mixed
*/
public function getAttribute(mixed $item, string $attribute, mixed $split, mixed $related) : void {}
/**
* Alias for `Kirby\Toolkit\Collection::group`
*
* @param string|Closure $field
* @param bool $i
* @return \Kirby\Toolkit\Collection A new collection with an element for
* each group and a sub collection in
* each group
* @throws \Exception
*/
public function groupBy(mixed $args) : void {}
/**
* Returns a Collection with the intersection of the given elements
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return static
*/
public function intersection(mixed $other) : void {}
/**
* Checks if there is an intersection between the given collection and this collection
* @since 3.3.0
*
* @param \Kirby\Toolkit\Collection $other
* @return bool
*/
public function intersects(mixed $other) : bool {}
/**
* Checks if the number of elements is zero
*
* @return bool
*/
public function isEmpty() : bool {}
/**
* Checks if the number of elements is even
*
* @return bool
*/
public function isEven() : bool {}
/**
* Checks if the number of elements is more than zero
*
* @return bool
*/
public function isNotEmpty() : bool {}
/**
* Checks if the number of elements is odd
*
* @return bool
*/
public function isOdd() : bool {}
/**
* Returns the last element
*
* @return mixed
*/
public function last() : void {}
/**
* Returns a new object with a limited number of elements
*
* @param int $limit The number of elements to return
* @return static
*/
public function limit(int $limit) : void {}
/**
* Map a function to each element
*
* @param callable $callback
* @return $this
*/
public function map(callable $callback) : void {}
/**
* Returns the nth element from the collection
*
* @param int $n
* @return mixed
*/
public function nth(int $n) : void {}
/**
* Returns a new object starting from the given offset
*
* @param int $offset The index to start from
* @return static
*/
public function offset(int $offset) : void {}
/**
* Get the previously added pagination object
*
* @return \Kirby\Toolkit\Pagination|null
*/
public function pagination() : void {}
/**
* Extracts all values for a single field into
* a new array
*
* @param string $field
* @param string|null $split
* @param bool $unique
* @return array
*/
public function pluck(string $field, string $split, bool $unique) : array {}
/**
* Adds a new element to the collection
*
* @param mixed $key string or array
* @param mixed $value
* @return $this
*/
public function set(mixed $key, mixed $value) : void {}
/**
* Shuffle all elements
*
* @return static
*/
public function shuffle() : void {}
/**
* Returns a slice of the object
*
* @param int $offset The optional index to start the slice from
* @param int|null $limit The optional number of elements to return
* @return $this|static
*/
public function slice(int $offset, int $limit) : void {}
/**
* Get sort arguments from a string
*
* @param string $sort
* @return array
*/
public static function sortArgs(string $sort) : array {}
/**
* Sorts the elements by any number of fields
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sort() : void {}
/**
* Alias for `Kirby\Toolkit\Collection::sort`
*
* @param string|callable $field Field name or value callback to sort by
* @param string $direction asc or desc
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
* @return $this|static
*/
public function sortBy(mixed $args) : void {}
/**
* Converts the object into a JSON string
*
* @return string
*/
public function toJson() : string {}
/**
* Converts the object to a string
*
* @return string
*/
public function toString() : string {}
/**
* Returns a non-associative array
* with all values. If a mapping Closure is passed,
* all values are processed by the Closure.
*
* @param Closure|null $map
* @return array
*/
public function values(Closure $map) : array {}
/**
* The when method only executes the given Closure when the first parameter
* is true. If the first parameter is false, the Closure will not be executed.
* You may pass another Closure as the third parameter to the when method.
* This Closure will execute if the first parameter evaluates as false
*
* @since 3.3.0
* @param mixed $condition
* @param \Closure $callback
* @param \Closure|null $fallback
* @return mixed
*/
public function when(mixed $condition, Closure $callback, Closure $fallback) : void {}
/**
* Alias for $this->not()
*
* @param string ...$keys any number of keys, passed as individual arguments
* @return static
*/
public function without(mixed $keys) : void {}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator
*/
public function getIterator() : void {}
/**
* Returns the current key
*
* @return string
*/
public function key() : void {}
/**
* Returns an array of all keys
*
* @return array
*/
public function keys() : array {}
/**
* Returns the current element
*
* @return mixed
*/
public function current() : void {}
/**
* Moves the cursor to the previous element
* and returns it
*
* @return mixed
*/
public function prev() : void {}
/**
* Moves the cursor to the next element
* and returns it
*
* @return mixed
*/
public function next() : void {}
/**
* Moves the cusor to the first element
*/
public function rewind() : void {}
/**
* Checks if the current element is valid
*
* @return bool
*/
public function valid() : bool {}
/**
* Counts all elements
*
* @return int
*/
public function count() : int {}
/**
* Tries to find the key for the given element
*
* @param mixed $needle the element to search for
* @return string|false the name of the key or false
*/
public function keyOf(mixed $needle) : void {}
/**
* Checks if the current key is set
*
* @param mixed $key the key to check
* @return bool
*/
public function __isset(mixed $key) : bool {}
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args) : void {}
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method) : bool {}
}
/**
* Shortcut to the visitor object
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class Visitor extends Kirby\Toolkit\Facade
{
/**
* @return \Kirby\Http\Visitor
*/
public static function instance() : void {}
/**
* Proxy for all public instance calls
*
* @param string $method
* @param array $args
* @return mixed
*/
public static function __callStatic(string $method, array $args) : void {}
}
/**
* The `Data` class provides readers and
* writers for data. The class comes with
* handlers for `json`, `php`, `txt`, `xml`
* and `yaml` encoded data, but can be
* extended and customized.
*
* The read and write methods automatically
* detect which data handler to use in order
* to correctly encode and decode passed data.
*
* @package Kirby
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Data
{
static public $aliases;
static public $handlers;
/**
* Handler getter
*
* @param string $type
* @return \Kirby\Data\Handler
*/
public static function handler(string $type) : void {}
/**
* Decodes data with the specified handler
*
* @param mixed $string
* @param string $type
* @return array
*/
public static function decode(mixed $string, string $type) : array {}
/**
* Encodes data with the specified handler
*
* @param mixed $data
* @param string $type
* @return string
*/
public static function encode(mixed $data, string $type) : string {}
/**
* Reads data from a file;
* the data handler is automatically chosen by
* the extension if not specified
*
* @param string $file
* @param string $type
* @return array
*/
public static function read(string $file, string $type) : array {}
/**
* Writes data to a file;
* the data handler is automatically chosen by
* the extension if not specified
*
* @param string $file
* @param mixed $data
* @param string $type
* @return bool
*/
public static function write(string $file, mixed $data, string $type) : bool {}
}
/**
* Simple Wrapper around json_encode and json_decode
*
* @package Kirby Data
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Json extends Kirby\Data\Handler
{
/**
* Converts an array to an encoded JSON string
*
* @param mixed $data
* @return string
*/
public static function encode(mixed $data) : string {}
/**
* Parses an encoded JSON string and returns a multi-dimensional array
*
* @param mixed $string
* @return array
*/
public static function decode(mixed $string) : array {}
/**
* Reads data from a file
*
* @param string $file
* @return array
*/
public static function read(string $file) : array {}
/**
* Writes data to a file
*
* @param string $file
* @param mixed $data
* @return bool
*/
public static function write(string $file, mixed $data) : bool {}
}
/**
* Simple Wrapper around the Spyc YAML class
*
* @package Kirby Data
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Yaml extends Kirby\Data\Handler
{
/**
* Converts an array to an encoded YAML string
*
* @param mixed $data
* @return string
*/
public static function encode(mixed $data) : string {}
/**
* Parses an encoded YAML string and returns a multi-dimensional array
*
* @param mixed $string
* @return array
*/
public static function decode(mixed $string) : array {}
/**
* Reads data from a file
*
* @param string $file
* @return array
*/
public static function read(string $file) : array {}
/**
* Writes data to a file
*
* @param string $file
* @param mixed $data
* @return bool
*/
public static function write(string $file, mixed $data) : bool {}
}
/**
* A simple database class
*
* @package Kirby Database
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Database
{
static public $connections;
static public $types;
/**
* Creates a new Database instance
*
* @param array $params
* @return void
*/
public function __construct(array $params) {}
/**
* Returns one of the started instances
*
* @param string|null $id
* @return static|null
*/
public static function instance(string $id) : void {}
/**
* Returns all started instances
*
* @return array
*/
public static function instances() : array {}
/**
* Connects to a database
*
* @param array|null $params This can either be a config key or an array of parameters for the connection
* @return \PDO|null
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function connect(array $params) : void {}
/**
* Returns the currently active connection
*
* @return \PDO|null
*/
public function connection() : PDO {}
/**
* Sets the exception mode
*
* @param bool $fail
* @return \Kirby\Database\Database
*/
public function fail(bool $fail = true) : void {}
/**
* Returns the used database type
*
* @return string
*/
public function type() : string {}
/**
* Returns the used table name prefix
*
* @return string|null
*/
public function prefix() : string {}
/**
* Escapes a value to be used for a safe query
* NOTE: Prepared statements using bound parameters are more secure and solid
*
* @param string $value
* @return string
*/
public function escape(string $value) : string {}
/**
* Adds a value to the db trace and also returns the entire trace if nothing is specified
*
* @param array|null $data
* @return array
*/
public function trace(array $data) : array {}
/**
* Returns the number of affected rows for the last query
*
* @return int|null
*/
public function affected() : int {}
/**
* Returns the last id if available
*
* @return int|null
*/
public function lastId() : int {}
/**
* Returns the last query
*
* @return string|null
*/
public function lastQuery() : string {}
/**
* Returns the last set of results
*
* @return mixed
*/
public function lastResult() : void {}
/**
* Returns the last db error
*
* @return \Throwable
*/
public function lastError() : void {}
/**
* Returns the name of the database
*
* @return string|null
*/
public function name() : string {}
/**
* Executes a sql query, which is expected to return a set of results
*
* @param string $query
* @param array $bindings
* @param array $params
* @return mixed
*/
public function query(string $query, array $bindings, array $params) : void {}
/**
* Executes a sql query, which is expected to not return a set of results
*
* @param string $query
* @param array $bindings
* @return bool
*/
public function execute(string $query, array $bindings) : bool {}
/**
* Returns the correct Sql generator instance
* for the type of database
*
* @return \Kirby\Database\Sql
*/
public function sql() : void {}
/**
* Sets the current table, which should be queried. Returns a
* Query object, which can be used to build a full query
* for that table
*
* @param string $table
* @return \Kirby\Database\Query
*/
public function table(string $table) : void {}
/**
* Checks if a table exists in the current database
*
* @param string $table
* @return bool
*/
public function validateTable(string $table) : bool {}
/**
* Checks if a column exists in a specified table
*
* @param string $table
* @param string $column
* @return bool
*/
public function validateColumn(string $table, string $column) : bool {}
/**
* Creates a new table
*
* @param string $table
* @param array $columns
* @return bool
*/
public function createTable(mixed $table, mixed $columns) : bool {}
/**
* Drops a table
*
* @param string $table
* @return bool
*/
public function dropTable(string $table) : bool {}
/**
* Magic way to start queries for tables by
* using a method named like the table.
* I.e. $db->users()->all()
*
* @param mixed $method
* @param mixed $arguments
* @return \Kirby\Database\Query
*/
public function __call(mixed $method, mixed $arguments) : void {}
}
/**
* Database shortcuts
*
* @package Kirby Database
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Db
{
static public $queries;
static public $connection;
/**
* (Re)connect the database
*
* @param array|null $params Pass `[]` to use the default params from the config,
* don't pass any argument to get the current connection
* @return \Kirby\Database\Database
*/
public static function connect(array $params) : void {}
/**
* Returns the current database connection
*
* @return \Kirby\Database\Database|null
*/
public static function connection() : void {}
/**
* Sets the current table which should be queried. Returns a
* Query object, which can be used to build a full query for
* that table.
*
* @param string $table
* @return \Kirby\Database\Query
*/
public static function table(string $table) : void {}
/**
* Executes a raw SQL query which expects a set of results
*
* @param string $query
* @param array $bindings
* @param array $params
* @return mixed
*/
public static function query(string $query, array $bindings, array $params) : void {}
/**
* Executes a raw SQL query which expects no set of results (i.e. update, insert, delete)
*
* @param string $query
* @param array $bindings
* @return bool
*/
public static function execute(string $query, array $bindings) : bool {}
/**
* Magic calls for other static Db methods are
* redirected to either a predefined query or
* the respective method of the Database object
*
* @param string $method
* @param mixed $arguments
* @return mixed
* @throws \Kirby\Exception\InvalidArgumentException
*/
public static function __callStatic(string $method, mixed $arguments) : void {}
}
/**
* ErrorPageException
* Thrown to trigger the CMS error page
* @since 3.3.0
*
* @package Kirby Exception
* @author Lukas Bestle <lukas@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class ErrorPageException extends Kirby\Exception\Exception implements Throwable, Stringable
{
/**
* Class constructor
*
* @param array|string $args Full option array ('key', 'translate', 'fallback',
* 'data', 'httpCode', 'details' and 'previous') or
* just the message string
*/
public function __construct(mixed $args) {}
/**
* Returns the file in which the Exception was created
* relative to the document root
*
* @return string
*/
public function getFileRelative() : string {}
/**
* Returns the data variables from the message
*
* @return array
*/
public function getData() : array {}
/**
* Returns the additional details that are
* not included in the message
*
* @return array
*/
public function getDetails() : array {}
/**
* Returns the exception key (error type)
*
* @return string
*/
public function getKey() : string {}
/**
* Returns the HTTP code that corresponds
* with the exception
*
* @return array
*/
public function getHttpCode() : int {}
/**
* Returns whether the exception message could
* be translated into the user's language
*
* @return bool
*/
public function isTranslated() : bool {}
/**
* Converts the object to an array
*
* @return array
*/
public function toArray() : array {}
public function __wakeup() : void {}
public function getMessage() : string {}
public function getCode() : void {}
public function getFile() : string {}
public function getLine() : int {}
public function getTrace() : array {}
public function getPrevious() : Throwable {}
public function getTraceAsString() : string {}
public function __toString() : string {}
}
/**
* The `Cookie` class helps you to
* handle cookies in your projects.
*
* @package Kirby Http
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Cookie
{
static public $key;
/**
* Set a new cookie
*
* <code>
*
* cookie::set('mycookie', 'hello', ['lifetime' => 60]);
* // expires in 1 hour
*
* </code>
*
* @param string $key The name of the cookie
* @param string $value The cookie content
* @param array $options Array of options:
* lifetime, path, domain, secure, httpOnly, sameSite
* @return bool true: cookie was created,
* false: cookie creation failed
*/
public static function set(string $key, string $value, array $options) : bool {}
/**
* Calculates the lifetime for a cookie
*
* @param int $minutes Number of minutes or timestamp
* @return int
*/
public static function lifetime(int $minutes) : int {}
/**
* Stores a cookie forever
*
* <code>
*
* cookie::forever('mycookie', 'hello');
* // never expires
*
* </code>
*
* @param string $key The name of the cookie
* @param string $value The cookie content
* @param array $options Array of options:
* path, domain, secure, httpOnly
* @return bool true: cookie was created,
* false: cookie creation failed
*/
public static function forever(string $key, string $value, array $options) : bool {}
/**
* Get a cookie value
*
* <code>
*
* cookie::get('mycookie', 'peter');
* // sample output: 'hello' or if the cookie is not set 'peter'
*
* </code>
*
* @param string|null $key The name of the cookie
* @param string|null $default The default value, which should be returned
* if the cookie has not been found
* @return mixed The found value
*/
public static function get(string $key, string $default) : void {}
/**
* Checks if a cookie exists
*
* @param string $key
* @return bool
*/
public static function exists(string $key) : bool {}
/**
* Remove a cookie
*
* <code>
*
* cookie::remove('mycookie');
* // mycookie is now gone
*
* </code>
*
* @param string $key The name of the cookie
* @return bool true: the cookie has been removed,
* false: the cookie could not be removed
*/
public static function remove(string $key) : bool {}
}
/**
* The Header class provides methods
* for sending HTTP headers.
*
* @package Kirby Http
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Header
{
static public $codes;
/**
* Sends a content type header
*
* @param string $mime
* @param string $charset
* @param bool $send
* @return string|void
*/
public static function contentType(string $mime, string $charset = 'UTF-8', bool $send = true) : void {}
/**
* Creates headers by key and value
*
* @param string|array $key
* @param string|null $value
* @return string
*/
public static function create(mixed $key, string $value) : string {}
/**
* Shortcut for static::contentType()
*
* @param string $mime
* @param string $charset
* @param bool $send
* @return string|void
*/
public static function type(string $mime, string $charset = 'UTF-8', bool $send = true) : void {}
/**
* Sends a status header
*
* Checks $code against a list of known status codes. To bypass this check
* and send a custom status code and message, use a $code string formatted
* as 3 digits followed by a space and a message, e.g. '999 Custom Status'.
*
* @param int|string $code The HTTP status code
* @param bool $send If set to false the header will be returned instead
* @return string|void
*/
public static function status(mixed $code, bool $send = true) : void {}
/**
* Sends a 200 header
*
* @param bool $send
* @return string|void
*/
public static function success(bool $send = true) : void {}
/**
* Sends a 201 header
*
* @param bool $send
* @return string|void
*/
public static function created(bool $send = true) : void {}
/**
* Sends a 202 header
*
* @param bool $send
* @return string|void
*/
public static function accepted(bool $send = true) : void {}
/**
* Sends a 400 header
*
* @param bool $send
* @return string|void
*/
public static function error(bool $send = true) : void {}
/**
* Sends a 403 header
*
* @param bool $send
* @return string|void
*/
public static function forbidden(bool $send = true) : void {}
/**
* Sends a 404 header
*
* @param bool $send
* @return string|void
*/
public static function notfound(bool $send = true) : void {}
/**
* Sends a 404 header
*
* @param bool $send
* @return string|void
*/
public static function missing(bool $send = true) : void {}
/**
* Sends a 410 header
*
* @param bool $send
* @return string|void
*/
public static function gone(bool $send = true) : void {}
/**
* Sends a 500 header
*
* @param bool $send
* @return string|void
*/
public static function panic(bool $send = true) : void {}
/**
* Sends a 503 header
*
* @param bool $send
* @return string|void
*/
public static function unavailable(bool $send = true) : void {}
/**
* Sends a redirect header
*
* @param string $url
* @param int $code
* @param bool $send
* @return string|void
*/
public static function redirect(string $url, int $code = 302, bool $send = true) : void {}
/**
* Sends download headers for anything that is downloadable
*
* @param array $params Check out the defaults array for available parameters
*/
public static function download(array $params) : void {}
}
/**
* A handy little class to handle
* all kinds of remote requests
*
* @package Kirby Http
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Remote
{
const CA_INTERNAL = 1;
const CA_SYSTEM = 2;
static public $defaults;
public $content;
public $curl;
public $curlopt;
public $errorCode;
public $errorMessage;
public $headers;
public $info;
public $options;
/**
* Magic getter for request info data
*
* @param string $method
* @param array $arguments
* @return mixed
*/
public function __call(string $method, array $arguments) : void {}
/**
* Constructor
*
* @param string $url
* @param array $options
*/
public function __construct(string $url, array $options) {}
public static function __callStatic(string $method, array $arguments) : void {}
/**
* Returns the http status code
*
* @return int|null
*/
public function code() : int {}
/**
* Returns the response content
*
* @return mixed
*/
public function content() : void {}
/**
* Sets up all curl options and sends the request
*
* @return $this
*/
public function fetch() : void {}
/**
* Static method to send a GET request
*
* @param string $url
* @param array $params
* @return static
*/
public static function get(string $url, array $params) : void {}
/**
* Returns all received headers
*
* @return array
*/
public function headers() : array {}
/**
* Returns the request info
*
* @return array
*/
public function info() : array {}
/**
* Decode the response content
*
* @param bool $array decode as array or object
* @return array|\stdClass
*/
public function json(bool $array = true) : void {}
/**
* Returns the request method
*
* @return string
*/
public function method() : string {}
/**
* Returns all options which have been
* set for the current request
*
* @return array
*/
public function options() : array {}
/**
* Static method to init this class and send a request
*
* @param string $url
* @param array $params
* @return static
*/
public static function request(string $url, array $params) : void {}
/**
* Returns the request Url
*
* @return string
*/
public function url() : string {}
}
/**
* A set of methods that make it more convenient to get variables
* from the global server array
*
* @package Kirby Http
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Server
{
static public $cli;
/**
* Returns the server's IP address
*
* @return string
*/
public static function address() : string {}
/**
* Checks if the request is being served by the CLI
*
* @return bool
*/
public static function cli() : bool {}
/**
* Gets a value from the _SERVER array
*
* <code>
* Server::get('document_root');
* // sample output: /var/www/kirby
*
* Server::get();
* // returns the whole server array
* </code>
*
* @param mixed $key The key to look for. Pass false or null to
* return the entire server array.
* @param mixed $default Optional default value, which should be
* returned if no element has been found
* @return mixed
*/
public static function get(mixed $key, mixed $default) : void {}
/**
* Help to sanitize some _SERVER keys
*
* @param string $key
* @param mixed $value
* @return mixed
*/
public static function sanitize(string $key, mixed $value) : void {}
/**
* Returns the correct port number
*
* @param bool $forwarded
* @return int
*/
public static function port(bool $forwarded) : int {}
/**
* Checks for a https request
*
* @return bool
*/
public static function https() : bool {}
/**
* Returns the correct host
*
* @param bool $forwarded
* @return string
*/
public static function host(bool $forwarded) : string {}
}
/**
* The Dimension class is used to provide additional
* methods for images and possibly other objects with
* width and height to recalculate the size,
* get the ratio or just the width and height.
*
* @package Kirby Image
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Dimensions implements Stringable
{
public $height;
public $width;
/**
* Constructor
*
* @param int $width
* @param int $height
*/
public function __construct(int $width, int $height) {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Echos the dimensions as width × height
*
* @return string
*/
public function __toString() : string {}
/**
* Crops the dimensions by width and height
*
* @param int $width
* @param int|null $height
* @return $this
*/
public function crop(int $width, int $height) : void {}
/**
* Returns the height
*
* @return int
*/
public function height() : void {}
/**
* Recalculates the width and height to fit into the given box.
*
* <code>
*
* $dimensions = new Dimensions(1200, 768);
* $dimensions->fit(500);
*
* echo $dimensions->width();
* // output: 500
*
* echo $dimensions->height();
* // output: 320
*
* </code>
*
* @param int $box the max width and/or height
* @param bool $force If true, the dimensions will be
* upscaled to fit the box if smaller
* @return $this object with recalculated dimensions
*/
public function fit(int $box, bool $force) : void {}
/**
* Recalculates the width and height to fit the given height
*
* <code>
*
* $dimensions = new Dimensions(1200, 768);
* $dimensions->fitHeight(500);
*
* echo $dimensions->width();
* // output: 781
*
* echo $dimensions->height();
* // output: 500
*
* </code>
*
* @param int|null $fit the max height
* @param bool $force If true, the dimensions will be
* upscaled to fit the box if smaller
* @return $this object with recalculated dimensions
*/
public function fitHeight(int $fit, bool $force) : void {}
/**
* Recalculates the width and height to fit the given width
*
* <code>
*
* $dimensions = new Dimensions(1200, 768);
* $dimensions->fitWidth(500);
*
* echo $dimensions->width();
* // output: 500
*
* echo $dimensions->height();
* // output: 320
*
* </code>
*
* @param int|null $fit the max width
* @param bool $force If true, the dimensions will be
* upscaled to fit the box if smaller
* @return $this object with recalculated dimensions
*/
public function fitWidth(int $fit, bool $force) : void {}
/**
* Recalculates the dimensions by the width and height
*
* @param int|null $width the max height
* @param int|null $height the max width
* @param bool $force
* @return $this
*/
public function fitWidthAndHeight(int $width, int $height, bool $force) : void {}
/**
* Detect the dimensions for an image file
*
* @param string $root
* @return static
*/
public static function forImage(string $root) : void {}
/**
* Detect the dimensions for a svg file
*
* @param string $root
* @return static
*/
public static function forSvg(string $root) : void {}
/**
* Checks if the dimensions are landscape
*
* @return bool
*/
public function landscape() : bool {}
/**
* Returns a string representation of the orientation
*
* @return string|false
*/
public function orientation() : void {}
/**
* Checks if the dimensions are portrait
*
* @return bool
*/
public function portrait() : bool {}
/**
* Calculates and returns the ratio
*
* <code>
*
* $dimensions = new Dimensions(1200, 768);
* echo $dimensions->ratio();
* // output: 1.5625
*
* </code>
*
* @return float
*/
public function ratio() : float {}
/**
* @param int|null $width
* @param int|null $height
* @param bool $force
* @return $this
*/
public function resize(int $width, int $height, bool $force) : void {}
/**
* Checks if the dimensions are square
*
* @return bool
*/
public function square() : bool {}
/**
* Resize and crop
*
* @param array $options
* @return $this
*/
public function thumb(array $options) : void {}
/**
* Converts the dimensions object
* to a plain PHP array
*
* @return array
*/
public function toArray() : array {}
/**
* Returns the width
*
* @return int
*/
public function width() : int {}
}
/**
* The `A` class provides a set of handy methods
* to simplify array handling and make it more
* consistent. The class contains methods for
* fetching elements from arrays, merging and
* sorting or shuffling arrays.
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class A
{
const MERGE_OVERWRITE = 0;
const MERGE_APPEND = 1;
const MERGE_REPLACE = 2;
/**
* Appends the given array
*
* @param array $array
* @param array $append
* @return array
*/
public static function append(array $array, array $append) : array {}
/**
* Recursively loops through the array and
* resolves any item defined as `Closure`,
* applying the passed parameters
* @since 3.5.6
*
* @param array $array
* @param mixed ...$args Parameters to pass to the closures
* @return array
*/
public static function apply(array $array, mixed $args) : array {}
/**
* Gets an element of an array by key
*
* <code>
* $array = [
* 'cat' => 'miao',
* 'dog' => 'wuff',
* 'bird' => 'tweet'
* ];
*
* echo A::get($array, 'cat');
* // output: 'miao'
*
* echo A::get($array, 'elephant', 'shut up');
* // output: 'shut up'
*
* $catAndDog = A::get($array, ['cat', 'dog']);
* // result: ['cat' => 'miao', 'dog' => 'wuff'];
* </code>
*
* @param array $array The source array
* @param mixed $key The key to look for
* @param mixed $default Optional default value, which should be
* returned if no element has been found
* @return mixed
*/
public static function get(mixed $array, mixed $key, mixed $default) : void {}
/**
* @param mixed $value
* @param mixed $separator
* @return string
*/
public static function join(mixed $value, mixed $separator = ', ') : void {}
/**
* Merges arrays recursively
*
* @param array $array1
* @param array $array2
* @param int $mode Behavior for elements with numeric keys;
* A::MERGE_APPEND: elements are appended, keys are reset;
* A::MERGE_OVERWRITE: elements are overwritten, keys are preserved
* A::MERGE_REPLACE: non-associative arrays are completely replaced
* @return array
*/
public static function merge(mixed $array1, mixed $array2, int $mode = 1) : void {}
/**
* Plucks a single column from an array
*
* <code>
* $array[] = [
* 'id' => 1,
* 'username' => 'homer',
* ];
*
* $array[] = [
* 'id' => 2,
* 'username' => 'marge',
* ];
*
* $array[] = [
* 'id' => 3,
* 'username' => 'lisa',
* ];
*
* var_dump(A::pluck($array, 'username'));
* // result: ['homer', 'marge', 'lisa'];
* </code>
*
* @param array $array The source array
* @param string $key The key name of the column to extract
* @return array The result array with all values
* from that column.
*/
public static function pluck(array $array, string $key) : void {}
/**
* Prepends the given array
*
* @param array $array
* @param array $prepend
* @return array
*/
public static function prepend(array $array, array $prepend) : array {}
/**
* Shuffles an array and keeps the keys
*
* <code>
* $array = [
* 'cat' => 'miao',
* 'dog' => 'wuff',
* 'bird' => 'tweet'
* ];
*
* $shuffled = A::shuffle($array);
* // output: [
* // 'dog' => 'wuff',
* // 'cat' => 'miao',
* // 'bird' => 'tweet'
* // ];
* </code>
*
* @param array $array The source array
* @return array The shuffled result array
*/
public static function shuffle(array $array) : array {}
/**
* Returns the first element of an array
*
* <code>
* $array = [
* 'cat' => 'miao',
* 'dog' => 'wuff',
* 'bird' => 'tweet'
* ];
*
* $first = A::first($array);
* // first: 'miao'
* </code>
*
* @param array $array The source array
* @return mixed The first element
*/
public static function first(array $array) : void {}
/**
* Returns the last element of an array
*
* <code>
* $array = [
* 'cat' => 'miao',
* 'dog' => 'wuff',
* 'bird' => 'tweet'
* ];
*
* $last = A::last($array);
* // last: 'tweet'
* </code>
*
* @param array $array The source array
* @return mixed The last element
*/
public static function last(array $array) : void {}
/**
* Fills an array up with additional elements to certain amount.
*
* <code>
* $array = [
* 'cat' => 'miao',
* 'dog' => 'wuff',
* 'bird' => 'tweet'
* ];
*
* $result = A::fill($array, 5, 'elephant');
*
* // result: [
* // 'cat',
* // 'dog',
* // 'bird',
* // 'elephant',
* // 'elephant',
* // ];
* </code>
*
* @param array $array The source array
* @param int $limit The number of elements the array should
* contain after filling it up.
* @param mixed $fill The element, which should be used to
* fill the array
* @return array The filled-up result array
*/
public static function fill(array $array, int $limit, mixed $fill = 'placeholder') : array {}
/**
* Move an array item to a new index
*
* @param array $array
* @param int $from
* @param int $to
* @return array
*/
public static function move(array $array, int $from, int $to) : array {}
/**
* Checks for missing elements in an array
*
* This is very handy to check for missing
* user values in a request for example.
*
* <code>
* $array = [
* 'cat' => 'miao',
* 'dog' => 'wuff',
* 'bird' => 'tweet'
* ];
*
* $required = ['cat', 'elephant'];
*
* $missng = A::missing($array, $required);
* // missing: [
* // 'elephant'
* // ];
* </code>
*
* @param array $array The source array
* @param array $required An array of required keys
* @return array An array of missing fields. If this
* is empty, nothing is missing.
*/
public static function missing(array $array, array $required) : array {}
/**
* Normalizes an array into a nested form by converting
* dot notation in keys to nested structures
*
* @param array $array
* @param array $ignore List of keys in dot notation that should
* not be converted to a nested structure
* @return array
*/
public static function nest(array $array, array $ignore) : array {}
/**
* Recursively creates a nested array from a set of keys
* with a key on each level
*
* @param mixed $value Arbitrary value that will end up at the bottom of the tree
* @param array $keys List of keys to use sorted from the topmost level
* @return array|mixed Nested array or (if `$keys` is empty) the input `$value`
*/
public static function nestByKeys(mixed $value, array $keys) : void {}
/**
* Sorts a multi-dimensional array by a certain column
*
* <code>
* $array[0] = [
* 'id' => 1,
* 'username' => 'mike',
* ];
*
* $array[1] = [
* 'id' => 2,
* 'username' => 'peter',
* ];
*
* $array[3] = [
* 'id' => 3,
* 'username' => 'john',
* ];
*
* $sorted = A::sort($array, 'username ASC');
* // Array
* // (
* // [0] => Array
* // (
* // [id] => 3
* // [username] => john
* // )
* // [1] => Array
* // (
* // [id] => 1
* // [username] => mike
* // )
* // [2] => Array
* // (
* // [id] => 2
* // [username] => peter
* // )
* // )
*
* </code>
*
* @param array $array The source array
* @param string $field The name of the column
* @param string $direction desc (descending) or asc (ascending)
* @param int $method A PHP sort method flag or 'natural' for
* natural sorting, which is not supported in
* PHP by sort flags
* @return array The sorted array
*/
public static function sort(array $array, string $field, string $direction = 'desc', mixed $method) : array {}
/**
* Checks wether an array is associative or not
*
* <code>
* $array = ['a', 'b', 'c'];
*
* A::isAssociative($array);
* // returns: false
*
* $array = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
*
* A::isAssociative($array);
* // returns: true
* </code>
*
* @param array $array The array to analyze
* @return bool true: The array is associative false: It's not
*/
public static function isAssociative(array $array) : bool {}
/**
* Returns the average value of an array
*
* @param array $array The source array
* @param int $decimals The number of decimals to return
* @return float The average value
*/
public static function average(array $array, int $decimals) : float {}
/**
* Merges arrays recursively
*
* <code>
* $defaults = [
* 'username' => 'admin',
* 'password' => 'admin',
* ];
*
* $options = A::extend($defaults, ['password' => 'super-secret']);
* // returns: [
* // 'username' => 'admin',
* // 'password' => 'super-secret'
* // ];
* </code>
*
* @param array ...$arrays
* @return array
*/
public static function extend(mixed $arrays) : array {}
/**
* Update an array with a second array
* The second array can contain callbacks as values,
* which will get the original values as argument
*
* <code>
* $user = [
* 'username' => 'homer',
* 'email' => 'homer@simpsons.com'
* ];
*
* // simple updates
* A::update($user, [
* 'username' => 'homer j. simpson'
* ]);
*
* // with callback
* A::update($user, [
* 'username' => function ($username) {
* return $username . ' j. simpson'
* }
* ]);
* </code>
*
* @param array $array
* @param array $update
* @return array
*/
public static function update(array $array, array $update) : array {}
/**
* Wraps the given value in an array
* if it's not an array yet.
*
* @param mixed|null $array
* @return array
*/
public static function wrap(mixed $array) : array {}
}
/**
* This is the core class to handle
* configuration values/constants.
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class C extends Kirby\Toolkit\Silo
{
static public $data;
/**
* Setter for new data.
*
* @param string|array $key
* @param mixed $value
* @return array
*/
public static function set(mixed $key, mixed $value) : array {}
/**
* @param string|array $key
* @param mixed $default
* @return mixed
*/
public static function get(mixed $key, mixed $default) : void {}
/**
* Removes an item from the data array
*
* @param string|null $key
* @return array
*/
public static function remove(string $key) : array {}
}
/**
* This is the core class to handle
* configuration values/constants.
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Config extends Kirby\Toolkit\Silo
{
static public $data;
/**
* Setter for new data.
*
* @param string|array $key
* @param mixed $value
* @return array
*/
public static function set(mixed $key, mixed $value) : array {}
/**
* @param string|array $key
* @param mixed $default
* @return mixed
*/
public static function get(mixed $key, mixed $default) : void {}
/**
* Removes an item from the data array
*
* @param string|null $key
* @return array
*/
public static function remove(string $key) : array {}
}
/**
* The `Escape` class provides methods
* for escaping common HTML attributes
* data. This can be used to put
* untrusted data into typical
* attribute values like width, name,
* value, etc.
*
* Wrapper for the Laminas Escaper
* @link https://github.com/laminas/laminas-escaper
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Escape
{
/**
* Escape common HTML attributes data
*
* This can be used to put untrusted data into typical attribute values
* like width, name, value, etc.
*
* This should not be used for complex attributes like href, src, style,
* or any of the event handlers like onmouseover.
* Use esc($string, 'js') for event handler attributes, esc($string, 'url')
* for src attributes and esc($string, 'css') for style attributes.
*
* <div attr=...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...>content</div>
* <div attr='...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'>content</div>
* <div attr="...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...">content</div>
*
* @param string $string
* @return string
*/
public static function attr(mixed $string) : void {}
/**
* Escape HTML style property values
*
* This can be used to put untrusted data into a stylesheet or a style tag.
*
* Stay away from putting untrusted data into complex properties like url,
* behavior, and custom (-moz-binding). You should also not put untrusted data
* into IE’s expression property value which allows JavaScript.
*
* <style>selector { property : ...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...; } </style>
* <style>selector { property : "...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE..."; } </style>
* <span style="property : ...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...">text</span>
*
* @param string $string
* @return string
*/
public static function css(mixed $string) : void {}
/**
* Escape HTML element content
*
* This can be used to put untrusted data directly into the HTML body somewhere.
* This includes inside normal tags like div, p, b, td, etc.
*
* Escapes &, <, >, ", and ' with HTML entity encoding to prevent switching
* into any execution context, such as script, style, or event handlers.
*
* <body>...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...</body>
* <div>...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...</div>
*
* @param string $string
* @return string
*/
public static function html(mixed $string) : void {}
/**
* Escape JavaScript data values
*
* This can be used to put dynamically generated JavaScript code
* into both script blocks and event-handler attributes.
*
* <script>alert('...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...')</script>
* <script>x='...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'</script>
* <div onmouseover="x='...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...'"</div>
*
* @param string $string
* @return string
*/
public static function js(mixed $string) : void {}
/**
* Escape URL parameter values
*
* This can be used to put untrusted data into HTTP GET parameter values.
* This should not be used to escape an entire URI.
*
* <a href="http://www.somesite.com?test=...ESCAPE UNTRUSTED DATA BEFORE PUTTING HERE...">link</a>
*
* @param string $string
* @return string
*/
public static function url(mixed $string) : void {}
/**
* Escape XML element content
*
* Removes offending characters that could be wrongfully interpreted as XML markup.
*
* The following characters are reserved in XML and will be replaced with their
* corresponding XML entities:
*
* ' is replaced with &apos;
* " is replaced with &quot;
* & is replaced with &amp;
* < is replaced with &lt;
* > is replaced with &gt;
*
* @param string $string
* @return string
*/
public static function xml(mixed $string) : void {}
}
/**
* The `F` class provides methods for
* dealing with files on the file system
* level, like creating, reading,
* deleting, copying or validatings files.
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class F
{
static public $types;
static public $units;
/**
* Appends new content to an existing file
*
* @param string $file The path for the file
* @param mixed $content Either a string or an array. Arrays will be converted to JSON.
* @return bool
*/
public static function append(string $file, mixed $content) : bool {}
/**
* Returns the file content as base64 encoded string
*
* @param string $file The path for the file
* @return string
*/
public static function base64(string $file) : string {}
/**
* Copy a file to a new location.
*
* @param string $source
* @param string $target
* @param bool $force
* @return bool
*/
public static function copy(string $source, string $target, bool $force) : bool {}
/**
* Just an alternative for dirname() to stay consistent
*
* <code>
*
* $dirname = F::dirname('/var/www/test.txt');
* // dirname is /var/www
*
* </code>
*
* @param string $file The path
* @return string
*/
public static function dirname(string $file) : string {}
/**
* Checks if the file exists on disk
*
* @param string $file
* @param string $in
* @return bool
*/
public static function exists(string $file, string $in) : bool {}
/**
* Gets the extension of a file
*
* @param string $file The filename or path
* @param string $extension Set an optional extension to overwrite the current one
* @return string
*/
public static function extension(string $file, string $extension) : string {}
/**
* Converts a file extension to a mime type
*
* @param string $extension
* @return string|false
*/
public static function extensionToMime(string $extension) : void {}
/**
* Returns the file type for a passed extension
*
* @param string $extension
* @return string|false
*/
public static function extensionToType(string $extension) : void {}
/**
* Returns all extensions for a certain file type
*
* @param string $type
* @return array
*/
public static function extensions(string $type) : void {}
/**
* Extracts the filename from a file path
*
* <code>
*
* $filename = F::filename('/var/www/test.txt');
* // filename is test.txt
*
* </code>
*
* @param string $name The path
* @return string
*/
public static function filename(string $name) : string {}
/**
* Invalidate opcode cache for file.
*
* @param string $file The path of the file
* @return bool
*/
public static function invalidateOpcodeCache(string $file) : bool {}
/**
* Checks if a file is of a certain type
*
* @param string $file Full path to the file
* @param string $value An extension or mime type
* @return bool
*/
public static function is(string $file, string $value) : bool {}
/**
* Checks if the file is readable
*
* @param string $file
* @return bool
*/
public static function isReadable(string $file) : bool {}
/**
* Checks if the file is writable
*
* @param string $file
* @return bool
*/
public static function isWritable(string $file) : bool {}
/**
* Create a (symbolic) link to a file
*
* @param string $source
* @param string $link
* @param string $method
* @return bool
*/
public static function link(string $source, string $link, string $method = 'link') : bool {}
/**
* Loads a file and returns the result or `false` if the
* file to load does not exist
*
* @param string $file
* @param mixed $fallback
* @param array $data Optional array of variables to extract in the variable scope
* @return mixed
*/
public static function load(string $file, mixed $fallback, array $data) : void {}
/**
* Loads a file using `include_once()` and returns whether loading was successful
*
* @param string $file
* @return bool
*/
public static function loadOnce(string $file) : bool {}
/**
* Returns the mime type of a file
*
* @param string $file
* @return string|false
*/
public static function mime(string $file) : void {}
/**
* Converts a mime type to a file extension
*
* @param string $mime
* @return string|false
*/
public static function mimeToExtension(string $mime) : void {}
/**
* Returns the type for a given mime
*
* @param string $mime
* @return string|false
*/
public static function mimeToType(string $mime) : void {}
/**
* Get the file's last modification time.
*
* @param string $file
* @param string $format
* @param string $handler date or strftime
* @return mixed
*/
public static function modified(string $file, string $format, string $handler = 'date') : void {}
/**
* Moves a file to a new location
*
* @param string $oldRoot The current path for the file
* @param string $newRoot The path to the new location
* @param bool $force Force move if the target file exists
* @return bool
*/
public static function move(string $oldRoot, string $newRoot, bool $force) : bool {}
/**
* Extracts the name from a file path or filename without extension
*
* @param string $name The path or filename
* @return string
*/
public static function name(string $name) : string {}
/**
* Converts an integer size into a human readable format
*
* @param mixed $size The file size or a file path
* @param string|null|false $locale Locale for number formatting,
* `null` for the current locale,
* `false` to disable number formatting
* @return string
*/
public static function niceSize(mixed $size, mixed $locale) : string {}
/**
* Reads the content of a file or requests the
* contents of a remote HTTP or HTTPS URL
*
* @param string $file The path for the file or an absolute URL
* @return string|false
*/
public static function read(string $file) : void {}
/**
* Changes the name of the file without
* touching the extension
*
* @param string $file
* @param string $newName
* @param bool $overwrite Force overwrite existing files
* @return string|false
*/
public static function rename(string $file, string $newName, bool $overwrite) : void {}
/**
* Returns the absolute path to the file if the file can be found.
*
* @param string $file
* @param string $in
* @return string|null
*/
public static function realpath(string $file, string $in) : void {}
/**
* Returns the relative path of the file
* starting after $in
*
* @param string $file
* @param string $in
* @return string
*/
public static function relativepath(string $file, string $in) : string {}
/**
* Deletes a file
*
* <code>
*
* $remove = F::remove('test.txt');
* if($remove) echo 'The file has been removed';
*
* </code>
*
* @param string $file The path for the file
* @return bool
*/
public static function remove(string $file) : bool {}
/**
* Sanitize a filename to strip unwanted special characters
*
* <code>
*
* $safe = f::safeName('über genious.txt');
* // safe will be ueber-genious.txt
*
* </code>
*
* @param string $string The file name
* @return string
*/
public static function safeName(string $string) : string {}
/**
* Tries to find similar or the same file by
* building a glob based on the path
*
* @param string $path
* @param string $pattern
* @return array
*/
public static function similar(string $path, string $pattern = '*') : array {}
/**
* Returns the size of a file.
*
* @param mixed $file The path
* @return int
*/
public static function size(string $file) : int {}
/**
* Categorize the file
*
* @param string $file Either the file path or extension
* @return string|null
*/
public static function type(string $file) : void {}
/**
* Returns all extensions of a given file type
* or `null` if the file type is unknown
*
* @param string $type
* @return array|null
*/
public static function typeToExtensions(string $type) : array {}
/**
* Unzips a zip file
*
* @param string $file
* @param string $to
* @return bool
*/
public static function unzip(string $file, string $to) : bool {}
/**
* Returns the file as data uri
*
* @param string $file The path for the file
* @return string|false
*/
public static function uri(string $file) : void {}
/**
* Creates a new file
*
* @param string $file The path for the new file
* @param mixed $content Either a string, an object or an array. Arrays and objects will be serialized.
* @param bool $append true: append the content to an exisiting file if available. false: overwrite.
* @return bool
*/
public static function write(string $file, mixed $content, bool $append) : bool {}
}
/**
* Localization class, roughly inspired by VueI18n
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class I18n
{
static public $load;
static public $locale;
static public $translations;
static public $fallback;
/**
* Returns the first fallback locale
*
* @deprecated 3.5.1 Use `\Kirby\Toolkit\I18n::fallbacks()` instead
* @todo Add deprecated() helper warning in 3.6.0
* @todo Remove in 3.7.0
*
* @return string
*/
public static function fallback() : string {}
/**
* Returns the list of fallback locales
*
* @return array
*/
public static function fallbacks() : array {}
/**
* Returns singular or plural
* depending on the given number
*
* @param int $count
* @param bool $none If true, 'none' will be returned if the count is 0
* @return string
*/
public static function form(int $count, bool $none) : string {}
/**
* Formats a number
*
* @param int|float $number
* @param string $locale
* @return string
*/
public static function formatNumber(mixed $number, string $locale) : string {}
/**
* Returns the locale code
*
* @return string
*/
public static function locale() : string {}
/**
* Translates a given message
* according to the currently set locale
*
* @param string|array $key
* @param string|array|null $fallback
* @param string|null $locale
* @return string|array|null
*/
public static function translate(mixed $key, mixed $fallback, string $locale) : void {}
/**
* Translate by key and then replace
* placeholders in the text
*
* @param string $key
* @param string|array|null $fallback
* @param array|null $replace
* @param string|null $locale
* @return string
*/
public static function template(string $key, mixed $fallback, array $replace, string $locale) : string {}
/**
* Returns the current or any other translation
* by locale. If the translation does not exist
* yet, the loader will try to load it, if defined.
*
* @param string|null $locale
* @return array
*/
public static function translation(string $locale) : array {}
/**
* Returns all loaded or defined translations
*
* @return array
*/
public static function translations() : array {}
/**
* Translates amounts
*
* Translation definition options:
* - Translation is a simple string: `{{ count }}` gets replaced in the template
* - Translation is an array with a value for each count: Chooses the correct template and
* replaces `{{ count }}` in the template; if no specific template for the input count is
* defined, the template that is defined last in the translation array is used
* - Translation is a callback with a `$count` argument: Returns the callback return value
*
* @param string $key
* @param int $count
* @param string $locale
* @param bool $formatNumber If set to `false`, the count is not formatted
* @return mixed
*/
public static function translateCount(string $key, int $count, string $locale, bool $formatNumber = true) : void {}
}
/**
* The `Mime` class provides method
* for MIME type detection or guessing
* from different criteria like
* extensions etc.
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Mime
{
static public $types;
/**
* Fixes an invalid MIME type guess for the given file
*
* @param string $file
* @param string $mime
* @param string $extension
* @return string|null
*/
public static function fix(string $file, string $mime, string $extension) : void {}
/**
* Guesses a MIME type by extension
*
* @param string $extension
* @return string|null
*/
public static function fromExtension(string $extension) : void {}
/**
* Returns the MIME type of a file
*
* @param string $file
* @return string|false
*/
public static function fromFileInfo(string $file) : void {}
/**
* Returns the MIME type of a file
*
* @param string $file
* @return string|false
*/
public static function fromMimeContentType(string $file) : void {}
/**
* Tries to detect a valid SVG and returns the MIME type accordingly
*
* @param string $file
* @return string|false
*/
public static function fromSvg(string $file) : void {}
/**
* Tests if a given MIME type is matched by an `Accept` header
* pattern; returns true if the MIME type is contained at all
*
* @param string $mime
* @param string $pattern
* @return bool
*/
public static function isAccepted(string $mime, string $pattern) : bool {}
/**
* Tests if a MIME wildcard pattern from an `Accept` header
* matches a given type
* @since 3.3.0
*
* @param string $test
* @param string $wildcard
* @return bool
*/
public static function matches(string $test, string $wildcard) : bool {}
/**
* Returns the extension for a given MIME type
*
* @param string|null $mime
* @return string|false
*/
public static function toExtension(string $mime) : void {}
/**
* Returns all available extensions for a given MIME type
*
* @param string|null $mime
* @return array
*/
public static function toExtensions(string $mime) : array {}
/**
* Returns the MIME type of a file
*
* @param string $file
* @param string $extension
* @return string|false
*/
public static function type(string $file, string $extension) : void {}
/**
* Returns all detectable MIME types
*
* @return array
*/
public static function types() : array {}
}
/**
* Super simple stdClass extension with
* magic getter methods for all properties
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Obj extends stdClass
{
/**
* Constructor
*
* @param array $data
*/
public function __construct(array $data) {}
/**
* Magic getter
*
* @param string $property
* @param array $arguments
* @return mixed
*/
public function __call(string $property, array $arguments) : void {}
/**
* Improved `var_dump` output
*
* @return array
*/
public function __debugInfo() : array {}
/**
* Magic property getter
*
* @param string $property
* @return mixed
*/
public function __get(string $property) : void {}
/**
* Property Getter
*
* @param string $property
* @param mixed $fallback
* @return mixed
*/
public function get(string $property, mixed $fallback) : void {}
/**
* Converts the object to an array
*
* @return array
*/
public function toArray() : array {}
/**
* Converts the object to a json string
*
* @param mixed ...$arguments
* @return string
*/
public function toJson(mixed $arguments) : string {}
}
/**
* The String class provides a set
* of handy methods for string
* handling and manipulation.
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Str
{
static public $language;
static public $ascii;
static public $defaults;
/**
* Parse accepted values and their quality from an
* accept string like an Accept or Accept-Language header
*
* @param string $input
* @return array
*/
public static function accepted(string $input) : array {}
/**
* Returns the rest of the string after the given character
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return string
*/
public static function after(string $string, string $needle, bool $caseInsensitive) : string {}
/**
* Convert a string to 7-bit ASCII.
*
* @param string $string
* @return string
*/
public static function ascii(string $string) : string {}
/**
* Returns the beginning of a string before the given character
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return string
*/
public static function before(string $string, string $needle, bool $caseInsensitive) : string {}
/**
* Returns everything between two strings from the first occurrence of a given string
*
* @param string $string
* @param string $start
* @param string $end
* @return string
*/
public static function between(string $string, string $start, string $end) : string {}
/**
* Checks if a str contains another string
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return bool
*/
public static function contains(string $string, string $needle, bool $caseInsensitive) : bool {}
/**
* Converts a string to a different encoding
*
* @param string $string
* @param string $targetEncoding
* @param string $sourceEncoding (optional)
* @return string
*/
public static function convert(mixed $string, mixed $targetEncoding, mixed $sourceEncoding) : void {}
/**
* Encode a string (used for email addresses)
*
* @param string $string
* @return string
*/
public static function encode(string $string) : string {}
/**
* Tries to detect the string encoding
*
* @param string $string
* @return string
*/
public static function encoding(string $string) : string {}
/**
* Checks if a string ends with the passed needle
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return bool
*/
public static function endsWith(string $string, string $needle, bool $caseInsensitive) : bool {}
/**
* Creates an excerpt of a string
* It removes all html tags first and then cuts the string
* according to the specified number of chars.
*
* @param string $string The string to be shortened
* @param int $chars The final number of characters the string should have
* @param bool $strip True: remove the HTML tags from the string first
* @param string $rep The element, which should be added if the string is too long. Ellipsis is the default.
* @return string The shortened string
*/
public static function excerpt(mixed $string, mixed $chars = 140, mixed $strip = true, mixed $rep = ' …') : void {}
/**
* Convert the value to a float with a decimal
* point, no matter what the locale setting is
*
* @param string|int|float $value
* @return string
*/
public static function float(mixed $value) : string {}
/**
* Returns the rest of the string starting from the given character
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return string
*/
public static function from(string $string, string $needle, bool $caseInsensitive) : string {}
/**
* Checks if the given string is a URL
*
* @param string|null $string
* @return bool
*/
public static function isURL(string $string) : bool {}
/**
* Convert a string to kebab case.
*
* @param string $value
* @return string
*/
public static function kebab(string $value) : string {}
/**
* A UTF-8 safe version of strlen()
*
* @param string $string
* @return int
*/
public static function length(string $string) : int {}
/**
* A UTF-8 safe version of strtolower()
*
* @param string $string
* @return string
*/
public static function lower(string $string) : string {}
/**
* Safe ltrim alternative
*
* @param string $string
* @param string $trim
* @return string
*/
public static function ltrim(string $string, string $trim = ' ') : string {}
/**
* Get a character pool with various possible combinations
*
* @param string|array $type
* @param bool $array
* @return string|array
*/
public static function pool(mixed $type, bool $array = true) : void {}
/**
* Returns the position of a needle in a string
* if it can be found
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return int|bool
*/
public static function position(string $string, string $needle, bool $caseInsensitive) : void {}
/**
* Runs a string query.
* Check out the Query class for more information.
*
* @param string $query
* @param array $data
* @return string|null
*/
public static function query(string $query, array $data) : void {}
/**
* Generates a random string that may be used for cryptographic purposes
*
* @param int $length The length of the random string
* @param string $type Pool type (type of allowed characters)
* @return string
*/
public static function random(int $length, string $type = 'alphaNum') : void {}
/**
* Replaces all or some occurrences of the search string with the replacement string
* Extension of the str_replace() function in PHP with an additional $limit parameter
*
* @param string|array $string String being replaced on (haystack);
* can be an array of multiple subject strings
* @param string|array $search Value being searched for (needle)
* @param string|array $replace Value to replace matches with
* @param int|array $limit Maximum possible replacements for each search value;
* multiple limits for each search value are supported;
* defaults to no limit
* @return string|array String with replaced values;
* if $string is an array, array of strings
*/
public static function replace(mixed $string, mixed $search, mixed $replace, mixed $limit = -1) : void {}
/**
* Generates a replacement array out of dynamic input data
* Used for Str::replace()
*
* @param string|array $search Value being searched for (needle)
* @param string|array $replace Value to replace matches with
* @param int|array $limit Maximum possible replacements for each search value;
* multiple limits for each search value are supported;
* defaults to no limit
* @return array List of replacement arrays, each with a
* 'search', 'replace' and 'limit' attribute
*/
public static function replacements(mixed $search, mixed $replace, mixed $limit) : array {}
/**
* Takes a replacement array and processes the replacements
* Used for Str::replace()
*
* @param string $string String being replaced on (haystack)
* @param array $replacements Replacement array from Str::replacements()
* @return string String with replaced values
*/
public static function replaceReplacements(string $string, array $replacements) : string {}
/**
* Safe rtrim alternative
*
* @param string $string
* @param string $trim
* @return string
*/
public static function rtrim(string $string, string $trim = ' ') : string {}
/**
* Shortens a string and adds an ellipsis if the string is too long
*
* <code>
*
* echo Str::short('This is a very, very, very long string', 10);
* // output: This is a…
*
* echo Str::short('This is a very, very, very long string', 10, '####');
* // output: This i####
*
* </code>
*
* @param string $string The string to be shortened
* @param int $length The final number of characters the
* string should have
* @param string $appendix The element, which should be added if the
* string is too long. Ellipsis is the default.
* @return string The shortened string
*/
public static function short(string $string, int $length, string $appendix = '…') : string {}
/**
* Convert a string to a safe version to be used in a URL
*
* @param string $string The unsafe string
* @param string $separator To be used instead of space and
* other non-word characters.
* @param string $allowed List of all allowed characters (regex)
* @param int $maxlength The maximum length of the slug
* @return string The safe string
*/
public static function slug(string $string, string $separator, string $allowed, int $maxlength = 128) : string {}
/**
* Calculates the similarity between two strings with multibyte support
* @since 3.5.2
*
* @author Based on the work of Antal Áron
* @copyright Original Copyright (c) 2017, Antal Áron
* @license https://github.com/antalaron/mb-similar-text/blob/master/LICENSE MIT License
* @param string $first
* @param string $second
* @param bool $caseInsensitive If `true`, strings are compared case-insensitively
* @return array matches: Number of matching chars in both strings
* percent: Similarity in percent
*/
public static function similarity(string $first, string $second, bool $caseInsensitive) : array {}
/**
* Convert a string to snake case.
*
* @param string $value
* @param string $delimiter
* @return string
*/
public static function snake(string $value, string $delimiter = '_') : string {}
/**
* Better alternative for explode()
* It takes care of removing empty values
* and it has a built-in way to skip values
* which are too short.
*
* @param string $string The string to split
* @param string $separator The string to split by
* @param int $length The min length of values.
* @return array An array of found values
*/
public static function split(mixed $string, string $separator = ',', int $length = 1) : array {}
/**
* Checks if a string starts with the passed needle
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return bool
*/
public static function startsWith(string $string, string $needle, bool $caseInsensitive) : bool {}
/**
* A UTF-8 safe version of substr()
*
* @param string $string
* @param int $start
* @param int $length
* @return string
*/
public static function substr(string $string, int $start, int $length) : string {}
/**
* Replaces placeholders in string with value from array
*
* <code>
*
* echo Str::template('From {{ b }} to {{ a }}', ['a' => 'there', 'b' => 'here']);
* // output: From here to there
*
* </code>
*
* @param string|null $string The string with placeholders
* @param array $data Associative array with placeholders as
* keys and replacements as values
* @param string|array|null $fallback An options array that contains:
* - fallback: if a token does not have any matches
* - callback: to be able to handle each matching result
* - start: start placeholder
* - end: end placeholder
* A simple fallback string is supported for compatibility (but deprecated).
* @param string $start Placeholder start characters
* @param string $end Placeholder end characters
*
* @todo Deprecate `string $fallback` and `$start`/`$end` arguments with warning in 3.6.0
* @todo Remove `$start` and `$end` parameters, rename `$fallback` to `$options` and only support `array` type for `$options` in 3.7.0
*
* @return string The filled-in string
*/
public static function template(string $string, array $data, mixed $fallback, string $start = '{{', string $end = '}}') : string {}
/**
* Converts a filesize string with shortcuts
* like M, G or K to an integer value
*
* @param mixed $size
* @return int
*/
public static function toBytes(mixed $size) : int {}
/**
* Convert the string to the given type
*
* @param string $string
* @param mixed $type
* @return mixed
*/
public static function toType(mixed $string, mixed $type) : void {}
/**
* Safe trim alternative
*
* @param string $string
* @param string $trim
* @return string
*/
public static function trim(string $string, string $trim = ' ') : string {}
/**
* A UTF-8 safe version of ucfirst()
*
* @param string $string
* @return string
*/
public static function ucfirst(string $string) : string {}
/**
* A UTF-8 safe version of ucwords()
*
* @param string $string
* @return string
*/
public static function ucwords(string $string) : string {}
/**
* Removes all html tags and encoded chars from a string
*
* <code>
*
* echo str::unhtml('some <em>crazy</em> stuff');
* // output: some uber crazy stuff
*
* </code>
*
* @param string $string
* @return string The html string
*/
public static function unhtml(string $string) : string {}
/**
* Returns the beginning of a string until the given character
*
* @param string $string
* @param string $needle
* @param bool $caseInsensitive
* @return string
*/
public static function until(string $string, string $needle, bool $caseInsensitive) : string {}
/**
* A UTF-8 safe version of strotoupper()
*
* @param string $string
* @return string
*/
public static function upper(string $string) : string {}
/**
* The widont function makes sure that there are no
* typographical widows at the end of a paragraph –
* that's a single word in the last line
*
* @param string $string
* @return string
*/
public static function widont(string $string) : string {}
}
/**
* Simple PHP template engine
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Tpl
{
/**
* Renders the template
*
* @param string $file
* @param array $data
* @return string
*/
public static function load(string $file, array $data) : string {}
}
/**
* A set of validator methods
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class V
{
static public $validators;
/**
* Validates the given input with all passed rules
* and returns an array with all error messages.
* The array will be empty if the input is valid
*
* @param mixed $input
* @param array $rules
* @param array $messages
* @return array
*/
public static function errors(mixed $input, array $rules, mixed $messages) : array {}
/**
* Creates a useful error message for the given validator
* and the arguments. This is used mainly internally
* to create error messages
*
* @param string $validatorName
* @param mixed ...$params
* @return string|null
*/
public static function message(string $validatorName, mixed $params) : string {}
/**
* Return the list of all validators
*
* @return array
*/
public static function validators() : array {}
/**
* Validate a single value against
* a set of rules, using all registered
* validators
*
* @param mixed $value
* @param array $rules
* @param array $messages
* @param bool $fail
* @return bool|array
*/
public static function value(mixed $value, array $rules, array $messages, bool $fail = true) : void {}
/**
* Validate an input array against
* a set of rules, using all registered
* validators
*
* @param array $input
* @param array $rules
* @return bool
*/
public static function input(array $input, array $rules) : bool {}
/**
* Calls an installed validator and passes all arguments
*
* @param string $method
* @param array $arguments
* @return bool
*/
public static function __callStatic(string $method, array $arguments) : bool {}
}
/**
* XML parser and creator class
*
* @package Kirby Toolkit
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://opensource.org/licenses/MIT
*/
class Xml
{
static public $entities;
static public $void;
/**
* Generates a single attribute or a list of attributes
*
* @param string|array $name String: A single attribute with that name will be generated.
* Key-value array: A list of attributes will be generated. Don't pass a second argument in that case.
* @param mixed $value If used with a `$name` string, pass the value of the attribute here.
* If used with a `$name` array, this can be set to `false` to disable attribute sorting.
* @return string|null The generated XML attributes string
*/
public static function attr(mixed $name, mixed $value) : string {}
/**
* Creates an XML string from an array
*
* Supports special array keys `@name` (element name),
* `@attributes` (XML attribute key-value array),
* `@namespaces` (array with XML namespaces) and
* `@value` (element content)
*
* @param array|string $props The source array or tag content (used internally)
* @param string $name The name of the root element
* @param bool $head Include the XML declaration head or not
* @param string $indent Indentation string, defaults to two spaces
* @param int $level The indendation level (used internally)
* @return string The XML string
*/
public static function create(mixed $props, string $name = 'root', bool $head = true, string $indent = ' ', int $level) : string {}
/**
* Removes all HTML/XML tags and encoded chars from a string
*
* ```
* echo Xml::decode('some &uuml;ber <em>crazy</em> stuff');
* // output: some über crazy stuff
* ```
*
* @param string|null $string
* @return string
*/
public static function decode(string $string) : string {}
/**
* Converts a string to an XML-safe string
*
* Converts it to HTML-safe first and then it
* will replace HTML entities with XML entities
*
* ```php
* echo Xml::encode('some über crazy stuff');
* // output: some &#252;ber crazy stuff
* ```
*
* @param string|null $string
* @param bool $html True = Convert to HTML-safe first
* @return string
*/
public static function encode(string $string, bool $html = true) : string {}
/**
* Returns the HTML-to-XML entity translation table
*
* @return array
*/
public static function entities() : array {}
/**
* Parses an XML string and returns an array
*
* @param string $xml
* @return array|null Parsed array or `null` on error
*/
public static function parse(string $xml) : array {}
/**
* Breaks a SimpleXMLElement down into a simpler tree
* structure of arrays and strings
*
* @param \SimpleXMLElement $element
* @param bool $collectName Whether the element name should be collected (for the root element)
* @return array|string
*/
public static function simplify(SimpleXMLElement $element, bool $collectName = true) : void {}
/**
* Builds an XML tag
*
* @param string $name Tag name
* @param array|string|null $content Scalar value or array with multiple lines of content or `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
* @param string|null $indent Indentation string, defaults to two spaces or `null` for output on one line
* @param int $level Indentation level
* @return string The generated XML
*/
public static function tag(string $name, mixed $content, array $attr, string $indent, int $level) : string {}
/**
* Properly encodes tag contents
*
* @param mixed $value
* @return string|null
*/
public static function value(mixed $value) : string {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment