March 30th, 2010 -
4 Comments
Today at work we realized that Tiny MCE doesn’t work properly on the iPhone. At least MCEComments for WordPress doesn’t This prevented users from commenting from a mobile device on the MSU blogs. I fixed this pretty simply by doing browser detection in PHP before loading the files for MCEComments. I modified the loaders for the plugin. Only two modifications of the tinyMCEComments.php was neccesary.
// Line 311
function mcecomment_init() {
global $post;
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false) {
$loadJS = false;
if (is_plugin_page()) {
$loadJS = true;
} else if (is_singular()) {
if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) {
$loadJS = true;
}
}
if ($loadJS)
mcecomment_getInitJS();
}
}
// Line 350
function mcecomment_loadCoreJS() {
global $post, $mce_locale;
if (is_singular() && (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false))
{
if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) {
wp_enqueue_script('tiny_mce', get_option('siteurl') .
'/wp-includes/js/tinymce/tiny_mce.js', false, '20081129');
wp_enqueue_script('tiny_mce_lang', get_option('siteurl') .
'/wp-includes/js/tinymce/langs/wp-langs-' . $mce_locale . '.js',
false, '20081129');
wp_deregister_script('comment-reply');
wp_enqueue_script( 'comment-reply', get_option('siteurl') .
'/wp-content/plugins/' . plugin_basename ( dirname ( __FILE__ ) ) .
"/comment-reply.dev.js", false, '20090102');
}
}
}
[ Tags ]: javascript, MCEComments, tincymcecomments, tiny MCE, wordpress
[ Category ]: programming
Tiny MCE Comments – Problems on iPhone
March 30th, 2010 - 4 Comments
Today at work we realized that Tiny MCE doesn’t work properly on the iPhone. At least MCEComments for WordPress doesn’t This prevented users from commenting from a mobile device on the MSU blogs. I fixed this pretty simply by doing browser detection in PHP before loading the files for MCEComments. I modified the loaders for the plugin. Only two modifications of the tinyMCEComments.php was neccesary.
// Line 311 function mcecomment_init() { global $post; if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false) { $loadJS = false; if (is_plugin_page()) { $loadJS = true; } else if (is_singular()) { if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) { $loadJS = true; } } if ($loadJS) mcecomment_getInitJS(); } }// Line 350 function mcecomment_loadCoreJS() { global $post, $mce_locale; if (is_singular() && (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), "iphone") === false)) { if (comments_open() && ( !get_option('comment_registration') || is_user_logged_in() )) { wp_enqueue_script('tiny_mce', get_option('siteurl') . '/wp-includes/js/tinymce/tiny_mce.js', false, '20081129'); wp_enqueue_script('tiny_mce_lang', get_option('siteurl') . '/wp-includes/js/tinymce/langs/wp-langs-' . $mce_locale . '.js', false, '20081129'); wp_deregister_script('comment-reply'); wp_enqueue_script( 'comment-reply', get_option('siteurl') . '/wp-content/plugins/' . plugin_basename ( dirname ( __FILE__ ) ) . "/comment-reply.dev.js", false, '20090102'); } } }[ Tags ]: javascript, MCEComments, tincymcecomments, tiny MCE, wordpress
[ Category ]: programming