本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory类的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory类的具体用法?PHP MauticFactory怎么用?PHP MauticFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MauticFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param FactoryInterface $knpFactory
* @param MatcherInterface $matcher
* @param MauticFactory $factory
*/
public function __construct(FactoryInterface $knpFactory, MatcherInterface $matcher, MauticFactory $factory)
{
$this->factory = $knpFactory;
$this->matcher = $matcher;
$this->dispatcher = $factory->getDispatcher();
$this->menuHelper = $factory->getHelper('menu');
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:12,代码来源:MenuBuilder.php
示例2: sendEmail
/**
* @param $tokens
* @param $config
* @param MauticFactory $factory
* @param Lead $lead
*/
public static function sendEmail($tokens, $config, MauticFactory $factory, Lead $lead)
{
$mailer = $factory->getMailer();
$emails = !empty($config['to']) ? explode(',', $config['to']) : array();
$mailer->setTo($emails);
$leadEmail = $lead->getEmail();
if (!empty($leadEmail)) {
// Reply to lead for user convenience
$mailer->setReplyTo($leadEmail);
}
if (!empty($config['cc'])) {
$emails = explode(',', $config['cc']);
$mailer->setCc($emails);
}
if (!empty($config['bcc'])) {
$emails = explode(',', $config['bcc']);
$mailer->setBcc($emails);
}
$mailer->setSubject($config['subject']);
$mailer->setTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send();
if ($config['copy_lead'] && !empty($leadEmail)) {
// Send copy to lead
$mailer->reset();
$mailer->setTo($leadEmail);
$mailer->setSubject($config['subject']);
$mailer->setTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send();
}
}
开发者ID:spdaly,项目名称:mautic,代码行数:40,代码来源:FormSubmitHelper.php
示例3: addRemoveLead
/**
* @param MauticFactory $factory
* @param $lead
* @param $event
*
* @throws \Doctrine\ORM\ORMException
*/
public static function addRemoveLead(MauticFactory $factory, $lead, $event)
{
/** @var \Mautic\CampaignBundle\Model\CampaignModel $campaignModel */
$campaignModel = $factory->getModel('campaign');
$properties = $event['properties'];
$addToCampaigns = $properties['addTo'];
$removeFromCampaigns = $properties['removeFrom'];
$em = $factory->getEntityManager();
$leadsModified = false;
if (!empty($addToCampaigns)) {
foreach ($addToCampaigns as $c) {
$campaignModel->addLead($em->getReference('MauticCampaignBundle:Campaign', $c), $lead, true);
}
$leadsModified = true;
}
if (!empty($removeFromCampaigns)) {
foreach ($removeFromCampaigns as $c) {
if ($c == 'this') {
$c = $event['campaign']['id'];
}
$campaignModel->removeLead($em->getReference('MauticCampaignBundle:Campaign', $c), $lead, true);
}
$leadsModified = true;
}
return $leadsModified;
}
开发者ID:dongilbert,项目名称:mautic,代码行数:33,代码来源:CampaignEventHelper.php
示例4: __construct
/**
* @param MatcherInterface $matcher
* @param MauticFactory $factory
* @param string $charset
* @param array $defaultOptions
*/
public function __construct(MatcherInterface $matcher, MauticFactory $factory, $charset, array $defaultOptions = array())
{
$this->engine = $factory->getTemplating();
$this->matcher =& $matcher;
$this->defaultOptions = array_merge(array('depth' => null, 'matchingDepth' => null, 'currentAsLink' => true, 'currentClass' => 'active', 'ancestorClass' => 'open', 'firstClass' => 'first', 'lastClass' => 'last', 'template' => 'MauticCoreBundle:Menu:main.html.php', 'compressed' => false, 'allow_safe_labels' => false, 'clear_matcher' => true), $defaultOptions);
$this->charset = $charset;
}
开发者ID:Yame-,项目名称:mautic,代码行数:13,代码来源:MenuRenderer.php
示例5: __construct
/**
* @param MauticFactory $factory
* @param string $theme
*
* @throws BadConfigurationException
* @throws FileNotFoundException
*/
public function __construct(MauticFactory $factory, $theme = 'current')
{
$this->factory = $factory;
$this->theme = $theme == 'current' ? $factory->getParameter('theme') : $theme;
if ($this->theme == null) {
$this->theme = 'Mauve';
}
$this->themeDir = $factory->getSystemPath('themes') . '/' . $this->theme;
$this->themePath = $factory->getSystemPath('themes_root') . '/' . $this->themeDir;
//check to make sure the theme exists
if (!file_exists($this->themePath)) {
throw new FileNotFoundException($this->theme . ' not found!');
}
//get the config
if (file_exists($this->themePath . '/config.json')) {
$this->config = json_decode(file_get_contents($this->themePath . '/config.json'), true);
} elseif (file_exists($this->themePath . '/config.php')) {
$this->config = (include $this->themePath . '/config.php');
} else {
throw new BadConfigurationException($this->theme . ' is missing a required config file');
}
if (!isset($this->config['name'])) {
throw new BadConfigurationException($this->theme . ' does not have a valid config file');
}
}
开发者ID:HomeRefill,项目名称:mautic,代码行数:32,代码来源:ThemeHelper.php
示例6: 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');
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:44,代码来源:AbTestHelper.php
示例7: __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();
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:10,代码来源:CategoryListType.php
示例8: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->devMode = $factory->getEnvironment() == 'dev';
$this->imageDir = $factory->getSystemPath('images');
$this->assetHelper = $factory->getHelper('template.assets');
$this->avatarHelper = $factory->getHelper('template.avatar');
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:10,代码来源:GravatarHelper.php
示例9: sendEmailAction
/**
* @param MauticFactory $factory
* @param $lead
* @param $event
*
* @return bool|mixed
*/
public static function sendEmailAction(MauticFactory $factory, $lead, $event)
{
$emailSent = false;
if ($lead instanceof Lead) {
$fields = $lead->getFields();
/** @var \Mautic\LeadBundle\Model\LeadModel $leadModel */
$leadModel = $factory->getModel('lead');
$leadCredentials = $leadModel->flattenFields($fields);
$leadCredentials['id'] = $lead->getId();
} else {
$leadCredentials = $lead;
}
if (!empty($leadCredentials['email'])) {
/** @var \Mautic\EmailBundle\Model\EmailModel $emailModel */
$emailModel = $factory->getModel('email');
$emailId = (int) $event['properties']['email'];
$email = $emailModel->getEntity($emailId);
if ($email != null && $email->isPublished()) {
$options = array('source' => array('campaign', $event['campaign']['id']));
$emailSent = $emailModel->sendEmail($email, $leadCredentials, $options);
}
}
unset($lead, $leadCredentials, $email, $emailModel, $factory);
return $emailSent;
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:32,代码来源:CampaignEventHelper.php
示例10: sendEmail
/**
* @param $action
*
* @return array
*/
public static function sendEmail($tokens, $config, MauticFactory $factory, $lead)
{
$mailer = $factory->getMailer();
$emails = !empty($config['to']) ? explode(',', $config['to']) : array();
$fields = $lead->getFields();
$email = $fields['core']['email']['value'];
if (!empty($email)) {
if ($config['copy_lead']) {
$emails[] = $email;
}
$mailer->setReplyTo($email);
}
$mailer->setTo($emails);
if (!empty($config['cc'])) {
$emails = explode(',', $config['cc']);
$mailer->setCc($emails);
}
if (!empty($config['bcc'])) {
$emails = explode(',', $config['bcc']);
$mailer->setBcc($emails);
}
$mailer->setSubject($config['subject']);
$mailer->setTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send();
}
开发者ID:woakes070048,项目名称:mautic,代码行数:32,代码来源:FormSubmitHelper.php
示例11: __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();
}
开发者ID:Yame-,项目名称:mautic,代码行数:10,代码来源:EmailType.php
示例12: send
/**
* @param array $config
* @param Lead $lead
* @param MauticFactory $factory
*
* @return boolean
*/
public static function send(array $config, Lead $lead, MauticFactory $factory)
{
/** @var \Mautic\LeadBundle\Model\LeadModel $leadModel */
$leadModel = $factory->getModel('lead.lead');
if ($leadModel->isContactable($lead, 'sms') !== DoNotContact::IS_CONTACTABLE) {
return array('failed' => 1);
}
$leadPhoneNumber = $lead->getFieldValue('mobile');
if (empty($leadPhoneNumber)) {
$leadPhoneNumber = $lead->getFieldValue('phone');
}
if (empty($leadPhoneNumber)) {
return array('failed' => 1);
}
/** @var \Mautic\SmsBundle\Api\AbstractSmsApi $sms */
$smsApi = $factory->getKernel()->getContainer()->get('mautic.sms.api');
/** @var \Mautic\SmsBundle\Model\SmsModel $smsModel */
$smsModel = $factory->getModel('sms');
$smsId = (int) $config['sms'];
/** @var \Mautic\SmsBundle\Entity\Sms $sms */
$sms = $smsModel->getEntity($smsId);
if ($sms->getId() !== $smsId) {
return array('failed' => 1);
}
$dispatcher = $factory->getDispatcher();
$event = new SmsSendEvent($sms->getMessage(), $lead);
$event->setSmsId($smsId);
$dispatcher->dispatch(SmsEvents::SMS_ON_SEND, $event);
$metadata = $smsApi->sendSms($leadPhoneNumber, $event->getContent());
// If there was a problem sending at this point, it's an API problem and should be requeued
if ($metadata === false) {
return false;
}
return array('type' => 'mautic.sms.sms', 'status' => 'mautic.sms.timeline.status.delivered', 'id' => $sms->getId(), 'name' => $sms->getName(), 'content' => $event->getContent());
}
开发者ID:HomeRefill,项目名称:mautic,代码行数:42,代码来源:SmsHelper.php
示例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');
}
开发者ID:dongilbert,项目名称:mautic,代码行数:13,代码来源:EncryptionHelper.php
示例14: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->factory = $factory;
$this->cacheDir = $factory->getSystemPath('cache', true);
$this->env = $factory->getEnvironment();
$this->configFile = $this->factory->getLocalConfigFile(false);
$this->containerFile = $this->factory->getKernel()->getContainerFile();
}
开发者ID:HomeRefill,项目名称:mautic,代码行数:11,代码来源:CacheHelper.php
示例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);
}
开发者ID:dongilbert,项目名称:mautic,代码行数:16,代码来源:AmazonTransport.php
示例16: updateTags
/**
* @param Lead $lead
* @param $config
* @param MauticFactory $factory
*
* @return bool
*/
public static function updateTags(Lead $lead, $config, MauticFactory $factory)
{
/** @var \Mautic\LeadBundle\Model\LeadModel $leadModel */
$leadModel = $factory->getModel('lead');
$addTags = !empty($config['add_tags']) ? $config['add_tags'] : array();
$removeTags = !empty($config['remove_tags']) ? $config['remove_tags'] : array();
$leadModel->modifyTags($lead, $addTags, $removeTags);
return true;
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:16,代码来源:EventHelper.php
示例17: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$choices = $factory->getModel('user')->getRepository()->getEntities(array('filter' => array('force' => array(array('column' => 'u.isPublished', 'expr' => 'eq', 'value' => true)))));
foreach ($choices as $choice) {
$this->choices[$choice->getId()] = $choice->getName(true);
}
//sort by language
ksort($this->choices);
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:12,代码来源:UserListType.php
示例18: __construct
/**
* DynamicContentFilterEntryFiltersType constructor.
*
* @param MauticFactory $factory
* @param ListModel $listModel
*/
public function __construct(MauticFactory $factory, ListModel $listModel)
{
$operatorChoices = $listModel->getFilterExpressionFunctions();
foreach ($operatorChoices as $key => $value) {
if (empty($value['hide'])) {
$this->operatorChoices[$key] = $value['label'];
}
}
$this->translator = $factory->getTranslator();
}
开发者ID:dongilbert,项目名称:mautic,代码行数:16,代码来源:DynamicContentFilterEntryFiltersType.php
示例19: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$viewOther = $factory->getSecurity()->isGranted('asset:assets:viewother');
$choices = $factory->getModel('asset')->getRepository()->getAssetList('', 0, 0, $viewOther);
foreach ($choices as $asset) {
$this->choices[$asset['language']][$asset['id']] = $asset['title'];
}
//sort by language
ksort($this->choices);
}
开发者ID:Jandersolutions,项目名称:mautic,代码行数:13,代码来源:AssetListType.php
示例20: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
/** @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper */
$integrationHelper = $this->factory->getHelper('integration');
$integrationObjects = $integrationHelper->getIntegrationObjects(null, $options['supported_features'], true);
$integrations = ['' => ''];
foreach ($integrationObjects as $name => $object) {
$settings = $object->getIntegrationSettings();
if ($settings->isPublished()) {
if (!isset($integrations[$settings->getPlugin()->getName()])) {
$integrations[$settings->getPlugin()->getName()] = [];
}
$integrations[$settings->getPlugin()->getName()][$object->getName()] = $object->getDisplayName();
}
}
$builder->add('integration', 'choice', ['choices' => $integrations, 'expanded' => false, 'label_attr' => ['class' => 'control-label'], 'multiple' => false, 'label' => 'mautic.integration.integration', 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.integration.integration.tooltip', 'onchange' => 'Mautic.getIntegrationConfig(this);'], 'required' => true, 'constraints' => [new NotBlank(['message' => 'mautic.core.value.required'])]]);
$formModifier = function (FormInterface $form, $data) use($integrationObjects) {
$form->add('config', 'integration_config', ['label' => false, 'attr' => ['class' => 'integration-config-container'], 'integration' => isset($integrationObjects[$data['integration']]) ? $integrationObjects[$data['integration']] : null, 'data' => isset($data['config']) ? $data['config'] : []]);
};
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($formModifier) {
$data = $event->getData();
$formModifier($event->getForm(), $data);
});
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use($formModifier) {
$data = $event->getData();
$formModifier($event->getForm(), $data);
});
}
开发者ID:Yame-,项目名称:mautic,代码行数:31,代码来源:IntegrationsListType.php
注:本文中的Mautic\CoreBundle\Factory\MauticFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论