当前位置: 首页>>代码示例>>PHP>>正文


PHP MauticFactory::getDispatcher方法代码示例

本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getDispatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getDispatcher方法的具体用法?PHP MauticFactory::getDispatcher怎么用?PHP MauticFactory::getDispatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mautic\CoreBundle\Factory\MauticFactory的用法示例。


在下文中一共展示了MauticFactory::getDispatcher方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Load each bundles routing.php file
  *
  * @param mixed $resource
  * @param null  $type
  *
  * @return RouteCollection
  * @throws \RuntimeException
  */
 public function load($resource, $type = null)
 {
     if (true === $this->loaded) {
         throw new \RuntimeException('Do not add the "mautic" loader twice');
     }
     $dispatcher = $this->factory->getDispatcher();
     // Public
     $event = new RouteEvent($this, 'public');
     $dispatcher->dispatch(CoreEvents::BUILD_ROUTE, $event);
     $collection = $event->getCollection();
     // Force all links to be SSL if the site_url parameter is SSL
     $siteUrl = $this->factory->getParameter('site_url');
     $forceSSL = false;
     if (!empty($siteUrl)) {
         $parts = parse_url($siteUrl);
         $forceSSL = !empty($parts['scheme']) && $parts['scheme'] == 'https';
     }
     if ($forceSSL) {
         $collection->setSchemes('https');
     }
     // Secured area - Default
     $event = new RouteEvent($this);
     $dispatcher->dispatch(CoreEvents::BUILD_ROUTE, $event);
     $secureCollection = $event->getCollection();
     // OneupUploader (added behind our secure /s)
     $secureCollection->addCollection($this->import('.', 'uploader'));
     if ($this->factory->getParameter('api_enabled')) {
         //API
         $event = new RouteEvent($this, 'api');
         $dispatcher->dispatch(CoreEvents::BUILD_ROUTE, $event);
         $apiCollection = $event->getCollection();
         $apiCollection->addPrefix('/api');
         if ($forceSSL) {
             $apiCollection->setSchemes('https');
         }
         $collection->addCollection($apiCollection);
     }
     $secureCollection->addPrefix('/s');
     if ($forceSSL) {
         $secureCollection->setSchemes('https');
     }
     $collection->addCollection($secureCollection);
     // Catch all
     $event = new RouteEvent($this, 'catchall');
     $dispatcher->dispatch(CoreEvents::BUILD_ROUTE, $event);
     $lastCollection = $event->getCollection();
     if ($forceSSL) {
         $lastCollection->setSchemes('https');
     }
     $collection->addCollection($lastCollection);
     $this->loaded = true;
     return $collection;
 }
开发者ID:woakes070048,项目名称:mautic,代码行数:62,代码来源:RouteLoader.php

示例2: logout

 /**
  * {@inheritdoc}
  *
  * @param Request $request
  *
  * @return Response never null
  */
 public function logout(Request $request, Response $response, TokenInterface $token)
 {
     /** @var \Mautic\UserBundle\Model\UserModel $userModel */
     $userModel = $this->factory->getModel('user');
     $userModel->setOnlineStatus('offline');
     $dispatcher = $this->factory->getDispatcher();
     if ($dispatcher->hasListeners(UserEvents::USER_LOGOUT)) {
         $event = new LogoutEvent($this->factory);
         $dispatcher->dispatch(UserEvents::USER_LOGOUT, $event);
     }
     // Clear session
     $this->factory->getSession()->clear();
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:20,代码来源:LogoutHandler.php

示例3: __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

示例4: __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;
 }
开发者ID:Jandersolutions,项目名称:mautic,代码行数:11,代码来源:CommonModel.php

示例5: dispatchSendEvent

 /**
  * Dispatch send event to generate tokens
  *
  * @return array
  */
 public function dispatchSendEvent()
 {
     if ($this->dispatcher == null) {
         $this->dispatcher = $this->factory->getDispatcher();
     }
     $event = new EmailSendEvent($this);
     $this->dispatcher->dispatch(EmailEvents::EMAIL_ON_SEND, $event);
     $this->eventTokens = array_merge($this->eventTokens, $event->getTokens());
 }
开发者ID:emtudo,项目名称:mautic,代码行数:14,代码来源:MailHelper.php

示例6: buildForm

 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (function_exists('imap_open')) {
         $data = $options['data'];
         $event = new MonitoredEmailEvent($builder, $data);
         // Default email bundles
         $event->addFolder('general', '', 'mautic.email.config.monitored_email.general');
         $event->addFolder('EmailBundle', 'bounces', 'mautic.email.config.monitored_email.bounce_folder');
         $event->addFolder('EmailBundle', 'unsubscribes', 'mautic.email.config.monitored_email.unsubscribe_folder');
         if ($this->factory->getDispatcher()->hasListeners(EmailEvents::MONITORED_EMAIL_CONFIG)) {
             $this->factory->getDispatcher()->dispatch(EmailEvents::MONITORED_EMAIL_CONFIG, $event);
         }
         $folderSettings = $event->getFolders();
         foreach ($folderSettings as $key => $settings) {
             $folderData = array_key_exists($key, $data) ? $data[$key] : [];
             $builder->add($key, 'monitored_mailboxes', ['label' => $settings['label'], 'mailbox' => $key, 'default_folder' => $settings['default'], 'data' => $folderData, 'required' => false, 'general_settings' => array_key_exists('general', $data) ? $data['general'] : []]);
         }
     }
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:23,代码来源:ConfigMonitoredEmailType.php

示例7: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->templating = $factory->getTemplating();
     $this->request = $factory->getRequest();
     $this->security = $factory->getSecurity();
     $this->serializer = $factory->getSerializer();
     $this->params = $factory->getSystemParameters();
     $this->dispatcher = $factory->getDispatcher();
     $this->translator = $factory->getTranslator();
     $this->init();
 }
开发者ID:HomeRefill,项目名称:mautic,代码行数:15,代码来源:CommonSubscriber.php

示例8: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->translator = $factory->getTranslator();
     $this->dispatcher = $factory->getDispatcher();
 }
开发者ID:dongilbert,项目名称:mautic,代码行数:8,代码来源:CategoryBundlesType.php

示例9: __construct

 /**
  * @param MauticFactory $factory
  */
 public function __construct(MauticFactory $factory)
 {
     $this->factory = $factory;
     $this->dispatcher = $factory->getDispatcher();
     $this->init();
 }
开发者ID:Yame-,项目名称:mautic,代码行数:9,代码来源:AbstractIntegration.php

示例10: dispatchIntegrationKeyEvent

 /**
  * @param       $eventName
  * @param array $keys
  *
  * @return array
  */
 protected function dispatchIntegrationKeyEvent($eventName, $keys = array())
 {
     /** @var PluginIntegrationKeyEvent $event */
     $event = $this->factory->getDispatcher()->dispatch($eventName, new PluginIntegrationKeyEvent($this, $keys));
     return $event->getKeys();
 }
开发者ID:HomeRefill,项目名称:mautic,代码行数:12,代码来源:AbstractIntegration.php

示例11: 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


注:本文中的Mautic\CoreBundle\Factory\MauticFactory::getDispatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。