[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> url.js (summary)

(no description)

File Size: 890 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 27 functions

  isURL()
  isEmail()
  getProtocol()
  isValidProtocol()
  getAuthority()
  isValidAuthority()
  getPath()
  isValidPath()
  getQueryString()
  buildQueryString()
  isValidQueryString()
  getPathAndQueryString()
  getFragment()
  isValidFragment()
  setPath()
  getQueryArgs()
  addQueryArgs()
  getQueryArg()
  hasQueryArg()
  removeQueryArgs()
  prependHTTP()
  safeDecodeURI()
  safeDecodeURIComponent()
  filterURLForDisplay()
  cleanForSlug()
  getFilename()
  normalizePath()

Functions
Functions that are not part of a class:

isURL(url)   X-Ref
Determines whether the given string looks like a URL.

return: {boolean} Whether or not it looks like a URL.
param: {string} url The string to scrutinise.

isEmail(email)   X-Ref
Determines whether the given string looks like an email.

return: {boolean} Whether or not it looks like an email.
param: {string} email The string to scrutinise.

getProtocol(url)   X-Ref
Returns the protocol part of the URL.

return: {string|void} The protocol part of the URL.
param: {string} url The full URL.

isValidProtocol(protocol)   X-Ref
Tests if a url protocol is valid.

return: {boolean} True if the argument is a valid protocol (e.g. http:, tel:).
param: {string} protocol The url protocol.

getAuthority(url)   X-Ref
Returns the authority part of the URL.

return: {string|void} The authority part of the URL.
param: {string} url The full URL.

isValidAuthority(authority)   X-Ref
Checks for invalid characters within the provided authority.

return: {boolean} True if the argument contains a valid authority.
param: {string} authority A string containing the URL authority.

getPath(url)   X-Ref
Returns the path part of the URL.

return: {string|void} The path part of the URL.
param: {string} url The full URL.

isValidPath(path)   X-Ref
Checks for invalid characters within the provided path.

return: {boolean} True if the argument contains a valid path
param: {string} path The URL path.

getQueryString(url)   X-Ref
Returns the query string part of the URL.

return: {string|void} The query string part of the URL.
param: {string} url The full URL.

buildQueryString(data)   X-Ref
Generates URL-encoded query string using input query data.

It is intended to behave equivalent as PHP's `http_build_query`, configured
with encoding type PHP_QUERY_RFC3986 (spaces as `%20`).

return: {string} Query string.
param: {Record<string,*>} data Data to encode.

isValidQueryString(queryString)   X-Ref
Checks for invalid characters within the provided query string.

return: {boolean} True if the argument contains a valid query string.
param: {string} queryString The query string.

getPathAndQueryString(url)   X-Ref
Returns the path part and query string part of the URL.

return: {string} The path part and query string part of the URL.
param: {string} url The full URL.

getFragment(url)   X-Ref
Returns the fragment part of the URL.

return: {string|void} The fragment part of the URL.
param: {string} url The full URL

isValidFragment(fragment)   X-Ref
Checks for invalid characters within the provided fragment.

return: {boolean} True if the argument contains a valid fragment.
param: {string} fragment The url fragment.

setPath(object, path, value)   X-Ref
Sets a value in object deeply by a given array of path segments. Mutates the
object reference.

param: {Record<string,*>} object Object in which to assign.
param: {string[]}         path   Path segment at which to set value.
param: {*}                value  Value to set.

getQueryArgs(url)   X-Ref
Returns an object of query arguments of the given URL. If the given URL is
invalid or has no querystring, an empty object is returned.

return: {QueryArgs} Query args object.
param: {string} url URL.

addQueryArgs()   X-Ref
Appends arguments as querystring to the provided URL. If the URL already
includes query arguments, the arguments are merged with (and take precedent
over) the existing set.

return: {string} URL with arguments applied.
param: {string} [url=''] URL to which arguments should be appended. If omitted,
param: {Object} [args]   Query arguments to apply to URL.

getQueryArg(url, arg)   X-Ref
Returns a single query argument of the url

return: {QueryArgParsed|void} Query arg value.
param: {string} url URL.
param: {string} arg Query arg name.

hasQueryArg(url, arg)   X-Ref
Determines whether the URL contains a given query arg.

return: {boolean} Whether or not the URL contains the query arg.
param: {string} url URL.
param: {string} arg Query arg name.

removeQueryArgs(url)   X-Ref
Removes arguments from the query string of the url

return: {string} Updated URL.
param: {string}    url  URL.
param: {...string} args Query Args.

prependHTTP(url)   X-Ref
Prepends "http://" to a url, if it looks like something that is meant to be a TLD.

return: {string} The updated URL.
param: {string} url The URL to test.

safeDecodeURI(uri)   X-Ref
Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
`decodeURI` throws an error.

return: {string} Decoded URI if possible.
param: {string} uri URI to decode.

safeDecodeURIComponent(uriComponent)   X-Ref
Safely decodes a URI component with `decodeURIComponent`. Returns the URI component unmodified if
`decodeURIComponent` throws an error.

return: {string} Decoded URI component if possible.
param: {string} uriComponent URI component to decode.

filterURLForDisplay(url)   X-Ref
Returns a URL for display.

return: {string} Displayed URL.
param: {string}      url       Original URL.
param: {number|null} maxLength URL length.

cleanForSlug(string)   X-Ref
Performs some basic cleanup of a string for use as a post slug.

This replicates some of what `sanitize_title()` does in WordPress core, but
is only designed to approximate what the slug will be.

Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin
letters. Removes combining diacritical marks. Converts whitespace, periods,
and forward slashes to hyphens. Removes any remaining non-word characters
except hyphens. Converts remaining string to lowercase. It does not account
for octets, HTML entities, or other encoded characters.

return: {string} Processed string.
param: {string} string Title or slug to be processed.

getFilename(url)   X-Ref
Returns the filename part of the URL.

return: {string|void} The filename part of the URL.
param: {string} url The full URL.

normalizePath(path)   X-Ref
Given a path, returns a normalized path where equal query parameter values
will be treated as identical, regardless of order they appear in the original
text.

return: {string} Normalized path.
param: {string} path Original path.



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1