random_string()
random_string(integer $length, string $characters) : string
Parameters
integer | $length | |
string | $characters |
Throws
- \InvalidArgumentException
Miscellaneous helper functions
get_snippet_content_graceful(string $path) : string
This helper function searches for a snippet either in the Filesystem or in the database and returns its content or code-field, respectively.
Prefix the snippet Path with 'file:' for retrieval of a file relative to MIDCOM_ROOT; omit it to get the code field of a Snippet.
Any error (files not found) will return null. If you want to trigger an error, look for midcom_helper_misc::get_snippet_content.
string | $path | The URL to the snippet. |
The content of the snippet/file.
get_snippet_content(string $path) : string
This helper function searches for a snippet either in the Filesystem or in the database and returns its content or code-field, respectively.
Prefix the snippet Path with 'file:' for retrieval of a file relative to MIDCOM_ROOT; omit it to get the code field of a Snippet.
Any error (files not found) will raise a MidCOM Error. If you want a more graceful behavior, look for midcom_helper_misc::get_snippet_content_graceful
string | $path | The URL to the snippet. |
The content of the snippet/file.
find_node_by_component(string $component, integer $node_id = null, \midcom_helper_nav $nap = null) : array
Returns the first instance of a given component on the site.
string | $component | The component name |
integer | $node_id | Node ID of parent topic |
\midcom_helper_nav | $nap |
NAP array of the first component instance found
Loading…