[wp-testers] FCKEditor

Matthew Robinson mattyrobuk at googlemail.com
Mon Mar 3 20:37:34 GMT 2008


Andrew (and others maybe),

I've been playing around with this code over the last few days.

I can get my code working as a pure TinyMCE plugin. Using the code  
below I can actually constract a simple WordPress plugin to get it  
working too but...

This does not work if the functions are part of a php class as far as  
I can tell. I've got a plugin script (appended below) - am I making a  
silly mistake or is the is bug? Basically this causes TinyMCE to fail  
and the non-visual editor buttons are rendered in their place. Safari  
Activity Monitor reports 'cannot decode raw data'

Matt

<start PHP code>
<?php
/*
Plugin Name: TMCE Test
Plugin URI:
Description: Add button to TMCE
Version:  1.0
Author: Matthew Robinson
Author URI:
*/

$mynewbutton = new new_button;
$mynewbutton->button_init();

class new_button {
	function add_plugin($arr) {
		$path = get_option('siteurl') . '/wp-content/plugins/TMCE/ 
editor_plugin.js';
		$arr['subscribe2'] = $path;

		return $arr;
	}
	
	function add_button($arr) {
		$arr[] = 'subscribe2';
		return $arr;
	}

	function button_init() {
		add_filter('mce_buttons', array(&$this, 'add_button'));
		add_filter('mce_external_plugins', array(&$this, 'add_plugin'));
	}
}
?>

On 2 Mar 2008, at 19:48, Andrew Ozz wrote:

>> Oh, I see - it's a plugin for TMCE - I was hoping to see an   
>> implementation under the WordPress hooks. :-(
>
> The WordPress hooks are really easy :)
> Both you need are filters:
>
> function add_plugin($arr) {
>  $path = get_option('siteurl') . '/' . PLUGINDIR .  /my-folder/ 
> plugin.js';
>  $arr['myplugin'] = $path;
>
>  return $arr;
> }
> add_filter( 'mce_external_plugins', 'add_plugin' );
>
> function add_button($arr) {
>
>  $arr[] = 'my_button';
>  return $arr;
> }
> add_filter( 'mce_buttons_3', 'add_button' );
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers



More information about the wp-testers mailing list