PHP 클래스 Hookr, hookr-plugin

상속: extends Hookr_Plugin
파일 보기 프로젝트 열기: explodybits/hookr-plugin

보호된 프로퍼티들

프로퍼티 타입 설명
$abort
$actions
$buffer
$comments
$context
$error
$hooks
$scripts
$settings
$visible

공개 메소드들

메소드 설명
abort ( mixed $mixed ) : mixed Abort hook callback.
activate ( ) : void Activate hook callback.
ajax ( ) Ajax entrypoint
buffer ( string $buffer ) : string Output buffer callback.
error ( mixed $mixed ) : mixed Error callback.
get_file ( ) : string Returns the plugin entry-point.
get_render ( string $tpl, array $data = [] ) : string Renders & returns a template file.
init ( ) : object Plugin init.
load ( ) : void Load hook callback.
loaded ( ) : void Loaded hook callback.
post_filter_buffer ( string $buffer ) : string Post-filter buffer for any last-chance changes.
register_actions ( $actions ) : void Registers the plugin actions.
register_menu ( object $wp_admin_bar ) : void Registers the admin bar menu.
register_page ( ) : void Registers the admin options page.
register_scripts ( ) : void Registers the JS assets.
register_settings ( ) : void Registers the plugin settings.
register_styles ( ) : void Registers the CSS assets.
set_context_footer ( ) : void Sets the runtime context to "footer"
set_context_header ( ) : void Sets the runtime context to "header"
set_context_limbo ( ) : void Sets the runtime context to "middle" (eventually)
set_context_middle ( $mixed = null ) : void Sets the runtime context to "middle"
settings_fields ( ) : string Renders the fields for use on the plugin options page.
settings_page ( ) : void. Renders the plugin options page.
settings_validate ( array $args ) : array Validates the settings posted from the plugin options page.
track_hook ( ) : void Echos (if applicable) the hook's tag & stores instance.

보호된 메소드들

메소드 설명
__construct ( )
_filter_wildcard ( array $array ) : array Utility method to filter wildcard tags.
ajax_detail ( ) : string Ajax callback for hook details.
ajax_enable ( ) : string Ajax callback for enabling/disabling
clear_cache ( $force = false ) : void Clears the cache.
create_hook ( string $tag, array $args = [] ) : stdClass Creates a generic hook instance.
create_key ( integer $index, char $char = 'h' ) : string Converts index key to '__h00001' (raw) format.
create_node ( DOMNode | string $node, string $value = '' ) : DOMElement Creates a new DOMElement.
decode_keys ( string $keys ) : array Decodes string of keys into array.
encode_keys ( array $keys ) : string Encodes an array of keys into a string.
filter_buffer ( string $buffer ) : string Filters buffer by converting raw keys to inline annotations.
filter_ignore ( DOMDocument $dom, string $buffer ) : string Filters the raw keys from nodes that are not rendered/off-canvas.
filter_keys ( DOMNode $node, integer $type = self::KEY_IGNORE ) : array Returns a list of keys in a specific node.
filter_node ( DOMNode $node ) : void Filters element nodes for actions/filters.
filter_nodes ( DOMNode $node ) Filters nodes for actions/filters.
filter_text ( DOMDocument $dom, string $buffer ) : string Filters the raw keys from text nodes.
get_cache ( null | string $key = null ) : null | json Returns value of the cache.
get_cache_file ( string | null $key = null ) : string Returns the cache filename.
get_child_node ( DOMNode $node, DOMXPath $xpath = null ) : DOMNode Returns the child node to be annotated.
get_hook ( string $key ) : object Returns a hook by key.
get_node_tag ( DOMNode $node ) : string For a parent node, return the child's tag name.
get_request_key ( null | string $key = null ) : string Returns a generic cache key.
get_setting ( string $key, string $val = '' ) : mixed Return a specific setting from the plugin settings object.
get_settings ( ) : object Returns the filters/runtime plugin settings object.
get_settings_default ( ) : object Returns the plugin's default settings.
get_settings_empty ( ) : object Returns an "empty" settings object.
get_settings_raw ( ) : array Returns the "raw" plugin options (unmodified).
get_target_node ( DOMNode $node ) : DOMNode Find the target node to be annotated.
has_key ( string $chunk ) : boolean Returns whether or not a chunk of html/text contains a raw key.
ignore_node ( string $tag ) : boolean Ignore the specific tag?
is_abort ( ) : boolean Should the plugin abort?
is_enabled ( ) : boolean Is the plugin enabled?
is_tag_ignore ( string $tag ) : boolean Should the tag be ignored?
is_tag_watch ( string $tag ) : boolean Is the tag being watched?
is_tools_page ( ) : boolean Is the current request for the plugin options page?
is_update_page ( ) : boolean Is the current request for the update page?
node_add_class ( DOMNode $node, string $class ) : void Add a CSS class to the given node.
node_has_class ( DOMNode $node, string $class ) : boolean Does the given node have CSS class?
parse_key ( string $key ) : integer Converts raw string key into it's index.
parse_keys ( string $chunk ) : array Returns the list of raw keys from a chunk of html/text.
post_filter_body ( DOMDocument $dom ) : void Post-filters with various runtime attributes/element creation.
post_filter_comments ( string $buffer ) : string Post-filters comments within buffer.
post_filter_html ( DOMDocument $dom ) : void Post-filters with various runtime attributes.
post_filter_scripts ( string $buffer ) : string Post-filters scripts within buffer.
pre_filter_body ( string $buffer ) : string Pre-filters raw keys between to .
pre_filter_buffer ( string $buffer ) : string Pre-filter buffer - calls self::pre_filter_* methods.
pre_filter_comments ( string $buffer ) : string Pre-filters comments within buffer.
pre_filter_html ( string $buffer ) : string Pre-filters raw keys from begining of document to .
pre_filter_nodes ( string $buffer ) : string Pre-filters the nodes containing raw keys.
pre_filter_offcanvas ( string $buffer, string $chunk ) : string Pre-filters raw keys from given chunk of html/text.
pre_filter_scripts ( string $buffer ) : string Pre-filters scripts within buffer.
register_hooks ( ) : void Registers the hooks.
set_cache ( mixed $val, null | string $key = null ) : boolean Write a value to the cache.
set_node_attrs ( DOMNode $node, array $attrs = [] ) : void Sets the attributes on a given DOMNode.
strip_keys ( string $buffer ) : string Strip keys
track_visible ( string $tag ) Sets the runtime visibility for the hooks.
unique_keys ( array $keys ) : array Returns a unique raw key list.
unregister_hooks ( ) : void Unregisters the hooks.

메소드 상세

__construct() 보호된 메소드

protected __construct ( )

_filter_wildcard() 보호된 메소드

Utility method to filter wildcard tags.
protected _filter_wildcard ( array $array ) : array
$array array
리턴 array

abort() 공개 메소드

Abort hook callback.
public abort ( mixed $mixed ) : mixed
$mixed mixed
리턴 mixed

activate() 공개 메소드

Activate hook callback.
public activate ( ) : void
리턴 void

ajax() 공개 메소드

Ajax entrypoint
public ajax ( )

ajax_detail() 보호된 메소드

Ajax callback for hook details.
protected ajax_detail ( ) : string
리턴 string

ajax_enable() 보호된 메소드

Ajax callback for enabling/disabling
protected ajax_enable ( ) : string
리턴 string

buffer() 공개 메소드

Output buffer callback.
public buffer ( string $buffer ) : string
$buffer string
리턴 string

clear_cache() 보호된 메소드

Clears the cache.
protected clear_cache ( $force = false ) : void
리턴 void

create_hook() 보호된 메소드

Creates a generic hook instance.
protected create_hook ( string $tag, array $args = [] ) : stdClass
$tag string
$args array
리턴 stdClass

create_key() 보호된 메소드

Converts index key to '__h00001' (raw) format.
protected create_key ( integer $index, char $char = 'h' ) : string
$index integer
$char char
리턴 string

