
Blackbams Blog
development – digital arts – internet
Knowledge is free. No one may take possession of it.
28. January 2012
Recently I had to fix a bunch of really annoying problems with this combination. Duplicated contents, automatically inserted line breaks and problems with the custom styles for TinyMCE really caused me to hate these Plugins. The reason for most of the problems is qTranslate though.
If you experience similar problems, the following "library" will be helpful for you. It contains a lot of functions to fix problems with this combination and to customize your backend the way you need it. Do not forget to remove the slashes in front of the required filter tags, otherwise the functions are not applied. Improvement ideas are welcome.
Download the Plugin Code (NOTE: GeSHi prints the code with some little errors here, please download the Plugin. Thanks.)
Download the Plugin Code (NOTE: GeSHi prints the code with some little errors here, please download the Plugin. Thanks.)
/*
Plugin Name: TinyMCE Advanced qTranslate fix editor problems
Plugin URI: https://blog.blackbam.at/2012/01/28/wordpress-3-3-tinymce-advanced-qtranslate-fix-style-problems/
Description: Remove line breaks and whitespace, enable custom stylesheets and multiple textareas. Fully customizable.
Version: 1.0.0
Author: David Stöckl
Author URI: http://www.blackbam.at/
*
Released and distributed under the GPLv2.
*
*/
/********** Administration ******************/
register_activation_hook(__FILE__,"tqfep_activate");
function tqfep_activate() {
add_option('tqfep_styles',"");
add_option('tqfep_fix_pre',1);
add_option('tqfep_fix_post',1);
add_option('tqfep_encoding','UTF-8');
add_option('tqfep_custom_styles',';My Class=myclass;');
register_uninstall_hook(__FILE__,"tqfep_uninstall");
}
function tqfep_uninstall() {
// delete all options, tables, ...
delete_option('tqfep_styles');
delete_option('tqfep_fix_pre');
delete_option('tqfep_fix_post');
delete_option('tqfep_encoding');
delete_option('tqfep_custom_styles');
}
function tqfepUpdateCheckbox($option) {
update_option($option,intval($_POST[$option]));
}
function tqfepUpdateSelect($option,$allowed) {
if(in_array($_POST[$option],$allowed)) {
update_option($option,$_POST[$option]);
}
}
// add the options page on initialization
add_action('admin_menu','tqfep_admin');
// add the actual options page
function tqfep_admin() {
add_options_page('Fix TQ Editor','Fix TQ Editor','manage_options',__FILE__,'tqfep_backend_page');
}
// add the options page
function tqfep_backend_page() { ?>
Settings: TinyMCE Advanced qTranslate fix editor problems
Settings saved successfully
", "-->", $content);
$content = preg_replace("/(-->)(\s| )*(\s| )*(<\/p>)(\s| )*/","-->",$content);
$content = htmlentities($content,ENT_COMPAT | ENT_HTML401,get_option('tqfep_encoding'));
return $content;
}
function fix_p_after_edit ($content) {
$content = str_replace("", "-->", $content);
$content = preg_replace("/(-->)(\s| )*
(\s| )*(<\/p>)(\s| )*/","-->",$content);
return $content;
}
Dieser Eintrag wurde am 28. January 2012 um 20:20 in der Kategorie Plugins, WordPress, WP Scripts veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.
Warning: Use of undefined constant Ext_related_links - assumed 'Ext_related_links' (this will throw an Error in a future version of PHP) in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 75
Already 6 comments belonging to "WordPress 3.3 – TinyMCE Advanced – qTranslate – fix style problems":
Kommentare abonnieren (RSS) or URL Trackback
John
says:
on 21. February 2012 at 15:32 on clock
Hi, Thanks for the solution but how can i use this library.Is it enough to upload the library folder to tinymce folder ? Thank you.
John
says:
on 21. February 2012 at 19:09 on clock
Hi, Thanks for the solution but how can i use this library.Is it enough to upload the library folder to tinymce folder ? Thank you.
John
says:
on 27. March 2012 at 12:16 on clock
Hi, Thanks for the solution but how can i use this library.Is it enough to upload the library folder to tinymce folder ? Thank you.
John
says:
on 27. March 2012 at 14:16 on clock
Hi, Thanks for the solution but how can i use this library.Is it enough to upload the library folder to tinymce folder ? Thank you.
John
says:
on 03. April 2012 at 15:11 on clock
Hi, Thanks for the solution but how can i use this library.Is it enough to upload the library folder to tinymce folder ? Thank you.
John
says:
on 05. April 2012 at 09:07 on clock
Hi, Thanks for the solution but how can i use this library.Is it enough to upload the library folder to tinymce folder ? Thank you.
Leave a comment: