function cforms_addbuttons() { global $wp_db_version; global $cforms_root; // Check for WordPress 2.5+ and activated RTE if ($wp_db_version >= 6846 && 'true' == get_user_option('rich_editing')) { add_filter('mce_external_plugins', 'cforms_plugin'); add_filter('mce_buttons', 'cforms_button'); } elseif (3664 <= $wp_db_version && 'true' == get_user_option('rich_editing')) { add_filter("mce_plugins", "cforms_plugin"); add_filter('mce_buttons', 'cforms_button'); add_action('tinymce_before_init', 'cforms_button_script'); } if (class_exists('buttonsnap')) { add_action('marker_css', 'cforms_css'); buttonsnap_separator(); buttonsnap_register_marker('cforms', 'cformscss'); buttonsnap_jsbutton($cforms_root . '/images/button.gif', __('cforms', 'cforms'), 'cforms_buttonscript();'); } }
function ps_imagemanager_init() { global $buttonsnap, $ps_imagemanager_root; if (is_array(get_settings('ps_imagemanager_options'))) { include_once dirname(__FILE__) . "/lib/buttonsnap.php"; // need it for buttonsnap_settext if (function_exists('wp_print_scripts') && 'true' == get_user_option('rich_editing')) { // if (4351 <= $wp_db_version && 'true' == get_user_option('rich_editing')) { add_filter("mce_plugins", "ps_imagemanager_mce_plugins", 5); add_filter("mce_buttons", "ps_imagemanager_mce_buttons", 5); add_action('tinymce_before_init', 'ps_imagemanager_external_plugins'); add_action('admin_footer', 'ps_imagemanager_add_quicktag'); function ps_imagemanager_add_quicktag() { echo <<<EOT \t\t\t\t\t<script type="text/javascript"> \t\t\t\t\t\t<!-- \t\t\t\t\t\t\t// code from http://roel.meurders.nl/wordpress-plugins/wp-addquicktag-plugin-for-adding-quicktags/ \t\t\t\t\t\t\tif(wpaqToolbar = document.getElementById("ed_toolbar")){ \t\t\t\t\t\t\t\tvar wpaqNr, wpaqBut, wpaqStart, wpaqEnd; \t\t\t\t\t\t\t\twpaqStart = ''; \t\t\t\t\t\t\t\twpaqEnd = ''; \t\t\t\t\t\t\t\twpaqNr = edButtons.length; \t\t\t\t\t\t\t\tedButtons[wpaqNr] = new edButton('ed_ImageManager','Imagemanager','', '','',-1); \t\t\t\t\t\t\t\tvar wpaqBut = wpaqToolbar.lastChild; \t\t\t\t\t\t\t\twhile (wpaqBut.nodeType != 1){ \t\t\t\t\t\t\t\t\twpaqBut = wpaqBut.previousSibling; \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\twpaqBut = wpaqBut.cloneNode(true); \t\t\t\t\t\t\t\twpaqToolbar.appendChild(wpaqBut); \t\t\t\t\t\t\t\twpaqBut.value = 'ImageManager'; \t\t\t\t\t\t\t\twpaqBut.title = wpaqNr; \t\t\t\t\t\t\t\t// wpaqBut.onclick = function () {edInsertTag(edCanvas, parseInt(this.title));} \t\t\t\t\t\t\t\twpaqBut.onclick = function () { \t\t\t\t\t\t\t\t\timagemagager_use_edInsert = true; // don't use buttonsnap_settext \t\t\t\t\t\t\t\t\topenImageManager(); \t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\twpaqBut.id = "ed_ImageManager"; \t\t\t\t\t\t\t} \t\t\t\t\t\t//--> \t\t\t\t\t</script> EOT; } } else { $button_image = $ps_imagemanager_root . '/gfx/images.png'; buttonsnap_separator(); buttonsnap_jsbutton($button_image, 'ImageManager', 'openImageManager();'); } } }
/** Register our button in the QuickTags bar */ function button_init() { if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) { return; } if ('true' == get_user_option('rich_editing')) { global $wp_db_version; //check if we are using WordPress 2.5+ if ($wp_db_version >= 7098) { // Use WordPress 2.5+ hooks add_filter('mce_external_plugins', array(&$this, 'mce3_plugin')); add_filter('mce_buttons', array(&$this, 'mce3_button')); } else { // Load and append our TinyMCE external plugin add_filter('mce_plugins', array(&$this, 'mce2_plugin')); add_filter('mce_buttons', array(&$this, 'mce2_button')); add_filter('tinymce_before_init', array(&$this, 'tinymce2_before_init')); } } else { buttonsnap_separator(); buttonsnap_jsbutton(WP_CONTENT_URL . '/plugins/subscribe2/include/s2_button.png', __('Subscribe2', 'subscribe2'), 's2_insert_token();'); } }
function addbuttons() { // Don't bother doing this stuff if the current user lacks permissions as they'll never see the pages if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) { return; } // Create the buttons based on the WP version number if ('true' == get_user_option('rich_editing') && $this->wpversion >= 2.1) { // WordPress 2.5+ (TinyMCE 3.x) if ($this->wpversion >= 2.5) { add_filter('mce_external_plugins', array(&$this, 'mce_external_plugins')); add_filter('mce_buttons_3', array(&$this, 'mce_buttons')); add_action('admin_head', array(&$this, 'buttonhider')); } else { add_filter('mce_plugins', array(&$this, 'mce_plugins')); if (1 != $this->settings['tinymce_linenumber']) { add_filter('mce_buttons_' . $this->settings['tinymce_linenumber'], array(&$this, 'mce_buttons')); } else { add_filter('mce_buttons', array(&$this, 'mce_buttons')); } add_action('tinymce_before_init', array(&$this, 'tinymce_before_init')); add_action('admin_head', array(&$this, 'buttonhider')); } } else { buttonsnap_separator(); if ('on' == $this->settings['youtube']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/youtube.png', __('YouTube', 'vvq'), 'VVQInsertVideoSite("' . __('YouTube', 'vvq') . '", "http://www.youtube.com/watch?v=JzqumbhfxRo", "youtube");'); } if ('on' == $this->settings['googlevideo']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/googlevideo.png', __('GVideo', 'vvq'), 'VVQInsertVideoSite("' . __('Google Video', 'vvq') . '", "http://video.google.com/videoplay?docid=3688185030664621355", "googlevideo");'); } if ('on' == $this->settings['ifilm']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/ifilm.png', __('IFILM', 'vvq'), 'VVQInsertVideoSite("' . __('IFILM', 'vvq') . '", "http://www.ifilm.com/video/2710582", "ifilm");'); } if ('on' == $this->settings['metacafe']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/metacafe.png', __('Metacafe', 'vvq'), 'VVQInsertVideoSite("' . __('Metacafe', 'vvq') . '", "http://www.metacafe.com/watch/299980/italian_police_lamborghini/", "metacafe");'); } if ('on' == $this->settings['myspace']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/myspace.png', __('MySpace', 'vvq'), 'VVQInsertVideoSite("' . __('MySpace', 'vvq') . '", "http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=1387215221", "myspace");'); } if ('on' == $this->settings['vimeo']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/vimeo.png', __('Vimeo', 'vvq'), 'VVQInsertVideoSite("' . __('Vimeo', 'vvq') . '", "http://www.vimeo.com/27810", "vimeo");'); } if ('on' == $this->settings['quicktime']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/quicktime.png', __('QT', 'vvq'), 'VVQInsertVideoFile("' . __('Quicktime', 'vvq') . '", "mov", "quicktime");'); } if ('on' == $this->settings['videofile']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/videofile.png', __('Video File', 'vvq'), 'VVQInsertVideoFile("", "avi", "video");'); } if ('on' == $this->settings['flv']['button']) { buttonsnap_jsbutton($this->fullfolderurl . 'images/flv.png', __('FLV', 'vvq'), 'VVQInsertVideoFile("' . __('FLV', 'vvq') . '", "flv", "flv");'); } } }