28. January 2012
von Blackbam

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.)





/*
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
checked="checked" />
checked="checked" />

", "-->", $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; }

Share

Warning: Undefined variable $time_since in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 42 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.

Fatal error: Uncaught Error: Undefined constant "Ext_related_links" in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php:75 Stack trace: #0 /home/.sites/609/site1266/web/blackbams-blog/wp-includes/template-loader.php(106): include() #1 /home/.sites/609/site1266/web/blackbams-blog/wp-blog-header.php(19): require_once('/home/.sites/60...') #2 /home/.sites/609/site1266/web/blackbams-blog/index.php(17): require('/home/.sites/60...') #3 {main} thrown in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 75 internal_server_error <![CDATA[WordPress &rsaquo; Error]]> 500