create_node() 보호된 메소드

Creates a new DOMElement.
protected create_node ( DOMNode | string $node, string $value = '' ) : DOMElement
$node DOMNode | string
$value string
리턴 DOMElement

decode_keys() 보호된 메소드

Decodes string of keys into array.
protected decode_keys ( string $keys ) : array
$keys string
리턴 array

encode_keys() 보호된 메소드

Encodes an array of keys into a string.
protected encode_keys ( array $keys ) : string
$keys array
리턴 string

error() 공개 메소드

Something bad happened... mmmkay?
public error ( mixed $mixed ) : mixed
$mixed mixed
리턴 mixed

filter_buffer() 보호된 메소드

Filters buffer by converting raw keys to inline annotations.
protected filter_buffer ( string $buffer ) : string
$buffer string
리턴 string

filter_ignore() 보호된 메소드

Filters the raw keys from nodes that are not rendered/off-canvas.
protected filter_ignore ( DOMDocument $dom, string $buffer ) : string
$dom DOMDocument
$buffer string
리턴 string

filter_keys() 보호된 메소드

Returns a list of keys in a specific node.
protected filter_keys ( DOMNode $node, integer $type = self::KEY_IGNORE ) : array
$node DOMNode
$type integer
리턴 array List of keys.

filter_node() 보호된 메소드

Filters element nodes for actions/filters.
protected filter_node ( DOMNode $node ) : void
$node DOMNode
리턴 void

filter_nodes() 보호된 메소드

Filters nodes for actions/filters.
protected filter_nodes ( DOMNode $node )
$node DOMNode

filter_text() 보호된 메소드

Filters the raw keys from text nodes.
protected filter_text ( DOMDocument $dom, string $buffer ) : string
$dom DOMDocument
$buffer string
리턴 string

get_cache() 보호된 메소드

Returns value of the cache.
protected get_cache ( null | string $key = null ) : null | json
$key null | string
리턴 null | json

get_cache_file() 보호된 메소드

Returns the cache filename.
protected get_cache_file ( string | null $key = null ) : string
$key string | null
리턴 string

get_child_node() 보호된 메소드

Returns the child node to be annotated.
protected get_child_node ( DOMNode $node, DOMXPath $xpath = null ) : DOMNode
$node DOMNode
$xpath DOMXPath
리턴 DOMNode

get_file() 공개 메소드

Returns the plugin entry-point.
public get_file ( ) : string
리턴 string

get_hook() 보호된 메소드

Returns a hook by key.
protected get_hook ( string $key ) : object
$key string
리턴 object

get_node_tag() 보호된 메소드

For a parent node, return the child's tag name.
protected get_node_tag ( DOMNode $node ) : string
$node DOMNode
리턴 string

get_render() 공개 메소드

Renders & returns a template file.
public get_render ( string $tpl, array $data = [] ) : string
$tpl string
$data array
리턴 string

get_request_key() 보호된 메소드

Returns a generic cache key.
protected get_request_key ( null | string $key = null ) : string
$key null | string
리턴 string

get_setting() 보호된 메소드

Return a specific setting from the plugin settings object.
protected get_setting ( string $key, string $val = '' ) : mixed
$key string
$val string
리턴 mixed The value of the specified key

get_settings() 보호된 메소드

Returns the filters/runtime plugin settings object.
protected get_settings ( ) : object
리턴 object The plugin settings object.

get_settings_default() 보호된 메소드

Returns the plugin's default settings.
protected get_settings_default ( ) : object
리턴 object

get_settings_empty() 보호된 메소드

Returns an "empty" settings object.
protected get_settings_empty ( ) : object
리턴 object The settigs object with empty values.

get_settings_raw() 보호된 메소드

Returns the "raw" plugin options (unmodified).
protected get_settings_raw ( ) : array
리턴 array Plugin settings

get_target_node() 보호된 메소드

Find the target node to be annotated.
protected get_target_node ( DOMNode $node ) : DOMNode
$node DOMNode
리턴 DOMNode

has_key() 보호된 메소드

