\

Namespaces

Functions

p($string)
Prints a sanitized string
Parameters:
  • $string (string) – the string which will be escaped and printed
emit_css_tag($href, $opts)
Prints a <link> tag for loading css
Parameters:
  • $href (string) – the source URL, ignored when empty
emit_css_loading_tags($obj)
Prints all tags for CSS loading
Parameters:
  • $obj (array) – all the script information from template
emit_script_tag($src, $script_content)
Prints a <script> tag with nonce and defer depending on config
Parameters:
  • $src (string) – the source URL, ignored when empty
  • $script_content (string) – the inline script content, ignored when empty
emit_script_loading_tags($obj)
Print all <script> tags for loading JS
Parameters:
  • $obj (array) – all the script information from template
Prints an unsanitized string - usage of this function may result into XSS.
Consider using p() instead.
Parameters:
  • $string (string|array) – the string which will be printed as it is
script($app, $file)
Shortcut for adding scripts to a page
Parameters:
  • $app (string) – the appname
  • $file (string|string[]) – the filename, if an array is given it will add all scripts
vendor_script($app, $file)
Shortcut for adding vendor scripts to a page
Parameters:
  • $app (string) – the appname
  • $file (string|string[]) – the filename, if an array is given it will add all scripts
style($app, $file)
Shortcut for adding styles to a page
Parameters:
  • $app (string) – the appname
  • $file (string|string[]) – the filename, if an array is given it will add all styles
vendor_style($app, $file)
Shortcut for adding vendor styles to a page
Parameters:
  • $app (string) – the appname
  • $file (string|string[]) – the filename, if an array is given it will add all styles
translation($app)
Shortcut for adding translations to a page
Parameters:
  • $app (string) – the appname if an array is given it will add all styles
component($app, $file)
Shortcut for HTML imports
Parameters:
  • $app (string) – the appname
  • $file (string|string[]) – the path relative to the app’s component folder, if an array is given it will add all components
make \OCP\IURLGenerator::linkTo available as a simple function
Parameters:
  • $app (string) – app
  • $file (string) – file
  • $args (array) – array with param=>value, will be appended to the returned url
Parameters:
  • $key
image_path($app, $image)
make \OCP\IURLGenerator::imagePath available as a simple function
Parameters:
  • $app (string) – app
  • $image (string) – image
mimetype_icon($mimetype)
make OC_Helper::mimetypeIcon available as a simple function
Parameters:
  • $mimetype (string) – mimetype
preview_icon($path)
make preview_icon available as a simple function
Returns the path to the preview of the image.
Parameters:
  • $path (string) – path of file
publicPreview_icon($path, $token)
Parameters:
  • $path (string) –
  • $token (string) –
human_file_size($bytes)
make OC_Helper::humanFileSize available as a simple function
Parameters:
  • $bytes (int) – size in bytes
strip_time($timestamp)
Strips the timestamp of its time value
Parameters:
  • $timestamp (int) – UNIX timestamp to strip
relative_modified_date($timestamp, $fromTime, $dateOnly)
Formats timestamp relatively to the current time using
a human-friendly format like “x minutes ago” or “yesterday”
Parameters:
  • $timestamp (int) – timestamp to format
  • $fromTime (int|null) – timestamp to compare from, defaults to current time
  • $dateOnly (bool|null) – whether to strip time information
html_select_options($options, $selected, $params)