function _l10n_image_paint($page) { $default = MLPLanguageHandler::get_site_default_lang(); # # Insert the remaining language fields... # global $l10n_mappings; $langs = MLPLanguageHandler::get_site_langs(); $fields = $l10n_mappings['txp_image']; $id = gps('id'); $row = safe_row('*', 'txp_image', "`id`='{$id}'"); $r = ''; $count = 2; foreach ($langs as $lang) { if ($lang !== $default) { $full_name = MLPLanguageHandler::get_native_name_of_lang($lang); $dir = MLPLanguageHandler::get_lang_direction_markup($lang); foreach ($fields as $field => $attributes) { $field_name = _l10n_make_field_name($field, $lang); if ($field === 'alt') { $r .= '<p>' . gTxt('alt_text') . ' ' . $full_name . '<br/>'; $r .= '<input type="text" name="' . $field_name . '" ' . $dir . ' value="' . $row[$field_name] . '" size="50" class="edit" id="' . $field_name . '" /></p>' . n; } else { $r .= '<p>' . gTxt('caption') . ' ' . $full_name . '<br/>'; $r .= '<textarea name="' . $field_name . '" cols="40" rows="5" style="width: 400px; height: 100px;"' . $dir . '>'; $r .= $row[$field_name] . '</textarea></p>' . n; } } } } $f = '<p><input type="submit" value="'; $page = str_replace($f, $r . n . $f, $page); # # Insert the default title field's language's direction... # $dir = MLPLanguageHandler::get_lang_direction_markup($default) . ' '; $f = '<input type="text" name="alt"'; $page = str_replace($f, $f . $dir, $page); $f = '<textarea id="caption"'; $page = str_replace($f, $f . $dir, $page); # # Insert the default title field's language name... # $f = 'for="alt-text">' . gTxt('alt_text'); $r = ' ' . MLPLanguageHandler::get_native_name_of_lang($default); $page = str_replace($f, $f . sp . $r, $page); $f = 'for="caption">' . gTxt('caption'); $page = str_replace($f, $f . sp . $r, $page); return $page; }
function render_import_list() { $count = 0; $site_langs = MLPLanguageHandler::get_site_langs(); $d = gps('data'); $d = @unserialize(@base64_decode(@str_replace("\r\n", '', $d))); $subtab = gps('subtab'); $o[] = '<div style="float:left;">'; $o[] = '<h2>' . gTxt('preview') . ' ' . gTxt('file') . '</h2>'; if (is_array($d) and !empty($d)) { if (!isset($d['header']) or $d['header'] !== L10N_SNIPPET_IO_HEADER) { $o[] = gTxt('l10n-invalid_import_file'); } else { $f[] = hInput('data', gps('data')) . n; $f[] = hInput('language', gps('language')) . n; $f[] = sInput('l10n_import_languageset') . n; $f[] = hInput('subtab', $this->sub_tab); $f[] = hInput('commit', 'true') . n; $f[] = $this->parent->form_inputs() . n; foreach ($d['data'] as $lang => $set) { $dir_markup = MLPLanguageHandler::get_lang_direction_markup($lang); if (empty($lang) or !in_array($lang, $site_langs) or empty($set)) { $l[] = tr(n . td(sp) . n . td(gTxt('l10n-language_not_supported'))) . n; } else { $l[] = tr(n . tdcs(gTxt('language') . ': <strong>' . MLPLanguageHandler::get_native_name_of_lang($lang) . ' [' . $lang . ']…</strong>' . br . br . n, 2)) . n; foreach ($set as $name => $couplet) { $data = htmlspecialchars($couplet[0]); $event = htmlspecialchars($couplet[1]); if (empty($name) or empty($event) or empty($data)) { continue; } $l[] = tr(n . t . '<td style="text-align: right;">' . $name . ' <em>(' . $event . ')</em> : </td>' . n . td("<input type=\"text\" readonly size=\"100\" value=\"{$data}\" {$dir_markup}/>")) . n; $count++; } } $l[] = tr(n . t . tdcs(sp, 2)) . n; } $l[] = tr(n . tdcs(sp, 2)) . n; $l[] = tr(n . tdcs(gTxt('l10n-total') . sp . ': ' . $count . sp . gTxt('strings'), 2)) . n; $l[] = tr(n . tdcs(sp, 2)) . n; $f2[] = '<span class="l10n_form_submit">' . fInput('submit', '', gTxt('save'), '') . '</span>'; $content = join('', $f) . tag(join('', $l), 'table') . join('', $f2); $o[] = form($content, '', "verify('" . doSlash(gTxt('l10n-import_warning')) . ' ' . doSlash(gTxt('are_you_sure')) . "')"); } } $o[] = '</div>'; echo join('', $o); }
function l10n_if_lang($atts, $thing) { /* Basic markup tag. Use this to wrap blocks of content you only want to appear when the specified language is set or if the direction of the selected language matches what you want. (Output different css files for rtl layouts for example). */ global $l10n_language; $out = ''; if (!$l10n_language) { return $out; } extract(lAtts(array('lang' => $l10n_language['short'], 'dir' => '', 'wraptag' => ''), $atts)); if (!empty($dir) and in_array($dir, array('rtl', 'ltr'))) { # Does the direction of the currently selected site language match that requested? # If so, parse the contained content. $cond = $dir == MLPLanguageHandler::get_lang_direction($l10n_language['short']); $out = parse(EvalElse($thing, $cond)) . n; } else { # If the required language matches the site language, output a suitably marked up block of content. $cond = ($lang == $l10n_language['short'] or $lang == $l10n_language['long']); $out = parse(EvalElse($thing, $cond)); if (!empty($wraptag)) { $dir = MLPLanguageHandler::get_lang_direction_markup($lang); $out = "<{$wraptag} lang=\"{$lang}\"{$dir}/>" . $out . "</{$wraptag}>" . n; } } return $out; }