Skip to content

Commit

Permalink
Marketing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhartless committed Feb 1, 2017
1 parent 96acd70 commit c90f59d
Show file tree
Hide file tree
Showing 315 changed files with 30,389 additions and 18,218 deletions.
7 changes: 7 additions & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ public function registerBundles()
new Mautic\CalendarBundle\MauticCalendarBundle(),
new Mautic\CampaignBundle\MauticCampaignBundle(),
new Mautic\CategoryBundle\MauticCategoryBundle(),
new Mautic\ChannelBundle\MauticChannelBundle(),
new Mautic\ConfigBundle\MauticConfigBundle(),
new Mautic\CoreBundle\MauticCoreBundle(),
new Mautic\DashboardBundle\MauticDashboardBundle(),
Expand Down Expand Up @@ -198,6 +199,12 @@ public function registerBundles()
$plugin = new $class();

if ($plugin instanceof \Symfony\Component\HttpKernel\Bundle\Bundle) {
if (defined($class.'::MINIMUM_MAUTIC_VERSION')) {
// Check if this version supports the plugin before loading it
if (version_compare($this->getVersion(), constant($class.'::MINIMUM_MAUTIC_VERSION'), 'lt')) {
continue;
}
}
$bundles[] = $plugin;
}

Expand Down
27 changes: 14 additions & 13 deletions app/bundles/ApiBundle/Controller/CommonApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class CommonApiController extends FOSRestController implements MauticController
*/
protected $customSelectRequested = false;

/**
* @var array
*/
protected $dataInputMasks = [];

/**
* @var EventDispatcherInterface
*/
Expand All @@ -78,11 +83,6 @@ class CommonApiController extends FOSRestController implements MauticController
*/
protected $entityNameOne;

/**
* @var MauticFactory
*/
protected $factory;

/**
* Custom JMS strategies to add to the view's context.
*
Expand All @@ -97,6 +97,11 @@ class CommonApiController extends FOSRestController implements MauticController
*/
protected $extraGetEntitiesArguments = [];

/**
* @var MauticFactory
*/
protected $factory;

/**
* @var bool
*/
Expand Down Expand Up @@ -160,11 +165,6 @@ class CommonApiController extends FOSRestController implements MauticController
*/
protected $user;

/**
* @var array
*/
protected $dataInputMasks = [];

/**
* Delete a batch of entities.
*
Expand Down Expand Up @@ -495,7 +495,7 @@ public function getFormErrorMessage(array $formErrors)
*
* @return array
*/
public function getFormErrorMessages(\Symfony\Component\Form\Form $form)
public function getFormErrorMessages(Form $form)
{
$errors = [];

Expand Down Expand Up @@ -1114,7 +1114,7 @@ protected function processForm($entity, $parameters = null, $method = 'PUT')
$msg = $this->getFormErrorMessage($formErrors);

if (!$msg) {
$msg = 'Request data are not valid';
$msg = $this->translator->trans('mautic.core.error.badrequest', [], 'flashes');
}

return $this->returnError($msg, Codes::HTTP_BAD_REQUEST, $formErrors);
Expand Down Expand Up @@ -1163,7 +1163,8 @@ protected function returnError($msg, $code = Codes::HTTP_OK, $details = [])
'code' => $code,
'details' => $details,
],
]
],
$code
);

