gde_media_insert

Modify the file insertion from Media Library if requested.

Description

(string) gde_media_insert( $html, $id, $attachment ); 

Returns (string)

HTML to insert into editor

Parameters (3)

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

Usage

  1. if ( !function_exists( 'gde_media_insert' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/functions-admin.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 = gde_media_insert($html, $id, $attachment); 
  15.  

Defined (1)

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

/functions-admin.php  
  1. function gde_media_insert( $html, $id, $attachment ) { 
  2. global $gdeoptions; 
  3.  
  4. $gdoc_url = ''; 
  5. if (isset($attachment['url'])) { 
  6. $gdoc_url = $attachment['url']; 
  7. elseif ($id > 0) { 
  8. $post = get_post($id); 
  9. if ($post) { 
  10. $gdoc_url = wp_get_attachment_url($id); 
  11.  
  12. if ($gdoc_url != '' && gde_valid_type( $gdoc_url ) && $gdeoptions['ed_embed_sc'] == "yes" ) { 
  13. return '[gview file="' . $gdoc_url . '"]'; 
  14. } else { 
  15. return $html;