c_ws_plugin__s2member_sp_access
public class c_ws_plugin__s2member_sp_access
3.5
( 4 Methods ) Method Summary | |
---|---|
public static null|bool | sp_access(int|str $sp_id, bool $read_only) Handles Specific Post/Page Access authentication. |
public static str|bool | sp_access_link_gen(str|int $sp_ids, int|str $hours, bool $shrink) Generates Specific Post/Page Access links. |
public static null | Generates Specific Post/Page Access links via AJAX. |
public static array | sp_access_session(str $add_sp_access_value) Handles Specific Post/Page sessions, by writing access values into a cookie. |
public static null|bool sp_access(int|str $sp_id, bool $read_only)
Handles Specific Post/Page Access authentication.
3.5
int|str $sp_id - Numeric Post/Page ID in WordPress®.
bool $read_only - Optional. Defaults to false. If $read_only = true
, no session cookies are set, no IP Restrictions are checked, and script execution is not exited on Link failure. In other words, with $read_only = true
, this function will simply return true or false.
null|bool - Always returns true
if access is indeed allowed in one way or another. If access is denied with $read_only = true
simply return false. If access is denied with $read_only = false
, return false; but if a Specific Post/Page Access Link is currently being used, we exit with a warning about Access Link expiration here.
public static str|bool sp_access_link_gen(str|int $sp_ids, int|str $hours, bool $shrink)
Generates Specific Post/Page Access links.
3.5
str|int $sp_ids - Comma-delimited list of Specific Post/Page IDs (numerical).
int|str $hours - Optional. A numeric expiration time for this link, in hours. Defaults to 72
.
bool $shrink - Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API.
str|bool - A Specific Post/Page Access Link, or false on failure.
public static null sp_access_link_via_ajax()
Generates Specific Post/Page Access links via AJAX.
3.5
add_action("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax");
null - Exits script execution after returning data for AJAX caller.
public static array sp_access_session(str $add_sp_access_value)
Handles Specific Post/Page sessions, by writing access values into a cookie.
Can be used to add a new value to the session, and/or to return the current set of values in the session.
3.5
str $add_sp_access_value - Encrypted Specific Post/Page Access value.
array - Array of Specific Post/Page Access values.
Specific Post/Page Access routines.