c_ws_plugin__s2member_utils_urls
public class c_ws_plugin__s2member_utils_urls
3.5
( 13 Methods ) Method Summary | |
---|---|
public static str | add_s2member_sig(str $url_uri_query, str $sig_var) Adds an s2Member-generated signature onto a full URL, a partial URI, or just a query string. |
public static str|bool | Builds a BuddyPress registration URL to |
public static str | e_amps(str $url_uri_query) Encodes all types of amperands to |
public static str | n_amps(str $url_uri_query) Normalizes amperands to |
public static str | parse_uri(str $url_uri) Parses out a full valid URI, from either a full URL, or a partial URI. |
public static str|array|bool | parse_url(str $url_uri, bool|int $component, bool $clean_path) Parses a URL/URI with same args as PHP's |
public static int|str | redirect_browsers_using_302_status(int|str $status) Filters content redirection status (uses 302s for browsers). |
public static str|array|bool | remote(str $url, str|array $post_vars, array $args, bool $return_array) Responsible for all remote communications processed by s2Member. |
public static str | remove_s2member_sigs(str $url_uri_query, str $sig_var) Removes all s2Member-generated signatures from a full URL, a partial URI, or just a query string. |
public static bool | s2member_sig_ok(str $url_uri_query, bool $check_time, str|int $exp_secs, str $sig_var) Verifies an s2Member-generated signature; in a full URL, a partial URI, or in just a query string. |
public static str|bool | shorten(str $url, str $api_sp, bool $try_backups) Shortens a long URL, based on s2Member configuration. |
public static str | Builds a WordPress® registration URL to |
public static str | Builds a WordPress® signup URL to |
public static str add_s2member_sig(str $url_uri_query, str $sig_var)
Adds an s2Member-generated signature onto a full URL, a partial URI, or just a query string.
111106
str $url_uri_query - A full URL, a partial URI, or just a query string; to append the s2Member-generated signature onto.
str $sig_var - Optional. The name of the s2Member-generated signature variable. Defaults to _s2member_sig
.
str - A full URL, a partial URI, or just a query string; with an s2Member-generated signature.
public static str|bool bp_register_url()
Builds a BuddyPress registration URL to /register
.
111009
str|bool - Full URL to /register
, if BuddyPress is installed; else false.
public static str e_amps(str $url_uri_query)
Encodes all types of amperands to amp;
, for use in XHTML code.
Note however, this is usually NOT necessary. Just use WordPress® esc_html()
or esc_attr()
.
111106
str $url_uri_query - A full URL, a partial URI, or just the query string.
str - A full URL, a partial URI, or just the query string; after having been encoded by this routine.
public static str n_amps(str $url_uri_query)
Normalizes amperands to &
when working with URLs, URIs, and/or query strings.
111106
str $url_uri_query - A full URL, a partial URI, or just the query string.
str - A full URL, a partial URI, or just the query string; after having been normalized by this routine.
public static str parse_uri(str $url_uri)
Parses out a full valid URI, from either a full URL, or a partial URI.
Uses s2Member\Utilities → c_ws_plugin__s2member_utils_urls::parse_url().
3.5
str $url_uri - Either a full URL, or a partial URI.
str - A valid URI, starting with /
on success, else an empty string.
public static str|array|bool parse_url(str $url_uri, bool|int $component, bool $clean_path)
Parses a URL/URI with same args as PHP's parse_url()
function.
This works around issues with this PHP function in versions prior to 5.3.8.
111017
str $url_uri - Either a full URL, or a partial URI to parse.
bool|int $component - Optional. See PHP documentation on parse_url()
function.
bool $clean_path - Defaults to true. s2Member will cleanup any return array path
.
str|array|bool - The return value from PHP's parse_url()
function. However, if $component
is passed, s2Member forces a string return.
public static int|str redirect_browsers_using_302_status(int|str $status)
Filters content redirection status (uses 302s for browsers).
3.5
add_filter("ws_plugin__s2member_content_redirect_status");
int|str $status - A numeric redirection status code.
int|str - A numeric status redirection code, possibly modified to a value of 302
.
public static str|array|bool remote(str $url, str|array $post_vars, array $args, bool $return_array)
Responsible for all remote communications processed by s2Member.
Uses wp_remote_request()
through the WP_Http
class.
3.5
str $url - Full URL with possible query string parameters.
str|array $post_vars - Optional. Either a string of POST vars, or an array.
array $args - Optional. An array of additional arguments used by wp_remote_request()
.
bool $return_array - Optional. If true, instead of a string, we return an array with elements: code
(http response code), message
(http response message), headers
(an array of lowercase headers), body
(the response body string), response
(full response array).
str|array|bool - Requested response str|array from remote location (see $return_array
parameter ); else (bool)false
on failure.
public static str remove_s2member_sigs(str $url_uri_query, str $sig_var)
Removes all s2Member-generated signatures from a full URL, a partial URI, or just a query string.
111106
str $url_uri_query - A full URL, a partial URI, or just the query string; to remove s2Member-generated signatures from.
str $sig_var - Optional. The name of the s2Member-generated signature variable. Defaults to _s2member_sig
.
str - A full URL, a partial URI, or just the query string; without any s2Member-generated signatures.
public static bool s2member_sig_ok(str $url_uri_query, bool $check_time, str|int $exp_secs, str $sig_var)
Verifies an s2Member-generated signature; in a full URL, a partial URI, or in just a query string.
111106
str $url_uri_query - A full URL, a partial URI, or just a query string. Must have an s2Member-generated signature to validate.
bool $check_time - Optional. Defaults to false. If true, s2Member will also check if the signature has expired, based on $exp_secs
.
str|int $exp_secs - Optional. Defaults to (int)10. If $check_time
is true, s2Member will check if the signature has expired, based on $exp_secs
.
str $sig_var - Optional. The name of the s2Member-generated signature variable. Defaults to _s2member_sig
.
bool - True if the s2Member-generated signature is OK, else false.
public static str|bool shorten(str $url, str $api_sp, bool $try_backups)
Shortens a long URL, based on s2Member configuration.
111002
str $url - A full/long URL to be shortened.
str $api_sp - Optional. A specific URL shortening API to use. Defaults to that which is configured in the s2Member Dashboard. Normally tiny_url
, by default.
bool $try_backups - Defaults to true. If a failure occurs with the first API, we'll try others until we have success.
str|bool - The shortened URL on success, else false on failure.
public static str wp_register_url()
Builds a WordPress® registration URL to /wp-login.php?action=register
.
3.5
str - Full URL to /wp-login.php?action=register
.
public static str wp_signup_url()
Builds a WordPress® signup URL to /wp-signup.php
.
3.5
str - Full URL to /wp-signup.php
.
URL utilities.