Update WP and plugins
This commit is contained in:
parent
10a4713229
commit
1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions
|
@ -75,7 +75,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
|
||||
// Attaching media to a post requires ability to edit said post.
|
||||
if ( ! empty( $request['post'] ) ) {
|
||||
$parent = get_post( (int) $request['post'] );
|
||||
$parent = get_post( (int) $request['post'] );
|
||||
$post_parent_type = get_post_type_object( $parent->post_type );
|
||||
|
||||
if ( ! current_user_can( $post_parent_type->cap->edit_post, $request['post'] ) ) {
|
||||
|
@ -101,7 +101,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
}
|
||||
|
||||
// Get the file via $_FILES or raw data.
|
||||
$files = $request->get_file_params();
|
||||
$files = $request->get_file_params();
|
||||
$headers = $request->get_headers();
|
||||
|
||||
if ( ! empty( $files ) ) {
|
||||
|
@ -116,11 +116,11 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
|
||||
$name = basename( $file['file'] );
|
||||
$name_parts = pathinfo( $name );
|
||||
$name = trim( substr( $name, 0, -(1 + strlen( $name_parts['extension'] ) ) ) );
|
||||
$name = trim( substr( $name, 0, -( 1 + strlen( $name_parts['extension'] ) ) ) );
|
||||
|
||||
$url = $file['url'];
|
||||
$type = $file['type'];
|
||||
$file = $file['file'];
|
||||
$url = $file['url'];
|
||||
$type = $file['type'];
|
||||
$file = $file['file'];
|
||||
|
||||
// Include image functions to get access to wp_read_image_metadata().
|
||||
require_once ABSPATH . 'wp-admin/includes/image.php';
|
||||
|
@ -138,9 +138,9 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$attachment = $this->prepare_item_for_database( $request );
|
||||
$attachment = $this->prepare_item_for_database( $request );
|
||||
$attachment->post_mime_type = $type;
|
||||
$attachment->guid = $url;
|
||||
$attachment->guid = $url;
|
||||
|
||||
if ( empty( $attachment->post_title ) ) {
|
||||
$attachment->post_title = preg_replace( '/\.[^.]+$/', '', basename( $file ) );
|
||||
|
@ -228,7 +228,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
}
|
||||
|
||||
$response = rest_ensure_response( $response );
|
||||
$data = $response->get_data();
|
||||
$data = $response->get_data();
|
||||
|
||||
if ( isset( $request['alt_text'] ) ) {
|
||||
update_post_meta( $data['id'], '_wp_attachment_image_alt', $request['alt_text'] );
|
||||
|
@ -421,10 +421,10 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
$schema = parent::get_item_schema();
|
||||
|
||||
$schema['properties']['alt_text'] = array(
|
||||
'description' => __( 'Alternative text to display when attachment is not displayed.' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'arg_options' => array(
|
||||
'description' => __( 'Alternative text to display when attachment is not displayed.' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'arg_options' => array(
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
),
|
||||
);
|
||||
|
@ -438,7 +438,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
'raw' => array(
|
||||
'description' => __( 'Caption for the attachment, as it exists in the database.' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'edit' ),
|
||||
|
@ -461,7 +461,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database()
|
||||
),
|
||||
'properties' => array(
|
||||
'raw' => array(
|
||||
'raw' => array(
|
||||
'description' => __( 'Description for the object, as it exists in the database.' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'edit' ),
|
||||
|
@ -476,39 +476,39 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
);
|
||||
|
||||
$schema['properties']['media_type'] = array(
|
||||
'description' => __( 'Attachment type.' ),
|
||||
'type' => 'string',
|
||||
'enum' => array( 'image', 'file' ),
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
'description' => __( 'Attachment type.' ),
|
||||
'type' => 'string',
|
||||
'enum' => array( 'image', 'file' ),
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
);
|
||||
|
||||
$schema['properties']['mime_type'] = array(
|
||||
'description' => __( 'The attachment MIME type.' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
'description' => __( 'The attachment MIME type.' ),
|
||||
'type' => 'string',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
);
|
||||
|
||||
$schema['properties']['media_details'] = array(
|
||||
'description' => __( 'Details about the media file, specific to its type.' ),
|
||||
'type' => 'object',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
'description' => __( 'Details about the media file, specific to its type.' ),
|
||||
'type' => 'object',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
);
|
||||
|
||||
$schema['properties']['post'] = array(
|
||||
'description' => __( 'The ID for the associated post of the attachment.' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'description' => __( 'The ID for the associated post of the attachment.' ),
|
||||
'type' => 'integer',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
);
|
||||
|
||||
$schema['properties']['source_url'] = array(
|
||||
'description' => __( 'URL to the original attachment file.' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
'description' => __( 'URL to the original attachment file.' ),
|
||||
'type' => 'string',
|
||||
'format' => 'uri',
|
||||
'context' => array( 'view', 'edit', 'embed' ),
|
||||
'readonly' => true,
|
||||
);
|
||||
|
||||
unset( $schema['properties']['password'] );
|
||||
|
@ -678,16 +678,16 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
* @return array Query parameters for the attachment collection as an array.
|
||||
*/
|
||||
public function get_collection_params() {
|
||||
$params = parent::get_collection_params();
|
||||
$params['status']['default'] = 'inherit';
|
||||
$params = parent::get_collection_params();
|
||||
$params['status']['default'] = 'inherit';
|
||||
$params['status']['items']['enum'] = array( 'inherit', 'private', 'trash' );
|
||||
$media_types = $this->get_media_types();
|
||||
$media_types = $this->get_media_types();
|
||||
|
||||
$params['media_type'] = array(
|
||||
'default' => null,
|
||||
'description' => __( 'Limit result set to attachments of a particular media type.' ),
|
||||
'type' => 'string',
|
||||
'enum' => array_keys( $media_types ),
|
||||
'default' => null,
|
||||
'description' => __( 'Limit result set to attachments of a particular media type.' ),
|
||||
'type' => 'string',
|
||||
'enum' => array_keys( $media_types ),
|
||||
);
|
||||
|
||||
$params['mime_type'] = array(
|
||||
|
@ -744,7 +744,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
|
||||
// Pass off to WP to handle the actual upload.
|
||||
$overrides = array(
|
||||
'test_form' => false,
|
||||
'test_form' => false,
|
||||
);
|
||||
|
||||
// Bypasses is_uploaded_file() when running unit tests.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue