PHP 클래스 The_Neverending_Home_Page, jetpack

파일 보기 프로젝트 열기: automattic/jetpack 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$option_name_enabled Don't access directly, instead use self::get_settings().
$settings
$the_time Initialize our static variables

공개 메소드들

메소드 설명
__construct ( ) : null Register actions and filters, plus parse IS settings
action_template_redirect ( ) : null Does the legwork to determine whether the feature is enabled.
action_wp_footer ( ) : string Provide IS with a list of the scripts and stylesheets already present on the page.
action_wp_footer_settings ( ) : string Prints the relevant infinite scroll settings in JS.
action_wp_head ( ) Alias for renamed class method.
ajax_response ( ) Our own Ajax response, avoiding calling admin-ajax
ajax_url ( ) : string Returns the Ajax url
allowed_query_vars ( array $allowed_vars ) : array Update the $allowed_vars array with the standard WP public and private query vars, as well as taxonomy vars
archive_supports_infinity ( ) : boolean Allow plugins to filter what archives Infinite Scroll supports
body_class ( $classes ) Adds an 'infinite-scroll' class to the body.
enqueue_spinner_scripts ( ) Enqueue spinner scripts.
filter_grunion_redirect_url ( string $url ) : string Ensure that IS doesn't interfere with Grunion by stripping IS query arguments from the Grunion redirect URL.
filter_infinite_scroll_results ( $results, $query_args, $wp_query ) : array Identify additional scripts required by the latest set of IS posts and provide the necessary data to the IS response handler.
footer ( ) : string The Infinite Blog Footer
get_excluded_posts ( ) : array In case IS is activated on search page, we have to exclude initially loaded posts which match the keyword by title, not the content as they are displayed before content-matching ones
get_last_post_date ( ) : string Grab the timestamp for the initial query's last post.
get_query_sort_field ( $query = null ) : string Returns the appropriate wp_posts table field for a given query's 'orderby' parameter, if applicable.
get_query_vars ( ) : array In case IS is active on search, we have to exclude posts matched by title rather than by post_content in order to prevent dupes on next pages
get_settings ( ) : object Parse IS settings provided by theme
get_taxonomy_vars ( ) : array Returns an array of stock and custom taxonomy query vars
got_infinity ( ) Has infinite scroll been triggered?
has_only_title_matching_posts ( ) : boolean This function checks whether all posts returned by initial wp_query match the keyword by title The code used in this function is borrowed from WP_Query class where it is used to construct like conditions for keywords
has_wrapper ( ) : boolean Check if the IS output should be wrapped in a div.
infinite_setting_html ( ) HTML code to display a checkbox true/false option for the infinite_scroll setting.
inject_query_args ( array $query_args ) : array Update the $query_args array with the parameters provided via AJAX/GET.
is_last_batch ( ) Is this guaranteed to be the last batch of posts?
posts_per_page_query ( object $query ) : null Let's overwrite the default post_per_page setting to always display a fixed amount.
preserve_more_tag ( $array ) The more tag will be ignored by default if the blog page isn't our homepage.
query ( ) : string Runs the query and returns the results via JSON.
query_time_filter ( string $where, object $query ) : string Create a where clause that will make sure post queries will always return results prior to (descending sort) or before (ascending sort) the last post date.
render ( ) : string Rendering fallback used when themes don't specify their own handler.
settings_api_init ( ) : null Add a checkbox field to Settings > Reading for enabling infinite scroll.
wp_query ( ) : object Retrieve the query used with Infinite Scroll

비공개 메소드들

메소드 설명
default_footer ( ) : string Render default IS footer
get_request_parameters ( ) : string Return query string for current request, prefixed with '?'.
get_request_path ( ) : string | boolean Build path data for current request.

메소드 상세

__construct() 공개 메소드

Register actions and filters, plus parse IS settings
public __construct ( ) : null
리턴 null

action_template_redirect() 공개 메소드

Does the legwork to determine whether the feature is enabled.
public action_template_redirect ( ) : null
리턴 null

action_wp_head() 공개 메소드

Previously, JS settings object was unnecessarily output in the document head. When the hook was changed, the method name no longer made sense.
public action_wp_head ( )

ajax_response() 공개 메소드

Our own Ajax response, avoiding calling admin-ajax
public ajax_response ( )

ajax_url() 공개 메소드

Returns the Ajax url
public ajax_url ( ) : string
리턴 string

