本文整理汇总了PHP中rex_i18n::hasMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_i18n::hasMsg方法的具体用法?PHP rex_i18n::hasMsg怎么用?PHP rex_i18n::hasMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_i18n
的用法示例。
在下文中一共展示了rex_i18n::hasMsg方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
// ----- EXTENSION POINT
// IDs aller Feldtypen bei denen das Parameter-Feld eingeblendet werden soll
$typeFields = rex_extension::registerPoint(new rex_extension_point('METAINFO_TYPE_FIELDS', [REX_METAINFO_FIELD_SELECT, REX_METAINFO_FIELD_RADIO, REX_METAINFO_FIELD_CHECKBOX, REX_METAINFO_FIELD_REX_MEDIA_WIDGET, REX_METAINFO_FIELD_REX_MEDIALIST_WIDGET, REX_METAINFO_FIELD_REX_LINK_WIDGET, REX_METAINFO_FIELD_REX_LINKLIST_WIDGET]));
$field = $this->addReadOnlyField('prefix', $this->metaPrefix);
$field->setLabel(rex_i18n::msg('minfo_field_label_prefix'));
$field = $this->addTextField('name');
$field->setLabel(rex_i18n::msg('minfo_field_label_name'));
$field = $this->addSelectField('priority');
$field->setLabel(rex_i18n::msg('minfo_field_label_priority'));
$select = $field->getSelect();
$select->setSize(1);
$select->addOption(rex_i18n::msg('minfo_field_first_priority'), 1);
// Im Edit Mode das Feld selbst nicht als Position einf�gen
$qry = 'SELECT name,priority FROM ' . $this->tableName . ' WHERE `name` LIKE "' . $this->metaPrefix . '%"';
if ($this->isEditMode()) {
$qry .= ' AND id != ' . $this->getParam('field_id');
}
$qry .= ' ORDER BY priority';
$sql = rex_sql::factory();
$sql->setQuery($qry);
$value = 1;
for ($i = 0; $i < $sql->getRows(); ++$i) {
$value = $sql->getValue('priority') + 1;
$select->addOption(rex_i18n::rawMsg('minfo_field_after_priority', $sql->getValue('name')), $value);
$sql->next();
}
if (!$this->isEditMode()) {
$select->setSelected($value);
}
$field = $this->addTextField('title');
$field->setLabel(rex_i18n::msg('minfo_field_label_title'));
$field->setNotice(rex_i18n::msg('minfo_field_notice_title'));
$gq = rex_sql::factory();
$gq->setQuery('SELECT dbtype,id FROM ' . rex::getTablePrefix() . 'metainfo_type');
$textFields = [];
foreach ($gq->getArray() as $f) {
if ($f['dbtype'] == 'text') {
$textFields[$f['id']] = $f['id'];
}
}
$field = $this->addSelectField('type_id');
$field->setLabel(rex_i18n::msg('minfo_field_label_type'));
$field->setAttribute('onchange', 'meta_checkConditionalFields(this, new Array(' . implode(',', $typeFields) . '), new Array(' . implode(',', $textFields) . '));');
$select = $field->getSelect();
$select->setSize(1);
$qry = 'SELECT label,id FROM ' . rex::getTablePrefix() . 'metainfo_type';
$select->addSqlOptions($qry);
$notices = '';
for ($i = 1; $i < REX_METAINFO_FIELD_COUNT; ++$i) {
if (rex_i18n::hasMsg('minfo_field_params_notice_' . $i)) {
$notices .= '<span id="metainfo-field-params-notice-' . $i . '" style="display:none">' . rex_i18n::msg('minfo_field_params_notice_' . $i) . '</span>' . "\n";
}
}
$notices .= '
<script type="text/javascript">
var needle = new getObj("' . $field->getAttribute('id') . '");
meta_checkConditionalFields(needle.obj, new Array(' . implode(',', $typeFields) . '), new Array(' . implode(',', $textFields) . '));
</script>';
$field = $this->addTextAreaField('params');
$field->setLabel(rex_i18n::msg('minfo_field_label_params'));
$field->setNotice($notices);
$field = $this->addTextAreaField('attributes');
$field->setLabel(rex_i18n::msg('minfo_field_label_attributes'));
$notice = rex_i18n::msg('minfo_field_attributes_notice') . "\n";
$field->setNotice($notice);
$field = $this->addTextAreaField('callback');
$field->setLabel(rex_i18n::msg('minfo_field_label_callback'));
$notice = rex_i18n::msg('minfo_field_label_notice') . "\n";
$field->setNotice($notice);
$field = $this->addTextField('default');
$field->setLabel(rex_i18n::msg('minfo_field_label_default'));
if ('clang_' !== $this->metaPrefix) {
$attributes = [];
$attributes['internal::fieldClass'] = 'rex_form_restrictons_element';
$field = $this->addField('', 'restrictions', null, $attributes);
$field->setLabel(rex_i18n::msg('minfo_field_label_restrictions'));
$field->setAttribute('size', 10);
$field->setAttribute('class', 'form-control');
}
parent::init();
}
示例2: i18n
/**
* Translates the given key.
*
* @param string $key Key
*
* @return string Tranlates text
*/
protected function i18n($key)
{
$args = func_get_args();
$key = $this->i18nPrefix . $args[0];
if (!rex_i18n::hasMsg($key)) {
$key = 'package_' . $args[0];
}
$args[0] = $key;
return call_user_func_array(['rex_i18n', 'msg'], $args);
}
示例3: i18n
/**
* {@inheritdoc}
*/
public function i18n($key)
{
$args = func_get_args();
$key = $this->getName() . '_' . $key;
if (rex_i18n::hasMsg($key)) {
$args[0] = $key;
}
return call_user_func_array('rex_i18n::msg', $args);
}
示例4: register
/**
* Registers a new permission.
*
* @param string $perm Perm key
* @param string $name Perm name
* @param string $group Perm group, possible values are rex_perm::GENERAL, rex_perm::OPTIONS and rex_perm::EXTRAS
*/
public static function register($perm, $name = null, $group = self::GENERAL)
{
$name = $name ?: (rex_i18n::hasMsg($key = 'perm_' . $group . '_' . $perm) ? rex_i18n::msg($key) : $perm);
self::$perms[$group][$perm] = $name;
}