bws_shortcode_media_button_popup

The Google Sitemap by BestWebSoft bws shortcode media button popup function.

Description

bws_shortcode_media_button_popup(); 

Usage

  1. if ( !function_exists( 'bws_shortcode_media_button_popup' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-sitemap-by-bestwebsoft/bws_menu/bws_functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bws_shortcode_media_button_popup(); 
  7.  

Defined (1)

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

/bws_menu/bws_functions.php  
  1. function bws_shortcode_media_button_popup() {  
  2. global $bws_shortcode_list, $wp_version; 
  3. if ( $wp_version < '3.3' ) 
  4. return; 
  5.  
  6. if ( ! empty( $bws_shortcode_list ) ) { ?> 
  7. <div id="bws_shortcode_popup" style="display:none;"> 
  8. <div id="bws_shortcode_popup_block"> 
  9. <div id="bws_shortcode_select_plugin"> 
  10. <h4><?php _e( 'Plugin', 'bestwebsoft' ); ?></h4> 
  11. <select name="bws_shortcode_select" id="bws_shortcode_select"> 
  12. <?php foreach ( $bws_shortcode_list as $key => $value ) { ?> 
  13. <option value="<?php echo $key; ?>"><?php echo $value['name']; ?></option> 
  14. <?php } ?> 
  15. </select> 
  16. </div> 
  17. <div class="clear"></div> 
  18. <div id="bws_shortcode_content"> 
  19. <h4><?php _e( 'Shortcode settings', 'bestwebsoft' ); ?></h4> 
  20. <?php echo apply_filters( 'bws_shortcode_button_content', '' ); ?> 
  21. </div> 
  22. <div class="clear"></div> 
  23. <div id="bws_shortcode_content_bottom"> 
  24. <p><?php _e( 'The shortcode will be inserted', 'bestwebsoft' ); ?></p> 
  25. <div id="bws_shortcode_block"><div id="bws_shortcode_display"></div></div> 
  26. </div> 
  27. <?php if ( $wp_version < '3.9' ) { ?> 
  28. <p> 
  29. <button class="button-primary primary bws_shortcode_insert"><?php _e( 'Insert', 'bestwebsoft' ); ?></button> 
  30. </p> 
  31. <?php } ?> 
  32. </div> 
  33. </div> 
  34. <?php } 
  35. if ( $wp_version < '3.9' ) { ?> 
  36. <script type="text/javascript"> 
  37. (function($) { 
  38. $( '.bws_shortcode_insert' ).on( 'click', function() {  
  39. var shortcode = $( '#TB_ajaxContent #bws_shortcode_display' ).text(); 
  40. if ( '' != shortcode ) { 
  41. /* insert shortcode to tinymce */ 
  42. if ( !tinyMCE.activeEditor || tinyMCE.activeEditor.isHidden() ) { 
  43. $( 'textarea#content' ).val( shortcode ); 
  44. } else { 
  45. tinyMCE.execCommand( 'mceInsertContent', false, shortcode ); 
  46. }  
  47. /* close the thickbox after adding shortcode to editor */ 
  48. self.parent.tb_remove(); 
  49. }); 
  50. })(jQuery); 
  51. </script> 
  52. <?php }