allowed_query_vars() 공개 메소드

Update the $allowed_vars array with the standard WP public and private query vars, as well as taxonomy vars
public allowed_query_vars ( array $allowed_vars ) : array
$allowed_vars array
리턴 array

archive_supports_infinity() 공개 정적인 메소드

Allow plugins to filter what archives Infinite Scroll supports
public static archive_supports_infinity ( ) : boolean
리턴 boolean

body_class() 공개 메소드

Adds an 'infinite-scroll' class to the body.
public body_class ( $classes )

enqueue_spinner_scripts() 공개 메소드

Enqueue spinner scripts.

filter_grunion_redirect_url() 공개 메소드

When arguments are present, Grunion redirects to the IS AJAX endpoint.
public filter_grunion_redirect_url ( string $url ) : string
$url string
리턴 string

filter_infinite_scroll_results() 공개 메소드

Identify additional scripts required by the latest set of IS posts and provide the necessary data to the IS response handler.
public filter_infinite_scroll_results ( $results, $query_args, $wp_query ) : array
리턴 array

get_excluded_posts() 공개 메소드

In case IS is activated on search page, we have to exclude initially loaded posts which match the keyword by title, not the content as they are displayed before content-matching ones
public get_excluded_posts ( ) : array
리턴 array

get_last_post_date() 공개 메소드

This takes into account the query's 'orderby' parameter and returns false if the posts are not ordered by date.
public get_last_post_date ( ) : string
리턴 string 'Y-m-d H:i:s' or false

get_query_sort_field() 공개 메소드

Returns the appropriate wp_posts table field for a given query's 'orderby' parameter, if applicable.
public get_query_sort_field ( $query = null ) : string
리턴 string or false

get_query_vars() 공개 메소드

In case IS is active on search, we have to exclude posts matched by title rather than by post_content in order to prevent dupes on next pages
public get_query_vars ( ) : array
리턴 array

get_settings() 정적인 공개 메소드

Parse IS settings provided by theme
static public get_settings ( ) : object
리턴 object

get_taxonomy_vars() 공개 메소드

Returns an array of stock and custom taxonomy query vars
public get_taxonomy_vars ( ) : array
리턴 array

got_infinity() 정적인 공개 메소드

Has infinite scroll been triggered?
static public got_infinity ( )

has_only_title_matching_posts() 공개 메소드

This function checks whether all posts returned by initial wp_query match the keyword by title The code used in this function is borrowed from WP_Query class where it is used to construct like conditions for keywords

has_wrapper() 공개 메소드

Setting value can be a boolean or a string specifying the class applied to the div.
public has_wrapper ( ) : boolean
리턴 boolean

infinite_setting_html() 공개 메소드

HTML code to display a checkbox true/false option for the infinite_scroll setting.

inject_query_args() 공개 메소드

Update the $query_args array with the parameters provided via AJAX/GET.
public inject_query_args ( array $query_args ) : array
$query_args array
리턴 array

is_last_batch() 정적인 공개 메소드

Is this guaranteed to be the last batch of posts?
static public is_last_batch ( )

posts_per_page_query() 공개 메소드

Let's overwrite the default post_per_page setting to always display a fixed amount.
public posts_per_page_query ( object $query ) : null
$query object
리턴 null

preserve_more_tag() 공개 메소드

Let's force the $more global to false.
public preserve_more_tag ( $array )

query() 공개 메소드

Triggered by an AJAX request.
public query ( ) : string
리턴 string or null

query_time_filter() 공개 메소드

Create a where clause that will make sure post queries will always return results prior to (descending sort) or before (ascending sort) the last post date.
public query_time_filter ( string $where, object $query ) : string
$where string
$query object
리턴 string

render() 공개 메소드

Rendering fallback used when themes don't specify their own handler.
public render ( ) : string
리턴 string

settings_api_init() 공개 메소드

Only show if the current theme supports infinity.
public settings_api_init ( ) : null
리턴 null

wp_query() 정적인 공개 메소드

Retrieve the query used with Infinite Scroll
static public wp_query ( ) : object
리턴 object

프로퍼티 상세

$option_name_enabled 정적으로 공개적으로 프로퍼티

Don't access directly, instead use self::get_settings().
static public $option_name_enabled

$settings 정적으로 공개적으로 프로퍼티

static public $settings

$the_time 정적으로 공개적으로 프로퍼티

Initialize our static variables
static public $the_time