本文整理汇总了PHP中JStringPunycode::emailToUTF8方法的典型用法代码示例。如果您正苦于以下问题:PHP JStringPunycode::emailToUTF8方法的具体用法?PHP JStringPunycode::emailToUTF8怎么用?PHP JStringPunycode::emailToUTF8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JStringPunycode
的用法示例。
在下文中一共展示了JStringPunycode::emailToUTF8方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
/**
* Method to get the field input markup for e-mail addresses.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
// Translate placeholder text
$hint = $this->translateHint ? JText::_($this->hint) : $this->hint;
// Initialize some field attributes.
$size = !empty($this->size) ? ' size="' . $this->size . '"' : '';
$maxLength = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';
$class = !empty($this->class) ? ' class="validate-email ' . $this->class . '"' : ' class="validate-email"';
$readonly = $this->readonly ? ' readonly' : '';
$disabled = $this->disabled ? ' disabled' : '';
$required = $this->required ? ' required aria-required="true"' : '';
$hint = $hint ? ' placeholder="' . $hint . '"' : '';
$autocomplete = !$this->autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $this->autocomplete . '"';
$autocomplete = $autocomplete == ' autocomplete="on"' ? '' : $autocomplete;
$autofocus = $this->autofocus ? ' autofocus' : '';
$multiple = $this->multiple ? ' multiple' : '';
$spellcheck = $this->spellcheck ? '' : ' spellcheck="false"';
$tabindex = (int) $this->element['tabindex'] ? ' tabindex="' . (int) $this->element['tabindex'] . '"' : '';
$title = strpos($this->class, 'hasTooltip') === false ? '' : ' title="' . (string) $this->title . '"';
// Initialize JavaScript field attributes.
$onchange = $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
// Including fallback code for HTML5 non supported browsers.
JHtml::_('jquery.framework');
JHtml::_('script', 'system/html5fallback.js', false, true);
return '<input type="email" name="' . $this->name . '"' . $class . ' id="' . $this->id . '" value="' . htmlspecialchars(JStringPunycode::emailToUTF8($this->value, ENT_COMPAT, 'UTF-8')) . '"' . $spellcheck . $size . $disabled . $readonly . $onchange . $autocomplete . $multiple . $maxLength . $hint . $required . $autofocus . $tabindex . $title . ' />';
}
示例2: load
/**
* Method to load a user, user groups, and any other necessary data
* from the database so that it can be bound to the user object.
*
* @param integer $userId An optional user id.
* @param boolean $reset False if row not found or on error
* (internal error state set in that case).
*
* @return boolean True on success, false on failure.
*
* @since 11.1
*/
public function load($userId = null, $reset = true)
{
// Get the id to load.
if ($userId !== null) {
$this->id = $userId;
} else {
$userId = $this->id;
}
// Check for a valid id to load.
if ($userId === null) {
return false;
}
// Reset the table.
$this->reset();
// Load the user data.
$query = $this->_db->getQuery(true)->select('*')->from($this->_db->quoteName('#__users'))->where($this->_db->quoteName('id') . ' = ' . (int) $userId);
$this->_db->setQuery($query);
$data = (array) $this->_db->loadAssoc();
if (!count($data)) {
return false;
}
// Convert e-mail from punycode
$data['email'] = JStringPunycode::emailToUTF8($data['email']);
// Bind the data to the table.
$return = $this->bind($data);
if ($return !== false) {
// Load the user groups.
$query->clear()->select($this->_db->quoteName('g.id'))->select($this->_db->quoteName('g.title'))->from($this->_db->quoteName('#__usergroups') . ' AS g')->join('INNER', $this->_db->quoteName('#__user_usergroup_map') . ' AS m ON m.group_id = g.id')->where($this->_db->quoteName('m.user_id') . ' = ' . (int) $userId);
$this->_db->setQuery($query);
// Add the groups to the user data.
$this->groups = $this->_db->loadAssocList('id', 'id');
}
return $return;
}
示例3: getInput
/**
* Method to get the field input markup for e-mail addresses.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : '';
$class = $this->element['class'] ? ' ' . (string) $this->element['class'] : '';
$readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : '';
$disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
$required = $this->required ? ' required="required" aria-required="true"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
return '<input type="text" name="' . $this->name . '" class="' . $class . '" id="' . $this->id . '" value="' . JStringPunycode::emailToUTF8($this->value, ENT_COMPAT, 'UTF-8') . '"' . $size . $disabled . $readonly . $onchange . $maxLength . $required . '/>';
}
示例4: cloak
/**
* Simple JavaScript email cloaker
*
* By default replaces an email with a mailto link with email cloaked
*
* @param string $mail The -mail address to cloak.
* @param boolean $mailto True if text and mailing address differ
* @param string $text Text for the link
* @param boolean $email True if text is an e-mail address
*
* @return string The cloaked email.
*
* @since 1.5
*/
public static function cloak($mail, $mailto = true, $text = '', $email = true)
{
// Handle IDN addresses: punycode for href but utf-8 for text displayed.
if ($mailto && (empty($text) || $email)) {
// Use dedicated $text whereas $mail is used as href and must be punycoded.
$text = JStringPunycode::emailToUTF8($text ? $text : $mail);
} elseif (!$mailto) {
// In that case we don't use link - so convert $mail back to utf-8.
$mail = JStringPunycode::emailToUTF8($mail);
}
// Convert mail
$mail = static::convertEncoding($mail);
// Split email by @ symbol
$mail = explode('@', $mail);
$mail_parts = explode('.', $mail[1]);
// Random number
$rand = rand(1, 100000);
$replacement = '<span id="cloak' . $rand . '">' . JText::_('JLIB_HTML_CLOAKING') . '</span>' . "<script type='text/javascript'>";
$replacement .= "\n //<!--";
$replacement .= "\n document.getElementById('cloak{$rand}').innerHTML = '';";
$replacement .= "\n var prefix = 'ma' + 'il' + 'to';";
$replacement .= "\n var path = 'hr' + 'ef' + '=';";
$replacement .= "\n var addy" . $rand . " = '" . @$mail[0] . "' + '@';";
$replacement .= "\n addy" . $rand . " = addy" . $rand . " + '" . implode("' + '.' + '", $mail_parts) . "';";
if ($mailto) {
// Special handling when mail text is different from mail address
if ($text) {
// Convert text - here is the right place
$text = static::convertEncoding($text);
if ($email) {
// Split email by @ symbol
$text = explode('@', $text);
$text_parts = explode('.', $text[1]);
$replacement .= "\n var addy_text" . $rand . " = '" . @$text[0] . "' + '@' + '" . implode("' + '.' + '", @$text_parts) . "';";
} else {
$replacement .= "\n var addy_text" . $rand . " = '" . $text . "';";
}
$replacement .= "\n document.getElementById('cloak{$rand}').innerHTML += '<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>'+addy_text" . $rand . "+'<\\/a>';";
} else {
$replacement .= "\n document.getElementById('cloak{$rand}').innerHTML += '<a ' + path + '\\'' + prefix + ':' + addy" . $rand . " + '\\'>' +addy" . $rand . "+'<\\/a>';";
}
} else {
$replacement .= "\n document.getElementById('cloak{$rand}').innerHTML += addy" . $rand . ";";
}
$replacement .= "\n //-->";
$replacement .= "\n </script>";
return $replacement;
}
示例5: nl2br
echo JText::_('COM_USERS_USERS_MULTIPLE_GROUPS');
?>
</span>
<?php
} else {
?>
<?php
echo nl2br($item->group_names);
?>
<?php
}
?>
</td>
<td class="center">
<?php
echo JStringPunycode::emailToUTF8($this->escape($item->email));
?>
</td>
<td class="center">
<?php
if ($item->lastvisitDate != '0000-00-00 00:00:00') {
?>
<?php
echo JHtml::_('date', $item->lastvisitDate, 'Y-m-d H:i:s');
?>
<?php
} else {
?>
<?php
echo JText::_('JNEVER');
?>
示例6:
echo $this->escape($row->version);
?>
</td>
<td align="center" class="hidden-phone">
<?php
echo $this->escape($row->creationDate);
?>
</td>
<td align="center" class="hidden-phone">
<?php
echo $this->escape($row->author);
?>
</td>
<td align="center" class="hidden-phone">
<?php
echo JStringPunycode::emailToUTF8($this->escape($row->authorEmail));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php
echo JHtml::_('form.token');
?>
</div>
示例7: emailToUTF8
/**
* Helper wrapper method for emailToUTF8
*
* @param string $email The punycode e-mail to transform.
*
* @return string The punycode e-mail.
*
* @see JStringPunycode::emailToUTF8()
* @since 3.4
*/
public function emailToUTF8($email)
{
return JStringPunycode::emailToUTF8($email);
}
示例8: foreach
foreach ($values as $value) {
if (empty($value['addr']) && !$is_ingroup) {
continue;
}
// Skip empty if not in field group
if (empty($value['addr'])) {
$field->{$prop}[$n++] = '';
continue;
}
// If not using property or property is empty, then use default property value
// NOTE: default property values have been cleared, if (propertyname_usage != 2)
$addr = $value['addr'];
$text = @$value['text'];
$text = $usetitle && strlen($text) ? $text : $default_title;
if (!strlen($text) || !$usetitle) {
$text = FLEXI_J30GE ? JStringPunycode::emailToUTF8($addr) : $addr;
// email in Punycode to UTF8, for the purpose of displaying it
$text_is_email = 1;
} else {
$text_is_email = strpos($text, '@') !== false;
}
// Create field's display
// Use paremeters to decide if email should be cloaked and if we need a mailto: link
if ($format != 'feed' && $email_cloaking) {
$html = JHTML::_('email.cloak', $addr, $mailto_link, $text, $text_is_email);
} else {
$html = $mailto_link ? '<a href="mailto:' . $addr . '" target="_blank" itemprop="email">' . $text . '</a>' : $text;
}
// Add prefix / suffix
$field->{$prop}[$n] = $pretext . $html . $posttext;
$n++;
示例9: onDisplayFieldValue
//.........这里部分代码省略.........
if (!strlen($default_addr)) {
$field->{$prop} = $is_ingroup ? array() : '';
return;
}
$values = array();
$values[0]['addr'] = JText::_($default_addr);
$values[0]['text'] = JText::_($default_title);
$values[0] = serialize($values[0]);
}
// (* BECAUSE OF THIS, the value display loop expects unserialized values)
foreach ($values as &$value) {
// Compatibility for unserialized values or for NULL values in a field group
if (!is_array($value)) {
$v = !empty($value) ? @unserialize($value) : false;
$value = $v !== false || $v === 'b:0;' ? $v : array('addr' => $value, 'text' => '');
}
}
unset($value);
// Unset this or you are looking for trouble !!!, because it is a reference and reusing it will overwrite the pointed variable !!!
// Prefix - Suffix - Separator parameters, replacing other field values if found
$remove_space = $field->parameters->get('remove_space', 0);
$pretext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('pretext', ''), 'pretext');
$posttext = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('posttext', ''), 'posttext');
$separatorf = $field->parameters->get('separatorf', 1);
$opentag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('opentag', ''), 'opentag');
$closetag = FlexicontentFields::replaceFieldValue($field, $item, $field->parameters->get('closetag', ''), 'closetag');
if ($pretext) {
$pretext = $remove_space ? $pretext : $pretext . ' ';
}
if ($posttext) {
$posttext = $remove_space ? $posttext : ' ' . $posttext;
}
switch ($separatorf) {
case 0:
$separatorf = ' ';
break;
case 1:
$separatorf = '<br />';
break;
case 2:
$separatorf = ' | ';
break;
case 3:
$separatorf = ', ';
break;
case 4:
$separatorf = $closetag . $opentag;
break;
case 5:
$separatorf = '';
break;
default:
$separatorf = ' ';
break;
}
// initialise property
$field->{$prop} = array();
$n = 0;
foreach ($values as $value) {
if (empty($value['addr']) && !$is_ingroup) {
continue;
}
// Skip empty if not in field group
if (empty($value['addr'])) {
$field->{$prop}[$n++] = '';
continue;
}
// If not using property or property is empty, then use default property value
// NOTE: default property values have been cleared, if (propertyname_usage != 2)
$addr = $value['addr'];
$text = @$value['text'];
$text = $usetitle && strlen($text) ? $text : $default_title;
if (!strlen($text) || !$usetitle) {
$text = FLEXI_J30GE ? JStringPunycode::emailToUTF8($addr) : $addr;
// email in Punycode to UTF8, for the purpose of displaying it
$text_is_email = 1;
} else {
$text_is_email = strpos($text, '@') !== false;
}
// Create field's display
// A cloacked email address with custom linking text
$html = $format != 'feed' ? JHTML::_('email.cloak', $addr, 1, $text, $text_is_email) : '<a href="mailto:' . $addr . '" target="_blank" itemprop="email">' . $text . '</a>';
// Add prefix / suffix
$field->{$prop}[$n] = $pretext . $html . $posttext;
$n++;
if (!$multiple) {
break;
}
// multiple values disabled, break out of the loop, not adding further values even if the exist
}
if (!$is_ingroup) {
// Apply separator and open/close tags
$field->{$prop} = implode($separatorf, $field->{$prop});
if ($field->{$prop} !== '') {
$field->{$prop} = $opentag . $field->{$prop} . $closetag;
} else {
$field->{$prop} = '';
}
}
}
示例10: onDisplayField
//.........这里部分代码省略.........
}
$js .= "\n\t\t\tvar uniqueRowNum" . $field->id . "\t= " . count($field->value) . "; // Unique row number incremented only\n\t\t\tvar rowCount" . $field->id . "\t= " . count($field->value) . "; // Counts existing rows to be able to limit a max number of values\n\t\t\tvar maxValues" . $field->id . " = " . $max_values . ";\n\t\t\t\n\t\t\tfunction addField" . $field->id . "(el, groupval_box, fieldval_box, params)\n\t\t\t{\n\t\t\t\tvar insert_before = (typeof params!== 'undefined' && typeof params.insert_before !== 'undefined') ? params.insert_before : 0;\n\t\t\t\tvar remove_previous = (typeof params!== 'undefined' && typeof params.remove_previous !== 'undefined') ? params.remove_previous : 0;\n\t\t\t\tvar scroll_visible = (typeof params!== 'undefined' && typeof params.scroll_visible !== 'undefined') ? params.scroll_visible : 1;\n\t\t\t\tvar animate_visible = (typeof params!== 'undefined' && typeof params.animate_visible !== 'undefined') ? params.animate_visible : 1;\n\t\t\t\t\n\t\t\t\tif((rowCount" . $field->id . " >= maxValues" . $field->id . ") && (maxValues" . $field->id . " != 0)) {\n\t\t\t\t\talert(Joomla.JText._('FLEXI_FIELD_MAX_ALLOWED_VALUES_REACHED') + maxValues" . $field->id . ");\n\t\t\t\t\treturn 'cancel';\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// Find last container of fields and clone it to create a new container of fields\n\t\t\t\tvar lastField = fieldval_box ? fieldval_box : jQuery(el).prev().children().last();\n\t\t\t\tvar newField = lastField.clone();\n\t\t\t\t";
// NOTE: HTML tag id of this form element needs to match the -for- attribute of label HTML tag of this FLEXIcontent field, so that label will be marked invalid when needed
// Update the new email address
$js .= "\n\t\t\t\tvar theInput = newField.find('input.emailaddr').first();\n\t\t\t\ttheInput.val('" . $default_addr . "');\n\t\t\t\ttheInput.attr('name','" . $fieldname . "['+uniqueRowNum" . $field->id . "+'][addr]');\n\t\t\t\ttheInput.attr('id','" . $elementid . "_'+uniqueRowNum" . $field->id . "+'_addr');\n\t\t\t\tnewField.find('.emailaddr-lbl').first().attr('for','" . $elementid . "_'+uniqueRowNum" . $field->id . "+'_addr');\n\t\t\t\t";
// Update the new email linking text
if ($usetitle) {
$js .= "\n\t\t\t\tvar theInput = newField.find('input.emailtext').first();\n\t\t\t\ttheInput.val('" . $default_title . "');\n\t\t\t\ttheInput.attr('name','" . $fieldname . "['+uniqueRowNum" . $field->id . "+'][text]');\n\t\t\t\ttheInput.attr('id','" . $elementid . "_'+uniqueRowNum" . $field->id . "+'_text');\n\t\t\t\tnewField.find('.emailtext-lbl').first().attr('for','" . $elementid . "_'+uniqueRowNum" . $field->id . "+'_text');\n\t\t\t\t\n\t\t\t\t// Update inputmask\n\t\t\t\tvar has_inputmask = newField.find('input.has_inputmask').length != 0;\n\t\t\t\tif (has_inputmask) newField.find('input.has_inputmask').inputmask();\n\t\t\t\t";
}
// Add new field to DOM
$js .= "\n\t\t\t\tlastField ?\n\t\t\t\t\t(insert_before ? newField.insertBefore( lastField ) : newField.insertAfter( lastField ) ) :\n\t\t\t\t\tnewField.appendTo( jQuery('#sortables_" . $field->id . "') ) ;\n\t\t\t\tif (remove_previous) lastField.remove();\n\t\t\t\t";
// Add new element to sortable objects (if field not in group)
if (!$use_ingroup) {
$js .= "\n\t\t\t\t//jQuery('#sortables_" . $field->id . "').sortable('refresh'); // Refresh was done appendTo ?\n\t\t\t\t";
}
// Show new field, increment counters
$js .= "\n\t\t\t\t//newField.fadeOut({ duration: 400, easing: 'swing' }).fadeIn({ duration: 200, easing: 'swing' });\n\t\t\t\tif (scroll_visible) fc_scrollIntoView(newField, 1);\n\t\t\t\tif (animate_visible) newField.css({opacity: 0.1}).animate({ opacity: 1 }, 800);\n\t\t\t\t\n\t\t\t\t// Enable tooltips on new element\n\t\t\t\tnewField.find('.hasTooltip').tooltip({'html': true,'container': newField});\n\t\t\t\t\n\t\t\t\trowCount" . $field->id . "++; // incremented / decremented\n\t\t\t\tuniqueRowNum" . $field->id . "++; // incremented only\n\t\t\t}\n\n\t\t\tfunction deleteField" . $field->id . "(el, groupval_box, fieldval_box)\n\t\t\t{\n\t\t\t\t// Find field value container\n\t\t\t\tvar row = fieldval_box ? fieldval_box : jQuery(el).closest('li');\n\t\t\t\t\n\t\t\t\t// Add empty container if last element, instantly removing the given field value container\n\t\t\t\tif(rowCount" . $field->id . " == 1)\n\t\t\t\t\taddField" . $field->id . "(null, groupval_box, row, {remove_previous: 1, scroll_visible: 0, animate_visible: 0});\n\t\t\t\t\n\t\t\t\t// Remove if not last one, if it is last one, we issued a replace (copy,empty new,delete old) above\n\t\t\t\tif(rowCount" . $field->id . " > 1) {\n\t\t\t\t\t// Destroy the remove/add/etc buttons, so that they are not reclicked, while we do the hide effect (before DOM removal of field value)\n\t\t\t\t\trow.find('.fcfield-delvalue').remove();\n\t\t\t\t\trow.find('.fcfield-insertvalue').remove();\n\t\t\t\t\trow.find('.fcfield-drag-handle').remove();\n\t\t\t\t\t// Do hide effect then remove from DOM\n\t\t\t\t\trow.slideUp(400, function(){ jQuery(this).remove(); });\n\t\t\t\t\trowCount" . $field->id . "--;\n\t\t\t\t}\n\t\t\t}\n\t\t\t";
$css .= '';
$remove_button = '<span class="fcfield-delvalue' . (JComponentHelper::getParams('com_flexicontent')->get('form_font_icons', 1) ? ' fcfont-icon' : '') . '" title="' . JText::_('FLEXI_REMOVE_VALUE') . '" onclick="deleteField' . $field->id . '(this);"></span>';
$move2 = '<span class="fcfield-drag-handle' . (JComponentHelper::getParams('com_flexicontent')->get('form_font_icons', 1) ? ' fcfont-icon' : '') . '" title="' . JText::_('FLEXI_CLICK_TO_DRAG') . '"></span>';
$add_here = '';
$add_here .= $add_position == 2 || $add_position == 3 ? '<span class="fcfield-insertvalue fc_before' . (JComponentHelper::getParams('com_flexicontent')->get('form_font_icons', 1) ? ' fcfont-icon' : '') . '" onclick="addField' . $field->id . '(null, jQuery(this).closest(\'ul\'), jQuery(this).closest(\'li\'), {insert_before: 1});" title="' . JText::_('FLEXI_ADD_BEFORE') . '"></span> ' : '';
$add_here .= $add_position == 1 || $add_position == 3 ? '<span class="fcfield-insertvalue fc_after' . (JComponentHelper::getParams('com_flexicontent')->get('form_font_icons', 1) ? ' fcfont-icon' : '') . '" onclick="addField' . $field->id . '(null, jQuery(this).closest(\'ul\'), jQuery(this).closest(\'li\'), {insert_before: 0});" title="' . JText::_('FLEXI_ADD_AFTER') . '"></span> ' : '';
} else {
$remove_button = '';
$move2 = '';
$add_here = '';
$js .= '';
$css .= '';
}
if ($js) {
$document->addScriptDeclaration($js);
}
if ($css) {
$document->addStyleDeclaration($css);
}
// *****************************************
// Create field's HTML display for item form
// *****************************************
$field->html = array();
$n = 0;
//if ($use_ingroup) {print_r($field->value);}
foreach ($field->value as $value) {
// Compatibility for unserialized values (e.g. reload user input after form validation error) or for NULL values in a field group
if (!is_array($value)) {
$v = !empty($value) ? @unserialize($value) : false;
$value = $v !== false || $v === 'b:0;' ? $v : array('addr' => $value, 'text' => '');
}
if (empty($value['addr']) && !$use_ingroup && $n) {
continue;
}
// If at least one added, skip empty if not in field group
$fieldname_n = $fieldname . '[' . $n . ']';
$elementid_n = $elementid . '_' . $n;
$value['addr'] = !empty($value['addr']) ? $value['addr'] : '';
$value['addr'] = htmlspecialchars(FLEXI_J30GE ? JStringPunycode::emailToUTF8($value['addr']) : $value['addr'], ENT_COMPAT, 'UTF-8');
$addr = '
<div class="nowrap_box">
<label class="label emailaddr-lbl" for="' . $elementid_n . '_addr">' . JText::_('FLEXI_FIELD_EMAILADDRESS') . '</label>
<input class="emailaddr fcfield_textval ' . $classes . '" name="' . $fieldname_n . '[addr]" id="' . $elementid_n . '_addr" type="text" value="' . $value['addr'] . '" ' . $attribs . ' />
</div>';
$text = '';
if ($usetitle) {
$value['text'] = !empty($value['text']) ? $value['text'] : $default_title;
$value['text'] = isset($value['text']) ? htmlspecialchars($value['text'], ENT_COMPAT, 'UTF-8') : '';
$text = '
<div class="nowrap_box">
<label class="label emailtext-lbl" for="' . $elementid_n . '_text">' . JText::_('FLEXI_FIELD_EMAILTITLE') . '</label>
<input class="emailtext fcfield_textval" name="' . $fieldname_n . '[text]" id="' . $elementid_n . '_text" type="text" size="' . $size . '" value="' . $value['text'] . '" />
</div>';
}
$field->html[] = '
' . $addr . '
' . $text . '
' . ($use_ingroup ? '' : $move2) . '
' . ($use_ingroup ? '' : $remove_button) . '
' . ($use_ingroup || !$add_position ? '' : $add_here) . '
';
$n++;
if (!$multiple) {
break;
}
// multiple values disabled, break out of the loop, not adding further values even if the exist
}
if ($use_ingroup) {
// do not convert the array to string if field is in a group
} else {
if ($multiple) {
// handle multiple records
$field->html = !count($field->html) ? '' : '<li class="' . $value_classes . '">' . implode('</li><li class="' . $value_classes . '">', $field->html) . '</li>';
$field->html = '<ul class="fcfield-sortables" id="sortables_' . $field->id . '">' . $field->html . '</ul>';
if (!$add_position) {
$field->html .= '<span class="fcfield-addvalue ' . (JComponentHelper::getParams('com_flexicontent')->get('form_font_icons', 1) ? ' fcfont-icon' : '') . '" onclick="addField' . $field->id . '(this);" title="' . JText::_('FLEXI_ADD_TO_BOTTOM') . '">' . JText::_('FLEXI_ADD_VALUE') . '</span>';
}
} else {
// handle single values
$field->html = '<div class="fcfieldval_container valuebox fcfieldval_container_' . $field->id . '">' . $field->html[0] . '</div>';
}
}
}
示例11: testEmailToUTF8
/**
* Tests JStringPunycode::emailToUTF8
*
* @return void
*
* @since 3.2
*/
public function testEmailToUTF8()
{
$this->assertEquals(JStringPunycode::emailToUTF8('example@xn----7sblgc4ag8bhcd.xn--p1ai'), 'example@джумла-тест.рф', 'Tests punycode decoding a UTF8 email in Cyrillic');
$this->assertEquals(JStringPunycode::emailToUTF8('example@xn--au-gr-de-nos-plumes-fzb.fr'), 'example@au-gré-de-nos-plumes.fr', 'Tests punycode decoding a UTF8 email in French');
}
示例12: onDisplayField
//.........这里部分代码省略.........
$value['addr'] = '';
$value['full'] = '';
$value['first'] = '';
$value['last'] = '';
}
// CSS classes of value container
$value_classes = 'fcfieldval_container valuebox fcfieldval_container_' . $field->id;
// Field name and HTML TAG id
$fieldname = 'custom[' . $field->name . ']';
$elementid = 'custom_' . $field->name;
$js = "";
$css = '
div[class^="fcfield_avs_box-"] {
clear: both;
float: left !important;
}
';
if ($js) {
$document->addScriptDeclaration($js);
}
if ($css) {
$document->addStyleDeclaration($css);
}
// *****************************************
// Create field's HTML display for item form
// *****************************************
$field->html = array();
$user = JFactory::getUser();
if ($item->id) {
if ($field->parameters->get('display_item_owner', 0)) {
$owner = JFactory::getUser($item->created_by);
$field->html[] = '
<span class="fc_acc_via_mail_item_owner">' . JText::_('FLEXI_ACCOUNT_V_SUBMIT_ITEM_OWNER') . '</span>
<span class="badge fc_acc_via_mail_owner_name">' . $owner->name . '</span>
<span class="fc_acc_via_mail_owner_uname">[' . $owner->username . ']</span>';
//<span class="fc_acc_via_mail_owner_uid">: '.$owner->id.'</span>';
}
} else {
if ($user->id) {
if ($field->parameters->get('display_when_logged', 0)) {
$field->html[] = '
<b class="fc_acc_via_mail_logged_as">' . JText::_('FLEXI_ACCOUNT_V_SUBMIT_LOGGED_AS') . '</b>
<span class="badge fc_acc_via_mail_owner_name">' . $user->name . '</span>
<span class="fc_acc_via_mail_owner_uname">[' . $user->username . ']</span>';
//<span class="fc_acc_via_mail_owner_uid">: '.$user->id.'</span>';
}
} else {
$n = 0;
$fieldname_n = $fieldname . '[' . $n . ']';
$elementid_n = $elementid . '_' . $n;
$value['addr'] = !empty($value['addr']) ? $value['addr'] : '';
$value['addr'] = htmlspecialchars(FLEXI_J30GE ? JStringPunycode::emailToUTF8($value['addr']) : $value['addr'], ENT_COMPAT, 'UTF-8');
$addr = '
<div class="fcfield_avs_box-addr nowrap_box">
<label class="label">' . JText::_('FLEXI_ACCOUNT_V_SUBMIT_ADDR') . '</label>
<input class="avs_addr fcfield_textval' . $classes . '" name="' . $fieldname_n . '[addr]" id="' . $elementid_n . '" type="text" value="' . $value['addr'] . '" ' . $attribs . ' />
</div>';
$full = '';
if ($usefull) {
$value['full'] = !empty($value['full']) ? $value['full'] : '';
$value['full'] = isset($value['full']) ? htmlspecialchars($value['full'], ENT_COMPAT, 'UTF-8') : '';
$full = '
<div class="fcfield_avs_box-full nowrap_box">
<label class="label">' . JText::_('FLEXI_ACCOUNT_V_SUBMIT_FULLNAME') . '</label>
<input class="avs_full fcfield_textval" name="' . $fieldname_n . '[full]" type="text" size="' . $size . '" value="' . $value['full'] . '" />
</div>';
}
$first = '';
if ($usefirst) {
$value['first'] = !empty($value['first']) ? $value['first'] : '';
$value['first'] = isset($value['first']) ? htmlspecialchars($value['first'], ENT_COMPAT, 'UTF-8') : '';
$first = '
<div class="fcfield_avs_box-first nowrap_box">
<label class="label">' . JText::_('FLEXI_ACCOUNT_V_SUBMIT_FIRSTNAME') . '</label>
<input class="avs_first fcfield_textval" name="' . $fieldname_n . '[first]" type="text" size="' . $size . '" value="' . $value['first'] . '" />
</div>';
}
$last = '';
if ($uselast) {
$value['last'] = !empty($value['last']) ? $value['last'] : '';
$value['last'] = isset($value['last']) ? htmlspecialchars($value['last'], ENT_COMPAT, 'UTF-8') : '';
$last = '
<div class="fcfield_avs_box-last nowrap_box">
<label class="label">' . JText::_('FLEXI_ACCOUNT_V_SUBMIT_LASTNAME') . '</label>
<input class="avs_last fcfield_textval" name="' . $fieldname_n . '[last]" type="text" size="' . $size . '" value="' . $value['last'] . '" />
</div>';
}
$field->html[] = '
' . $addr . '
' . $full . '
' . $first . '
' . $last . '
';
}
}
if (!count($field->html) && $field->formhidden != 4) {
$field->html[] = '';
}
$field->html = !count($field->html) ? null : '<div class="fcfieldval_container valuebox fcfieldval_container_' . $field->id . '">' . $field->html[0] . '</div>';
}
示例13: array
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
* @var array $inputType Options available for this field.
* @var array $spellcheck Options available for this field.
* @var string $accept File types that are accepted.
*/
$autocomplete = !$autocomplete ? 'autocomplete="off"' : 'autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete == 'autocomplete="on"' ? '' : $autocomplete;
$attributes = array($spellcheck ? '' : 'spellcheck="false"', !empty($size) ? 'size="' . $size . '"' : '', $disabled ? 'disabled' : '', $readonly ? 'readonly' : '', $onchange ? 'onchange="' . $onchange . '"' : '', $autocomplete, $multiple ? 'multiple' : '', !empty($maxLength) ? 'maxlength="' . $maxLength . '"' : '', strlen($hint) ? 'placeholder="' . $hint . '"' : '', $required ? 'required aria-required="true"' : '', $autofocus ? 'autofocus' : '');
// Including fallback code for HTML5 non supported browsers.
JHtml::_('jquery.framework');
JHtml::_('script', 'system/html5fallback.js', false, true);
?>
<input type="email" name="<?php
echo $name;
?>
"<?php
echo !empty($class) ? ' class="validate-email ' . $class . '"' : ' class="validate-email"';
?>
id="<?php
echo $id;
?>
" value="<?php
echo htmlspecialchars(JStringPunycode::emailToUTF8($value), ENT_COMPAT, 'UTF-8');
?>
"
<?php
echo implode(' ', $attributes);
?>
/>