\n// name)) { $termname = $term->name; } else { $termname = ""; } // create input fields for each language foreach($q_config['enabled_languages'] as $language) { if(isset($_GET['action']) && $_GET['action']=='edit') { echo qtrans_insertTermInput2($id, $name, $termname, $language); } else { echo qtrans_insertTermInput($id, $name, $termname, $language); } } // hide real category text echo "ins.style.display='none';\n"; echo "// ]]>\n\n"; } function qtrans_modifyCategoryForm($term) { qtrans_modifyTermForm('name', __('Category Name', 'qtranslate'), $term); qtrans_modifyTermForm('tag-name', __('Category Name', 'qtranslate'), $term); } function qtrans_modifyTagForm($term) { qtrans_modifyTermForm('name', __('Tag Name', 'qtranslate'), $term); qtrans_modifyTermForm('tag-name', __('Tag Name', 'qtranslate'), $term); } function qtrans_modifyLinkCategoryForm($term) { return qtrans_modifyTermForm('name', __('Category Name', 'qtranslate'), $term); } // Modifys TinyMCE to edit multilingual content function qtrans_modifyRichEditor($old_content) { global $q_config; $init_editor = true; if($GLOBALS['wp_version'] != QT_SUPPORTED_WP_VERSION) { if(!(isset($_REQUEST['qtranslateincompatiblemessage'])&&$_REQUEST['qtranslateincompatiblemessage']=="shown")) { echo '

'.__('The qTranslate Editor has disabled itself because it hasn\'t been tested with your Wordpress version yet. This is done to prevent Wordpress from malfunctioning. You can reenable it by clicking here (may cause data loss! Use at own risk!). To remove this message permanently, please update qTranslate to the corresponding version.', 'qtranslate').'