Returns whether or not a chunk of html/text contains a raw key.
protected has_key ( string $chunk ) : boolean
$chunk string
리턴 boolean

ignore_node() 보호된 메소드

Ignore the specific tag?
protected ignore_node ( string $tag ) : boolean
$tag string
리턴 boolean

init() 정적인 공개 메소드

Plugin init.
static public init ( ) : object
리턴 object

is_abort() 보호된 메소드

Should the plugin abort?
protected is_abort ( ) : boolean
리턴 boolean

is_enabled() 보호된 메소드

Is the plugin enabled?
protected is_enabled ( ) : boolean
리턴 boolean

is_tag_ignore() 보호된 메소드

Should the tag be ignored?
protected is_tag_ignore ( string $tag ) : boolean
$tag string
리턴 boolean

is_tag_watch() 보호된 메소드

Is the tag being watched?
protected is_tag_watch ( string $tag ) : boolean
$tag string
리턴 boolean

is_tools_page() 보호된 메소드

Is the current request for the plugin options page?
protected is_tools_page ( ) : boolean
리턴 boolean

is_update_page() 보호된 메소드

Is the current request for the update page?
protected is_update_page ( ) : boolean
리턴 boolean

load() 공개 메소드

Load hook callback.
public load ( ) : void
리턴 void

loaded() 공개 메소드

Loaded hook callback.
public loaded ( ) : void
리턴 void

node_add_class() 보호된 메소드

Add a CSS class to the given node.
protected node_add_class ( DOMNode $node, string $class ) : void
$node DOMNode
$class string
리턴 void

node_has_class() 보호된 메소드

Does the given node have CSS class?
protected node_has_class ( DOMNode $node, string $class ) : boolean
$node DOMNode
$class string
리턴 boolean

parse_key() 보호된 메소드

Converts raw string key into it's index.
protected parse_key ( string $key ) : integer
$key string
리턴 integer

parse_keys() 보호된 메소드

Returns the list of raw keys from a chunk of html/text.
protected parse_keys ( string $chunk ) : array
$chunk string
리턴 array

post_filter_body() 보호된 메소드

Post-filters with various runtime attributes/element creation.
protected post_filter_body ( DOMDocument $dom ) : void
$dom DOMDocument
리턴 void

post_filter_buffer() 공개 메소드

Post-filter buffer for any last-chance changes.
public post_filter_buffer ( string $buffer ) : string
$buffer string
리턴 string

post_filter_comments() 보호된 메소드

Converts raw keys to their original values.
protected post_filter_comments ( string $buffer ) : string
$buffer string
리턴 string

post_filter_html() 보호된 메소드

Post-filters with various runtime attributes.
protected post_filter_html ( DOMDocument $dom ) : void
$dom DOMDocument
리턴 void

post_filter_scripts() 보호된 메소드

Converts raw keys to their original values.
protected post_filter_scripts ( string $buffer ) : string
$buffer string
리턴 string

pre_filter_body() 보호된 메소드

Pre-filters raw keys between to .
protected pre_filter_body ( string $buffer ) : string
$buffer string
리턴 string

pre_filter_buffer() 보호된 메소드

Pre-filter buffer - calls self::pre_filter_* methods.
또한 보기: pre_filter_html
또한 보기: pre_filter_body
protected pre_filter_buffer ( string $buffer ) : string
$buffer string
리턴 string

pre_filter_comments() 보호된 메소드

Converts comments to raw key, for later replacement. This is needed because of various conditional comments that will corrupt the output of $dom->saveHTML().
protected pre_filter_comments ( string $buffer ) : string
$buffer string
리턴 string

pre_filter_html() 보호된 메소드

This is needed to prevent the DOMDocument parser from vomitting. Since Hookr doens't know what context it render's it's keys, pre-filtering is required to prevent corrupted output.
protected pre_filter_html ( string $buffer ) : string
$buffer string
리턴 string

pre_filter_nodes() 보호된 메소드

Pre-filters the nodes containing raw keys.
protected pre_filter_nodes ( string $buffer ) : string
$buffer string
리턴 string

