Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: class-wp-xmlrpc-server.php
if ( current_user_can( 'edit_term_meta', $term_id ) ) {
[500] Fix | Delete
update_metadata_by_mid( 'term', $meta['id'], $meta['value'] );
[501] Fix | Delete
}
[502] Fix | Delete
} elseif ( current_user_can( 'delete_term_meta', $term_id ) ) {
[503] Fix | Delete
delete_metadata_by_mid( 'term', $meta['id'] );
[504] Fix | Delete
}
[505] Fix | Delete
} elseif ( current_user_can( 'add_term_meta', $term_id ) ) {
[506] Fix | Delete
add_term_meta( $term_id, $meta['key'], $meta['value'] );
[507] Fix | Delete
}
[508] Fix | Delete
}
[509] Fix | Delete
}
[510] Fix | Delete
[511] Fix | Delete
/**
[512] Fix | Delete
* Sets up blog options property.
[513] Fix | Delete
*
[514] Fix | Delete
* Passes property through {@see 'xmlrpc_blog_options'} filter.
[515] Fix | Delete
*
[516] Fix | Delete
* @since 2.6.0
[517] Fix | Delete
*/
[518] Fix | Delete
public function initialise_blog_option_info() {
[519] Fix | Delete
$this->blog_options = array(
[520] Fix | Delete
// Read-only options.
[521] Fix | Delete
'software_name' => array(
[522] Fix | Delete
'desc' => __( 'Software Name' ),
[523] Fix | Delete
'readonly' => true,
[524] Fix | Delete
'value' => 'WordPress',
[525] Fix | Delete
),
[526] Fix | Delete
'software_version' => array(
[527] Fix | Delete
'desc' => __( 'Software Version' ),
[528] Fix | Delete
'readonly' => true,
[529] Fix | Delete
'value' => get_bloginfo( 'version' ),
[530] Fix | Delete
),
[531] Fix | Delete
'blog_url' => array(
[532] Fix | Delete
'desc' => __( 'WordPress Address (URL)' ),
[533] Fix | Delete
'readonly' => true,
[534] Fix | Delete
'option' => 'siteurl',
[535] Fix | Delete
),
[536] Fix | Delete
'home_url' => array(
[537] Fix | Delete
'desc' => __( 'Site Address (URL)' ),
[538] Fix | Delete
'readonly' => true,
[539] Fix | Delete
'option' => 'home',
[540] Fix | Delete
),
[541] Fix | Delete
'login_url' => array(
[542] Fix | Delete
'desc' => __( 'Login Address (URL)' ),
[543] Fix | Delete
'readonly' => true,
[544] Fix | Delete
'value' => wp_login_url(),
[545] Fix | Delete
),
[546] Fix | Delete
'admin_url' => array(
[547] Fix | Delete
'desc' => __( 'The URL to the admin area' ),
[548] Fix | Delete
'readonly' => true,
[549] Fix | Delete
'value' => get_admin_url(),
[550] Fix | Delete
),
[551] Fix | Delete
'image_default_link_type' => array(
[552] Fix | Delete
'desc' => __( 'Image default link type' ),
[553] Fix | Delete
'readonly' => true,
[554] Fix | Delete
'option' => 'image_default_link_type',
[555] Fix | Delete
),
[556] Fix | Delete
'image_default_size' => array(
[557] Fix | Delete
'desc' => __( 'Image default size' ),
[558] Fix | Delete
'readonly' => true,
[559] Fix | Delete
'option' => 'image_default_size',
[560] Fix | Delete
),
[561] Fix | Delete
'image_default_align' => array(
[562] Fix | Delete
'desc' => __( 'Image default align' ),
[563] Fix | Delete
'readonly' => true,
[564] Fix | Delete
'option' => 'image_default_align',
[565] Fix | Delete
),
[566] Fix | Delete
'template' => array(
[567] Fix | Delete
'desc' => __( 'Template' ),
[568] Fix | Delete
'readonly' => true,
[569] Fix | Delete
'option' => 'template',
[570] Fix | Delete
),
[571] Fix | Delete
'stylesheet' => array(
[572] Fix | Delete
'desc' => __( 'Stylesheet' ),
[573] Fix | Delete
'readonly' => true,
[574] Fix | Delete
'option' => 'stylesheet',
[575] Fix | Delete
),
[576] Fix | Delete
'post_thumbnail' => array(
[577] Fix | Delete
'desc' => __( 'Post Thumbnail' ),
[578] Fix | Delete
'readonly' => true,
[579] Fix | Delete
'value' => current_theme_supports( 'post-thumbnails' ),
[580] Fix | Delete
),
[581] Fix | Delete
[582] Fix | Delete
// Updatable options.
[583] Fix | Delete
'time_zone' => array(
[584] Fix | Delete
'desc' => __( 'Time Zone' ),
[585] Fix | Delete
'readonly' => false,
[586] Fix | Delete
'option' => 'gmt_offset',
[587] Fix | Delete
),
[588] Fix | Delete
'blog_title' => array(
[589] Fix | Delete
'desc' => __( 'Site Title' ),
[590] Fix | Delete
'readonly' => false,
[591] Fix | Delete
'option' => 'blogname',
[592] Fix | Delete
),
[593] Fix | Delete
'blog_tagline' => array(
[594] Fix | Delete
'desc' => __( 'Site Tagline' ),
[595] Fix | Delete
'readonly' => false,
[596] Fix | Delete
'option' => 'blogdescription',
[597] Fix | Delete
),
[598] Fix | Delete
'date_format' => array(
[599] Fix | Delete
'desc' => __( 'Date Format' ),
[600] Fix | Delete
'readonly' => false,
[601] Fix | Delete
'option' => 'date_format',
[602] Fix | Delete
),
[603] Fix | Delete
'time_format' => array(
[604] Fix | Delete
'desc' => __( 'Time Format' ),
[605] Fix | Delete
'readonly' => false,
[606] Fix | Delete
'option' => 'time_format',
[607] Fix | Delete
),
[608] Fix | Delete
'users_can_register' => array(
[609] Fix | Delete
'desc' => __( 'Allow new users to sign up' ),
[610] Fix | Delete
'readonly' => false,
[611] Fix | Delete
'option' => 'users_can_register',
[612] Fix | Delete
),
[613] Fix | Delete
'thumbnail_size_w' => array(
[614] Fix | Delete
'desc' => __( 'Thumbnail Width' ),
[615] Fix | Delete
'readonly' => false,
[616] Fix | Delete
'option' => 'thumbnail_size_w',
[617] Fix | Delete
),
[618] Fix | Delete
'thumbnail_size_h' => array(
[619] Fix | Delete
'desc' => __( 'Thumbnail Height' ),
[620] Fix | Delete
'readonly' => false,
[621] Fix | Delete
'option' => 'thumbnail_size_h',
[622] Fix | Delete
),
[623] Fix | Delete
'thumbnail_crop' => array(
[624] Fix | Delete
'desc' => __( 'Crop thumbnail to exact dimensions' ),
[625] Fix | Delete
'readonly' => false,
[626] Fix | Delete
'option' => 'thumbnail_crop',
[627] Fix | Delete
),
[628] Fix | Delete
'medium_size_w' => array(
[629] Fix | Delete
'desc' => __( 'Medium size image width' ),
[630] Fix | Delete
'readonly' => false,
[631] Fix | Delete
'option' => 'medium_size_w',
[632] Fix | Delete
),
[633] Fix | Delete
'medium_size_h' => array(
[634] Fix | Delete
'desc' => __( 'Medium size image height' ),
[635] Fix | Delete
'readonly' => false,
[636] Fix | Delete
'option' => 'medium_size_h',
[637] Fix | Delete
),
[638] Fix | Delete
'medium_large_size_w' => array(
[639] Fix | Delete
'desc' => __( 'Medium-Large size image width' ),
[640] Fix | Delete
'readonly' => false,
[641] Fix | Delete
'option' => 'medium_large_size_w',
[642] Fix | Delete
),
[643] Fix | Delete
'medium_large_size_h' => array(
[644] Fix | Delete
'desc' => __( 'Medium-Large size image height' ),
[645] Fix | Delete
'readonly' => false,
[646] Fix | Delete
'option' => 'medium_large_size_h',
[647] Fix | Delete
),
[648] Fix | Delete
'large_size_w' => array(
[649] Fix | Delete
'desc' => __( 'Large size image width' ),
[650] Fix | Delete
'readonly' => false,
[651] Fix | Delete
'option' => 'large_size_w',
[652] Fix | Delete
),
[653] Fix | Delete
'large_size_h' => array(
[654] Fix | Delete
'desc' => __( 'Large size image height' ),
[655] Fix | Delete
'readonly' => false,
[656] Fix | Delete
'option' => 'large_size_h',
[657] Fix | Delete
),
[658] Fix | Delete
'default_comment_status' => array(
[659] Fix | Delete
'desc' => __( 'Allow people to submit comments on new posts.' ),
[660] Fix | Delete
'readonly' => false,
[661] Fix | Delete
'option' => 'default_comment_status',
[662] Fix | Delete
),
[663] Fix | Delete
'default_ping_status' => array(
[664] Fix | Delete
'desc' => __( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new posts.' ),
[665] Fix | Delete
'readonly' => false,
[666] Fix | Delete
'option' => 'default_ping_status',
[667] Fix | Delete
),
[668] Fix | Delete
);
[669] Fix | Delete
[670] Fix | Delete
/**
[671] Fix | Delete
* Filters the XML-RPC blog options property.
[672] Fix | Delete
*
[673] Fix | Delete
* @since 2.6.0
[674] Fix | Delete
*
[675] Fix | Delete
* @param array $blog_options An array of XML-RPC blog options.
[676] Fix | Delete
*/
[677] Fix | Delete
$this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
/**
[681] Fix | Delete
* Retrieves the blogs of the user.
[682] Fix | Delete
*
[683] Fix | Delete
* @since 2.6.0
[684] Fix | Delete
*
[685] Fix | Delete
* @param array $args {
[686] Fix | Delete
* Method arguments. Note: arguments must be ordered as documented.
[687] Fix | Delete
*
[688] Fix | Delete
* @type string $0 Username.
[689] Fix | Delete
* @type string $1 Password.
[690] Fix | Delete
* }
[691] Fix | Delete
* @return array|IXR_Error Array contains:
[692] Fix | Delete
* - 'isAdmin'
[693] Fix | Delete
* - 'isPrimary' - whether the blog is the user's primary blog
[694] Fix | Delete
* - 'url'
[695] Fix | Delete
* - 'blogid'
[696] Fix | Delete
* - 'blogName'
[697] Fix | Delete
* - 'xmlrpc' - url of xmlrpc endpoint
[698] Fix | Delete
*/
[699] Fix | Delete
public function wp_getUsersBlogs( $args ) {
[700] Fix | Delete
if ( ! $this->minimum_args( $args, 2 ) ) {
[701] Fix | Delete
return $this->error;
[702] Fix | Delete
}
[703] Fix | Delete
[704] Fix | Delete
// If this isn't on WPMU then just use blogger_getUsersBlogs().
[705] Fix | Delete
if ( ! is_multisite() ) {
[706] Fix | Delete
array_unshift( $args, 1 );
[707] Fix | Delete
return $this->blogger_getUsersBlogs( $args );
[708] Fix | Delete
}
[709] Fix | Delete
[710] Fix | Delete
$this->escape( $args );
[711] Fix | Delete
[712] Fix | Delete
$username = $args[0];
[713] Fix | Delete
$password = $args[1];
[714] Fix | Delete
[715] Fix | Delete
$user = $this->login( $username, $password );
[716] Fix | Delete
if ( ! $user ) {
[717] Fix | Delete
return $this->error;
[718] Fix | Delete
}
[719] Fix | Delete
[720] Fix | Delete
/**
[721] Fix | Delete
* Fires after the XML-RPC user has been authenticated but before the rest of
[722] Fix | Delete
* the method logic begins.
[723] Fix | Delete
*
[724] Fix | Delete
* All built-in XML-RPC methods use the action xmlrpc_call, with a parameter
[725] Fix | Delete
* equal to the method's name, e.g., wp.getUsersBlogs, wp.newPost, etc.
[726] Fix | Delete
*
[727] Fix | Delete
* @since 2.5.0
[728] Fix | Delete
* @since 5.7.0 Added the `$args` and `$server` parameters.
[729] Fix | Delete
*
[730] Fix | Delete
* @param string $name The method name.
[731] Fix | Delete
* @param array|string $args The escaped arguments passed to the method.
[732] Fix | Delete
* @param wp_xmlrpc_server $server The XML-RPC server instance.
[733] Fix | Delete
*/
[734] Fix | Delete
do_action( 'xmlrpc_call', 'wp.getUsersBlogs', $args, $this );
[735] Fix | Delete
[736] Fix | Delete
$blogs = (array) get_blogs_of_user( $user->ID );
[737] Fix | Delete
$struct = array();
[738] Fix | Delete
$primary_blog_id = 0;
[739] Fix | Delete
$active_blog = get_active_blog_for_user( $user->ID );
[740] Fix | Delete
if ( $active_blog ) {
[741] Fix | Delete
$primary_blog_id = (int) $active_blog->blog_id;
[742] Fix | Delete
}
[743] Fix | Delete
[744] Fix | Delete
foreach ( $blogs as $blog ) {
[745] Fix | Delete
// Don't include blogs that aren't hosted at this site.
[746] Fix | Delete
if ( get_current_network_id() != $blog->site_id ) {
[747] Fix | Delete
continue;
[748] Fix | Delete
}
[749] Fix | Delete
[750] Fix | Delete
$blog_id = $blog->userblog_id;
[751] Fix | Delete
[752] Fix | Delete
switch_to_blog( $blog_id );
[753] Fix | Delete
[754] Fix | Delete
$is_admin = current_user_can( 'manage_options' );
[755] Fix | Delete
$is_primary = ( (int) $blog_id === $primary_blog_id );
[756] Fix | Delete
[757] Fix | Delete
$struct[] = array(
[758] Fix | Delete
'isAdmin' => $is_admin,
[759] Fix | Delete
'isPrimary' => $is_primary,
[760] Fix | Delete
'url' => home_url( '/' ),
[761] Fix | Delete
'blogid' => (string) $blog_id,
[762] Fix | Delete
'blogName' => get_option( 'blogname' ),
[763] Fix | Delete
'xmlrpc' => site_url( 'xmlrpc.php', 'rpc' ),
[764] Fix | Delete
);
[765] Fix | Delete
[766] Fix | Delete
restore_current_blog();
[767] Fix | Delete
}
[768] Fix | Delete
[769] Fix | Delete
return $struct;
[770] Fix | Delete
}
[771] Fix | Delete
[772] Fix | Delete
/**
[773] Fix | Delete
* Checks if the method received at least the minimum number of arguments.
[774] Fix | Delete
*
[775] Fix | Delete
* @since 3.4.0
[776] Fix | Delete
*
[777] Fix | Delete
* @param array $args An array of arguments to check.
[778] Fix | Delete
* @param int $count Minimum number of arguments.
[779] Fix | Delete
* @return bool True if `$args` contains at least `$count` arguments, false otherwise.
[780] Fix | Delete
*/
[781] Fix | Delete
protected function minimum_args( $args, $count ) {
[782] Fix | Delete
if ( ! is_array( $args ) || count( $args ) < $count ) {
[783] Fix | Delete
$this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) );
[784] Fix | Delete
return false;
[785] Fix | Delete
}
[786] Fix | Delete
[787] Fix | Delete
return true;
[788] Fix | Delete
}
[789] Fix | Delete
[790] Fix | Delete
/**
[791] Fix | Delete
* Prepares taxonomy data for return in an XML-RPC object.
[792] Fix | Delete
*
[793] Fix | Delete
* @param WP_Taxonomy $taxonomy The unprepared taxonomy data.
[794] Fix | Delete
* @param array $fields The subset of taxonomy fields to return.
[795] Fix | Delete
* @return array The prepared taxonomy data.
[796] Fix | Delete
*/
[797] Fix | Delete
protected function _prepare_taxonomy( $taxonomy, $fields ) {
[798] Fix | Delete
$_taxonomy = array(
[799] Fix | Delete
'name' => $taxonomy->name,
[800] Fix | Delete
'label' => $taxonomy->label,
[801] Fix | Delete
'hierarchical' => (bool) $taxonomy->hierarchical,
[802] Fix | Delete
'public' => (bool) $taxonomy->public,
[803] Fix | Delete
'show_ui' => (bool) $taxonomy->show_ui,
[804] Fix | Delete
'_builtin' => (bool) $taxonomy->_builtin,
[805] Fix | Delete
);
[806] Fix | Delete
[807] Fix | Delete
if ( in_array( 'labels', $fields, true ) ) {
[808] Fix | Delete
$_taxonomy['labels'] = (array) $taxonomy->labels;
[809] Fix | Delete
}
[810] Fix | Delete
[811] Fix | Delete
if ( in_array( 'cap', $fields, true ) ) {
[812] Fix | Delete
$_taxonomy['cap'] = (array) $taxonomy->cap;
[813] Fix | Delete
}
[814] Fix | Delete
[815] Fix | Delete
if ( in_array( 'menu', $fields, true ) ) {
[816] Fix | Delete
$_taxonomy['show_in_menu'] = (bool) $taxonomy->show_in_menu;
[817] Fix | Delete
}
[818] Fix | Delete
[819] Fix | Delete
if ( in_array( 'object_type', $fields, true ) ) {
[820] Fix | Delete
$_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
[821] Fix | Delete
}
[822] Fix | Delete
[823] Fix | Delete
/**
[824] Fix | Delete
* Filters XML-RPC-prepared data for the given taxonomy.
[825] Fix | Delete
*
[826] Fix | Delete
* @since 3.4.0
[827] Fix | Delete
*
[828] Fix | Delete
* @param array $_taxonomy An array of taxonomy data.
[829] Fix | Delete
* @param WP_Taxonomy $taxonomy Taxonomy object.
[830] Fix | Delete
* @param array $fields The subset of taxonomy fields to return.
[831] Fix | Delete
*/
[832] Fix | Delete
return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
[833] Fix | Delete
}
[834] Fix | Delete
[835] Fix | Delete
/**
[836] Fix | Delete
* Prepares term data for return in an XML-RPC object.
[837] Fix | Delete
*
[838] Fix | Delete
* @param array|object $term The unprepared term data.
[839] Fix | Delete
* @return array The prepared term data.
[840] Fix | Delete
*/
[841] Fix | Delete
protected function _prepare_term( $term ) {
[842] Fix | Delete
$_term = $term;
[843] Fix | Delete
if ( ! is_array( $_term ) ) {
[844] Fix | Delete
$_term = get_object_vars( $_term );
[845] Fix | Delete
}
[846] Fix | Delete
[847] Fix | Delete
// For integers which may be larger than XML-RPC supports ensure we return strings.
[848] Fix | Delete
$_term['term_id'] = (string) $_term['term_id'];
[849] Fix | Delete
$_term['term_group'] = (string) $_term['term_group'];
[850] Fix | Delete
$_term['term_taxonomy_id'] = (string) $_term['term_taxonomy_id'];
[851] Fix | Delete
$_term['parent'] = (string) $_term['parent'];
[852] Fix | Delete
[853] Fix | Delete
// Count we are happy to return as an integer because people really shouldn't use terms that much.
[854] Fix | Delete
$_term['count'] = (int) $_term['count'];
[855] Fix | Delete
[856] Fix | Delete
// Get term meta.
[857] Fix | Delete
$_term['custom_fields'] = $this->get_term_custom_fields( $_term['term_id'] );
[858] Fix | Delete
[859] Fix | Delete
/**
[860] Fix | Delete
* Filters XML-RPC-prepared data for the given term.
[861] Fix | Delete
*
[862] Fix | Delete
* @since 3.4.0
[863] Fix | Delete
*
[864] Fix | Delete
* @param array $_term An array of term data.
[865] Fix | Delete
* @param array|object $term Term object or array.
[866] Fix | Delete
*/
[867] Fix | Delete
return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
[868] Fix | Delete
}
[869] Fix | Delete
[870] Fix | Delete
/**
[871] Fix | Delete
* Converts a WordPress date string to an IXR_Date object.
[872] Fix | Delete
*
[873] Fix | Delete
* @param string $date Date string to convert.
[874] Fix | Delete
* @return IXR_Date IXR_Date object.
[875] Fix | Delete
*/
[876] Fix | Delete
protected function _convert_date( $date ) {
[877] Fix | Delete
if ( '0000-00-00 00:00:00' === $date ) {
[878] Fix | Delete
return new IXR_Date( '00000000T00:00:00Z' );
[879] Fix | Delete
}
[880] Fix | Delete
return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) );
[881] Fix | Delete
}
[882] Fix | Delete
[883] Fix | Delete
/**
[884] Fix | Delete
* Converts a WordPress GMT date string to an IXR_Date object.
[885] Fix | Delete
*
[886] Fix | Delete
* @param string $date_gmt WordPress GMT date string.
[887] Fix | Delete
* @param string $date Date string.
[888] Fix | Delete
* @return IXR_Date IXR_Date object.
[889] Fix | Delete
*/
[890] Fix | Delete
protected function _convert_date_gmt( $date_gmt, $date ) {
[891] Fix | Delete
if ( '0000-00-00 00:00:00' !== $date && '0000-00-00 00:00:00' === $date_gmt ) {
[892] Fix | Delete
return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) );
[893] Fix | Delete
}
[894] Fix | Delete
return $this->_convert_date( $date_gmt );
[895] Fix | Delete
}
[896] Fix | Delete
[897] Fix | Delete
/**
[898] Fix | Delete
* Prepares post data for return in an XML-RPC object.
[899] Fix | Delete
*
[900] Fix | Delete
* @param array $post The unprepared post data.
[901] Fix | Delete
* @param array $fields The subset of post type fields to return.
[902] Fix | Delete
* @return array The prepared post data.
[903] Fix | Delete
*/
[904] Fix | Delete
protected function _prepare_post( $post, $fields ) {
[905] Fix | Delete
// Holds the data for this post. built up based on $fields.
[906] Fix | Delete
$_post = array( 'post_id' => (string) $post['ID'] );
[907] Fix | Delete
[908] Fix | Delete
// Prepare common post fields.
[909] Fix | Delete
$post_fields = array(
[910] Fix | Delete
'post_title' => $post['post_title'],
[911] Fix | Delete
'post_date' => $this->_convert_date( $post['post_date'] ),
[912] Fix | Delete
'post_date_gmt' => $this->_convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ),
[913] Fix | Delete
'post_modified' => $this->_convert_date( $post['post_modified'] ),
[914] Fix | Delete
'post_modified_gmt' => $this->_convert_date_gmt( $post['post_modified_gmt'], $post['post_modified'] ),
[915] Fix | Delete
'post_status' => $post['post_status'],
[916] Fix | Delete
'post_type' => $post['post_type'],
[917] Fix | Delete
'post_name' => $post['post_name'],
[918] Fix | Delete
'post_author' => $post['post_author'],
[919] Fix | Delete
'post_password' => $post['post_password'],
[920] Fix | Delete
'post_excerpt' => $post['post_excerpt'],
[921] Fix | Delete
'post_content' => $post['post_content'],
[922] Fix | Delete
'post_parent' => (string) $post['post_parent'],
[923] Fix | Delete
'post_mime_type' => $post['post_mime_type'],
[924] Fix | Delete
'link' => get_permalink( $post['ID'] ),
[925] Fix | Delete
'guid' => $post['guid'],
[926] Fix | Delete
'menu_order' => (int) $post['menu_order'],
[927] Fix | Delete
'comment_status' => $post['comment_status'],
[928] Fix | Delete
'ping_status' => $post['ping_status'],
[929] Fix | Delete
'sticky' => ( 'post' === $post['post_type'] && is_sticky( $post['ID'] ) ),
[930] Fix | Delete
);
[931] Fix | Delete
[932] Fix | Delete
// Thumbnail.
[933] Fix | Delete
$post_fields['post_thumbnail'] = array();
[934] Fix | Delete
$thumbnail_id = get_post_thumbnail_id( $post['ID'] );
[935] Fix | Delete
if ( $thumbnail_id ) {
[936] Fix | Delete
$thumbnail_size = current_theme_supports( 'post-thumbnail' ) ? 'post-thumbnail' : 'thumbnail';
[937] Fix | Delete
$post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id ), $thumbnail_size );
[938] Fix | Delete
}
[939] Fix | Delete
[940] Fix | Delete
// Consider future posts as published.
[941] Fix | Delete
if ( 'future' === $post_fields['post_status'] ) {
[942] Fix | Delete
$post_fields['post_status'] = 'publish';
[943] Fix | Delete
}
[944] Fix | Delete
[945] Fix | Delete
// Fill in blank post format.
[946] Fix | Delete
$post_fields['post_format'] = get_post_format( $post['ID'] );
[947] Fix | Delete
if ( empty( $post_fields['post_format'] ) ) {
[948] Fix | Delete
$post_fields['post_format'] = 'standard';
[949] Fix | Delete
}
[950] Fix | Delete
[951] Fix | Delete
// Merge requested $post_fields fields into $_post.
[952] Fix | Delete
if ( in_array( 'post', $fields, true ) ) {
[953] Fix | Delete
$_post = array_merge( $_post, $post_fields );
[954] Fix | Delete
} else {
[955] Fix | Delete
$requested_fields = array_intersect_key( $post_fields, array_flip( $fields ) );
[956] Fix | Delete
$_post = array_merge( $_post, $requested_fields );
[957] Fix | Delete
}
[958] Fix | Delete
[959] Fix | Delete
$all_taxonomy_fields = in_array( 'taxonomies', $fields, true );
[960] Fix | Delete
[961] Fix | Delete
if ( $all_taxonomy_fields || in_array( 'terms', $fields, true ) ) {
[962] Fix | Delete
$post_type_taxonomies = get_object_taxonomies( $post['post_type'], 'names' );
[963] Fix | Delete
$terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies );
[964] Fix | Delete
$_post['terms'] = array();
[965] Fix | Delete
foreach ( $terms as $term ) {
[966] Fix | Delete
$_post['terms'][] = $this->_prepare_term( $term );
[967] Fix | Delete
}
[968] Fix | Delete
}
[969] Fix | Delete
[970] Fix | Delete
if ( in_array( 'custom_fields', $fields, true ) ) {
[971] Fix | Delete
$_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
[972] Fix | Delete
}
[973] Fix | Delete
[974] Fix | Delete
if ( in_array( 'enclosure', $fields, true ) ) {
[975] Fix | Delete
$_post['enclosure'] = array();
[976] Fix | Delete
$enclosures = (array) get_post_meta( $post['ID'], 'enclosure' );
[977] Fix | Delete
if ( ! empty( $enclosures ) ) {
[978] Fix | Delete
$encdata = explode( "\n", $enclosures[0] );
[979] Fix | Delete
$_post['enclosure']['url'] = trim( htmlspecialchars( $encdata[0] ) );
[980] Fix | Delete
$_post['enclosure']['length'] = (int) trim( $encdata[1] );
[981] Fix | Delete
$_post['enclosure']['type'] = trim( $encdata[2] );
[982] Fix | Delete
}
[983] Fix | Delete
}
[984] Fix | Delete
[985] Fix | Delete
/**
[986] Fix | Delete
* Filters XML-RPC-prepared date for the given post.
[987] Fix | Delete
*
[988] Fix | Delete
* @since 3.4.0
[989] Fix | Delete
*
[990] Fix | Delete
* @param array $_post An array of modified post data.
[991] Fix | Delete
* @param array $post An array of post data.
[992] Fix | Delete
* @param array $fields An array of post fields.
[993] Fix | Delete
*/
[994] Fix | Delete
return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields );
[995] Fix | Delete
}
[996] Fix | Delete
[997] Fix | Delete
/**
[998] Fix | Delete
* Prepares post data for return in an XML-RPC object.
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function