'; } $init_editor = false; } // save callback hook preg_match("/]*id='([^']+)'/",$old_content,$matches); $id = $matches[1]; preg_match("/cols='([^']+)'/",$old_content,$matches); $cols = $matches[1]; preg_match("/rows='([^']+)'/",$old_content,$matches); $rows = $matches[1]; // don't do anything if not editing the content if($id!="content") return $old_content; // don't do anything to the editor if it's not rich if(!user_can_richedit()) { //echo '

'.__('The qTranslate Editor could not be loaded because WYSIWYG/TinyMCE is not activated in your profile.').'

'; return $old_content; } $content = ""; $content_append = ""; // create editing field for selected languages $old_content = substr($old_content,0,26) ."" .substr($old_content,26); // do some crazy js to alter the admin view $content .="\n"; $content_append .="\n"; return $content.$old_content.$content_append; } function qtrans_modifyExcerpt() { global $q_config; echo "\n"; } function qtrans_createTitlebarButton($parent, $language, $target, $id) { global $q_config; $html = " jQuery('#".$parent." .handlediv').after('
\"".$language."\"
'); jQuery('#".$id."').click(function() {qtrans_switch_postbox('".$parent."','".$target."','".$language."');}); "; return $html; } function qtrans_createTextArea($parent, $language, $target, $id) { global $q_config; $html = " jQuery('#".$target."').after(''); jQuery('#qtrans_textarea_".$target."_".$language."').attr('cols', jQuery('#".$target."').attr('cols')); jQuery('#qtrans_textarea_".$target."_".$language."').attr('rows', jQuery('#".$target."').attr('rows')); jQuery('#qtrans_textarea_".$target."_".$language."').attr('tabindex', jQuery('#".$target."').attr('tabindex')); jQuery('#qtrans_textarea_".$target."_".$language."').blur(function() {qtrans_switch_postbox('".$parent."','".$target."',false);}); jQuery('#qtrans_textarea_".$target."_".$language."').val(qtrans_use('".$language."',jQuery('#".$target."').val())); "; return $html; } function qtrans_insertTermInput($id,$name,$term,$language){ global $q_config; $html =" var il = document.getElementsByTagName('input'); var d = document.createElement('div'); var l = document.createTextNode('".$name." (".$q_config['language_name'][$language].")'); var ll = document.createElement('label'); var i = document.createElement('input'); var ins = null; for(var j = 0; j < il.length; j++) { if(il[j].id=='".$id."') { ins = il[j]; break; } } i.type = 'text'; i.id = i.name = ll.htmlFor ='qtrans_term_".$language."'; "; if(isset($q_config['term_name'][$term][$language])) { $html .=" i.value = '".addslashes(htmlspecialchars_decode($q_config['term_name'][$term][$language], ENT_NOQUOTES))."'; "; } else { $html .=" i.value = ins.value; "; } if($language == $q_config['default_language']) { $html .=" i.onchange = function() { var il = document.getElementsByTagName('input'); var ins = null; for(var j = 0; j < il.length; j++) { if(il[j].id=='".$id."') { ins = il[j]; break; } } ins.value = document.getElementById('qtrans_term_".$language."').value; }; "; } $html .=" ins = ins.parentNode; d.className = 'form-field form-required'; ll.appendChild(l); d.appendChild(ll); d.appendChild(i); ins.parentNode.insertBefore(d,ins); "; return $html; } function qtrans_insertTermInput2($id,$name,$term,$language){ global $q_config; $html =" var tr = document.createElement('tr'); var th = document.createElement('th'); var ll = document.createElement('label'); var l = document.createTextNode('".$name." (".$q_config['language_name'][$language].")'); var td = document.createElement('td'); var i = document.createElement('input'); var ins = document.getElementById('".$id."'); i.type = 'text'; i.id = i.name = ll.htmlFor ='qtrans_term_".$language."'; "; if(isset($q_config['term_name'][$term][$language])) { $html .=" i.value = '".addslashes(htmlspecialchars_decode($q_config['term_name'][$term][$language], ENT_QUOTES))."'; "; } else { $html .=" i.value = ins.value; "; } if($language == $q_config['default_language']) { $html .=" i.onchange = function() { var il = document.getElementsByTagName('input'); var ins = null; for(var j = 0; j < il.length; j++) { if(il[j].id=='".$id."') { ins = il[j]; break; } } ins.value = document.getElementById('qtrans_term_".$language."').value; }; "; } $html .=" ins = ins.parentNode.parentNode; tr.className = 'form-field form-required'; th.scope = 'row'; th.vAlign = 'top'; ll.appendChild(l); th.appendChild(ll); tr.appendChild(th); td.appendChild(i); tr.appendChild(td); ins.parentNode.insertBefore(tr,ins); "; return $html; } function qtrans_insertTitleInput($language){ global $q_config; $html =" var td = document.getElementById('titlediv'); var qtd = document.createElement('div'); var h = document.createElement('h3'); var l = document.createTextNode('".__("Title", 'qtranslate')." (".$q_config['language_name'][$language].")'); var tw = document.createElement('div'); var ti = document.createElement('input'); var slug = document.getElementById('edit-slug-box'); ti.type = 'text'; ti.id = 'qtrans_title_".$language."'; ti.tabIndex = '1'; ti.value = qtrans_use('".$language."', document.getElementById('title').value); ti.onchange = qtrans_integrate_title; ti.className = 'qtrans_title_input'; h.className = 'qtrans_title'; tw.className = 'qtrans_title_wrap'; qtd.className = 'postarea'; h.appendChild(l); tw.appendChild(ti); qtd.appendChild(h); qtd.appendChild(tw);"; if($q_config['default_language'] == $language) $html.="if(slug) qtd.appendChild(slug);"; $html.=" td.parentNode.insertBefore(qtd,td); "; return $html; } function qtrans_createEditorToolbarButton($language, $id, $js_function = 'switchEditors.go', $label = ''){ global $q_config; $html = " var bc = document.getElementById('editor-toolbar'); var mb = document.getElementById('media-buttons'); var ls = document.createElement('a'); var l = document.createTextNode('".(($label==='')?$q_config['language_name'][$language]:$label)."'); ls.id = 'qtrans_select_".$language."'; ls.className = 'edButton'; ls.onclick = function() { ".$js_function."('".$id."','".$language."'); }; ls.appendChild(l); bc.insertBefore(ls,mb); "; return $html; } ?>