PHP Class The_Neverending_Home_Page, jetpack

Afficher le fichier Open project: automattic/jetpack Class Usage Examples

Méthodes publiques

Свойство Type Description
$option_name_enabled Don't access directly, instead use self::get_settings().
$settings
$the_time Initialize our static variables

Méthodes publiques

Méthode Description
__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

Private Methods

Méthode Description
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.

Method Details

__construct() public méthode

Register actions and filters, plus parse IS settings
public __construct ( ) : null
Résultat null

action_template_redirect() public méthode

Does the legwork to determine whether the feature is enabled.
public action_template_redirect ( ) : null
Résultat null

action_wp_head() public méthode

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() public méthode

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

ajax_url() public méthode

Returns the Ajax url
public ajax_url ( ) : string
Résultat string

allowed_query_vars() public méthode

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
Résultat array

archive_supports_infinity() public static méthode

Allow plugins to filter what archives Infinite Scroll supports
public static archive_supports_infinity ( ) : boolean
Résultat boolean

body_class() public méthode

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

enqueue_spinner_scripts() public méthode

Enqueue spinner scripts.

filter_grunion_redirect_url() public méthode

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

filter_infinite_scroll_results() public méthode

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
Résultat array

get_excluded_posts() public méthode

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
Résultat array

get_last_post_date() public méthode

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
Résultat string 'Y-m-d H:i:s' or false

get_query_sort_field() public méthode

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

get_query_vars() public méthode

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
Résultat array

get_settings() static public méthode

Parse IS settings provided by theme
static public get_settings ( ) : object
Résultat object

get_taxonomy_vars() public méthode

Returns an array of stock and custom taxonomy query vars
public get_taxonomy_vars ( ) : array
Résultat array

got_infinity() static public méthode

Has infinite scroll been triggered?
static public got_infinity ( )

has_only_title_matching_posts() public méthode

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() public méthode

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

infinite_setting_html() public méthode

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

inject_query_args() public méthode

Update the $query_args array with the parameters provided via AJAX/GET.
public inject_query_args ( array $query_args ) : array
$query_args array
Résultat array

is_last_batch() static public méthode

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

posts_per_page_query() public méthode

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
Résultat null

preserve_more_tag() public méthode

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

query() public méthode

Triggered by an AJAX request.
public query ( ) : string
Résultat string or null

query_time_filter() public méthode

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
Résultat string

render() public méthode

Rendering fallback used when themes don't specify their own handler.
public render ( ) : string
Résultat string

settings_api_init() public méthode

Only show if the current theme supports infinity.
public settings_api_init ( ) : null
Résultat null

wp_query() static public méthode

Retrieve the query used with Infinite Scroll
static public wp_query ( ) : object
Résultat object

Property Details

$option_name_enabled static_oe public_oe property

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

$settings static_oe public_oe property

static public $settings

$the_time static_oe public_oe property

Initialize our static variables
static public $the_time