diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-12-28 17:28:28 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-12-28 17:28:28 +0000 |
commit | cbb50049a575a64e481f94e0a51280507d3d19ba (patch) | |
tree | 056cea04c14c952eff70a3254d6c2ac83d2ce40e /phpBB/includes/acp/acp_language.php | |
parent | d6ef968a679f97e60d62bfae7ac2856cb8334591 (diff) | |
download | forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar.gz forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar.bz2 forums-cbb50049a575a64e481f94e0a51280507d3d19ba.tar.xz forums-cbb50049a575a64e481f94e0a51280507d3d19ba.zip |
- add return links to approve details [#6252]
- lets decide on input field or textarea based on the entry length in language pack management [#6280]
git-svn-id: file:///svn/phpbb/trunk@6819 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_language.php')
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 147 |
1 files changed, 47 insertions, 100 deletions
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index abd01b6263..94a79fa2d3 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -622,16 +622,15 @@ class acp_language if (!$is_email_file) { - $method = ($is_help_file) ? 'print_help_entries' : 'print_language_entries'; $tpl = ''; $name = (($this->language_directory) ? $this->language_directory . '/' : '') . $this->language_file; if (isset($missing_vars[$name]) && sizeof($missing_vars[$name])) { - $tpl .= $this->$method($missing_vars[$name], '* '); + $tpl .= $this->print_language_entries($missing_vars[$name], '* '); } - $tpl .= $this->$method($lang); + $tpl .= $this->print_language_entries($lang); $template->assign_var('TPL', $tpl); unset($tpl); @@ -950,7 +949,7 @@ class acp_language * {FILENAME} [{LANG_NAME}] * * @package language -* @copyright (c) 2006 phpBB Group +* @copyright (c) ' . date('Y') . ' phpBB Group * @author {CHANGED} - {AUTHOR} * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @@ -1030,6 +1029,35 @@ $lang = array_merge($lang, array( } /** + * Little helper to add some hardcoded template bits + */ + function add_input_field() + { + $keys = func_get_args(); + + $non_static = array_shift($keys); + $value = array_shift($keys); + + if (!$non_static) + { + return '<strong>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</strong>'; + } + + // If more then 270 characters, then we present a textarea, else an input field + $textarea = (utf8_strlen($value) > 270) ? true : false; + $tpl = ''; + + $tpl .= ($textarea) ? '<textarea name="' : '<input type="text" name="'; + $tpl .= 'entry[' . implode('][', array_map('utf8_htmlspecialchars', $keys)) . ']"'; + + $tpl .= ($textarea) ? ' cols="80" rows="5" style="width: 90%;">' : ' style="width: 90%" value="'; + $tpl .= htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); + $tpl .= ($textarea) ? '</textarea>' : '" />'; + + return $tpl; + } + + /** * Print language entries */ function print_language_entries(&$lang_ary, $key_prefix = '', $input_field = true) @@ -1040,56 +1068,46 @@ $lang = array_merge($lang, array( { if (is_array($value)) { + // Write key $tpl .= ' <tr> - <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td> + <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</strong></td> </tr>'; foreach ($value as $_key => $_value) { if (is_array($_value)) { + // Write key $tpl .= ' <tr> - <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . ' <b>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</b></td> + <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . ' <strong>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</strong></td> </tr>'; foreach ($_value as $__key => $__value) { + // Write key $tpl .= ' <tr> - <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . '</b></td> + <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . '</strong></td> <td class="row2">'; - if ($input_field) - { - $tpl .= '<input type="text" name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($__key, ENT_COMPAT, 'UTF-8') . ']" value="' . htmlspecialchars($__value, ENT_COMPAT, 'UTF-8') . '" size="50" />'; - } - else - { - $tpl .= '<b>' . htmlspecialchars($__value, ENT_COMPAT, 'UTF-8') . '</b>'; - } - + $tpl .= $this->add_input_field($input_field, $__value, $key, $_key, $__key); + $tpl .= '</td> </tr>'; } } else { + // Write key $tpl .= ' <tr> - <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</b></td> + <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</strong></td> <td class="row2">'; - if ($input_field) - { - $tpl .= '<input type="text" name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . ']" value="' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '" size="50" />'; - } - else - { - $tpl .= '<b>' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '</b>'; - } - + $tpl .= $this->add_input_field($input_field, $_value, $key, $_key); + $tpl .= '</td> </tr>'; } @@ -1102,84 +1120,13 @@ $lang = array_merge($lang, array( } else { + // Write key $tpl .= ' <tr> - <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td> - <td class="row2">'; - - if ($input_field) - { - $tpl .= '<input type="text" name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ']" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" size="50" />'; - } - else - { - $tpl .= '<b>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</b>'; - } - - $tpl .= '</td> - </tr>'; - } - } - - return $tpl; - } - - /** - * Print help entries - */ - function print_help_entries(&$lang_ary, $key_prefix = '', $text_field = true) - { - $tpl = ''; - - foreach ($lang_ary as $key => $value) - { - if (is_array($value)) - { - $tpl .= ' - <tr> - <td class="row3" colspan="2">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td> - </tr>'; - - foreach ($value as $_key => $_value) - { - $tpl .= ' - <tr> - <td class="row1" style="width: 10%; white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . '</b></td> - <td class="row2">'; - - if ($text_field) - { - $tpl .= '<textarea name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '][' . htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') . ']" cols="80" rows="5" style="width: 90%;">' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '</textarea>'; - } - else - { - $tpl .= '<b>' . htmlspecialchars($_value, ENT_COMPAT, 'UTF-8') . '</b>'; - } - - $tpl .= '</td> - </tr>'; - } - - $tpl .= ' - <tr> - <td class="spacer" colspan="2"> </td> - </tr>'; - } - else - { - $tpl .= ' - <tr> - <td class="row1" style="width: 10%; white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<b>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</b></td> + <td class="row1" style="white-space: nowrap;">' . htmlspecialchars($key_prefix, ENT_COMPAT, 'UTF-8') . '<strong>' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . '</strong></td> <td class="row2">'; - if ($text_field) - { - $tpl .= '<textarea name="entry[' . htmlspecialchars($key, ENT_COMPAT, 'UTF-8') . ']" cols="80" rows="5" style="width: 90%;">' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</textarea>'; - } - else - { - $tpl .= '<b>' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '</b>'; - } + $tpl .= $this->add_input_field($input_field, $value, $key); $tpl .= '</td> </tr>'; |