本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getTranslator方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getTranslator方法的具体用法?PHP MauticFactory::getTranslator怎么用?PHP MauticFactory::getTranslator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getTranslator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* {@inheritdoc}
*/
public function authenticate(TokenInterface $token)
{
if (!$this->supports($token)) {
return null;
}
$translator = $this->factory->getTranslator();
$requestParameters = $token->getRequestParameters();
$requestMethod = $token->getRequestMethod();
$requestUrl = $token->getRequestUrl();
if ($this->serverService->validateRequest($requestParameters, $requestMethod, $requestUrl)) {
$accessToken = $this->tokenProvider->loadAccessTokenByToken($requestParameters['oauth_token']);
$user = $accessToken->getUser();
if (null !== $user) {
//Recreate token to include user roles in order to be able to avoid CSRF checks with forms
$token = new OAuthToken($user->getRoles());
$token->setRequestParameters($requestParameters);
$token->setRequestMethod($requestMethod);
$token->setRequestUrl($requestUrl);
$token->setAuthenticated(true);
$token->setUser($user);
}
return $token;
}
throw new AuthenticationException($translator->trans('mautic.api.oauth.auth.failed'));
}
示例2: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('site_url', 'text', array('label' => 'mautic.core.config.form.site.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.site.url.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('webroot', 'page_list', array('label' => 'mautic.core.config.form.webroot', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.webroot.tooltip', 'data-placeholder' => $this->factory->getTranslator()->trans('mautic.core.config.form.webroot.dashboard')), 'multiple' => false, 'empty_value' => '', 'required' => false));
$builder->add('cache_path', 'text', array('label' => 'mautic.core.config.form.cache.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cache.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('log_path', 'text', array('label' => 'mautic.core.config.form.log.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.log.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('image_path', 'text', array('label' => 'mautic.core.config.form.image.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.image.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('theme', 'theme_list', array('label' => 'mautic.core.config.form.theme', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.template.help')));
// Get the list of available languages
/** @var \Mautic\CoreBundle\Helper\LanguageHelper $languageHelper */
$languageHelper = $this->factory->getHelper('language');
$languages = $languageHelper->fetchLanguages(false, false);
$langChoices = array();
foreach ($languages as $code => $langData) {
$langChoices[$code] = $langData['name'];
}
$langChoices = array_merge($langChoices, $this->factory->getParameter('supported_languages'));
// Alpha sort the languages by name
asort($langChoices);
$builder->add('locale', 'choice', array('choices' => $langChoices, 'label' => 'mautic.core.config.form.locale', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.locale.tooltip'), 'empty_value' => false));
$arrayStringTransformer = new ArrayStringTransformer();
$builder->add($builder->create('trusted_hosts', 'text', array('label' => 'mautic.core.config.form.trusted.hosts', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.hosts.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
$builder->add($builder->create('trusted_proxies', 'text', array('label' => 'mautic.core.config.form.trusted.proxies', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.trusted.proxies.tooltip'), 'required' => false))->addViewTransformer($arrayStringTransformer));
$arrayLinebreakTransformer = new ArrayLinebreakTransformer();
$builder->add($builder->create('do_not_track_ips', 'textarea', array('label' => 'mautic.core.config.form.do_not_track_ips', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.do_not_track_ips.tooltip'), 'required' => false))->addViewTransformer($arrayLinebreakTransformer));
$builder->add('rememberme_key', 'text', array('label' => 'mautic.core.config.form.rememberme.key', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.key.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('rememberme_lifetime', 'text', array('label' => 'mautic.core.config.form.rememberme.lifetime', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.lifetime.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('rememberme_path', 'text', array('label' => 'mautic.core.config.form.rememberme.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('rememberme_domain', 'text', array('label' => 'mautic.core.config.form.rememberme.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.rememberme.domain.tooltip'), 'required' => false));
$builder->add('default_pagelimit', 'choice', array('choices' => array(5 => 'mautic.core.pagination.5', 10 => 'mautic.core.pagination.10', 15 => 'mautic.core.pagination.15', 20 => 'mautic.core.pagination.20', 25 => 'mautic.core.pagination.25', 30 => 'mautic.core.pagination.30', 50 => 'mautic.core.pagination.50', 100 => 'mautic.core.pagination.100'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.core.config.form.default.pagelimit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.pagelimit.tooltip'), 'required' => false, 'empty_value' => false));
$builder->add('default_timezone', 'timezone', array('label' => 'mautic.core.config.form.default.timezone', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.default.timezone.tooltip'), 'multiple' => false, 'empty_value' => 'mautic.user.user.form.defaulttimezone', 'required' => false));
$builder->add('date_format_full', 'text', array('label' => 'mautic.core.config.form.date.format.full', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.full.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('date_format_short', 'text', array('label' => 'mautic.core.config.form.date.format.short', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.short.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('date_format_dateonly', 'text', array('label' => 'mautic.core.config.form.date.format.dateonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.dateonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('date_format_timeonly', 'text', array('label' => 'mautic.core.config.form.date.format.timeonly', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.date.format.timeonly.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
// Search for IP Services
$bundles = $this->factory->getMauticBundles(true);
$choices = array();
foreach ($bundles as $bundle) {
if (isset($bundle['config']['ip_lookup_services'])) {
foreach ($bundle['config']['ip_lookup_services'] as $service => $details) {
$choices[$service] = $details['display_name'];
}
}
}
natcasesort($choices);
$builder->add('ip_lookup_service', 'choice', array('choices' => $choices, 'label' => 'mautic.core.config.form.ip.lookup.service', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.service.tooltip')));
$builder->add('ip_lookup_auth', 'text', array('label' => 'mautic.core.config.form.ip.lookup.auth', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.ip.lookup.auth.tooltip'), 'required' => false));
$builder->add('transifex_username', 'text', array('label' => 'mautic.core.config.form.transifex.username', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.transifex.username.tooltip', 'autocomplete' => 'off'), 'required' => false));
$builder->add('transifex_password', 'password', array('label' => 'mautic.core.config.form.transifex.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'tooltip' => 'mautic.core.config.form.transifex.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
$builder->add('update_stability', 'choice', array('choices' => array('alpha' => 'mautic.core.config.update_stability.alpha', 'beta' => 'mautic.core.config.update_stability.beta', 'rc' => 'mautic.core.config.update_stability.rc', 'stable' => 'mautic.core.config.update_stability.stable'), 'label' => 'mautic.core.config.form.update.stability', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.update.stability.tooltip'), 'empty_value' => false));
$builder->add('cookie_path', 'text', array('label' => 'mautic.core.config.form.cookie.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.path.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('cookie_domain', 'text', array('label' => 'mautic.core.config.form.cookie.domain', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.core.config.form.cookie.domain.tooltip'), 'required' => false));
$builder->add('cookie_secure', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.secure', 'empty_value' => 'mautic.core.form.default', 'data' => array_key_exists('cookie_secure', $options['data']) && !empty($options['data']['cookie_secure']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.secure.tooltip')));
$builder->add('cookie_httponly', 'yesno_button_group', array('label' => 'mautic.core.config.form.cookie.httponly', 'data' => array_key_exists('cookie_httponly', $options['data']) && !empty($options['data']['cookie_httponly']) ? true : false, 'attr' => array('tooltip' => 'mautic.core.config.form.cookie.httponly.tooltip')));
}
示例3: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$model = $this->factory->getModel('lead.list');
$lists = $model->getUserLists();
$segments = [];
$segments[0] = $this->factory->getTranslator()->trans('mautic.lead.all.leads');
foreach ($lists as $list) {
$segments[$list['id']] = $list['name'];
}
$builder->add('flag', 'choice', ['label' => 'mautic.lead.list.filter', 'multiple' => true, 'choices' => $segments, 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
}
示例4: extractLanguagePackage
/**
* Extracts a downloaded package for the specified language
*
* This will attempt to download the package if it is not found
*
* @param $languageCode
*
* @return array
*/
public function extractLanguagePackage($languageCode)
{
$packagePath = $this->factory->getSystemPath('cache') . '/' . $languageCode . '.zip';
$translator = $this->factory->getTranslator();
// Make sure the package actually exists
if (!file_exists($packagePath)) {
// Let's try to fetch it
$result = $this->fetchPackage($languageCode);
// If there was a failure, there's nothing else we can do here
if ($result['error']) {
return $result;
}
}
$zipper = new \ZipArchive();
$archive = $zipper->open($packagePath);
if ($archive !== true) {
// Get the exact error
switch ($archive) {
case \ZipArchive::ER_EXISTS:
$error = 'mautic.core.update.archive_file_exists';
break;
case \ZipArchive::ER_INCONS:
case \ZipArchive::ER_INVAL:
case \ZipArchive::ER_MEMORY:
$error = 'mautic.core.update.archive_zip_corrupt';
break;
case \ZipArchive::ER_NOENT:
$error = 'mautic.core.update.archive_no_such_file';
break;
case \ZipArchive::ER_NOZIP:
$error = 'mautic.core.update.archive_not_valid_zip';
break;
case \ZipArchive::ER_READ:
case \ZipArchive::ER_SEEK:
case \ZipArchive::ER_OPEN:
default:
$error = 'mautic.core.update.archive_could_not_open';
break;
}
return array('error' => true, 'message' => $error);
}
// Extract the archive file now
$zipper->extractTo($this->factory->getSystemPath('translations_root') . '/translations');
$zipper->close();
// We can remove the package now
@unlink($packagePath);
return array('error' => false, 'message' => 'mautic.core.language.helper.language.saved.successfully');
}
示例5: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
/** @var \Mautic\LeadBundle\Model\ListModel $listModel */
$listModel = $factory->getModel('lead.list');
$this->fieldChoices = $listModel->getChoiceFields();
// Locales
$this->timezoneChoices = FormFieldHelper::getTimezonesChoices();
$this->countryChoices = FormFieldHelper::getCountryChoices();
$this->regionChoices = FormFieldHelper::getRegionChoices();
// Segments
$lists = $listModel->getUserLists();
foreach ($lists as $list) {
$this->listChoices[$list['id']] = $list['name'];
}
// Emails
/** @var \Mautic\EmailBundle\Model\EmailModel $emailModel */
$emailModel = $factory->getModel('email');
$viewOther = $factory->getSecurity()->isGranted('email:emails:viewother');
$emails = $emailModel->getRepository()->getEmailList('', 0, 0, $viewOther, true);
foreach ($emails as $email) {
$this->emailChoices[$email['language']][$email['id']] = $email['name'];
}
ksort($this->emailChoices);
// Tags
$leadModel = $factory->getModel('lead');
$tags = $leadModel->getTagList();
foreach ($tags as $tag) {
$this->tagChoices[$tag['value']] = $tag['label'];
}
}
示例6: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->validator = $factory->getValidator();
$this->apiMode = $factory->getRequest()->get('api_mode', $factory->getSession()->get('mautic.client.filter.api_mode', 'oauth1a'));
$this->router = $factory->getRouter();
}
示例7: populateLeadData
/**
* Match lead data with integration fields
*
* @param $lead
* @param $config
*
* @return array
*/
public function populateLeadData($lead, $config = array())
{
if (!isset($config['leadFields'])) {
$config = $this->mergeConfigToFeatureSettings($config);
if (empty($config['leadFields'])) {
return array();
}
}
if ($lead instanceof Lead) {
$fields = $lead->getFields(true);
} else {
$fields = $lead;
}
$leadFields = $config['leadFields'];
$availableFields = $this->getAvailableLeadFields($config);
$unknown = $this->factory->getTranslator()->trans('mautic.integration.form.lead.unknown');
$matched = array();
foreach ($availableFields as $key => $field) {
$integrationKey = $this->convertLeadFieldKey($key, $field);
if (isset($leadFields[$key])) {
$mauticKey = $leadFields[$key];
if (isset($fields[$mauticKey]) && !empty($fields[$mauticKey]['value'])) {
$matched[$integrationKey] = $fields[$mauticKey]['value'];
}
}
if (!empty($field['required']) && empty($matched[$integrationKey])) {
$matched[$integrationKey] = $unknown;
}
}
return $matched;
}
示例8: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->defaultTheme = $factory->getParameter('theme');
$this->em = $factory->getEntityManager();
$this->request = $factory->getRequest();
}
示例9: determineDwellTimeTestWinner
/**
* Determines the winner of A/B test based on dwell time rates
*
* @param MauticFactory $factory
* @param Page $parent
* @param $children
*
* @return array
*/
public static function determineDwellTimeTestWinner($factory, $parent, $children)
{
//find the hits that did not go any further
$repo = $factory->getEntityManager()->getRepository('MauticPageBundle:Hit');
$pageIds = array($parent->getId());
foreach ($children as $c) {
$pageIds[] = $c->getId();
}
$startDate = $parent->getVariantStartDate();
if ($startDate != null && !empty($pageIds)) {
//get their bounce rates
$counts = $repo->getDwellTimes(array('pageIds' => $pageIds, 'startDate' => $startDate));
$translator = $factory->getTranslator();
$support = array();
if ($counts) {
//in order to get a fair grade, we have to compare the averages here since a page that is only shown
//25% of the time will have a significantly lower sum than a page shown 75% of the time
$avgs = array();
$support['data'] = array();
$support['labels'] = array();
foreach ($counts as $pid => $stats) {
$avgs[$pid] = $stats['average'];
$support['data'][$translator->trans('mautic.page.abtest.label.dewlltime.average')][] = $stats['average'];
$support['labels'][] = $pid . ':' . $stats['title'];
}
//set max for scales
$max = max($avgs);
$support['step_width'] = ceil($max / 10) * 10;
//get the page ids with the greatest average dwell time
$winners = $max > 0 ? array_keys($avgs, $max) : array();
return array('winners' => $winners, 'support' => $support, 'basedOn' => 'page.dwelltime', 'supportTemplate' => 'MauticPageBundle:SubscribedEvents\\AbTest:bargraph.html.php');
}
}
return array('winners' => array(), 'support' => array(), 'basedOn' => 'page.dwelltime');
}
示例10: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->em = $factory->getEntityManager();
$this->translator = $factory->getTranslator();
$this->model = $factory->getModel('category');
$this->router = $factory->getRouter();
}
示例11: buildForm
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('unsubscribe_text', 'textarea', array('label' => 'mautic.email.config.unsubscribe_text', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.unsubscribe_text.tooltip'), 'required' => false, 'data' => array_key_exists('unsubscribe_text', $options['data']) && !empty($options['data']['unsubscribe_text']) ? $options['data']['unsubscribe_text'] : $this->factory->getTranslator()->trans('mautic.email.unsubscribe.text', array('%link%' => '|URL|'))));
$builder->add('webview_text', 'textarea', array('label' => 'mautic.email.config.webview_text', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.webview_text.tooltip'), 'required' => false, 'data' => array_key_exists('webview_text', $options['data']) && !empty($options['data']['webview_text']) ? $options['data']['webview_text'] : $this->factory->getTranslator()->trans('mautic.email.webview.text', array('%link%' => '|URL|'))));
$builder->add('unsubscribe_message', 'textarea', array('label' => 'mautic.email.config.unsubscribe_message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.unsubscribe_message.tooltip'), 'required' => false, 'data' => array_key_exists('unsubscribe_message', $options['data']) && !empty($options['data']['unsubscribe_message']) ? $options['data']['unsubscribe_message'] : $this->factory->getTranslator()->trans('mautic.email.unsubscribed.success', array('%resubscribeUrl%' => '|URL|', '%email%' => '|EMAIL|'))));
$builder->add('resubscribe_message', 'textarea', array('label' => 'mautic.email.config.resubscribe_message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.resubscribe_message.tooltip'), 'required' => false, 'data' => array_key_exists('resubscribe_message', $options['data']) && !empty($options['data']['resubscribe_message']) ? $options['data']['resubscribe_message'] : $this->factory->getTranslator()->trans('mautic.email.resubscribed.success', array('%unsubscribeUrl%' => '|URL|', '%email%' => '|EMAIL|'))));
$builder->add('mailer_from_name', 'text', array('label' => 'mautic.email.config.mailer.from.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.from.name.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.value.required')))));
$builder->add('mailer_from_email', 'text', array('label' => 'mautic.email.config.mailer.from.email', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.from.email.tooltip'), 'constraints' => array(new NotBlank(array('message' => 'mautic.core.email.required')), new Email(array('message' => 'mautic.core.email.required')))));
$builder->add('mailer_return_path', 'text', array('label' => 'mautic.email.config.mailer.return.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.return.path.tooltip'), 'required' => false));
$builder->add('mailer_transport', 'choice', array('choices' => array('mail' => 'mautic.email.config.mailer_transport.mail', 'mautic.transport.mandrill' => 'mautic.email.config.mailer_transport.mandrill', 'mautic.transport.sendgrid' => 'mautic.email.config.mailer_transport.sendgrid', 'mautic.transport.amazon' => 'mautic.email.config.mailer_transport.amazon', 'mautic.transport.postmark' => 'mautic.email.config.mailer_transport.postmark', 'gmail' => 'mautic.email.config.mailer_transport.gmail', 'sendmail' => 'mautic.email.config.mailer_transport.sendmail', 'smtp' => 'mautic.email.config.mailer_transport.smtp'), 'label' => 'mautic.email.config.mailer.transport', 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.transport.tooltip'), 'empty_value' => false));
$smtpServiceShowConditions = '{"config_emailconfig_mailer_transport":["smtp"]}';
$builder->add('mailer_host', 'text', array('label' => 'mautic.email.config.mailer.host', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.host.tooltip'), 'required' => false));
$builder->add('mailer_port', 'text', array('label' => 'mautic.email.config.mailer.port', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.port.tooltip'), 'required' => false));
$mailerLoginShowConditions = '{
"config_emailconfig_mailer_auth_mode":[
"plain",
"login",
"cram-md5"
], "config_emailconfig_mailer_transport":[
"mautic.transport.mandrill",
"mautic.transport.sendgrid",
"mautic.transport.amazon",
"mautic.transport.postmark",
"gmail"
]
}';
$mailerLoginHideConditions = '{
"config_emailconfig_mailer_transport":[
"mail",
"sendmail"
]
}';
$builder->add('mailer_auth_mode', 'choice', array('choices' => array('plain' => 'mautic.email.config.mailer_auth_mode.plain', 'login' => 'mautic.email.config.mailer_auth_mode.login', 'cram-md5' => 'mautic.email.config.mailer_auth_mode.cram-md5'), 'label' => 'mautic.email.config.mailer.auth.mode', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.auth.mode.tooltip'), 'empty_value' => 'mautic.email.config.mailer_auth_mode.none'));
$builder->add('mailer_user', 'text', array('label' => 'mautic.email.config.mailer.user', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-show-on' => $mailerLoginShowConditions, 'data-hide-on' => $mailerLoginHideConditions, 'tooltip' => 'mautic.email.config.mailer.user.tooltip', 'autocomplete' => 'off'), 'required' => false));
$builder->add('mailer_password', 'password', array('label' => 'mautic.email.config.mailer.password', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'placeholder' => 'mautic.user.user.form.passwordplaceholder', 'preaddon' => 'fa fa-lock', 'data-show-on' => $mailerLoginShowConditions, 'data-hide-on' => $mailerLoginHideConditions, 'tooltip' => 'mautic.email.config.mailer.password.tooltip', 'autocomplete' => 'off'), 'required' => false));
$builder->add('mailer_encryption', 'choice', array('choices' => array('ssl' => 'mautic.email.config.mailer_encryption.ssl', 'tls' => 'mautic.email.config.mailer_encryption.tls'), 'label' => 'mautic.email.config.mailer.encryption', 'required' => false, 'attr' => array('class' => 'form-control', 'data-show-on' => $smtpServiceShowConditions, 'tooltip' => 'mautic.email.config.mailer.encryption.tooltip'), 'empty_value' => 'mautic.email.config.mailer_encryption.none'));
$builder->add('mailer_test_connection_button', 'standalone_button', array('label' => 'mautic.email.config.mailer.transport.test_connection', 'required' => false, 'attr' => array('class' => 'btn btn-success', 'onclick' => 'Mautic.testEmailServerConnection()')));
$builder->add('mailer_test_send_button', 'standalone_button', array('label' => 'mautic.email.config.mailer.transport.test_send', 'required' => false, 'attr' => array('class' => 'btn btn-info', 'onclick' => 'Mautic.testEmailServerConnection(true)')));
$spoolConditions = '{"config_emailconfig_mailer_spool_type":["memory"]}';
$builder->add('mailer_spool_type', 'choice', array('choices' => array('memory' => 'mautic.email.config.mailer_spool_type.memory', 'file' => 'mautic.email.config.mailer_spool_type.file'), 'label' => 'mautic.email.config.mailer.spool.type', 'label_attr' => array('class' => 'control-label'), 'required' => false, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.email.config.mailer.spool.type.tooltip'), 'empty_value' => false));
$builder->add('mailer_spool_path', 'text', array('label' => 'mautic.email.config.mailer.spool.path', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.path.tooltip'), 'required' => false));
$builder->add('mailer_spool_msg_limit', 'text', array('label' => 'mautic.email.config.mailer.spool.msg.limit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.msg.limit.tooltip'), 'required' => false));
$builder->add('mailer_spool_time_limit', 'text', array('label' => 'mautic.email.config.mailer.spool.time.limit', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.time.limit.tooltip'), 'required' => false));
$builder->add('mailer_spool_recover_timeout', 'text', array('label' => 'mautic.email.config.mailer.spool.recover.timeout', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.recover.timeout.tooltip'), 'required' => false));
$builder->add('mailer_spool_clear_timeout', 'text', array('label' => 'mautic.email.config.mailer.spool.clear.timeout', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-hide-on' => $spoolConditions, 'tooltip' => 'mautic.email.config.mailer.spool.clear.timeout.tooltip'), 'required' => false));
$builder->add('monitored_email', 'monitored_email', array('label' => false, 'data' => array_key_exists('monitored_email', $options['data']) ? $options['data']['monitored_email'] : array(), 'required' => false));
}
示例12: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->em = $factory->getEntityManager();
$this->security = $factory->getSecurity();
$this->dispatcher = $factory->getDispatcher();
$this->translator = $factory->getTranslator();
$this->factory = $factory;
}
示例13: __construct
/**
* @param MauticFactory $factory
*
* @throws \RuntimeException if the mcrypt extension is not enabled
*/
public function __construct(MauticFactory $factory)
{
// Toss an Exception back if mcrypt is not found
if (!extension_loaded('mcrypt')) {
throw new \RuntimeException($factory->getTranslator()->trans('mautic.core.error.no.mcrypt'));
}
$this->key = $factory->getParameter('secret_key');
}
示例14: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->em = $factory->getEntityManager();
$this->model = $factory->getModel('page');
$this->canViewOther = $factory->getSecurity()->isGranted('page:pages:viewother');
$this->user = $factory->getUser();
}
示例15: handleCallbackResponse
/**
* Handle bounces & complaints from Amazon.
*
* @param Request $request
* @param MauticFactory $factory
*
* @return mixed
*/
public function handleCallbackResponse(Request $request, MauticFactory $factory)
{
$translator = $factory->getTranslator();
$logger = $factory->getLogger();
$logger->debug('Receiving webhook from Amazon');
$payload = json_decode($request->getContent(), true);
return $this->processJsonPayload($payload, $logger, $translator);
}