'', 'title' => '', 'image' => '', 'js_plugin_file' => '', 'shortcodes' => array() ); $this->button = array_merge($defaults, $button); $this->add_button(); } // add button function add_button() { if ( current_user_can('edit_posts') && current_user_can('edit_pages') && self::$count == 0) { add_filter( 'mce_external_plugins' , array( &$this, 'add_javascript' ) ); add_filter( 'mce_buttons' , array( &$this, 'display_in_editor' ) ); add_filter( 'admin_print_scripts' , array( &$this, 'create_js_globals' ) ); self::$count ++; } } //displays all buttons that are added to the $buttons array in the tinymce visual editor function display_in_editor($buttons) { array_push($buttons, $this->button['id']); return $buttons; } // add the javascript that holds the tinyce plugin function add_javascript($plugin_array) { $plugin_array[$this->button['id']] = $this->button['js_plugin_file']; return $plugin_array; } //print js globals so the tinymce plugin can fetch them function create_js_globals() { $theme = wp_get_theme(); global $post_ID; echo "\n \n \n "; } } // end class } // end if !class_exists