PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-videopress/src/class-xmlrpc.php +20 -3 12.2.3 → 16.3 View file →
@@ -6,8 +6,10 @@
6 6 */
7 7
8 8 namespace Automattic\Jetpack\VideoPress;
9 9
10 +use WP_User;
11 +
10 12 /**
11 13 * VideoPress playback module markup generator.
12 14 *
13 15 * @since 0.1.1
@@ -58,9 +60,9 @@
58 60 * @param WP_User $user The user object the API request is signed by.
59 61 *
60 62 * @return array
61 63 */
62 - public function xmlrpc_methods( $methods, $core_methods, $user ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
64 + public function xmlrpc_methods( $methods, $core_methods, $user ) {
63 65 if ( $user && $user instanceof WP_User ) {
64 66 $this->current_user = $user;
65 67 }
66 68
@@ -85,12 +87,27 @@
85 87 public function create_media_item( $media ) {
86 88 $this->authenticate_user();
87 89
88 90 foreach ( $media as & $media_item ) {
89 - $title = sanitize_title( basename( $media_item['url'] ) );
90 - $guid = isset( $media['guid'] ) ? $media['guid'] : null;
91 + $url = is_string( $media_item['url'] ?? null ) ? $media_item['url'] : '';
92 + $title = isset( $media_item['title'] ) && '' !== $media_item['title']
93 + ? sanitize_text_field( $media_item['title'] )
94 + : sanitize_title( basename( $url ) );
95 + $guid = $media['guid'] ?? null;
91 96
92 97 $media_id = videopress_create_new_media_item( $title, $guid );
98 +
99 + $post_update = array();
100 + if ( isset( $media_item['description'] ) && '' !== $media_item['description'] ) {
101 + $post_update['post_content'] = sanitize_textarea_field( $media_item['description'] );
102 + }
103 + if ( isset( $media_item['caption'] ) && '' !== $media_item['caption'] ) {
104 + $post_update['post_excerpt'] = sanitize_textarea_field( $media_item['caption'] );
105 + }
106 + if ( $post_update ) {
107 + $post_update['ID'] = $media_id;
108 + wp_update_post( $post_update );
109 + }
93 110
94 111 wp_update_attachment_metadata(
95 112 $media_id,
96 113 array(