本文整理匯總了PHP中Mautic\CoreBundle\Helper\InputHelper::transliterate方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputHelper::transliterate方法的具體用法?PHP InputHelper::transliterate怎麽用?PHP InputHelper::transliterate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mautic\CoreBundle\Helper\InputHelper
的用法示例。
在下文中一共展示了InputHelper::transliterate方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: strtolower
<?php
/**
* @copyright 2014 Mautic Contributors. All rights reserved
* @author Mautic
*
* @link http://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
use Mautic\CoreBundle\Helper\InputHelper;
$formName = '_' . strtolower(InputHelper::alphanum(InputHelper::transliterate($form->getName())) . '_focus');
$jsFormName = ltrim($formName, '_');
$fields = $form->getFields();
$required = [];
if (empty($preview)) {
echo $view->render('MauticFormBundle:Builder:script.html.php', ['form' => $form, 'formName' => $formName]);
?>
<script>
var MauticFocusHandler = function (messageType, message) {
// Store the HTML
var wrapper = document.getElementById('mauticform_wrapper<?php
echo $formName;
?>
');
var innerForm = wrapper.getElementsByClassName('mauticform-innerform');
innerForm[0].style.display = "none";
<?php
if ($style == 'page') {
示例2: cleanAlias
/**
* Cleans a string to be used as an alias. The returned string will be alphanumeric or underscore, less than 25 characters
* and if it is a reserved SQL keyword, it will be prefixed with f_
*
* @param string $alias
* @param string $prefix Used when the alias is a reserved keyword by the database platform
* @param int|bool $maxLength Maximum number of characters used; 0 to disable
* @param string $spaceCharacter Character to replace spaces with
* @return string
* @throws \Doctrine\DBAL\DBALException
*/
public function cleanAlias($alias, $prefix = '', $maxLength = false, $spaceCharacter = '_')
{
// Transliterate to latin characters
$alias = InputHelper::transliterate(trim($alias));
// Some labels are quite long if a question so cut this short
$alias = strtolower(InputHelper::alphanum($alias, false, $spaceCharacter));
// Trim if applicable
if ($maxLength) {
$alias = substr($alias, 0, $maxLength);
}
if (substr($alias, -1) == '_') {
$alias = substr($alias, 0, -1);
}
// Check that alias is SQL safe since it will be used for the column name
$databasePlatform = $this->em->getConnection()->getDatabasePlatform();
$reservedWords = $databasePlatform->getReservedKeywordsList();
if ($reservedWords->isKeyword($alias) || is_numeric($alias)) {
$alias = $prefix . $alias;
}
return $alias;
}
示例3: generateFormName
/**
* Generate a form name for HTML attributes
*/
public function generateFormName()
{
return strtolower(InputHelper::alphanum(InputHelper::transliterate($this->name)));
}
示例4: empty
$wrapDiv = false;
}
$count = 0;
$firstId = 'mauticform_' . $containerType . '_' . $type . '_' . $field['alias'] . '_' . InputHelper::alphanum(InputHelper::transliterate($list[0])) . '1';
$formButtons = !empty($inForm) ? $view->render('MauticFormBundle:Builder:actions.html.php', ['id' => $id, 'formId' => $formId, 'formName' => $formName]) : '';
$label = !$field['showLabel'] ? '' : <<<HTML
<label {$labelAttr} for="{$firstId}">{$view->escape($field['label'])}</label>
HTML;
$help = empty($field['helpMessage']) ? '' : <<<HTML
<span class="mauticform-helpmessage">{$field['helpMessage']}</span>
HTML;
$options = [];
foreach ($list as $counter => $l) {
$id = $field['alias'] . '_' . InputHelper::alphanum(InputHelper::transliterate($l)) . $counter;
$checked = $field['defaultValue'] == $l ? 'checked="checked"' : '';
$checkboxBrackets = $type == 'checkbox' ? '[]' : '';
$option = <<<HTML
<label id="mauticform_{$containerType}_label_{$id}" for="mauticform_{$containerType}_{$type}_{$id}" {$optionLabelAttr}>
<input {$inputAttr}{$checked} name="mauticform[{$field['alias']}]{$checkboxBrackets}" id="mauticform_{$containerType}_{$type}_{$id}" type="{$type}" value="{$view->escape($l)}" />
{$view->escape($l)}
</label>
HTML;
if ($wrapDiv) {
$option = <<<HTML
<div class="mauticform-{$containerType}-row">{$option}
</div>
HTML;
示例5: generateFormName
/**
* Generate a form name for HTML attributes
*/
public function generateFormName()
{
$name = strtolower(InputHelper::alphanum(InputHelper::transliterate($this->name)));
return empty($name) ? 'form-' . $this->id : $name;
}
示例6: getAvailableLeadFields
/**
* @return array
*/
public function getAvailableLeadFields($settings = array())
{
$zohoFields = array();
$silenceExceptions = isset($settings['silence_exceptions']) ? $settings['silence_exceptions'] : true;
try {
if ($this->isAuthorized()) {
$leadObject = $this->getApiHelper()->getLeadFields();
if ($leadObject == null || isset($leadObject['response']) && isset($leadObject['response']['error'])) {
return array();
}
$zohoFields = array();
foreach ($leadObject['Leads']['section'] as $optgroup) {
//$zohoFields[$optgroup['dv']] = array();
if (!array_key_exists(0, $optgroup['FL'])) {
$optgroup['FL'] = array($optgroup['FL']);
}
foreach ($optgroup['FL'] as $field) {
if (!(bool) $field['isreadonly'] || in_array($field['type'], array('Lookup', 'OwnerLookup', 'Boolean'))) {
continue;
}
$key = InputHelper::alphanum(InputHelper::transliterate($field['dv']));
$zohoFields[$key] = array('type' => 'string', 'label' => $field['label'], 'dv' => $field['dv'], 'required' => $field['req'] == 'true');
}
}
}
} catch (ErrorException $exception) {
$this->logIntegrationError($exception);
if (!$silenceExceptions) {
throw $exception;
}
return false;
}
return $zohoFields;
}