本文整理汇总了PHP中rex_i18n类的典型用法代码示例。如果您正苦于以下问题:PHP rex_i18n类的具体用法?PHP rex_i18n怎么用?PHP rex_i18n使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rex_i18n类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getForm
function getForm()
{
if (!$this->table->isSearchable()) {
return '';
}
$yform = new rex_yform_manager_searchform();
$yform->setObjectparams('form_skin', 'default');
$yform->setObjectparams('form_showformafterupdate', 1);
$yform->setObjectparams('real_field_names', true);
$yform->setObjectparams('form_action', $this->scriptPath);
$yform->setObjectparams('form_method', 'get');
foreach ($this->linkVars as $k => $v) {
$yform->setHiddenField($k, $v);
}
// $yform->setValueField('text', array('label' => 'ID', 'name' => 'id'));
foreach ($this->table->getFields() as $field) {
if ($field->getTypeName() && $field->getType() == 'value' && $field->isSearchable()) {
if (method_exists('rex_yform_' . $field->getTypeName(), 'getSearchField')) {
call_user_func('rex_yform_' . $field->getTypeName() . '::getSearchField', array('searchForm' => $yform, 'searchObject' => $this, 'field' => $field, 'fields' => $this->table->getFields()));
}
}
}
$yform->setValueField('submit', array('yform_search_submit', rex_i18n::msg('yform_search')));
return $yform->getForm();
}
开发者ID:xong,项目名称:redaxo_yform,代码行数:25,代码来源:search.php
示例2: execute
public function execute()
{
if (!rex::getUser()->isAdmin()) {
throw new rex_api_exception('user has no permission for this operation!');
}
$type = rex_get('type', 'string');
switch ($type) {
case 'articles':
$prefix = 'art\\_%';
$defaultFields = [['translate:online_from', 'art_online_from', '1', '', '10', ''], ['translate:online_to', 'art_online_to', '2', '', '10', ''], ['translate:description', 'art_description', '3', '', '2', '']];
break;
case 'media':
$prefix = 'med\\_%';
$defaultFields = [['translate:pool_file_description', 'med_description', '1', '', '2', ''], ['translate:pool_file_copyright', 'med_copyright', '2', '', '1', '']];
break;
default:
throw new rex_api_exception(sprintf('metainfo type "%s" does not have default field.', $type));
}
$existing = rex_sql::factory()->getArray('SELECT name FROM ' . rex::getTable('metainfo_field') . ' WHERE name LIKE ?', [$prefix]);
$existing = array_column($existing, 'name', 'name');
foreach ($defaultFields as $field) {
if (!isset($existing[$field[1]])) {
$return = call_user_func_array('rex_metainfo_add_field', $field);
if (is_string($return)) {
throw new rex_api_exception($return);
}
}
}
return new rex_api_result(true, rex_i18n::msg('minfo_default_fields_created'));
}
开发者ID:DECAF,项目名称:redaxo,代码行数:30,代码来源:api_default_fields.php
示例3: getWidget
public static function getWidget($id, $name, $value, array $args = [])
{
$art_name = '';
$art = rex_article::get($value);
$category = 0;
// Falls ein Artikel vorausgewählt ist, dessen Namen anzeigen und beim öffnen der Linkmap dessen Kategorie anzeigen
if ($art instanceof rex_article) {
$art_name = $art->getName();
$category = $art->getCategoryId();
}
$open_params = '&clang=' . rex_clang::getCurrentId();
if ($category || isset($args['category']) && ($category = (int) $args['category'])) {
$open_params .= '&category_id=' . $category;
}
$class = ' rex-disabled';
$open_func = '';
$delete_func = '';
if (rex::getUser()->getComplexPerm('structure')->hasStructurePerm()) {
$class = '';
$open_func = 'openLinkMap(\'REX_LINK_' . $id . '\', \'' . $open_params . '\');';
$delete_func = 'deleteREXLink(' . $id . ');';
}
$e = [];
$e['field'] = '<input class="form-control" type="text" name="REX_LINK_NAME[' . $id . ']" value="' . htmlspecialchars($art_name) . '" id="REX_LINK_' . $id . '_NAME" readonly="readonly" /><input type="hidden" name="' . $name . '" id="REX_LINK_' . $id . '" value="' . $value . '" />';
$e['functionButtons'] = '
<a href="#" class="btn btn-popup' . $class . '" onclick="' . $open_func . 'return false;" title="' . rex_i18n::msg('var_link_open') . '"><i class="rex-icon rex-icon-open-linkmap"></i></a>
<a href="#" class="btn btn-popup' . $class . '" onclick="' . $delete_func . 'return false;" title="' . rex_i18n::msg('var_link_delete') . '"><i class="rex-icon rex-icon-delete-link"></i></a>';
$fragment = new rex_fragment();
$fragment->setVar('elements', [$e], false);
$media = $fragment->parse('core/form/widget.php');
return $media;
}
开发者ID:DECAF,项目名称:redaxo,代码行数:32,代码来源:var_link.php
示例4: getFieldParams
public static function getFieldParams()
{
$options = array_map(function (rex_clang $clang) {
return $clang->getName();
}, rex_clang::getAll());
return ['label' => rex_i18n::msg('clangs'), 'all_label' => rex_i18n::msg('all_clangs'), 'options' => $options];
}
开发者ID:staabm,项目名称:redaxo,代码行数:7,代码来源:perm.php
示例5: modifySliceEditMenu
public static function modifySliceEditMenu(rex_extension_point $ep)
{
$Icons = array();
$Config = rex_config::get('slice_ui');
if (!empty($Config['general']['copy_n_cut']) && $Config['general']['copy_n_cut']) {
$Icons = array(array('hidden_label' => rex_i18n::msg('slice_ui_copy'), 'url' => 'index.php?page=content/copy&article_id=' . $ep->getParam('article_id') . '&mode=edit&module_id=' . $ep->getParam('module_id') . '&slice_id=' . $ep->getParam('slice_id') . '&clang=' . $ep->getParam('clang') . '&ctype=' . $ep->getParam('ctype'), 'attributes' => array('class' => array('btn-copy'), 'title' => rex_i18n::msg('slice_ui_copy'), 'data-title-online' => rex_i18n::msg('slice_ui_slice_ui_copied')), 'icon' => 'copy'), array('hidden_label' => rex_i18n::msg('slice_ui_cut'), 'url' => 'index.php?page=content/cut&article_id=' . $ep->getParam('article_id') . '&mode=edit&module_id=' . $ep->getParam('module_id') . '&slice_id=' . $ep->getParam('slice_id') . '&clang=' . $ep->getParam('clang') . '&ctype=' . $ep->getParam('ctype'), 'attributes' => array('class' => array('btn-cut'), 'title' => rex_i18n::msg('slice_ui_cut'), 'data-title-online' => rex_i18n::msg('slice_ui_slice_ui_cutted')), 'icon' => 'cut'));
if (!self::checkPermissions(array('article_id' => $ep->getParam('article_id'), 'clang' => $ep->getParam('clang'), 'ctype' => $ep->getParam('ctype'), 'module_id' => $ep->getParam('module_id')))) {
unset($Icons);
}
// Einfügen soll möglich bleiben
if ($_SESSION['slice_ui']['slice_id'] === $ep->getParam('slice_id') && $_SESSION['slice_ui']['cut'] === true) {
$Icons[0]['attributes']['style'] = 'display:none';
}
if (!empty($_SESSION['slice_ui']['slice_id']) && $_SESSION['slice_ui']['slice_id'] !== $ep->getParam('slice_id') || $_SESSION['slice_ui']['slice_id'] === $ep->getParam('slice_id') && $_SESSION['slice_ui']['cut'] !== true) {
$Icons[0] = array('hidden_label' => rex_i18n::msg('slice_ui_paste'), 'url' => 'index.php?page=content/pasteAfter&article_id=' . $ep->getParam('article_id') . '&mode=edit&module_id=' . $ep->getParam('module_id') . '&slice_id=' . $ep->getParam('slice_id') . '&clang=' . $ep->getParam('clang') . '&ctype=' . $ep->getParam('ctype'), 'attributes' => array('class' => array('btn-paste'), 'title' => rex_i18n::msg('slice_ui_paste'), 'data-pjax' => 'true', 'data-title-online' => rex_i18n::msg('slice_ui_slice_ui_pasted')), 'icon' => 'paste');
}
}
$sql = rex_sql::factory();
$sql->setTable(rex::getTablePrefix() . 'article_slice');
$sql->setWhere(array('id' => $ep->getParam('slice_id')));
$sql->select();
$mode = 'visible';
if ($sql->getValue('active') == 0) {
$mode = 'invisible';
}
if (!empty($Config['general']['slice_status']) && $Config['general']['slice_status']) {
$Icons[] = array('hidden_label' => rex_i18n::msg('slice_ui_toggle_' . $mode), 'url' => 'index.php?page=content/toggleSlice&article_id=' . $ep->getParam('article_id') . '&mode=edit&module_id=' . $ep->getParam('module_id') . '&slice_id=' . $ep->getParam('slice_id') . '&clang=' . $ep->getParam('clang') . '&ctype=' . $ep->getParam('ctype') . '&visible=' . $sql->getValue('active'), 'attributes' => array('class' => array('btn-' . $mode), 'title' => rex_i18n::msg('slice_ui_toggle_' . $mode), 'data-state' => $mode, 'data-title-online' => rex_i18n::msg('slice_ui_slice_toggled')), 'icon' => $mode);
}
if (!empty($Config['general']['drag_n_drop']) && $Config['general']['drag_n_drop']) {
$Icons[] = array('hidden_label' => rex_i18n::msg('slice_ui_move'), 'url' => 'index.php?page=content/move&article_id=' . $ep->getParam('article_id') . '&mode=edit&module_id=' . $ep->getParam('module_id') . '&slice_id=' . $ep->getParam('slice_id') . '&clang=' . $ep->getParam('clang') . '&ctype=' . $ep->getParam('ctype'), 'attributes' => array('class' => array('btn-move-up-n-down', 'hide', !empty($Config['general']['keep_move_arrows']) && $Config['general']['keep_move_arrows'] ? 'keep_arrows' : 'remove_arrows'), 'title' => rex_i18n::msg('slice_ui_toggle_move'), 'data-prio' => '', 'data-title-online' => rex_i18n::msg('slice_ui_slice_moved')), 'icon' => 'move-up-n-down');
}
return $Icons;
}
开发者ID:nilsology,项目名称:slice_ui,代码行数:33,代码来源:slice_ui.php
示例6: formatElement
public function formatElement()
{
$name = $this->getFieldName();
$qry = 'SELECT ' . $this->labelField . ',' . $name . ' FROM ' . $this->table->getTableName() . ' WHERE 1=1';
if ($this->whereCondition != '') {
$qry .= ' AND (' . $this->whereCondition . ')';
}
// Im Edit Mode das Feld selbst nicht als Position einfügen
if ($this->table->isEditMode()) {
$qry .= ' AND (' . $name . '!=' . $this->getValue() . ')';
}
$qry .= ' ORDER BY ' . $name;
$sql = rex_sql::factory();
$sql->setQuery($qry);
$this->select->addOption(rex_i18n::msg($this->firstOptionMsg), 1);
$value = 1;
foreach ($sql as $opt) {
$value = $opt->getValue($name) + 1;
$this->select->addOption(rex_i18n::rawMsg($this->optionMsg, $opt->getValue($this->labelField)), $value);
}
if (!$this->table->isEditMode()) {
$this->select->setSelected($value);
}
return parent::formatElement();
}
开发者ID:staabm,项目名称:redaxo,代码行数:25,代码来源:prio.php
示例7: getListValue
static function getListValue($params)
{
$format = rex_i18n::msg('yform_format_date');
if (($d = DateTime::createFromFormat('Y-m-d', $params['subject'])) && $d->format('Y-m-d') == $params['subject']) {
return $d->format($format);
}
return '[' . $params['subject'] . ']';
}
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:8,代码来源:date.php
示例8: extractArchiveTo
protected function extractArchiveTo($dir)
{
if (!rex_install_archive::extract($this->archive, $dir, $this->addonkey)) {
rex_dir::delete($dir);
return rex_i18n::msg('install_warning_addon_zip_not_extracted');
}
return true;
}
开发者ID:eaCe,项目名称:redaxo,代码行数:8,代码来源:api_package_download.php
示例9: isValid
public function isValid($value)
{
$article = rex_article::get($value);
if (!$article instanceof rex_article) {
return rex_i18n::msg('system_setting_' . $this->key . '_invalid');
}
return true;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:8,代码来源:system_setting_article_id.php
示例10: isValid
public function isValid($value)
{
$sql = rex_sql::factory();
$sql->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id=' . $value . ' AND active=1');
if ($sql->getRows() != 1 && $value != 0) {
return rex_i18n::msg('system_setting_default_template_id_invalid');
}
return true;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:9,代码来源:system_setting_default_template_id.php
示例11: doAction
public function doAction()
{
$path = rex_path::addon($this->addonkey);
$temppath = rex_path::addon('.new.' . $this->addonkey);
if (($msg = $this->extractArchiveTo($temppath)) !== true) {
return $msg;
}
if ($this->addon->isAvailable() && ($msg = $this->checkRequirements()) !== true) {
return $msg;
}
// ---- include update.php
if ($this->addon->isInstalled() && file_exists($temppath . rex_package::FILE_UPDATE)) {
try {
$this->addon->includeFile('../.new.' . $this->addonkey . '/' . rex_package::FILE_UPDATE);
} catch (rex_functional_exception $e) {
return $e->getMessage();
} catch (rex_sql_exception $e) {
return 'SQL error: ' . $e->getMessage();
}
if (($msg = $this->addon->getProperty('updatemsg', '')) != '') {
return $msg;
}
if (!$this->addon->getProperty('update', true)) {
return rex_i18n::msg('package_no_reason');
}
}
// ---- backup
$assets = $this->addon->getAssetsPath();
if (rex_addon::get('install')->getConfig('backups')) {
$archivePath = rex_path::addonData('install', $this->addonkey . '/');
rex_dir::create($archivePath);
$archive = $archivePath . strtolower(preg_replace('/[^a-z0-9-_.]/i', '_', $this->addon->getVersion('0'))) . '.zip';
rex_install_archive::copyDirToArchive($path, $archive);
if (is_dir($assets)) {
rex_install_archive::copyDirToArchive($assets, $archive, 'assets');
}
}
// ---- copy plugins to new addon dir
foreach ($this->addon->getRegisteredPlugins() as $plugin) {
$pluginPath = $temppath . '/plugins/' . $plugin->getName();
if (!is_dir($pluginPath)) {
rex_dir::copy($plugin->getPath(), $pluginPath);
} elseif ($plugin->isInstalled() && is_dir($pluginPath . '/assets')) {
rex_dir::copy($pluginPath . '/assets', $plugin->getAssetsPath());
}
}
// ---- update main addon dir
rex_dir::delete($path);
rename($temppath, $path);
// ---- update assets
$origAssets = $this->addon->getPath('assets');
if ($this->addon->isInstalled() && is_dir($origAssets)) {
rex_dir::copy($origAssets, $assets);
}
$this->addon->setProperty('version', $this->file['version']);
rex_install_packages::updatedPackage($this->addonkey, $this->fileId);
}
开发者ID:staabm,项目名称:redaxo,代码行数:57,代码来源:api_package_update.php
示例12: setValue
public function setValue($value)
{
$value = (int) $value;
$article = rex_article::get($value);
if (!$article instanceof rex_article) {
return rex_i18n::msg('system_setting_' . $this->key . '_invalid');
}
rex_config::set('structure', $this->key, $value);
return true;
}
开发者ID:staabm,项目名称:redaxo,代码行数:10,代码来源:system_setting_article_id.php
示例13: rex_delete_cache
/**
* Deletes the cache.
*
* @package redaxo\core
*/
function rex_delete_cache()
{
// close logger, so the logfile can also be deleted
rex_logger::close();
$finder = rex_finder::factory(rex_path::cache())->recursive()->childFirst()->ignoreFiles(['.htaccess', '.redaxo'], false)->ignoreSystemStuff(false);
rex_dir::deleteIterator($finder);
rex_clang::reset();
// ----- EXTENSION POINT
return rex_extension::registerPoint(new rex_extension_point('CACHE_DELETED', rex_i18n::msg('delete_cache_message')));
}
开发者ID:staabm,项目名称:redaxo,代码行数:15,代码来源:function_rex_other.php
示例14: getParamFields
public function getParamFields()
{
$fields = [['label' => rex_i18n::msg('im_export_filename'), 'name' => 'filename', 'type' => 'text', 'default' => self::DEFAULT_FILENAME, 'notice' => rex_i18n::msg('im_export_filename_notice')], ['name' => 'sendmail', 'type' => 'checkbox', 'options' => [1 => rex_i18n::msg('im_export_send_mail')]]];
if (rex_addon::get('phpmailer')->isAvailable()) {
$fields[] = ['label' => rex_i18n::msg('im_export_mailaddress'), 'name' => 'mailaddress', 'type' => 'text', 'visible_if' => ['sendmail' => 1]];
} else {
$fields[1]['notice'] = rex_i18n::msg('im_export_send_mail_notice');
$fields[1]['attributes'] = ['disabled' => 'disabled'];
}
return $fields;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:11,代码来源:cronjob.php
示例15: setValue
public function setValue($value)
{
$value = (int) $value;
$sql = rex_sql::factory();
$sql->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'template WHERE id=' . $value . ' AND active=1');
if ($sql->getRows() != 1 && $value != 0) {
return rex_i18n::msg('system_setting_default_template_id_invalid');
}
rex_config::set('structure/content', 'default_template_id', $value);
return true;
}
开发者ID:staabm,项目名称:redaxo,代码行数:11,代码来源:system_setting_default_template_id.php
示例16: formatLabel
public static function formatLabel(rex_structure_element $OOobject)
{
$label = $OOobject->getName();
if (trim($label) == '') {
$label = ' ';
}
$label .= ' [' . $OOobject->getId() . ']';
if ($OOobject instanceof rex_article && !$OOobject->hasTemplate()) {
$label .= ' [' . rex_i18n::msg('linkmap_has_no_template') . ']';
}
return $label;
}
开发者ID:staabm,项目名称:redaxo,代码行数:12,代码来源:renderer.php
示例17: 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);
}
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:12,代码来源:select.php
示例18: 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();
}
开发者ID:VIEWSION,项目名称:redaxo_yform,代码行数:52,代码来源:prio.php
示例19: formatElement
public function formatElement()
{
$name = $this->getAttribute('name') . '[]';
$value = explode('|', htmlspecialchars($this->getValue()));
if (count($value) != 4) {
$value = [null, 1, 'd'];
}
$options = ['i' => rex_i18n::msg('cronjob_interval_minutes'), 'h' => rex_i18n::msg('cronjob_interval_hour'), 'd' => rex_i18n::msg('cronjob_interval_day'), 'w' => rex_i18n::msg('cronjob_interval_week'), 'm' => rex_i18n::msg('cronjob_interval_month'), 'y' => rex_i18n::msg('cronjob_interval_year')];
$items = [];
$buttonLabel = '';
foreach ($options as $optionValue => $optionTitle) {
$item = [];
$item['title'] = $optionTitle;
$item['href'] = '#';
$item['attributes'] = 'data-value="' . $optionValue . '"';
if ($optionValue == $value[2]) {
$buttonLabel = $optionTitle;
}
$items[] = $item;
}
$toolbar = '';
$fragment = new rex_fragment();
$fragment->setVar('button_label', $buttonLabel);
$fragment->setVar('items', $items, false);
$fragment->setVar('group', true);
$fragment->setVar('right', true);
$dropdown = $fragment->parse('core/dropdowns/dropdown.php');
$formElements = [];
$n = [];
$n['field'] = '<input class="form-control" type="text" name="' . $name . '" value="' . $value[1] . '" />';
$n['right'] = $dropdown;
$formElements[] = $n;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$field = '<div class="rex-js-cronjob-interval">' . $fragment->parse('core/form/input_group.php') . '<input class="rex-js-cronjob-interval-value" type="hidden" name="' . $name . '" value="' . $value[2] . '" /></div>';
$javascript = '
<script type="text/javascript">
// <![CDATA[
jQuery(function($){
$(".rex-js-cronjob-interval .dropdown-menu li a").click(function(event){
event.preventDefault();
var $title = $(this).text();
$(this).closest(".input-group-btn").find(".btn > b").html($title);
var $value = $(this).closest("li").attr("data-value");
$(".rex-js-cronjob-interval-value").val($value);
});
});
// ]]>
</script>';
return $field . $javascript;
}
开发者ID:skerbis,项目名称:redaxo,代码行数:52,代码来源:form.php
示例20: testStrftime
public function testStrftime()
{
$oldLocale = rex_i18n::getLocale();
rex_i18n::setLocale('en_gb');
$value = 1336811080;
$format = '%d.%m.%Y %H:%M';
$this->assertEquals('12.05.2012 10:24', rex_formatter::strftime($value, $format));
$format = 'date';
$this->assertEquals('2012-May-12', rex_formatter::strftime($value, $format));
$format = 'datetime';
$this->assertEquals('2012-May-12 10:24', rex_formatter::strftime($value, $format));
rex_i18n::setLocale($oldLocale);
}
开发者ID:staabm,项目名称:redaxo,代码行数:13,代码来源:formatter_test.php
注:本文中的rex_i18n类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论