Changeset 55365 for trunk/src/wp-includes/class-wp-embed.php
- Timestamp:
- 02/19/2023 03:03:50 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-embed.php
r54319 r55365 223 223 } 224 224 225 $post_ ID= ( ! empty( $post->ID ) ) ? $post->ID : null;225 $post_id = ( ! empty( $post->ID ) ) ? $post->ID : null; 226 226 227 227 // Potentially set by WP_Embed::cache_oembed(). 228 228 if ( ! empty( $this->post_ID ) ) { 229 $post_ ID= $this->post_ID;229 $post_id = $this->post_ID; 230 230 } 231 231 … … 243 243 * @param string $url The attempted embed URL. 244 244 * @param array $attr An array of shortcode attributes. 245 * @param int $post_ IDPost ID.245 * @param int $post_id Post ID. 246 246 */ 247 $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ ID);247 $ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_id ); 248 248 249 249 $cache = ''; … … 252 252 $cached_post_id = $this->find_oembed_post_id( $key_suffix ); 253 253 254 if ( $post_ ID) {255 $cache = get_post_meta( $post_ ID, $cachekey, true );256 $cache_time = get_post_meta( $post_ ID, $cachekey_time, true );254 if ( $post_id ) { 255 $cache = get_post_meta( $post_id, $cachekey, true ); 256 $cache_time = get_post_meta( $post_id, $cachekey_time, true ); 257 257 258 258 if ( ! $cache_time ) { … … 285 285 * @param string $url The attempted embed URL. 286 286 * @param array $attr An array of shortcode attributes. 287 * @param int $post_ IDPost ID.287 * @param int $post_id Post ID. 288 288 */ 289 return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ ID);289 return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_id ); 290 290 } 291 291 } … … 306 306 $html = wp_oembed_get( $url, $attr ); 307 307 308 if ( $post_ ID) {308 if ( $post_id ) { 309 309 if ( $html ) { 310 update_post_meta( $post_ ID, $cachekey, $html );311 update_post_meta( $post_ ID, $cachekey_time, time() );310 update_post_meta( $post_id, $cachekey, $html ); 311 update_post_meta( $post_id, $cachekey_time, time() ); 312 312 } elseif ( ! $cache ) { 313 update_post_meta( $post_ ID, $cachekey, '{{unknown}}' );313 update_post_meta( $post_id, $cachekey, '{{unknown}}' ); 314 314 } 315 315 } else { … … 370 370 if ( $html ) { 371 371 /** This filter is documented in wp-includes/class-wp-embed.php */ 372 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ ID);372 return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_id ); 373 373 } 374 374 … … 380 380 * Deletes all oEmbed caches. Unused by core as of 4.0.0. 381 381 * 382 * @param int $post_ IDPost ID to delete the caches for.383 */ 384 public function delete_oembed_caches( $post_ ID) {385 $post_metas = get_post_custom_keys( $post_ ID);382 * @param int $post_id Post ID to delete the caches for. 383 */ 384 public function delete_oembed_caches( $post_id ) { 385 $post_metas = get_post_custom_keys( $post_id ); 386 386 if ( empty( $post_metas ) ) { 387 387 return; … … 390 390 foreach ( $post_metas as $post_meta_key ) { 391 391 if ( '_oembed_' === substr( $post_meta_key, 0, 8 ) ) { 392 delete_post_meta( $post_ ID, $post_meta_key );392 delete_post_meta( $post_id, $post_meta_key ); 393 393 } 394 394 } … … 398 398 * Triggers a caching of all oEmbed results. 399 399 * 400 * @param int $post_ IDPost ID to do the caching for.401 */ 402 public function cache_oembed( $post_ ID) {403 $post = get_post( $post_ ID);400 * @param int $post_id Post ID to do the caching for. 401 */ 402 public function cache_oembed( $post_id ) { 403 $post = get_post( $post_id ); 404 404 405 405 $post_types = get_post_types( array( 'show_ui' => true ) );
Note: See TracChangeset
for help on using the changeset viewer.