pre_filter_offcanvas() 보호된 메소드

Pre-filters raw keys from given chunk of html/text.
또한 보기: pre_filter_html
또한 보기: pre_filter_body
protected pre_filter_offcanvas ( string $buffer, string $chunk ) : string
$buffer string
$chunk string
리턴 string

pre_filter_scripts() 보호된 메소드

For whatever reason, the DOMDocument object has absolutely terrible performance when it comes to large inline-scripts. To prevent Hookr from lagging too much on the admin side, the "ginormous" scripts have to be removed.
protected pre_filter_scripts ( string $buffer ) : string
$buffer string
리턴 string

register_actions() 공개 메소드

Registers the plugin actions.
public register_actions ( $actions ) : void
리턴 void

register_hooks() 보호된 메소드

Registers the hooks.
protected register_hooks ( ) : void
리턴 void

register_menu() 공개 메소드

Registers the admin bar menu.
public register_menu ( object $wp_admin_bar ) : void
$wp_admin_bar object
리턴 void

register_page() 공개 메소드

Registers the admin options page.
public register_page ( ) : void
리턴 void

register_scripts() 공개 메소드

Registers the JS assets.
public register_scripts ( ) : void
리턴 void

register_settings() 공개 메소드

Registers the plugin settings.
public register_settings ( ) : void
리턴 void

register_styles() 공개 메소드

Registers the CSS assets.
public register_styles ( ) : void
리턴 void

set_cache() 보호된 메소드

Write a value to the cache.
protected set_cache ( mixed $val, null | string $key = null ) : boolean
$val mixed
$key null | string
리턴 boolean

set_context_header() 공개 메소드

Sets the runtime context to "header"
public set_context_header ( ) : void
리턴 void

set_context_limbo() 공개 메소드

Sets the runtime context to "middle" (eventually)
public set_context_limbo ( ) : void
리턴 void

set_context_middle() 공개 메소드

Sets the runtime context to "middle"
public set_context_middle ( $mixed = null ) : void
리턴 void

set_node_attrs() 보호된 메소드

Sets the attributes on a given DOMNode.
protected set_node_attrs ( DOMNode $node, array $attrs = [] ) : void
$node DOMNode
$attrs array
리턴 void

settings_fields() 공개 메소드

Renders the fields for use on the plugin options page.
또한 보기: self::settings_page()
public settings_fields ( ) : string
리턴 string The pre-rendered markup.

settings_page() 공개 메소드

Renders the plugin options page.
public settings_page ( ) : void.
리턴 void.

settings_validate() 공개 메소드

Validates the settings posted from the plugin options page.
public settings_validate ( array $args ) : array
$args array The plugin settings.
리턴 array

strip_keys() 보호된 메소드

Strip keys
protected strip_keys ( string $buffer ) : string
$buffer string
리턴 string

track_hook() 공개 메소드

This is really where the magic happens... just sayin'
public track_hook ( ) : void
리턴 void

track_visible() 보호된 메소드

First, this is an expensive function; it attempts to correctly render hooks based on whether or not they are within the element.
protected track_visible ( string $tag )
$tag string

unique_keys() 보호된 메소드

Returns a unique raw key list.
protected unique_keys ( array $keys ) : array
$keys array
리턴 array

unregister_hooks() 보호된 메소드

Unregisters the hooks.
protected unregister_hooks ( ) : void
리턴 void

프로퍼티 상세

$abort 보호되어 있는 프로퍼티

protected $abort

$actions 보호되어 있는 프로퍼티

protected $actions

$buffer 보호되어 있는 프로퍼티

protected $buffer

$comments 보호되어 있는 프로퍼티

protected $comments

$context 보호되어 있는 프로퍼티

protected $context

$error 보호되어 있는 프로퍼티

protected $error

$hooks 보호되어 있는 프로퍼티

protected $hooks

$scripts 보호되어 있는 프로퍼티

protected $scripts

$settings 보호되어 있는 프로퍼티

protected $settings

$visible 보호되어 있는 프로퍼티

protected $visible