Index: branches/5.1.x/core/kernel/languages/phrases_cache.php =================================================================== diff -u -N -r13448 -r13545 --- branches/5.1.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 13448) +++ branches/5.1.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 13545) @@ -1,6 +1,6 @@ Conn =& $this->Application->GetADODBConnection(); - - if (defined('DEBUG_MODE') && DEBUG_MODE && $this->Application->isAdmin) { - // only has effect in admin, because on front-end phrases are translated in "Content Mode" - $this->_editMissing = defined('DBG_PHRASES') && DBG_PHRASES; - } - - // now we use admin phrase editing template even on front-end - $this->_phraseEditTemplate = 'languages/phrase_edit'; } /** @@ -102,11 +107,33 @@ function setPhraseEditing() { if (!$this->Application->isAdmin && (EDITING_MODE == EDITING_MODE_CONTENT)) { + // front-end viewed in content mode $this->_editExisting = true; $this->_editMissing = true; $this->_simpleEditingMode = true; $this->_translateHtmlTag = 'span'; } + + $this->_editLinkMask = 'javascript:translate_phrase(\'#LABEL#\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPreparePhrase\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});'; + + if (defined('DEBUG_MODE') && DEBUG_MODE && !$this->Application->GetVar('admin')) { + // admin and front-end while not viewed using content mode (via admin) + $this->_editMissing = defined('DBG_PHRASES') && DBG_PHRASES; + + if (!$this->Application->isAdmin) { + $this->_phraseEditTemplate = 'phrases_edit'; + + $url_params = Array ( + 'm_opener' => 'd', + 'phrases_label' => '#LABEL#', + 'phrases_event' => 'OnPreparePhrase', + 'pass' => 'm,phrases' + ); + + $this->_escapePhraseName = false; + $this->_editLinkMask = $this->Application->HREF($this->_phraseEditTemplate, '', $url_params); + } + } } function Init($prefix, $special = '') @@ -223,7 +250,7 @@ return ''; } - $original_label = $label; + $original_label = $this->_escapePhraseName ? addslashes($label) : $label; $label = mb_strtoupper($label); $cache_key = ($allow_editing ? '' : 'NE:') . $label; @@ -233,7 +260,7 @@ if ($this->_editExisting && $allow_editing && !array_key_exists($label, $this->_missingPhrases)) { // option to change translation for Labels - $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPreparePhrase\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});'; + $edit_url = 'javascript:translate_phrase(\'' . $original_label . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPreparePhrase\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});'; $translated_label = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" name="cms-translate-phrase" title="Edit translation">' . $translated_label . '_translateHtmlTag . '>'; if ($this->fromTag) { @@ -269,7 +296,7 @@ $translation = '!' . $label . '!'; if ($this->_editMissing && $allow_editing) { - $edit_url = 'javascript:translate_phrase(\'' . addslashes($original_label) . '\', \'' . $this->_phraseEditTemplate . '\', {event: \'OnPreparePhrase\', simple_mode: ' . ($this->_simpleEditingMode ? 'true' : 'false') . '});'; + $edit_url = str_replace('#LABEL#', $original_label, $this->_editLinkMask); $translation = '<' . $this->_translateHtmlTag . ' href="' . $edit_url . '" name="cms-translate-phrase" title="Translate">!' . $label . '!_translateHtmlTag . '>'; if ($this->fromTag) {