= 6846 && 'true' == get_user_option('rich_editing') ) { add_filter( 'mce_external_plugins', 'cforms_plugin'); add_filter( 'mce_buttons', 'cforms_button'); } // Check for WordPress 2.1+ and activated RTE elseif ( 3664 <= $wp_db_version && 'true' == get_user_option('rich_editing') ) { add_filter("mce_plugins", "cforms_plugin"); add_filter('mce_buttons', 'cforms_button'); add_action('tinymce_before_init','cforms_button_script'); } if ( class_exists('buttonsnap') ) { add_action('marker_css','cforms_css'); buttonsnap_separator(); buttonsnap_register_marker('cforms','cformscss'); buttonsnap_jsbutton($cforms_root . '/images/button.gif', __('cforms', 'cforms'), 'cforms_buttonscript();'); } } // used to insert button in wordpress 2.1x editor function cforms_css() { global $cforms_root; echo ".cformscss{ background: #F0F0EE url(".$cforms_root."/images/cfii_code_ed.jpg) no-repeat top right; overflow:hidden; padding:0; width:400px; }"; } // used to insert button in wordpress 2.1x & 2.5x editor function cforms_button($buttons) { array_push($buttons, "separator", "cforms"); return $buttons; } // Tell TinyMCE that there is a plugin (wp2.1) function cforms_plugin($plugins) { global $cforms_root,$wp_db_version; if ( $wp_db_version >= 6846 ) $plugins['cforms'] = $cforms_root.'/js/editor_plugin25.js'; else array_push($plugins, "-cforms"); return $plugins; } // Load the TinyMCE plugin : editor_plugin.js (wp2.1) function cforms_button_script() { global $cforms_root,$wp_db_version; $pluginURL = $cforms_root .'/js/'; $fns = getAllformNames(); echo 'var placeholder="'.__('placeholder for:','cforms').'";'; echo 'var formnames=new Array('.$fns.');'; echo 'tinyMCE.loadPlugin("cforms", "'.$pluginURL.'");'."\n"; echo 'var purl="'.$pluginURL.'";'."\n"; return; } function getAllformNames() { $fns = ''; $forms = get_option('cforms_formcount'); for ($i=0;$i<$forms;$i++) { $no = ($i==0)?'':($i+1); $fns .= '"'.get_option('cforms'.$no.'_fname').'",'; } return substr($fns,0,-1); } // Load the Script for the Button(wp2.1) function insert_cforms_script() { global $cforms_root, $wp_db_version; $options = ''; $forms = get_option('cforms_formcount'); for ($i=0;$i<$forms;$i++) { $no = ($i==0)?'':($i+1); $options .= ''; } $fns = getAllformNames(); ?>