PHP Class The_SEO_Framework\Post_Data

Holds Post data.
Since: 2.1.6
Inheritance: extends Detect
ファイルを表示 Open project: sybrew/the-seo-framework

Public Methods

Method Description
fetch_excerpt ( integer $the_id = '', integer $tt_id = '' ) : string | empty Fetches excerpt from post excerpt or fetches the full post content.
get_excerpt_by_id ( string $excerpt = '', integer $the_id = '', integer $tt_id = '' ) : string Fetches or parses the excerpt of the post.
get_latest_post_id ( ) : integer Fetch latest public post ID.
get_post_content ( integer $id ) : string Fetches Post content.
inpost_seo_save ( integer $post_id, object $post ) : mixed Save the SEO settings when we save a post or page.
save_custom_fields ( array $data, string $nonce_action, string $nonce_name, WP_Post | integer $post ) : mixed Save post meta / custom field data for a post or page.
uses_page_builder ( integer $post_id ) : boolean Determines whether the post has a page builder attached to it.

Protected Methods

Method Description
__construct ( ) Constructor, load parent constructor
fetch_post_by_id ( integer $the_id = '', integer $tt_id = '', mixed $output = ARRAY_A ) : empty | array Returns Post Array from ID.

Method Details

__construct() protected method

Constructor, load parent constructor
protected __construct ( )

fetch_excerpt() public method

Determines if a page builder is used to return an empty string. Does not sanitize output.
Since: 2.5.2
Since: 2.6.6 Detects Page builders.
public fetch_excerpt ( integer $the_id = '', integer $tt_id = '' ) : string | empty
$the_id integer The Post ID.
$tt_id integer The Taxonomy Term ID.
return string | empty excerpt.

fetch_post_by_id() protected method

Also returns latest post from blog or archive if applicable.
Since: 2.6.0
Since: 2.6.6 Added $output parameter.
protected fetch_post_by_id ( integer $the_id = '', integer $tt_id = '', mixed $output = ARRAY_A ) : empty | array
$the_id integer The Post ID.
$tt_id integer The Taxonomy Term ID
$output mixed The value type to return. Accepts OBJECT, ARRAY_A, or ARRAY_N
return empty | array The Post Array.

get_excerpt_by_id() public method

Fetches or parses the excerpt of the post.
Since: 1.0.0
public get_excerpt_by_id ( string $excerpt = '', integer $the_id = '', integer $tt_id = '' ) : string
$excerpt string the Excerpt.
$the_id integer The Post ID.
$tt_id integer The Taxonomy Term ID.
return string The escaped Excerpt.

get_latest_post_id() public method

Fetch latest public post ID.
Since: 2.4.3
public get_latest_post_id ( ) : integer
return integer Latest Post ID.

get_post_content() public method

Fetches Post content.
Since: 2.6.0
public get_post_content ( integer $id ) : string
$id integer The post ID.
return string The post content.

inpost_seo_save() public method

Some values get sanitized, the rest are pulled from identically named subkeys in the $_POST['autodescription'] array.
Since: 2.0.0
public inpost_seo_save ( integer $post_id, object $post ) : mixed
$post_id integer Post ID.
$post object Post object.
return mixed Returns post id if permissions incorrect, null if doing autosave, ajax or future post, false if update or delete failed, and true on success.

save_custom_fields() public method

It verifies the nonce, then checks we're not doing autosave, ajax or a future post request. It then checks the current user's permissions, before finally* either updating the post meta, or deleting the field if the value was not truthy. By passing an array of fields => values from the same metabox (and therefore same nonce) into the $data argument, repeated checks against the nonce, request and permissions are avoided.
Since: 2.0.0
public save_custom_fields ( array $data, string $nonce_action, string $nonce_name, WP_Post | integer $post ) : mixed
$data array Key/Value pairs of data to save in '_field_name' => 'value' format.
$nonce_action string Nonce action for use with wp_verify_nonce().
$nonce_name string Name of the nonce to check for permissions.
$post WP_Post | integer Post object or ID.
return mixed Return null if permissions incorrect, doing autosave, ajax or future post, false if update or delete failed, and true on success.

uses_page_builder() public method

Doesn't use plugin detection features as some builders might be incorporated within themes. Detects the following builders: - Divi Builder by Elegant Themes - Visual Composer by WPBakery - Page Builder by SiteOrigin - Beaver Builder by Fastline Media
Since: 2.6.6
public uses_page_builder ( integer $post_id ) : boolean
$post_id integer
return boolean