Skip to content

functions_essentials_resources

Daniel Spors edited this page Feb 14, 2023 · 2 revisions

Functions in file essentials/resources.php

resources_init

Initializes the resources essential.

Definition: public function resources_init()

Returns: void

resourceExists

Checks if a resource exists and returns it if so.

Definition: public function resourceExists($filename, $return_url=false, $as_local_path=false, $nocache=false)

Returns: string Depending on $return_url returns: (the resource URL or false on error) OR (true or false)

Parameters:

  • string $filename The resource name

  • bool $return_url If true returns an URL, else returns true or false depending on if the resource exists

  • bool $as_local_path If true returns not URL, but a filepath in local filesystem. Needs $return_url=true.

  • bool $nocache If true skips all internal caches and peforms a search now

resFile

Returns aresource file, as local path or as URI.

Definition: public function resFile($filename, $as_local_path=false)

Returns: string An URL to the resource or the local file path. FALSE on error.

Parameters:

  • string $filename The resource filename (relative or name only)

  • bool $as_local_path If true returns no URL, but a local path

register_less_variable

Registers a variable for use in LESS files.

Definition: public function register_less_variable($name, $value)

Returns: void

Parameters:

  • string $name Variable name

  • string $value Variable value

add_less_import_dir

Adds a folder to the LESS search path.

Definition: public function add_less_import_dir($dir, $key=false)

Returns: void

Parameters:

  • string $dir Folder to be added

  • mixed $key If given names this folder, so that it can be overwritten by another call to add_less_import_dir

clear_less_cache

Clears the LESS cache.

Definition: public function clear_less_cache()

Returns: void

compile_less_code

Compiles LESS code to CSS.

Definition: public function compile_less_code($less, $use_vars=false)

Returns: string The compiled CSS code

Parameters:

  • string $less The LESS code

  • bool $use_vars Switch if defined variables should be used (default: true).

Clone this wiki locally