[wp-trac] [WordPress Trac] #20030: WP_Editor outputs external plugins multiple times (was: Shortcodes 3.3)
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 13 14:48:27 UTC 2012
#20030: WP_Editor outputs external plugins multiple times
--------------------------+------------------------------
Reporter: cmsmaster | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version: 3.3
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Changes (by duck_):
* keywords: => has-patch
* version: 3.3.1 => 3.3
Comment:
This occurs because WP_Editor::editor_settings() appends `$ext_plugins` to
`self::$ext_plugins` without clearing the variable. So by the end of the
loop `$ext_plugins` contains the full output we desire (one entry per
plugin), but `self::$ext_plugins` has the first external plugin include
`count( $ext_plugins )` times. See
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/class-wp-
editor.php#L248.
The patch attached moves the assignment to `self::$ext_plugins` out of the
loop.
A smaller test case:
{{{
function trac20030_mce_external_plugins( $plugins ) {
$plugins['myplugin1'] = WP_PLUGIN_URL . '/myplugin1.js';
$plugins['myplugin2'] = WP_PLUGIN_URL . '/myplugin2.js';
return $plugins;
}
add_filter( 'mce_external_plugins', 'trac20030_mce_external_plugins' );
}}}
Outputs this in current trunk:
{{{
tinyMCEPreInit.load_ext("http://wp.dev/wp-content/plugins", "en");
tinymce.PluginManager.load("myplugin1", "http://wp.dev/wp-
content/plugins/myplugin1.js");
tinyMCEPreInit.load_ext("http://wp.dev/wp-content/plugins", "en");
tinymce.PluginManager.load("myplugin1", "http://wp.dev/wp-
content/plugins/myplugin1.js");
tinyMCEPreInit.load_ext("http://wp.dev/wp-content/plugins", "en");
tinymce.PluginManager.load("myplugin2", "http://wp.dev/wp-
content/plugins/myplugin2.js");
}}}
Notice the extra entry for "myplugin1".
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20030#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list