PHP Class The_SEO_Framework\Transients

Generates, stores and deletes common transients.
Since: 2.7.1
Inheritance: extends Sitemaps
ファイルを表示 Open project: sybrew/the-seo-framework

Protected Properties

Property Type Description
$auto_description_transient The Automatic Description transient name.
$ld_json_transient The LD+Json script transient name.
$sitemap_transient The sitemap transient name.
$theme_doing_it_right_transient The Theme is doing the Title right transient name

Public Methods

Method Description
delete_auto_description_frontpage_transient ( string $old_option ) : string Delete transient for the automatic description for blog on save request.
delete_auto_description_transient ( mixed $page_id, string $taxonomy = '', string $type = null ) : boolean Delete transient for the automatic description on requests.
delete_auto_description_transients_term ( integer $term_id, integer $tt_id, string $taxonomy, mixed $deleted_term = '' ) Delete transient on term save/deletion.
delete_front_ld_json_transient ( ) : boolean Flushes the home page LD+Json transient.
delete_ld_json_transient ( mixed $page_id, string $taxonomy = '', string | null $type = null ) : boolean Delete transient for the LD+Json scripts on requests.
delete_sitemap_transient ( ) : boolean Delete transient for sitemap on requests.
delete_sitemap_transient_permalink_updated ( ) : boolean Checks whether the permalink structure is updated.
delete_theme_dir_transient ( string | object $value = null, array | object | null $options = null ) : boolean Delete transient for the Theme doing it Right bool on special requests.
delete_transients_author ( integer $user_id ) Delete transient on profile save.
delete_transients_post ( integer $post_id ) : boolean | null Delete transient on post save.
generate_cache_key ( integer | string | boolean $page_id, string $taxonomy = '', string $type = null ) : string Generate transient key based on query vars.
generate_front_page_cache_key ( string $type = '' ) : string Returns the front page partial transient key.
get_transient ( string $transient ) : mixed | boolean Get the value of the transient.
set_theme_dir_transient ( $dir = null ) Sets transient for Theme doing it Right.
set_transient ( string $transient, string $value, integer $expiration = '' ) Set the value of the transient.
setup_auto_description_transient ( integer | string | boolean $page_id, string $taxonomy = '', strgin $type = null ) Setup vars for transients which require $page_id.
setup_ld_json_transient ( integer | string | boolean $page_id, string $taxonomy = '', string | null $type = null ) Setup vars for transients which require $page_id.
setup_transient_names ( ) Setup vars for general site transients.

Protected Methods

Method Description
__construct ( ) Constructor, load parent constructor and set up caches.
add_cache_key_suffix ( $key = '' ) : string Adds cache key suffix based on blog id and locale.
generate_taxonomial_cache_key ( integer $page_id = '', string $taxonomy = '' ) : string Generates Cache key for taxonomial archives.

Method Details

__construct() protected method

Constructor, load parent constructor and set up caches.
protected __construct ( )

add_cache_key_suffix() protected method

Adds cache key suffix based on blog id and locale.
Since: 2.7.0
Since: 2.7.1 $locale is now static. $key may now be empty.
protected add_cache_key_suffix ( $key = '' ) : string
return string the cache key.

delete_auto_description_frontpage_transient() public method

Returns old option, since that's passed for sanitation within WP Core.
Since: 2.3.3
public delete_auto_description_frontpage_transient ( string $old_option ) : string
$old_option string The previous blog description option.
return string Previous option.

delete_auto_description_transient() public method

Delete transient for the automatic description on requests.
Since: 2.3.3
public delete_auto_description_transient ( mixed $page_id, string $taxonomy = '', string $type = null ) : boolean
$page_id mixed The page ID or identifier.
$taxonomy string The tt name.
$type string The Post Type
return boolean true

delete_auto_description_transients_term() public method

Delete transient on term save/deletion.
Since: 2.3.3
public delete_auto_description_transients_term ( integer $term_id, integer $tt_id, string $taxonomy, mixed $deleted_term = '' )
$term_id integer The Term ID
$tt_id integer The Term Taxonomy ID.
$taxonomy string The Taxonomy type.
$deleted_term mixed Copy of the already-deleted term. Unused.

delete_front_ld_json_transient() public method

Flushes the home page LD+Json transient.
Since: 2.6.0
public delete_front_ld_json_transient ( ) : boolean
return boolean Whether it's flushed on current call.

delete_ld_json_transient() public method

