| @@ -6,8 +6,12 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | use Automattic\Jetpack\Assets; |
| 9 | 9 | |
| 10 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 11 | + exit( 0 ); | |
| 12 | +} | |
| 13 | + | |
| 10 | 14 | /** |
| 11 | 15 | * WordPress Shortcode Editor View JS Code |
| 12 | 16 | */ |
| 13 | 17 | function videopress_handle_editor_view_js() { |
| @@ -122,9 +126,9 @@ | ||
| 122 | 126 | |
| 123 | 127 | /** |
| 124 | 128 | * Make sure that any Video that has a VideoPress GUID passes that data back. |
| 125 | 129 | * |
| 126 | - * @param WP_Post $post Attachment object. | |
| 130 | + * @param array $post Attachment data array. | |
| 127 | 131 | * @deprecated 11.4 |
| 128 | 132 | */ |
| 129 | 133 | function videopress_prepare_attachment_for_js( $post ) { |
| 130 | 134 | _deprecated_function( __METHOD__, 'jetpack-11.4' ); |
| @@ -214,12 +218,12 @@ | ||
| 214 | 218 | */ |
| 215 | 219 | function videopress_media_send_to_editor( $html, $id, $attachment ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 216 | 220 | $videopress_guid = get_post_meta( $id, 'videopress_guid', true ); |
| 217 | 221 | if ( $videopress_guid && videopress_is_valid_guid( $videopress_guid ) ) { |
| 218 | - if ( '[video ' === substr( $html, 0, 7 ) ) { | |
| 222 | + if ( str_starts_with( $html, '[video ' ) ) { | |
| 219 | 223 | $html = sprintf( '[videopress %1$s]', esc_attr( $videopress_guid ) ); |
| 220 | 224 | |
| 221 | - } elseif ( '<a href=' === substr( $html, 0, 8 ) ) { | |
| 225 | + } elseif ( str_starts_with( $html, '<a href=' ) ) { | |
| 222 | 226 | // We got here because `wp_attachment_is()` returned false for |
| 223 | 227 | // video, because there isn't a local copy of the file. |
| 224 | 228 | $html = sprintf( '[videopress %1$s]', esc_attr( $videopress_guid ) ); |
| 225 | 229 | } |