videopress_media_send_to_editor

The WordPress Core videopress media send to editor function.

Description

videopress_media_send_to_editor( $html, $id, $attachment ); 

Parameters (3)

0. $html
The html.
1. $id
The id.
2. $attachment
The attachment.

Usage

  1. if ( !function_exists( 'videopress_media_send_to_editor' ) ) { 
  2. require_once '/modules/videopress/editor-media-view.php'; 
  3.  
  4. // The html. 
  5. $html = null; 
  6.  
  7. // The id. 
  8. $id = null; 
  9.  
  10. // The attachment. 
  11. $attachment = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = videopress_media_send_to_editor($html, $id, $attachment); 
  15.  

Defined (1)

The function is defined in the following location(s).

/modules/videopress/editor-media-view.php  
  1. function videopress_media_send_to_editor( $html, $id, $attachment ) { 
  2. $videopress_guid = get_post_meta( $id, 'videopress_guid', true ); 
  3. if ( $videopress_guid && videopress_is_valid_guid( $videopress_guid ) ) { 
  4. if ( '[video ' === substr( $html, 0, 7 ) ) { 
  5. $html = sprintf( '[videopress %1$s]', esc_attr( $videopress_guid ) ); 
  6.  
  7. } elseif ( '<a href=' === substr( $html, 0, 8 ) ) { 
  8. // We got here because `wp_attachment_is()` returned false for 
  9. // video, because there isn't a local copy of the file. 
  10. $html = sprintf( '[videopress %1$s]', esc_attr( $videopress_guid ) ); 
  11. } elseif ( videopress_is_attachment_without_guid( $id ) ) { 
  12. $html = sprintf( '[videopress postid=%d]', $id ); 
  13. return $html;