Delete transient for the LD+Json scripts on requests.
Since: 2.4.2
public delete_ld_json_transient ( mixed $page_id, string $taxonomy = '', string | null $type = null ) : boolean
$page_id mixed The page ID or identifier.
$taxonomy string The tt name.
$type string | null The post type.
return boolean true

delete_sitemap_transient() public method

Also ping search engines.
Since: 2.2.9
public delete_sitemap_transient ( ) : boolean
return boolean true

delete_theme_dir_transient() public method

Delete transient for the Theme doing it Right bool on special requests.
Since: 2.5.2
Since: 2.7.0
public delete_theme_dir_transient ( string | object $value = null, array | object | null $options = null ) : boolean
$value string | object The theme directory stylesheet location, or either WP_Theme/WP_Upgrader instance.
$options array | object | null If set, the update options array or the Old theme WP_Theme instance.
return boolean True on success, false on failure.

delete_transients_author() public method

Delete transient on profile save.
Since: 2.6.4
public delete_transients_author ( integer $user_id )
$user_id integer The User ID that has been updated.

delete_transients_post() public method

Delete transient on post save.
Since: 2.2.9
public delete_transients_post ( integer $post_id ) : boolean | null
$post_id integer The Post ID that has been updated.
return boolean | null True when sitemap is flushed. False on revision. Null when sitemaps are deactivated.

generate_cache_key() public method

Generate transient key based on query vars.
Since: 2.3.3
Since: 2.6.0 Refactored.
public generate_cache_key ( integer | string | boolean $page_id, string $taxonomy = '', string $type = null ) : string
$page_id integer | string | boolean the Taxonomy or Post ID.
$taxonomy string The Taxonomy name.
$type string The Post Type
return string The generated page id key.

generate_front_page_cache_key() public method

Returns the front page partial transient key.
public generate_front_page_cache_key ( string $type = '' ) : string
$type string
return string the front page transient key.

generate_taxonomial_cache_key() protected method

Generates Cache key for taxonomial archives.
Since: 2.6.0
protected generate_taxonomial_cache_key ( integer $page_id = '', string $taxonomy = '' ) : string
$page_id integer The taxonomy or page ID.
$taxonomy string The taxonomy name.
return string The Taxonomial Archive cache key.

get_transient() public method

If the transient does not exists, does not have a value or has expired, or transients have been disabled through a constant, then the transient will be false.
Since: 2.6.0
public get_transient ( string $transient ) : mixed | boolean
$transient string Transient name. Expected to not be SQL-escaped.
return mixed | boolean Value of the transient. False on failure or non existing transient.

set_theme_dir_transient() public method

Sets transient for Theme doing it Right.
Since: 2.5.2
Since: 2.7.0 Will always set "doing it wrong" transient, even if it was "doing it right" earlier.
public set_theme_dir_transient ( $dir = null )

set_transient() public method

. Prevents setting of transients when they're disabled.
Since: 2.6.0
public set_transient ( string $transient, string $value, integer $expiration = '' )
$transient string Transient name. Expected to not be SQL-escaped.
$value string Transient value. Expected to not be SQL-escaped.
$expiration integer Optional Transient expiration date, optional. Expected to not be SQL-escaped.

setup_auto_description_transient() public method

Setup vars for transients which require $page_id.
Since: 2.3.3
public setup_auto_description_transient ( integer | string | boolean $page_id, string $taxonomy = '', strgin $type = null )
$page_id integer | string | boolean the Taxonomy or Post ID. If false it will generate for the blog page.
$taxonomy string The taxonomy name.
$type strgin The Post Type

setup_ld_json_transient() public method

Setup vars for transients which require $page_id.
Since: 2.3.3
public setup_ld_json_transient ( integer | string | boolean $page_id, string $taxonomy = '', string | null $type = null )
$page_id integer | string | boolean the Taxonomy or Post ID. If false it will generate for the blog page.
$taxonomy string The taxonomy name.
$type string | null The post type.

setup_transient_names() public method

Setup vars for general site transients.
Since: 2.3.3
Since: 2.7.1 Added locale suffix.

Property Details

$auto_description_transient protected_oe property

The Automatic Description transient name.
Since: 2.3.3
protected $auto_description_transient

$ld_json_transient protected_oe property

The LD+Json script transient name.
Since: 2.3.3
protected $ld_json_transient

$sitemap_transient protected_oe property

The sitemap transient name.
Since: 2.2.9
protected $sitemap_transient

$theme_doing_it_right_transient protected_oe property

The Theme is doing the Title right transient name
Since: 2.5.2
protected $theme_doing_it_right_transient