add_nextgen_button

Add_nextgen_button.

Defined (1)

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

/admin/tinymce/tinymce.php  
  1. class add_nextgen_button { 
  2.  
  3. var $pluginname = 'NextGEN'; 
  4. var $path = ''; 
  5. var $internalVersion = 200; 
  6.  
  7. /** 
  8. * add_nextgen_button::add_nextgen_button() 
  9. * the constructor 
  10. *  
  11. * @return void 
  12. */ 
  13. function add_nextgen_button() { 
  14.  
  15. // Set path to editor_plugin.js 
  16. $this->path = NGGALLERY_URLPATH . 'admin/tinymce/';  
  17.  
  18. // Modify the version when tinyMCE plugins are changed. 
  19. add_filter('tiny_mce_version', array (&$this, 'change_tinymce_version') ); 
  20.  
  21. // init process for button control 
  22. add_action('init', array (&$this, 'addbuttons') ); 
  23.  
  24. /** 
  25. * add_nextgen_button::addbuttons() 
  26. *  
  27. * @return void 
  28. */ 
  29. function addbuttons() { 
  30.  
  31. // Don't bother doing this stuff if the current user lacks permissions 
  32. if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )  
  33. return; 
  34.  
  35. // Check for NextGEN capability 
  36. if ( !current_user_can('NextGEN Use TinyMCE') )  
  37. return; 
  38.  
  39. // Add only in Rich Editor mode 
  40. if ( get_user_option('rich_editing') == 'true') { 
  41.  
  42. // add the button for wp2.5 in a new way 
  43. add_filter("mce_external_plugins", array (&$this, 'add_tinymce_plugin' ), 5); 
  44. add_filter('mce_buttons', array (&$this, 'register_button' ), 5); 
  45.  
  46. /** 
  47. * add_nextgen_button::register_button() 
  48. * used to insert button in wordpress 2.5x editor 
  49. *  
  50. * @return $buttons 
  51. */ 
  52. function register_button($buttons) { 
  53.  
  54. array_push($buttons, 'separator', $this->pluginname ); 
  55.  
  56. return $buttons; 
  57.  
  58. /** 
  59. * add_nextgen_button::add_tinymce_plugin() 
  60. * Load the TinyMCE plugin : editor_plugin.js 
  61. *  
  62. * @return $plugin_array 
  63. */ 
  64. function add_tinymce_plugin($plugin_array) {  
  65.  
  66. $plugin_array[$this->pluginname] = $this->path . 'editor_plugin.js'; 
  67.  
  68. return $plugin_array; 
  69.  
  70. /** 
  71. * add_nextgen_button::change_tinymce_version() 
  72. * A different version will rebuild the cache 
  73. *  
  74. * @return $versio 
  75. */ 
  76. function change_tinymce_version($version) { 
  77. $version = $version + $this->internalVersion; 
  78. return $version; 
  79.