[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

(no description)

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

Defines 30 functions

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

Functions
Functions that are not part of a class:

matcher(match)   X-Ref
No description

__webpack_require__(moduleId)   X-Ref
No description

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

param: {string} url The full URL.
return: {string|void} The query string part of the 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`).

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

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

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

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

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

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

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

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

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

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

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

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.

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

addQueryArgs(url = '', args)   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.

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

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

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

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

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

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

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

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

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

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

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

filterURLForDisplay(url, maxLength = null)   X-Ref
Returns a URL for display.

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

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.

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

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

param: {string} url The full URL.
return: {string|void} The filename part of the 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.

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

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

Note: this will not replace "http://" with "https://".

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



Generated : Mon Mar 18 08:20:01 2024 Cross-referenced by PHPXref