ProcessWire functions
Documentation for procedural functions available in ProcessWire CMS.
Common
| Name | Return | Summary | |
|---|---|---|---|
wire() wire() wire(string $name = 'wire') | mixed | Return an API variable, or return current Process | |
wire404() wire404() wire404(string $message = '') | None | Stop execution with a 404 unless redirect URL available (for front-end use) | |
wireCount() wireCount(mixed $value) wireCount(mixed $value) | int | Return the count of item(s) present in the given value | |
wireDate() wireDate() wireDate($format = '', $ts = null) | string bool | Format a date, using PHP date(), strftime() or other special strings (see arguments). | |
wireEmpty() wireEmpty(mixed $value) wireEmpty(mixed $value) | bool | Is the given value empty according to Process | |
wireInstance() wireInstance() wireInstance($wire = null) | Process | Get or set the current Process | |
wireLen() wireLen($value) wireLen($value) | int | Returns string byte length of any type (string, array, object, bool, int, etc.) | |
wireLength() wireLength($value) wireLength($value, bool $mb = true) | int | Returns string length of any type (string, array, object, bool, int, etc.) | |
wireMail() wireMail() wireMail($to = '', string $from = '', string $subject = '', $body = '', $options = array) | int WireMail | Send an email or get a WireMail object to populate before send |
Markup
| Name | Return | Summary | |
|---|---|---|---|
wireIconMarkup() wireIconMarkup(string $icon) wireIconMarkup(string $icon, string $class = '') | string | Render markup for a system icon | |
wireIconMarkupFile() wireIconMarkupFile(string $filename) wireIconMarkupFile(string $filename, $class = '') | string | Get the markup or class name for an icon that can represent the given filename |
Strings
| Name | Return | Summary | |
|---|---|---|---|
wireBytesStr() wireBytesStr(int $bytes) wireBytesStr(int $bytes, $small = false, $options = array) | string | Given a quantity of bytes (int), return readable string that refers to quantity in bytes, kB, MB, GB and TB | |
wireDate() wireDate() wireDate($format = '', $ts = null) | string bool | Format a date, using PHP date(), strftime() or other special strings (see arguments). | |
wirePopulateStringTags() wirePopulateStringTags(string $str, $vars) wirePopulateStringTags(string $str, $vars, array $options = array) | string | Given a string ($str) and values ($vars), replace “{tags}” in the string with the values | |
wireRelativeTimeStr() wireRelativeTimeStr($ts) wireRelativeTimeStr($ts, $abbreviate = false, bool $useTense = true) | string | Given a unix timestamp (or date string), returns a formatted string indicating the time relative to now |
Arrays
These shortcuts for creating WireArray types are available in Process
| Name | Return | Summary | |
|---|---|---|---|
PageArray() PageArray() PageArray($items = array) | PageArray | Create new PageArray, add given $items (pages) to it, and return it | |
WireArray() WireArray() WireArray($items = array) | WireArray | Create new WireArray, add given $items to it, and return it | |
WireData() WireData() WireData($data = array) | WireData | Create a new WireData instance and optionally add given associative array of data to it |
Functions API
| Name | Return | Summary | |
|---|---|---|---|
wire() wire() wire(string $name = 'wire') | mixed | Return an API variable, or return current Process |
Files
These file system functions are procedural versions of some of those provided by the $files API variable.
Class helpers
API reference based on Process