Template_Handler implements Registerable, Standard_Service

Handles the protection of document archives, categories and single post.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service

Table of Contents

detect_page_context()  : array<string|int, mixed>
Detect the current page context
is_document_shortcode_context()  : bool
Check if we're in a document shortcode context
meta_robots_noindex_head()  : mixed
Add noindex nofollow <meta>
protect_document_pages()  : mixed
Protect the shortcode, archive and single document pages.
register()  : mixed
{@inheritdoc}
get_protection_info()  : array<string|int, mixed>
Get all applicable protection types for the current page
get_spoofed_login_post()  : WP_Post
Get a spoofed post for combined password and user login page
handle_404()  : mixed
Handle 404
handle_protection()  : mixed
Handle protection based on applicable protection info
is_page_unlocked()  : bool
Check if the page is unlocked based on protection info
is_protectable_page()  : bool
Check if the current page is protectable
override_global_wp_query()  : mixed
Override global $wp_query
prevent_caching()  : mixed
Attempt to prevent caching.
prevent_indexing()  : mixed
Prevent search engine indexing.

Methods

detect_page_context()

Detect the current page context

public static detect_page_context() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

Context information with 'type' and 'object_id'

is_document_shortcode_context()

Check if we're in a document shortcode context

public static is_document_shortcode_context() : bool
Tags
Return values
bool

meta_robots_noindex_head()

Add noindex nofollow <meta>

public meta_robots_noindex_head() : mixed
Tags
Return values
mixed

protect_document_pages()

Protect the shortcode, archive and single document pages.

public protect_document_pages() : mixed
Tags
Return values
mixed

register()

{@inheritdoc}

public register() : mixed
Tags
Return values
mixed

get_protection_info()

Get all applicable protection types for the current page

private get_protection_info() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

Array of protection types that apply to the current page

get_spoofed_login_post()

Get a spoofed post for combined password and user login page

private get_spoofed_login_post(bool $password_protection, bool $user_protection[, array<string|int, mixed> $protection_types = [] ]) : WP_Post
Parameters
$password_protection : bool

Whether password protection is enabled

$user_protection : bool

Whether user protection is enabled

$protection_types : array<string|int, mixed> = []

Array of all protection types

Tags
Return values
WP_Post

handle_404()

Handle 404

private handle_404() : mixed
Tags
Return values
mixed

handle_protection()

Handle protection based on applicable protection info

private handle_protection(array<string|int, mixed> $protection_info) : mixed
Parameters
$protection_info : array<string|int, mixed>

Protection information array with types and level

Tags
Return values
mixed

is_page_unlocked()

Check if the page is unlocked based on protection info

private is_page_unlocked(array<string|int, mixed>|bool $protection_info) : bool
Parameters
$protection_info : array<string|int, mixed>|bool

Protection information array or false

Tags
Return values
bool

True if page is unlocked, false otherwise

is_protectable_page()

Check if the current page is protectable

private is_protectable_page() : bool
Tags
Return values
bool

True if the page is protectable, false otherwise

override_global_wp_query()

Override global $wp_query

private override_global_wp_query() : mixed
Tags
Return values
mixed

prevent_caching()

Attempt to prevent caching.

private prevent_caching() : mixed
Tags
Return values
mixed

prevent_indexing()

Prevent search engine indexing.

private prevent_indexing() : mixed
Tags
Return values
mixed

Search results