本文整理汇总了PHP中rex_i18n类的典型用法代码示例。如果您正苦于以下问题:PHP rex_i18n类的具体用法?PHP rex_i18n怎么用?PHP rex_i18n使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了rex_i18n类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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'));
}
示例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;
}
示例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];
}
示例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;
}
示例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();
}
示例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'] . ']';
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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')));
}
示例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;
}
示例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;
}