[wp-trac] [WordPress Trac] #18150: languages files for tinymce external plugin don't work properly in the theme files

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 17 17:27:26 UTC 2011


#18150: languages files for tinymce external plugin don't work properly in the
theme files
--------------------------+------------------------------------
 Reporter:  kaptinlin     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  TinyMCE       |    Version:  3.2.1
 Severity:  normal        |   Keywords:  has-patch dev-feedback
--------------------------+------------------------------------
 When adding a external tinymce plugin by using mce_external_plugins hook
 in the theme's function.php file

 It will not load language files in TINYMCE_PLUGIN_PATH/langs/ folder.

 Then i look into the code of \wp-admin\includes\post.php file.

 In line 1498 of version 3.2.1

 The code is below
  {{{
 $path = str_replace( WP_PLUGIN_URL, '', $plugurl );
 $path = WP_PLUGIN_DIR . $path . '/langs/';
 }}}

 It just replace the url of plugin folder with the real path.

 When you echo the $path , you will see

 'D:\wamp\www\wordpress/wp-content/pluginshttp://localhost/wordpress/wp-
 content/themes/theme_name/tinymce/langs/'

 The correct one should be

 'D:\wamp\www\wordpress/wp-content/themes/theme_name/tinymce/langs/'


 So i add some code to fix it.  Just replace the line 1498-1499 of \wp-
 admin\includes\post.php (version 3.2.1) with the code below.

  {{{
 if(false !== strpos($plugurl, WP_PLUGIN_URL)){
                 $path = str_replace( WP_PLUGIN_URL, '', $plugurl );
                 $path = WP_PLUGIN_DIR . $path . '/langs/';
 }else{
                 $path = str_replace( get_template_directory_uri(), '',
 $plugurl );
                 $path =  get_template_directory(). $path . '/langs/';
 }
 }}}


 It works perfect.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18150>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list