本文整理汇总了PHP中rex_i18n::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_i18n::translate方法的具体用法?PHP rex_i18n::translate怎么用?PHP rex_i18n::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_i18n
的用法示例。
在下文中一共展示了rex_i18n::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListValue
static function getListValue($params)
{
$return = array();
$new_select = new self();
$values = $new_select->getArrayFromString($params['params']['field']['options']);
foreach (explode(',', $params['value']) as $k) {
if (isset($values[$k])) {
$return[] = rex_i18n::translate($values[$k]);
}
}
return implode('<br />', $return);
}
示例2: enterObject
function enterObject()
{
$options[1] = rex_i18n::msg('yform_prio_top');
$scopeWhere = $this->getScopeWhere();
if (false === $scopeWhere) {
$options[''] = rex_i18n::msg('yform_prio_bottom');
} else {
$this->preEditScopeWhere = $scopeWhere;
$sql = rex_sql::factory();
if ($this->debug) {
$sql->setDebug();
}
$fields = $this->getElement('fields');
if (!is_array($fields)) {
$fields = array_filter(explode(',', $fields));
}
if (empty($fields)) {
$fields = array('id');
}
$selectFields = array();
foreach ($fields as $field) {
$selectFields[] = $field;
}
$sql->setQuery(sprintf('SELECT id, %s, %s as prio FROM %s%s ORDER BY %2$s', implode(', ', $selectFields), $this->getElement('name'), $this->params['main_table'], $scopeWhere));
$prio = 1;
while ($sql->hasNext()) {
if ($sql->getValue('id') != $this->params['main_id']) {
$prio = $sql->getValue('prio') + 1;
$label = array();
foreach ($fields as $field) {
$label[] = rex_i18n::translate($sql->getValue($field));
}
$options[$prio] = rex_i18n::msg('yform_prio_after', implode(' | ', $label));
}
$sql->next();
}
}
if (!$this->params['send'] && $this->getValue() == '') {
if ($this->getElement('default') == '') {
$this->setValue(isset($prio) ? $prio : '');
} else {
$this->setValue($this->getElement('default'));
}
}
if (!is_array($this->getValue())) {
$this->setValue(explode(',', $this->getValue()));
}
$this->params['form_output'][$this->getId()] = $this->parse('value.select.tpl.php', array('options' => $options, 'multiple' => false, 'size' => 1));
$this->setValue(implode(',', $this->getValue()));
$this->params['value_pool']['email'][$this->getName()] = $this->getValue();
$this->params['value_pool']['sql'][$this->getName()] = $this->getValue();
}
示例3: executeAction
function executeAction()
{
$text = $this->getElement(2);
if ($text == '') {
$text = $this->params['answertext'];
}
$text = rex_i18n::translate($text, null);
if ($this->getElement(5) == '0') {
$text = nl2br(htmlspecialchars($text));
}
if ($this->getElement(5) == '2') {
$text = htmlspecialchars_decode($text);
$text = str_replace('<br />', '', $text);
$text = str_replace(''', '\'', $text);
$text = rex_a79_textile($text);
}
$text = $this->getElement(3) . $text . $this->getElement(4);
foreach ($this->params['value_pool']['email'] as $search => $replace) {
$text = str_replace('###' . $search . '###', $replace, $text);
}
$this->params['output'] = $text;
}
示例4: rex_yform_list_translate
function rex_yform_list_translate($params)
{
return rex_i18n::translate($params['subject']);
}
示例5: clangSwitchAsDropdown
/**
* Returns a clang switch.
*
* @param rex_context $context
*
* @return string
*/
public static function clangSwitchAsDropdown(rex_context $context)
{
if (rex_clang::count() == 1) {
return '';
}
$button_label = '';
$items = [];
foreach (rex_clang::getAll() as $id => $clang) {
if (rex::getUser()->getComplexPerm('clang')->hasPerm($id)) {
$item = [];
$item['title'] = rex_i18n::translate($clang->getName());
$item['href'] = $context->getUrl(['clang' => $id]);
if ($id == $context->getParam('clang')) {
$item['active'] = true;
$button_label = rex_i18n::translate($clang->getName());
}
$items[] = $item;
}
}
$fragment = new rex_fragment();
$fragment->setVar('class', 'rex-language');
$fragment->setVar('button_prefix', rex_i18n::msg('language'));
$fragment->setVar('button_label', $button_label);
$fragment->setVar('header', rex_i18n::msg('clang_select'));
$fragment->setVar('items', $items, false);
if (rex::getUser()->isAdmin()) {
$fragment->setVar('footer', '<a href="' . rex_url::backendPage('system/lang') . '"><i class="fa fa-flag"></i> ' . rex_i18n::msg('languages_edit') . '</a>', false);
}
return $fragment->parse('core/dropdowns/dropdown.php');
}
示例6: rex_select
if (!is_array($modules)) {
$modules = [];
}
if (!is_array($categories)) {
$categories = [];
}
// modules[ctype_id][module_id];
// modules[ctype_id]['all'];
// Module ...
$modul_select = new rex_select();
$modul_select->setMultiple(true);
$modul_select->setSize(10);
$modul_select->setAttribute('class', 'form-control');
$m_sql = rex_sql::factory();
foreach ($m_sql->getArray('SELECT id, name FROM ' . rex::getTablePrefix() . 'module ORDER BY name') as $m) {
$modul_select->addOption(rex_i18n::translate($m['name']), $m['id']);
}
// Kategorien
$cat_select = new rex_category_select(false, false, false, false);
$cat_select->setMultiple(true);
$cat_select->setSize(10);
$cat_select->setName('categories[]');
$cat_select->setId('rex-id-categories-select');
$cat_select->setAttribute('class', 'form-control');
if (count($categories) > 0) {
foreach ($categories as $c => $cc) {
// typsicherer vergleich, weil (0 != "all") => false
if ($c !== 'all') {
$cat_select->setSelected($cc);
}
}
示例7: addSlice
protected function addSlice($sliceId, $moduleIdToAdd)
{
$MOD = rex_sql::factory();
$MOD->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'module WHERE id="' . $moduleIdToAdd . '"');
if ($MOD->getRows() != 1) {
$slice_content = rex_view::warning(rex_i18n::msg('module_doesnt_exist'));
} else {
$initDataSql = rex_sql::factory();
// ----- PRE VIEW ACTION [ADD]
$action = new rex_article_action($moduleIdToAdd, 'add', $initDataSql);
$action->setRequestValues();
$action->exec(rex_article_action::PREVIEW);
// ----- / PRE VIEW ACTION
$moduleInput = $this->replaceVars($initDataSql, $MOD->getValue('input'));
$moduleInput = $this->getStreamOutput('module/' . $moduleIdToAdd . '/input', $moduleInput);
$msg = '';
if ($this->warning != '') {
$msg .= rex_view::warning($this->warning);
}
if ($this->info != '') {
$msg .= rex_view::success($this->info);
}
$formElements = [];
$n = [];
$n['field'] = '<a class="btn btn-abort" href="' . rex_url::currentBackendPage(['article_id' => $this->article_id, 'slice_id' => $sliceId, 'clang' => $this->clang, 'ctype' => $this->ctype]) . '#slice' . $sliceId . '">' . rex_i18n::msg('form_abort') . '</a>';
$formElements[] = $n;
$n = [];
$n['field'] = '<button class="btn btn-save" type="submit" name="btn_save" value="1"' . rex::getAccesskey(rex_i18n::msg('add_block'), 'save') . '>' . rex_i18n::msg('add_block') . '</button>';
$formElements[] = $n;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$slice_footer = $fragment->parse('core/form/submit.php');
$panel = '
<fieldset>
<legend>' . rex_i18n::msg('add_block') . '</legend>
<input type="hidden" name="function" value="add" />
<input type="hidden" name="module_id" value="' . $moduleIdToAdd . '" />
<input type="hidden" name="save" value="1" />
<div class="rex-slice-input">
' . $moduleInput . '
</div>
</fieldset>
';
$fragment = new rex_fragment();
$fragment->setVar('before', $msg, false);
$fragment->setVar('class', 'add', false);
$fragment->setVar('title', rex_i18n::msg('module') . ': ' . rex_i18n::translate($MOD->getValue('name')), false);
$fragment->setVar('body', $panel, false);
$fragment->setVar('footer', $slice_footer, false);
$slice_content = $fragment->parse('core/page/section.php');
$slice_content = '
<li class="rex-slice rex-slice-add" id="slice' . $sliceId . '">
<form action="' . rex_url::currentBackendPage(['article_id' => $this->article_id, 'slice_id' => $sliceId, 'clang' => $this->clang, 'ctype' => $this->ctype]) . '#slice' . $sliceId . '" method="post" id="REX_FORM" enctype="multipart/form-data">
' . $slice_content . '
</form>
<script type="text/javascript">
<!--
jQuery(function($) {
$(":input:visible:enabled:not([readonly]):first", $("#REX_FORM")).focus();
});
//-->
</script>
</li>
';
}
return $slice_content;
}
示例8:
?>
<li class="el_<?php
echo $k;
?>
"><?php
echo rex_i18n::translate($v, null, false);
?>
</li>
<?php
}
?>
<?php
if ($this->objparams['unique_error'] != '') {
?>
<li><?php
echo rex_i18n::translate(preg_replace("~\\*|:|\\(.*\\)~Usim", '', $this->objparams['unique_error']));
?>
</li>
<?php
}
?>
</ul>
<?php
if ($this->objparams['Error-occured']) {
?>
</dd>
</dl>
<?php
}
}
示例9: rex_fragment
' . $actions . '
</tbody>
</table>
';
$fragment = new rex_fragment();
$fragment->setVar('title', rex_i18n::msg('actions_added_caption'), false);
$fragment->setVar('content', $panel, false);
$content .= $fragment->parse('core/page/section.php');
}
$gaa_sel = new rex_select();
$gaa_sel->setName('action_id');
$gaa_sel->setId('action_id');
$gaa_sel->setSize(1);
$gaa_sel->setAttribute('class', 'form-control');
for ($i = 0; $i < $gaa->getRows(); ++$i) {
$gaa_sel->addOption(rex_i18n::translate($gaa->getValue('name'), false), $gaa->getValue('id'));
$gaa->next();
}
$panel = '';
$panel .= '<fieldset>';
$formElements = [];
$n = [];
$n['label'] = '<label for="action_id">' . rex_i18n::msg('action') . '</label>';
$n['field'] = $gaa_sel->get();
$formElements[] = $n;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$panel .= $fragment->parse('core/form/form.php');
$panel .= '</fieldset>';
$formElements = [];
$n = [];
示例10: getListValue
static function getListValue($params)
{
// TODO Relation table berücksichtigen
$field = $params['params']['field'];
if (4 == $field['type']) {
$link = 'index.php?page=yform&subpage=manager&tripage=data_edit&table_name=' . $field['table'];
if (is_int($popup = rex_request('popup', 'int', null))) {
$link .= '&popup=' . $popup;
} elseif (!rex_request('rex_yform_filter', 'array')) {
$link .= '&popup=0';
}
if (isset($field['filter']) && $field['filter']) {
$filter = self::getFilterArray($field['filter'], $field['table_name'], function ($key) use($params) {
return $params['list']->getValue($key);
});
}
$filter[$field['field']] = $params['list']->getValue('id');
self::addFilterParams($link, $filter);
return '<a href="' . $link . '">' . rex_i18n::translate($field['label']) . '</a>';
}
$listValues = self::getListValues($field['table'], $field['field']);
$return = array();
foreach (explode(',', $params['value']) as $value) {
if (isset($listValues[$value])) {
$return[] = $listValues[$value];
}
}
return implode('<br />', $return);
}
示例11: ob_end_clean
$info = rex_i18n::msg('category_moved');
ob_end_clean();
rex_response::sendRedirect($context->getUrl(['page' => 'content/edit', 'info' => $info], false));
} else {
$warning = rex_i18n::msg('content_error_movecategory');
}
} else {
$warning = rex_i18n::msg('no_rights_to_this_function');
}
}
// ------------------------------------------ END: MOVE CATEGORY
// ------------------------------------------ START: CONTENT HEAD MENUE
$editPage = rex_be_controller::getPageObject('content/edit');
$editPage->setHref($context->getUrl(['page' => 'content/edit'], false));
foreach ($ctypes as $key => $val) {
$editPage->addSubpage((new rex_be_page('ctype' . $key, rex_i18n::translate($val)))->setHref(['page' => 'content/edit', 'article_id' => $article_id, 'clang' => $clang, 'ctype' => $key], false)->setIsActive($ctype == $key));
}
$nav = rex_be_navigation::factory();
$nav->addPage($editPage);
$blocks = $nav->getNavigation();
$navigation = current($blocks);
$content_navi_left = $navigation['navigation'];
$nav = rex_be_navigation::factory();
foreach (rex_be_controller::getPageObject('content')->getSubpages() as $subpage) {
if ($subpage->getKey() != 'edit') {
$subpage->setHref($context->getUrl(['page' => $subpage->getFullKey()], false));
$nav->addPage($subpage);
}
}
$blocks = $nav->getNavigation();
$navigation = current($blocks);
示例12: array
<p class="formsubmit formsubmits <?php
echo $this->getHTMLClass();
?>
">
<?php
$css_classes = $this->getElement("css_classes");
if ($css_classes == "") {
$css_classes = array();
} else {
$css_classes = explode(",", $this->getElement("css_classes"));
}
$labels = explode(",", $this->getElement("labels"));
foreach ($labels as $label) {
$classes = array();
$classes[] = 'submit';
if ($this->getWarningClass() != "") {
$classes[] = $this->getWarningClass();
}
$value = htmlspecialchars(stripslashes(rex_i18n::translate($label)));
$id = $this->getFieldId();
$key = array_search($label, $labels);
if ($key !== FALSE && isset($css_classes[$key])) {
$classes[] = $css_classes[$key];
}
echo '<input type="submit" class="' . implode(" ", $classes) . '" name="' . $this->getFieldName() . '" id="' . $id . '" value="' . $label . '" />';
}
?>
</p>
示例13: rex_select
// --------------------------------------------- ARTIKEL LISTE
$echo = '';
// --------------------- READ TEMPLATES
if ($category_id > 0 || $category_id == 0 && !rex::getUser()->getComplexPerm('structure')->hasMountpoints()) {
$withTemplates = $this->getPlugin('content')->isAvailable();
$tmpl_head = '';
if ($withTemplates) {
$template_select = new rex_select();
$template_select->setName('template_id');
$template_select->setSize(1);
$template_select->setStyle('class="form-control"');
$templates = rex_template::getTemplatesForCategory($category_id);
if (count($templates) > 0) {
foreach ($templates as $t_id => $t_name) {
$template_select->addOption(rex_i18n::translate($t_name, false), $t_id);
$TEMPLATE_NAME[$t_id] = rex_i18n::translate($t_name);
}
} else {
$template_select->addOption(rex_i18n::msg('option_no_template'), '0');
}
$TEMPLATE_NAME[0] = rex_i18n::msg('template_default_name');
$tmpl_head = '<th>' . rex_i18n::msg('header_template') . '</th>';
}
// --------------------- ARTIKEL LIST
$art_add_link = '';
if ($KATPERM) {
$art_add_link = '<a href="' . $context->getUrl(['function' => 'add_art', 'artstart' => $artstart]) . '"' . rex::getAccesskey(rex_i18n::msg('article_add'), 'add_2') . '><i class="rex-icon rex-icon-add-article"></i></a>';
}
// ---------- COUNT DATA
$sql = rex_sql::factory();
// $sql->setDebug();
示例14: enterObject
function enterObject()
{
$error = array();
$rfile = 'file_' . md5($this->getFieldName('file'));
$err_msgs = $this->getElement('messages');
// min_err,max_err,type_err,empty_err
if (!is_array($err_msgs)) {
$err_msgs = explode(',', $err_msgs);
}
$err_msgs['min_error'] = $err_msgs[0];
$err_msgs['max_error'] = isset($err_msgs[1]) ? rex_i18n::translate($err_msgs[1]) : 'max_error';
$err_msgs['type_error'] = isset($err_msgs[2]) ? rex_i18n::translate($err_msgs[2]) : 'type_error';
$err_msgs['empty_error'] = isset($err_msgs[3]) ? rex_i18n::translate($err_msgs[3]) : 'empty_error';
$err_msgs['delete_file'] = isset($err_msgs[4]) ? rex_i18n::translate($err_msgs[4]) : 'delete ';
$this->tmp_messages = $err_msgs;
$value = $this->getValue();
if ($value == "") {
$value = $this->getElement('default_file');
}
$this->setValue('');
$value_email = '';
$value_sql = '';
if (!is_string($value) && $value["delete"] == 1) {
$value = '';
}
// SIZE CHECK
$sizes = explode(',', $this->getElement('max_size'));
$minsize = count($sizes) > 1 ? (int) ($sizes[0] * 1024) : 0;
$maxsize = count($sizes) > 1 ? (int) ($sizes[1] * 1024) : (int) ($sizes[0] * 1024);
if ($this->params['send'] && isset($_FILES[$rfile]) && $_FILES[$rfile]['name'] != '' && ($_FILES[$rfile]['size'] > $maxsize || $_FILES[$rfile]['size'] < $minsize)) {
if ($_FILES[$rfile]['size'] < $minsize) {
$error[] = $err_msgs['min_error'];
}
if ($_FILES[$rfile]['size'] > $maxsize) {
$error[] = $err_msgs['max_error'];
}
unset($_FILES[$rfile]);
}
$database_filename_field = $this->getElement('database_filename_field');
if ($database_filename_field != "") {
$value = $this->params['value_pool']['sql'][$database_filename_field];
}
$prefix = md5(mt_rand() . microtime(true)) . '_';
if ($this->getElement('file_prefix')) {
$prefix .= $this->getElement('file_prefix') . '_';
}
$upload_folder = $this->getElement('upload_folder');
if ($upload_folder == "") {
$upload_folder = rex_path::addonData('yform', 'uploads');
rex_dir::create($upload_folder);
}
if ($value != "") {
if ($REX["REDAXO"]) {
$value = explode("_", $value, 2);
$value = $value[0];
}
$search_path = $upload_folder . '/' . $value . '_' . $this->getElement('file_prefix');
$files = glob(preg_replace('/(\\*|\\?|\\[)/', '[$1]', $search_path) . '*');
if (count($files) == 1) {
$value = basename($files[0]);
if (rex_request("rex_upload_downloadfile") == $value) {
$file = $upload_folder . '/' . $value;
if (file_exists($file)) {
ob_end_clean();
$filename = explode("_", basename($file), 2);
$filename = $filename[1];
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $filename);
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
exit;
}
}
} else {
$value = "";
}
}
if ($this->params['send']) {
if (isset($_FILES[$rfile]) && $_FILES[$rfile]['name'] != '') {
$FILE['size'] = $_FILES[$rfile]['size'];
$FILE['name'] = $_FILES[$rfile]['name'];
$FILE['type'] = $_FILES[$rfile]['type'];
$FILE['tmp_name'] = $_FILES[$rfile]['tmp_name'];
$FILE['error'] = $_FILES[$rfile]['error'];
$FILE['name_normed'] = strtolower(preg_replace('/[^a-zA-Z0-9.\\-\\$\\+]/', '_', $FILE['name']));
$extensions_array = explode(',', $this->getElement('types'));
$ext = '.' . pathinfo($FILE['name'], PATHINFO_EXTENSION);
if (!in_array(strtolower($ext), $extensions_array) && !in_array(strtoupper($ext), $extensions_array)) {
$error[] = $err_msgs['type_error'];
$value = '';
} else {
$file_normed = $FILE['name_normed'];
$file_normed_new = $prefix . $file_normed;
if (file_exists($upload_folder . '/' . $file_normed_new)) {
for ($cf = 1; $cf < 1000; $cf++) {
$file_normed_new = $prefix . $cf . '_' . $file_normed;
//.........这里部分代码省略.........
示例15: htmlspecialchars
<p class="formsubmit <?php
echo $this->getHTMLClass();
?>
">
<input type="submit" class="submit <?php
echo $this->getElement(4), ' ', $this->getWarningClass();
?>
" name="<?php
echo $this->getFieldName();
?>
" id="<?php
echo $this->getFieldId();
?>
" value="<?php
echo htmlspecialchars(stripslashes(rex_i18n::translate($this->getValue())));
?>
" />
</p>