Module: util

Quick reference

Members

(static) addUrlParam :module:util/addUrlParam

Type:
Source:

(static) hooks :module:util/hooks

Type:
Source:

(static, constant) ICON_OBJ_FOLDER_CLOSED :React.Element

Icon showing a closed folder.
Type:
  • React.Element
Source:

(static, constant) ICON_OBJ_FOLDER_COLLECTION :React.Element

Icon showing a collection.
Type:
  • React.Element
Source:
Icon showing a gallery.
Type:
  • React.Element
Source:

(static, constant) ICON_OBJ_FOLDER_OPEN :React.Element

Icon showing a opened folder.
Type:
  • React.Element
Source:

(static, constant) ICON_OBJ_FOLDER_ROOT :React.Element

Icon showing a home icon for Unorganized.
Type:
  • React.Element
Source:

(static) rmlOpts :object

The localized Real Media Library script object.
Type:
  • object
Source:

Methods

(static) ajax(url, settingsopt, urlopt)

Execute a jQuery request with X-WP-Nonce header.
Parameters:
Name Type Attributes Default Description
url string The url appended to ".../wp-json/realmedialibrary/v1/"
settings object <optional>
The options for jQuery.ajax
url string <optional>
'realmedialibrary/v1' The API namespace
Source:
Returns:
Result of jQuery.ajax

(static) applyNodeDefaults(folders)

Handle tree node defaults for loaded folder items and new items.
Parameters:
Name Type Description
folders Array.<object> The folders
Source:
Returns:
object[]

(static) dataUriToBlob(sUri) → {Blob}

Export Data URI to blob instance.
Parameters:
Name Type Description
sUri string
Source:
Returns:
Type
Blob

(static) fetchTree(settingsopt) → {object}

Execute the REST query to fetch the category tree.
Parameters:
Name Type Attributes Description
settings object <optional>
Additional options for jQuery.ajax
Source:
Returns:
The original AJAX result and the tree result prepared for AIO
Type
object

(static) findDeep(obj, path) → {mixed|undefined}

Allows you to find an object path.
Parameters:
Name Type Description
obj object The object
path string The path
Source:
Returns:
Type
mixed | undefined

(static) humanFileSize(bytes) → {string}

Transform bytes to humand readable string.
Parameters:
Name Type Description
bytes int The bytes
Source:
See:
Returns:
Type
string

(static) i18n(key, paramsopt, spanWrapperPropsopt) → {React.Element}

Creates a React component (span) with the translated markdown.
Parameters:
Name Type Attributes Description
key string The key in rmlOpts.lang
params object <optional>
The parameters
spanWrapperProps object | string('maxWidth') <optional>
Wraps an additinal span wrapper with custom attributes
Source:
See:
Returns:
Or null if key not found
Type
React.Element

(static) secondsFormat(totalSec) → {string}

Transform seconds to readable HH:mm:ss.
Parameters:
Name Type Description
totalSec int The seconds
Source:
Returns:
Type
string

(static) urlParam(name, urlopt) → {string|null}

Get URL parameter of current url.
Parameters:
Name Type Attributes Default Description
name string The parameter name
url string <optional>
window.location.href
Source:
Returns:
Type
string | null