return $this->handleView($view);
Expand Down
48 changes: 34 additions & 14 deletions app/bundles/ApiBundle/Serializer/Driver/ApiMetadataDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public function createProperty($name)
*/
public function addProperty($name, $serializedName = null, $useGetter = false)
{
if (empty($name)) {
return $this;
}

$this->createProperty($name);

if ($useGetter && !$this->properties[$name]->getter) {
Expand Down Expand Up @@ -173,14 +177,16 @@ public function addProperty($name, $serializedName = null, $useGetter = false)
public function addProperties(array $properties, $addToListGroup = false, $useGetter = false)
{
foreach ($properties as $prop) {
$serializedName = null;
if (is_array($prop)) {
list($prop, $serializedName) = $prop;
}
$this->addProperty($prop, $serializedName, $useGetter);

if ($addToListGroup) {
$this->inListGroup();
if (!empty($prop)) {
$serializedName = null;
if (is_array($prop)) {
list($prop, $serializedName) = $prop;
}
$this->addProperty($prop, $serializedName, $useGetter);

if ($addToListGroup) {
$this->inListGroup();
}
}
}

Expand Down Expand Up @@ -210,7 +216,7 @@ public function addListProperties(array $properties)
public function setSinceVersion($version, $property = null)
{
if ($property === null) {
$property = $this->currentPropertyName;
$property = $this->getCurrentPropertyName();
}

$this->properties[$property]->sinceVersion = $version;
Expand All @@ -227,7 +233,7 @@ public function setSinceVersion($version, $property = null)
public function setUntilVersion($version, $property = null)
{
if ($property === null) {
$property = $this->currentPropertyName;
$property = $this->getCurrentPropertyName();
}

$this->properties[$property]->untilVersion = $version;
Expand All @@ -244,7 +250,7 @@ public function setUntilVersion($version, $property = null)
public function setSerializedName($name, $property = null)
{
if ($property === null) {
$property = $this->currentPropertyName;
$property = $this->getCurrentPropertyName();
}

$this->properties[$property]->serializedName = $name;
Expand All @@ -267,7 +273,7 @@ public function setGroups($groups, $property = null)
}

if ($property === null) {
$property = $this->currentPropertyName;
$property = $this->getCurrentPropertyName();
}

$this->properties[$property]->groups = $groups;
Expand All @@ -291,7 +297,7 @@ public function addGroup($group, $property = null)
}
} else {
if ($property === null) {
$property = $this->currentPropertyName;
$property = $this->getCurrentPropertyName();
}

$this->properties[$property]->groups[] = $group;
Expand Down Expand Up @@ -324,7 +330,7 @@ public function inListGroup()
public function setMaxDepth($depth, $property = null)
{
if ($property === null) {
$property = $this->currentPropertyName;
$property = $this->getCurrentPropertyName();
}

$this->properties[$property]->maxDepth = (int) $depth;
Expand All @@ -344,4 +350,18 @@ public function build()
$this->currentPropertyName = null;
$this->properties = [];
}

/**
* @return string
*
* @throws \Exception
*/
protected function getCurrentPropertyName()
{
if (empty($this->currentPropertyName)) {
throw new \Exception('Current property is not set');
}

return $this->currentPropertyName;
}
}
4 changes: 0 additions & 4 deletions app/bundles/AssetBundle/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
return [
'routes' => [
'main' => [
'mautic_asset_buildertoken_index' => [
'path' => '/asset/buildertokens/{page}',
'controller' => 'MauticAssetBundle:SubscribedEvents\BuilderToken:index',
],
'mautic_asset_index' => [
'path' => '/assets/{page}',
'controller' => 'MauticAssetBundle:Asset:index',
Expand Down

This file was deleted.

15 changes: 0 additions & 15 deletions app/bundles/AssetBundle/EventListener/BuilderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ public static function getSubscribedEvents()
*/
public function onBuilderBuild(BuilderEvent $event)
{
if ($event->tokenSectionsRequested()) {
$this->addTokenSections($event);
}

if ($event->tokensRequested($this->assetToken)) {
$tokenHelper = new BuilderTokenHelper($this->factory, 'asset');

$event->addTokensFromHelper($tokenHelper, $this->assetToken, 'title', 'id', false, true);
}
}
Expand Down Expand Up @@ -111,16 +106,6 @@ public function onPageDisplay(PageDisplayEvent $event)
$event->setContent($content);
}

/**
* @param $event
*/
private function addTokenSections($event)
{
//add email tokens
$tokenHelper = new BuilderTokenHelper($this->factory, 'asset');
$event->addTokenSection('asset.emailtokens', 'mautic.asset.assets', $tokenHelper->getTokenContent(), -255);
}

/**
* @param $event
* @param $leadId
Expand Down
10 changes: 6 additions & 4 deletions app/bundles/AssetBundle/EventListener/CampaignSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ public static function getSubscribedEvents()
public function onCampaignBuild(CampaignBuilderEvent $event)
{
$trigger = [
'label' => 'mautic.asset.campaign.event.download',
'description' => 'mautic.asset.campaign.event.download_descr',
'eventName' => AssetEvents::ON_CAMPAIGN_TRIGGER_DECISION,
'formType' => 'campaignevent_assetdownload',
'label' => 'mautic.asset.campaign.event.download',
'description' => 'mautic.asset.campaign.event.download_descr',
'eventName' => AssetEvents::ON_CAMPAIGN_TRIGGER_DECISION,
'formType' => 'campaignevent_assetdownload',
'channel' => 'asset',
'channelIdField' => 'assets',
];

$event->addDecision('asset.download', $trigger);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit c90f59d

Please # to comment.