iis_config()
IIS Start config helper
iis_config(string $keys[, mixed|null $fallback = null ]) : mixed
Parameters
-
$keys
: string
-
the key to get the value for. Use dot notation for going deeper.
-
$fallback
: mixed|null
= null
-
fallback if value is missing
Return values
mixed
—
The value (if found) for the given key.
iis_remember()
Cache return value of callback if not already cached and return the contents
iis_remember(string $cache_key, int $cache_time, callable $callback) : mixed|null
Parameters
-
$cache_key
: string
-
The name of the cached content.
-
$cache_time
: int
-
How long the content should be cached.
-
$callback
: callable
-
The callback that returns the content that should be cached.
Return values
mixed|null
—
Escape input recursively
iis_safe_get_input(mixed $input) : array<string|int, mixed>|string
Parameters
-
$input
: mixed
-
Return values
array<string|int, mixed>|string
—
iis_safe_get()
Return a safe GET value with an optional default value.
iis_safe_get(string $key[, null|string $default = null ]) : null|string
Parameters
-
$key
: string
-
The key for the $_GET array.
-
$default
: null|string
= null
-
Default value if GET variable doesn't exist.
Return values
null|string
—
iis_active_class()
Echo an "active"-class if the comparison is true, otherwise
an empty string.
iis_active_class(string $value[, string $compare_with = null ][, string $class = 'is-active' ][, bool $include_attr = true ]) : void
Parameters
-
$value
: string
-
The value to compare against.
-
$compare_with
: string
= null
-
The value to compare with.
-
$class
: string
= 'is-active'
-
The class that should be echoed if true.
-
$include_attr
: bool
= true
-
True if class attribute should be included.
Return values
void
—
iis_active()
Echo a string if the comparison is true, otherwise empty string
iis_active(string $value[, string|array<string|int, mixed> $compare_with = null ][, string $attr = 'checked' ][, bool $echo = true ]) : bool|string|void
Parameters
-
$value
: string
-
The value to compare against.
-
$compare_with
: string|array<string|int, mixed>
= null
-
The value to compare with.
-
$attr
: string
= 'checked'
-
The attribute that should be echoed if $echo is true.
-
$echo
: bool
= true
-
True if class attribute should be included.
Return values
bool|string|void
—
iis_mix_manifest()
Get the laravel mix manifest
iis_mix_manifest() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null
—
iis_mix()
Get the path to a versioned Mix file
iis_mix(string $path[, string $base = '/assets/' ]) : string|null
Parameters
-
$path
: string
-
-
$base
: string
= '/assets/'
-
Return values
string|null
—
iis_get_hero()
Get the content hero
iis_get_hero([int|null $post_id = null ]) : array<string|int, mixed>|null
Parameters
-
$post_id
: int|null
= null
-
Return values
array<string|int, mixed>|null
—
iis_has_hero()
Checks if content starts with a hero
iis_has_hero([int|null $post_id = null ]) : bool
Parameters
-
$post_id
: int|null
= null
-
Return values
bool
—
iis_has_full_hero()
Checks if content starts with a full-width hero
iis_has_full_hero([int|null $post_id = null ]) : bool
Parameters
-
$post_id
: int|null
= null
-
Return values
bool
—
imns()
Get and echo the styleguide namespace, set in .env-file of the theme
imns(string $class[, bool $echo = true ]) : void|string
Parameters
-
$class
: string
-
Class names, separated by space
-
$echo
: bool
= true
-
true for echo and false to return the string
Return values
void|string
—
iis_uses_styleguide()
Check if theme is using the styleguide
iis_uses_styleguide() : bool
-
deprecated
-
Return values
bool
—
iis_styleguide_sprite()
Print IIS styleguide icon sprite
iis_styleguide_sprite() : void
Return values
void
—
iis_word_count()
Count number of words in string.
iis_word_count( $str) : false|int|null
Multibyte version because str_word_count does not work with Swedish chars.
https://stackoverflow.com/questions/8290537/is-php-str-word-count-multibyte-safe
Parameters
-
$str
:
-
Return values
false|int|null
—
iis_get_reading_time()
Get reading time for a string, in minutes.
iis_get_reading_time(string $html) : float
Uses the calculation from https://blog.medium.com/read-time-and-you-bc2048ab620c.
Parameters
-
$html
: string
-
Return values
float
—
iis_get_post_reading_time()
Get reading time for a post, in minutes.
iis_get_post_reading_time(WP_Post|object|int $post_id) : float
Uses the calculation from https://blog.medium.com/read-time-and-you-bc2048ab620c.
Parameters
-
$post_id
: WP_Post|object|int
-
Return values
float
—
iis_get_images_reading_time()
Calculate reading time for images in minutes.
iis_get_images_reading_time(int $total_images, int $wpm) : int
Based on function from
https://github.com/yingles/reading-time-wp/blob/master/rt-reading-time.php
Parameters
-
$total_images
: int
-
number of images in post.
-
$wpm
: int
-
Return values
int
—
Additional time in minutes added to the reading time by images.