Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/sal
File: class.json-api-post-base.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
/**
[1] Fix | Delete
* This class wraps a WP_Post and proxies any undefined attributes
[2] Fix | Delete
* and methods to the wrapped class. We need to do this because at present
[3] Fix | Delete
* the WP_Post class is marked as final (in 4.5 this will change, though it's
[4] Fix | Delete
* not clear if there will be a mechanism to retrieve from the DB into the over-
[5] Fix | Delete
* ridden class dynamically).
[6] Fix | Delete
*
[7] Fix | Delete
* @package automattic/jetpack
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
use Automattic\Jetpack\Status;
[11] Fix | Delete
[12] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[13] Fix | Delete
exit( 0 );
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
require_once __DIR__ . '/class.json-api-metadata.php';
[17] Fix | Delete
require_once __DIR__ . '/class.json-api-date.php';
[18] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/post.php';
[19] Fix | Delete
require_once ABSPATH . 'wp-includes/post.php';
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* Base class for SAL_Post.
[23] Fix | Delete
*/
[24] Fix | Delete
abstract class SAL_Post {
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* A WP_Post instance.
[28] Fix | Delete
*
[29] Fix | Delete
* @var WP_Post
[30] Fix | Delete
*/
[31] Fix | Delete
public $post;
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* The post request context (for example 'edit' or 'display')
[35] Fix | Delete
*
[36] Fix | Delete
* @var string
[37] Fix | Delete
*/
[38] Fix | Delete
public $context;
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* A Jetpack_Site instance.
[42] Fix | Delete
*
[43] Fix | Delete
* @var Jetpack_Site
[44] Fix | Delete
*/
[45] Fix | Delete
public $site;
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Constructor function
[49] Fix | Delete
*
[50] Fix | Delete
* @param Jetpack_Site $site A Jetpack_Site instance.
[51] Fix | Delete
* @param WP_Post $post A WP_Post instance.
[52] Fix | Delete
* @param string $context The post request context (for example 'edit' or 'display').
[53] Fix | Delete
*/
[54] Fix | Delete
public function __construct( $site, $post, $context ) {
[55] Fix | Delete
$this->post = $post;
[56] Fix | Delete
$this->context = $context;
[57] Fix | Delete
$this->site = $site;
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Setting this WP_Post instance's key value
[62] Fix | Delete
*
[63] Fix | Delete
* @param string $key The post key to set.
[64] Fix | Delete
* @param string $value The value to set the post key to (for example filter, ID, post_status).
[65] Fix | Delete
*/
[66] Fix | Delete
public function __set( $key, $value ) {
[67] Fix | Delete
$this->post->{ $key } = $value;
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* Returning a WPCOM_JSON_API_Links instance if the post key is set to 'links', or the post key value.
[72] Fix | Delete
*
[73] Fix | Delete
* @param string $key The post key value.
[74] Fix | Delete
*
[75] Fix | Delete
* @return WPCOM_JSON_API_Links|string
[76] Fix | Delete
*/
[77] Fix | Delete
public function __get( $key ) {
[78] Fix | Delete
if ( 'links' === $key ) {
[79] Fix | Delete
require_once __DIR__ . '/class.json-api-links.php';
[80] Fix | Delete
return WPCOM_JSON_API_Links::getInstance();
[81] Fix | Delete
}
[82] Fix | Delete
return $this->post->{ $key };
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
/**
[86] Fix | Delete
* A function to either call a given function, or return an error if it doesn't exist.
[87] Fix | Delete
*
[88] Fix | Delete
* @param string $name A function name to be called.
[89] Fix | Delete
* @param mixed $arguments Arguments to be passed into the given function.
[90] Fix | Delete
*
[91] Fix | Delete
* @return mixed|bool
[92] Fix | Delete
*/
[93] Fix | Delete
public function __call( $name, $arguments ) {
[94] Fix | Delete
if ( is_callable( array( $this->post, $name ) ) ) {
[95] Fix | Delete
return call_user_func_array( array( $this->post, $name ), $arguments );
[96] Fix | Delete
} else {
[97] Fix | Delete
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
[98] Fix | Delete
trigger_error(
[99] Fix | Delete
esc_html(
[100] Fix | Delete
sprintf(
[101] Fix | Delete
/* translators: %s is the method name that has been called */
[102] Fix | Delete
__( 'Call to undefined method %s', 'jetpack' ),
[103] Fix | Delete
$name
[104] Fix | Delete
)
[105] Fix | Delete
)
[106] Fix | Delete
);
[107] Fix | Delete
}
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
/**
[111] Fix | Delete
* Checking to see if a given property is set.
[112] Fix | Delete
*
[113] Fix | Delete
* @param string $name Property to check if set.
[114] Fix | Delete
*
[115] Fix | Delete
* @return bool
[116] Fix | Delete
*/
[117] Fix | Delete
public function __isset( $name ) {
[118] Fix | Delete
return isset( $this->post->{ $name } );
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
/**
[122] Fix | Delete
* Defining a base get_like_count() function to be extended in the Jetpack_Post class.
[123] Fix | Delete
*
[124] Fix | Delete
* This will define a default value for the like counts on a post, if this hasn't been defined yet.
[125] Fix | Delete
*
[126] Fix | Delete
* @see class.json-api-post-jetpack.php
[127] Fix | Delete
*/
[128] Fix | Delete
abstract public function get_like_count();
[129] Fix | Delete
[130] Fix | Delete
/**
[131] Fix | Delete
* Defining a base is_liked() function to be extended in the Jetpack_Post class.
[132] Fix | Delete
*
[133] Fix | Delete
* This will define a default value for whether or not the current user likes this post, if this hasn't been defined yet.
[134] Fix | Delete
*
[135] Fix | Delete
* @see class.json-api-post-jetpack.php
[136] Fix | Delete
*/
[137] Fix | Delete
abstract public function is_liked();
[138] Fix | Delete
[139] Fix | Delete
/**
[140] Fix | Delete
* Defining a base is_reblogged() function to be extended in the Jetpack_Post class.
[141] Fix | Delete
*
[142] Fix | Delete
* This will define a default value for whether or not the current user reblogged this post, if this hasn't been defined yet.
[143] Fix | Delete
*
[144] Fix | Delete
* @see class.json-api-post-jetpack.php
[145] Fix | Delete
*/
[146] Fix | Delete
abstract public function is_reblogged();
[147] Fix | Delete
[148] Fix | Delete
/**
[149] Fix | Delete
* Defining a base is_following() function to be extended in the Jetpack_Post class.
[150] Fix | Delete
*
[151] Fix | Delete
* This will define a default value for whether or not the current user is following this blog, if this hasn't been defined yet.
[152] Fix | Delete
*
[153] Fix | Delete
* @see class.json-api-post-jetpack.php
[154] Fix | Delete
*/
[155] Fix | Delete
abstract public function is_following();
[156] Fix | Delete
[157] Fix | Delete
/**
[158] Fix | Delete
* Defining a base get_global_id() function to be extended in the Jetpack_Post class.
[159] Fix | Delete
*
[160] Fix | Delete
* This will define the unique WordPress.com-wide representation of a post, if this hasn't been defined yet.
[161] Fix | Delete
*
[162] Fix | Delete
* @see class.json-api-post-jetpack.php
[163] Fix | Delete
*/
[164] Fix | Delete
abstract public function get_global_id();
[165] Fix | Delete
[166] Fix | Delete
/**
[167] Fix | Delete
* Defining a base get_geo() function to be extended in the Jetpack_Post class.
[168] Fix | Delete
*
[169] Fix | Delete
* This will define a default value for whether or not there is gelocation data for this post, if this hasn't been defined yet.
[170] Fix | Delete
*
[171] Fix | Delete
* @see class.json-api-post-jetpack.php
[172] Fix | Delete
*/
[173] Fix | Delete
abstract public function get_geo();
[174] Fix | Delete
[175] Fix | Delete
/**
[176] Fix | Delete
* Returns an int which helps define the menu order for the post.
[177] Fix | Delete
*
[178] Fix | Delete
* @return int
[179] Fix | Delete
*/
[180] Fix | Delete
public function get_menu_order() {
[181] Fix | Delete
return (int) $this->post->menu_order;
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
/**
[185] Fix | Delete
* Returns a string which represents the post's GUID.
[186] Fix | Delete
*
[187] Fix | Delete
* @return string
[188] Fix | Delete
*/
[189] Fix | Delete
public function get_guid() {
[190] Fix | Delete
return (string) $this->post->guid;
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
/**
[194] Fix | Delete
* Returns a string which represents the post type.
[195] Fix | Delete
*
[196] Fix | Delete
* @return string
[197] Fix | Delete
*/
[198] Fix | Delete
public function get_type() {
[199] Fix | Delete
return (string) $this->post->post_type;
[200] Fix | Delete
}
[201] Fix | Delete
[202] Fix | Delete
/**
[203] Fix | Delete
* Returns an object which holds the terms associated with that post object.
[204] Fix | Delete
*
[205] Fix | Delete
* @return object
[206] Fix | Delete
*/
[207] Fix | Delete
public function get_terms() {
[208] Fix | Delete
$taxonomies = get_object_taxonomies( $this->post, 'objects' );
[209] Fix | Delete
$terms = array();
[210] Fix | Delete
foreach ( $taxonomies as $taxonomy ) {
[211] Fix | Delete
if ( ! $taxonomy->public && ! current_user_can( $taxonomy->cap->assign_terms ) ) {
[212] Fix | Delete
continue;
[213] Fix | Delete
}
[214] Fix | Delete
[215] Fix | Delete
$terms[ $taxonomy->name ] = array();
[216] Fix | Delete
[217] Fix | Delete
$taxonomy_terms = wp_get_object_terms( $this->post->ID, $taxonomy->name, array( 'fields' => 'all' ) );
[218] Fix | Delete
foreach ( $taxonomy_terms as $term ) {
[219] Fix | Delete
$formatted_term = $this->format_taxonomy( $term, $taxonomy->name, 'display' );
[220] Fix | Delete
$terms[ $taxonomy->name ][ $term->name ] = $formatted_term;
[221] Fix | Delete
}
[222] Fix | Delete
[223] Fix | Delete
$terms[ $taxonomy->name ] = (object) $terms[ $taxonomy->name ];
[224] Fix | Delete
}
[225] Fix | Delete
[226] Fix | Delete
return (object) $terms;
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
/**
[230] Fix | Delete
* Returns an object which holds the posts tag details
[231] Fix | Delete
*
[232] Fix | Delete
* @return object
[233] Fix | Delete
*/
[234] Fix | Delete
public function get_tags() {
[235] Fix | Delete
$tags = array();
[236] Fix | Delete
$terms = wp_get_post_tags( $this->post->ID );
[237] Fix | Delete
foreach ( $terms as $term ) {
[238] Fix | Delete
if ( ! empty( $term->name ) ) {
[239] Fix | Delete
$tags[ $term->name ] = $this->format_taxonomy( $term, 'post_tag', 'display' );
[240] Fix | Delete
}
[241] Fix | Delete
}
[242] Fix | Delete
return (object) $tags;
[243] Fix | Delete
}
[244] Fix | Delete
[245] Fix | Delete
/**
[246] Fix | Delete
* Returns an object which holds the posts category details
[247] Fix | Delete
*
[248] Fix | Delete
* @return object
[249] Fix | Delete
*/
[250] Fix | Delete
public function get_categories() {
[251] Fix | Delete
$categories = array();
[252] Fix | Delete
$terms = wp_get_object_terms( $this->post->ID, 'category', array( 'fields' => 'all' ) );
[253] Fix | Delete
foreach ( $terms as $term ) {
[254] Fix | Delete
if ( ! empty( $term->name ) ) {
[255] Fix | Delete
$categories[ $term->name ] = $this->format_taxonomy( $term, 'category', 'display' );
[256] Fix | Delete
}
[257] Fix | Delete
}
[258] Fix | Delete
return (object) $categories;
[259] Fix | Delete
}
[260] Fix | Delete
[261] Fix | Delete
/**
[262] Fix | Delete
* Returns an array of objects which hold the posts attachment information and numbers representing how many associated posts are found.
[263] Fix | Delete
*
[264] Fix | Delete
* @return array
[265] Fix | Delete
*/
[266] Fix | Delete
public function get_attachments_and_count() {
[267] Fix | Delete
$attachments = array();
[268] Fix | Delete
$_attachments = new WP_Query(
[269] Fix | Delete
array(
[270] Fix | Delete
'post_parent' => $this->post->ID,
[271] Fix | Delete
'post_status' => 'inherit',
[272] Fix | Delete
'post_type' => 'attachment',
[273] Fix | Delete
'posts_per_page' => '20',
[274] Fix | Delete
)
[275] Fix | Delete
);
[276] Fix | Delete
foreach ( $_attachments->posts as $attachment ) {
[277] Fix | Delete
$attachments[ $attachment->ID ] = $this->get_media_item_v1_1( $attachment->ID );
[278] Fix | Delete
}
[279] Fix | Delete
return array( (object) $attachments, (int) $_attachments->found_posts );
[280] Fix | Delete
}
[281] Fix | Delete
[282] Fix | Delete
/**
[283] Fix | Delete
* Returns an array with a posts metadata information.
[284] Fix | Delete
*
[285] Fix | Delete
* @return array
[286] Fix | Delete
*/
[287] Fix | Delete
public function get_metadata() {
[288] Fix | Delete
$metadata = array();
[289] Fix | Delete
foreach ( (array) has_meta( $this->post->ID ) as $meta ) {
[290] Fix | Delete
// Don't expose protected fields.
[291] Fix | Delete
$meta_key = $meta['meta_key'];
[292] Fix | Delete
[293] Fix | Delete
$show = ! ( WPCOM_JSON_API_Metadata::is_internal_only( $meta_key ) )
[294] Fix | Delete
&&
[295] Fix | Delete
(
[296] Fix | Delete
WPCOM_JSON_API_Metadata::is_public( $meta_key )
[297] Fix | Delete
||
[298] Fix | Delete
current_user_can( 'edit_post_meta', $this->post->ID, $meta_key )
[299] Fix | Delete
);
[300] Fix | Delete
[301] Fix | Delete
if ( Jetpack_SEO_Posts::DESCRIPTION_META_KEY === $meta_key && ! Jetpack_SEO_Utils::is_enabled_jetpack_seo() ) {
[302] Fix | Delete
$show = false;
[303] Fix | Delete
}
[304] Fix | Delete
[305] Fix | Delete
if ( $show ) {
[306] Fix | Delete
$metadata[] = array(
[307] Fix | Delete
'id' => $meta['meta_id'],
[308] Fix | Delete
'key' => $meta['meta_key'],
[309] Fix | Delete
'value' => $this->safe_maybe_unserialize( $meta['meta_value'] ),
[310] Fix | Delete
);
[311] Fix | Delete
}
[312] Fix | Delete
}
[313] Fix | Delete
[314] Fix | Delete
return $metadata;
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
/**
[318] Fix | Delete
* Returns an object with a posts link meta details.
[319] Fix | Delete
*
[320] Fix | Delete
* @return object
[321] Fix | Delete
*/
[322] Fix | Delete
public function get_meta() {
[323] Fix | Delete
$meta = (object) array(
[324] Fix | Delete
'links' => (object) array(
[325] Fix | Delete
'self' => (string) $this->get_post_link(),
[326] Fix | Delete
'help' => (string) $this->get_post_link( 'help' ),
[327] Fix | Delete
'site' => (string) $this->get_site_link(),
[328] Fix | Delete
'replies' => (string) $this->get_post_link( 'replies/' ),
[329] Fix | Delete
'likes' => (string) $this->get_post_link( 'likes/' ),
[330] Fix | Delete
),
[331] Fix | Delete
);
[332] Fix | Delete
[333] Fix | Delete
$amp_permalink = get_post_meta( $this->post->ID, '_jetpack_amp_permalink', true );
[334] Fix | Delete
[335] Fix | Delete
if ( ! empty( $amp_permalink ) ) {
[336] Fix | Delete
$meta->links->amp = (string) $amp_permalink;
[337] Fix | Delete
}
[338] Fix | Delete
[339] Fix | Delete
// add autosave link if a more recent autosave exists.
[340] Fix | Delete
if ( 'edit' === $this->context ) {
[341] Fix | Delete
$autosave = wp_get_post_autosave( $this->post->ID );
[342] Fix | Delete
if ( $autosave && $autosave->post_modified > $this->post->post_modified ) {
[343] Fix | Delete
$meta->links->autosave = (string) $this->get_post_link() . '/autosave';
[344] Fix | Delete
}
[345] Fix | Delete
}
[346] Fix | Delete
[347] Fix | Delete
return $meta;
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
/**
[351] Fix | Delete
* Returns an array with the current user's publish, deletion and edit capabilities.
[352] Fix | Delete
*
[353] Fix | Delete
* @return array
[354] Fix | Delete
*/
[355] Fix | Delete
public function get_current_user_capabilities() {
[356] Fix | Delete
return array(
[357] Fix | Delete
'publish_post' => current_user_can( 'publish_post', $this->post->ID ),
[358] Fix | Delete
'delete_post' => current_user_can( 'delete_post', $this->post->ID ),
[359] Fix | Delete
'edit_post' => current_user_can( 'edit_post', $this->post->ID ),
[360] Fix | Delete
);
[361] Fix | Delete
}
[362] Fix | Delete
[363] Fix | Delete
/**
[364] Fix | Delete
* Returns an array with post revision ids, or false if 'edit' isn't the current post request context.
[365] Fix | Delete
*
[366] Fix | Delete
* @return bool|array
[367] Fix | Delete
*/
[368] Fix | Delete
public function get_revisions() {
[369] Fix | Delete
if ( 'edit' !== $this->context ) {
[370] Fix | Delete
return false;
[371] Fix | Delete
}
[372] Fix | Delete
[373] Fix | Delete
$args = array(
[374] Fix | Delete
'posts_per_page' => -1,
[375] Fix | Delete
'post_type' => 'revision',
[376] Fix | Delete
'post_status' => 'any',
[377] Fix | Delete
'fields' => 'ids', // Fetch only the IDs.
[378] Fix | Delete
'post_parent' => $this->post->ID,
[379] Fix | Delete
);
[380] Fix | Delete
[381] Fix | Delete
$revision_query = new WP_Query( $args );
[382] Fix | Delete
return $revision_query->posts; // This returns an array of revision IDs.
[383] Fix | Delete
}
[384] Fix | Delete
[385] Fix | Delete
/**
[386] Fix | Delete
* Returns an object with extra post permalink suggestions.
[387] Fix | Delete
*
[388] Fix | Delete
* @return object
[389] Fix | Delete
*/
[390] Fix | Delete
public function get_other_urls() {
[391] Fix | Delete
$other_urls = array();
[392] Fix | Delete
[393] Fix | Delete
if ( 'publish' !== $this->post->post_status ) {
[394] Fix | Delete
$other_urls = $this->get_permalink_suggestions( $this->post->post_title );
[395] Fix | Delete
}
[396] Fix | Delete
[397] Fix | Delete
return (object) $other_urls;
[398] Fix | Delete
}
[399] Fix | Delete
[400] Fix | Delete
/**
[401] Fix | Delete
* Calls the WPCOM_JSON_API_Links get_site_link() function to generate a site link endpoint URL.
[402] Fix | Delete
*
[403] Fix | Delete
* @return string Endpoint URL including site information.
[404] Fix | Delete
*/
[405] Fix | Delete
protected function get_site_link() {
[406] Fix | Delete
return $this->links->get_site_link( $this->site->get_id() );
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
/**
[410] Fix | Delete
* Calls the WPCOM_JSON_API_Links get_post_link() function to generate a posts endpoint URL.
[411] Fix | Delete
*
[412] Fix | Delete
* @param string $path Optional path to be appended to the URL.
[413] Fix | Delete
* @return string Endpoint URL including post information.
[414] Fix | Delete
*/
[415] Fix | Delete
protected function get_post_link( $path = null ) {
[416] Fix | Delete
return $this->links->get_post_link( $this->site->get_id(), $this->post->ID, $path );
[417] Fix | Delete
}
[418] Fix | Delete
[419] Fix | Delete
/**
[420] Fix | Delete
* Returns an array of user and post specific social media post URLs.
[421] Fix | Delete
*
[422] Fix | Delete
* @return array
[423] Fix | Delete
*/
[424] Fix | Delete
public function get_publicize_urls() {
[425] Fix | Delete
$publicize_urls = array();
[426] Fix | Delete
$publicize = get_post_meta( $this->post->ID, 'publicize_results', true );
[427] Fix | Delete
if ( $publicize ) {
[428] Fix | Delete
// get_post_meta(..., true) will return a string if the value was stored as a scalar or serialized, so we may need to unserialize.
[429] Fix | Delete
if ( is_string( $publicize ) ) {
[430] Fix | Delete
$maybe_array_publicize = maybe_unserialize( $publicize );
[431] Fix | Delete
if ( ! is_array( $maybe_array_publicize ) ) {
[432] Fix | Delete
$maybe_array_publicize = json_decode( $publicize, true );
[433] Fix | Delete
}
[434] Fix | Delete
if ( is_array( $maybe_array_publicize ) ) {
[435] Fix | Delete
$publicize = $maybe_array_publicize;
[436] Fix | Delete
} else {
[437] Fix | Delete
return $publicize_urls;
[438] Fix | Delete
}
[439] Fix | Delete
}
[440] Fix | Delete
[441] Fix | Delete
if ( is_array( $publicize ) ) {
[442] Fix | Delete
foreach ( $publicize as $service => $data ) {
[443] Fix | Delete
switch ( $service ) {
[444] Fix | Delete
// @todo explore removing once Twitter is removed from Publicize.
[445] Fix | Delete
case 'twitter':
[446] Fix | Delete
foreach ( $data as $datum ) {
[447] Fix | Delete
if ( isset( $datum['user_id'] ) && isset( $datum['post_id'] ) ) {
[448] Fix | Delete
$publicize_urls[] = esc_url_raw( "https://twitter.com/{$datum['user_id']}/status/{$datum['post_id']}" );
[449] Fix | Delete
}
[450] Fix | Delete
}
[451] Fix | Delete
break;
[452] Fix | Delete
case 'fb':
[453] Fix | Delete
foreach ( $data as $datum ) {
[454] Fix | Delete
if ( isset( $datum['user_id'] ) && isset( $datum['post_id'] ) ) {
[455] Fix | Delete
$publicize_urls[] = esc_url_raw( "https://www.facebook.com/permalink.php?story_fbid={$datum['post_id']}&id={$datum['user_id']}" );
[456] Fix | Delete
}
[457] Fix | Delete
}
[458] Fix | Delete
break;
[459] Fix | Delete
}
[460] Fix | Delete
}
[461] Fix | Delete
}
[462] Fix | Delete
}
[463] Fix | Delete
return (array) $publicize_urls;
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
/**
[467] Fix | Delete
* Returns a string with the page's custom template metadata.
[468] Fix | Delete
*
[469] Fix | Delete
* @return string
[470] Fix | Delete
*/
[471] Fix | Delete
public function get_page_template() {
[472] Fix | Delete
return (string) get_post_meta( $this->post->ID, '_wp_page_template', true );
[473] Fix | Delete
}
[474] Fix | Delete
[475] Fix | Delete
/**
[476] Fix | Delete
* Returns a string representing the source URL of a post's featured image (or an empty string otherwise).
[477] Fix | Delete
*
[478] Fix | Delete
* Note - this is overridden in jetpack-shadow
[479] Fix | Delete
*
[480] Fix | Delete
* @return string
[481] Fix | Delete
*/
[482] Fix | Delete
public function get_featured_image() {
[483] Fix | Delete
$image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id( $this->post->ID ), 'full' );
[484] Fix | Delete
if ( is_array( $image_attributes ) && isset( $image_attributes[0] ) ) {
[485] Fix | Delete
return (string) $image_attributes[0];
[486] Fix | Delete
} else {
[487] Fix | Delete
return '';
[488] Fix | Delete
}
[489] Fix | Delete
}
[490] Fix | Delete
[491] Fix | Delete
/**
[492] Fix | Delete
* Returns an object representing a post's featured image thumbnail image.
[493] Fix | Delete
*
[494] Fix | Delete
* @return object
[495] Fix | Delete
*/
[496] Fix | Delete
public function get_post_thumbnail() {
[497] Fix | Delete
$thumb = null;
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function