From 0ab17e97eb4c8742a31ce4005c9568244f69c695 Mon Sep 17 00:00:00 2001 From: Alan Hartless Date: Sat, 1 Aug 2015 12:22:37 -0500 Subject: [PATCH] Converting "addon" to "plugin" --- .htaccess | 2 +- app/AppKernel.php | 26 +- .../AddonBundle/Bundle/AddonBundleBase.php | 67 ----- app/bundles/AddonBundle/Config/config.php | 105 -------- .../Controller/AddonController.php | 255 ------------------ .../AddonBundle/Views/Addon/index.html.php | 40 --- .../AddonBundle/Views/Addon/list.html.php | 91 ------- .../AssetBundle/Controller/AjaxController.php | 4 +- .../Controller/AssetController.php | 6 +- .../Event/RemoteAssetBrowseEvent.php | 2 +- .../AssetBundle/Views/Remote/browse.html.php | 2 +- .../AssetBundle/Views/Remote/list.html.php | 2 +- .../Command/PullTransifexCommand.php | 4 +- .../Command/PushTransifexCommand.php | 4 +- .../CoreBundle/Controller/AjaxController.php | 8 +- .../MauticCoreExtension.php | 6 +- .../EventListener/CommonSubscriber.php | 4 +- .../CoreBundle/Factory/MauticFactory.php | 24 +- app/bundles/CoreBundle/Helper/CacheHelper.php | 4 +- .../Security/Permissions/CorePermissions.php | 22 +- .../Templating/TemplateReference.php | 4 +- .../LeadBundle/Controller/AjaxController.php | 6 +- .../LeadBundle/Controller/LeadController.php | 2 +- .../Form/Type/UpdateLeadActionType.php | 2 +- app/bundles/PageBundle/Config/config.php | 2 +- .../Assets/css/plugin.css} | 0 .../Assets/img/generic.png | Bin .../Assets/js/plugin.js} | 2 +- .../PluginBundle/Bundle/PluginBundleBase.php | 41 +++ app/bundles/PluginBundle/Config/config.php | 98 +++++++ .../Controller/AjaxController.php | 26 +- .../Controller/AuthController.php | 6 +- .../Controller/IntegrationController.php | 64 ++--- .../Controller/PluginController.php | 176 ++++++++++++ .../Entity/Integration.php | 20 +- .../Entity/IntegrationRepository.php | 2 +- .../Entity/Plugin.php} | 12 +- .../Entity/PluginRepository.php} | 10 +- .../EventListener/CampaignSubscriber.php | 10 +- .../EventListener/FormSubscriber.php | 14 +- .../EventListener/PointSubscriber.php | 12 +- .../Exception/ApiErrorException.php | 2 +- .../Form/Type/DetailsType.php | 6 +- .../Form/Type/FeatureSettingsType.php | 4 +- .../Form/Type/FieldsType.php | 2 +- .../Form/Type/IntegrationConfigType.php | 4 +- .../Form/Type/IntegrationsListType.php | 16 +- .../Form/Type/KeysType.php | 2 +- .../Helper/AddonHelper.php | 16 +- .../Helper/EventHelper.php | 6 +- .../Helper/IntegrationHelper.php | 74 ++--- .../Helper/oAuthHelper.php | 6 +- .../Integration/AbstractIntegration.php | 10 +- .../MauticPluginBundle.php} | 6 +- .../Model/AddonModel.php | 12 +- .../Permissions/PluginPermissions.php} | 8 +- .../Translations/en_US/flashes.ini | 4 +- .../Translations/en_US/messages.ini | 30 +-- .../Views/Auth/auth.html.php | 0 .../Views/Auth/postauth.html.php | 0 ...ls_featureSettings_leadFields_row.html.php | 0 ...ation_details_featureSettings_row.html.php | 0 ...ion_details_supportedFeatures_row.html.php | 0 .../integration_fields_row.html.php | 0 .../Views/Integration/form.html.php | 6 +- .../Views/Integration/grid.html.php | 8 +- .../Views/Integration/index.html.php | 10 +- app/config/config.php | 26 +- app/config/parameters.php | 6 +- app/config/paths.php | 2 +- composer.json | 2 +- .../Assets/img/rackspace.png | Bin .../Config/config.php | 6 +- .../RemoteAssetBrowseSubscriber.php | 4 +- .../Form/Type/OpenStackType.php | 2 +- .../Form/Type/RackspaceType.php | 2 +- .../Integration/AmazonS3Integration.php | 2 +- .../Integration/CloudStorageIntegration.php | 4 +- .../Integration/OpenStackIntegration.php | 2 +- .../Integration/RackspaceIntegration.php | 2 +- .../MauticCloudStorageBundle.php | 6 +- .../Translations/en_US/messages.ini | 0 .../MauticCrmBundle/Api/CrmApi.php | 4 +- .../MauticCrmBundle/Api/SalesforceApi.php | 4 +- .../MauticCrmBundle/Api/SugarcrmApi.php | 6 +- .../MauticCrmBundle/Api/VtigerApi.php | 4 +- .../MauticCrmBundle/Api/ZohoApi.php | 4 +- .../MauticCrmBundle/Assets/img/cobalt.png | Bin .../MauticCrmBundle/Assets/img/salesforce.png | Bin .../MauticCrmBundle/Assets/img/sugarcrm.png | Bin .../MauticCrmBundle/Assets/img/vtiger.png | Bin .../MauticCrmBundle/Assets/img/zoho.png | Bin .../MauticCrmBundle/Config/config.php | 0 .../Integration/CrmAbstractIntegration.php | 10 +- .../Integration/SalesforceIntegration.php | 2 +- .../Integration/SugarcrmIntegration.php | 4 +- .../Integration/VtigerIntegration.php | 2 +- .../Integration/ZohoIntegration.php | 2 +- .../MauticCrmBundle/MauticCrmBundle.php | 8 +- .../Translations/en_US/messages.ini | 0 .../Views/Form/config.html.php | 0 .../Api/ConstantContactApi.php | 4 +- .../Api/EmailMarketingApi.php | 4 +- .../Api/IcontactApi.php | 4 +- .../Api/MailchimpApi.php | 7 +- .../Assets/img/constantcontact.png | Bin .../Assets/img/icontact.png | Bin .../Assets/img/mailchimp.png | Bin .../Config/config.php | 6 +- .../Form/Type/ConstantContactType.php | 8 +- .../Form/Type/IcontactType.php | 8 +- .../Form/Type/MailchimpType.php | 8 +- .../ConstantContactIntegration.php | 2 +- .../Integration/EmailAbstractIntegration.php | 8 +- .../Integration/IcontactIntegration.php | 2 +- .../Integration/MailchimpIntegration.php | 2 +- .../MauticEmailMarketingBundle.php | 8 +- .../Translations/en_US/messages.ini | 0 ...mailmarketing_constantcontact_row.html.php | 0 .../emailmarketing_icontact_row.html.php | 0 .../emailmarketing_mailchimp_row.html.php | 0 .../Assets/img/facebook.png | Bin .../Assets/img/foursquare.png | Bin .../Assets/img/googleplus.png | Bin .../Assets/img/instagram.png | Bin .../Assets/img/linkedin.png | Bin .../MauticSocialBundle/Assets/img/twitter.png | Bin .../MauticSocialBundle/Config/config.php | 8 +- .../Form/Type/FacebookType.php | 2 +- .../Form/Type/GooglePlusType.php | 2 +- .../Form/Type/LinkedInType.php | 2 +- .../Form/Type/TwitterType.php | 2 +- .../Integration/FacebookIntegration.php | 2 +- .../Integration/FoursquareIntegration.php | 2 +- .../Integration/GooglePlusIntegration.php | 2 +- .../Integration/InstagramIntegration.php | 2 +- .../Integration/LinkedInIntegration.php | 2 +- .../Integration/SocialIntegration.php | 4 +- .../Integration/TwitterIntegration.php | 6 +- .../MauticSocialBundle/MauticSocialBundle.php | 6 +- .../Translations/en_US/messages.ini | 0 .../Views/Integration/Facebook/share.html.php | 0 .../Integration/GooglePlus/share.html.php | 0 .../Views/Integration/LinkedIn/share.html.php | 0 .../Views/Integration/Twitter/share.html.php | 0 {addons => plugins}/index.html | 0 robots.txt | 1 + upgrade.php | 14 +- 148 files changed, 714 insertions(+), 949 deletions(-) delete mode 100644 app/bundles/AddonBundle/Bundle/AddonBundleBase.php delete mode 100644 app/bundles/AddonBundle/Config/config.php delete mode 100644 app/bundles/AddonBundle/Controller/AddonController.php delete mode 100644 app/bundles/AddonBundle/Views/Addon/index.html.php delete mode 100644 app/bundles/AddonBundle/Views/Addon/list.html.php rename app/bundles/{AddonBundle/Assets/css/addon.css => PluginBundle/Assets/css/plugin.css} (100%) rename app/bundles/{AddonBundle => PluginBundle}/Assets/img/generic.png (100%) rename app/bundles/{AddonBundle/Assets/js/addon.js => PluginBundle/Assets/js/plugin.js} (99%) create mode 100644 app/bundles/PluginBundle/Bundle/PluginBundleBase.php create mode 100644 app/bundles/PluginBundle/Config/config.php rename app/bundles/{AddonBundle => PluginBundle}/Controller/AjaxController.php (84%) rename app/bundles/{AddonBundle => PluginBundle}/Controller/AuthController.php (93%) rename app/bundles/{AddonBundle => PluginBundle}/Controller/IntegrationController.php (77%) create mode 100644 app/bundles/PluginBundle/Controller/PluginController.php rename app/bundles/{AddonBundle => PluginBundle}/Entity/Integration.php (84%) rename app/bundles/{AddonBundle => PluginBundle}/Entity/IntegrationRepository.php (95%) rename app/bundles/{AddonBundle/Entity/Addon.php => PluginBundle/Entity/Plugin.php} (93%) rename app/bundles/{AddonBundle/Entity/AddonRepository.php => PluginBundle/Entity/PluginRepository.php} (89%) rename app/bundles/{AddonBundle => PluginBundle}/EventListener/CampaignSubscriber.php (73%) rename app/bundles/{AddonBundle => PluginBundle}/EventListener/FormSubscriber.php (65%) rename app/bundles/{AddonBundle => PluginBundle}/EventListener/PointSubscriber.php (69%) rename app/bundles/{AddonBundle => PluginBundle}/Exception/ApiErrorException.php (91%) rename app/bundles/{AddonBundle => PluginBundle}/Form/Type/DetailsType.php (96%) rename app/bundles/{AddonBundle => PluginBundle}/Form/Type/FeatureSettingsType.php (97%) rename app/bundles/{AddonBundle => PluginBundle}/Form/Type/FieldsType.php (98%) rename app/bundles/{AddonBundle => PluginBundle}/Form/Type/IntegrationConfigType.php (93%) rename app/bundles/{AddonBundle => PluginBundle}/Form/Type/IntegrationsListType.php (85%) rename app/bundles/{AddonBundle => PluginBundle}/Form/Type/KeysType.php (97%) rename app/bundles/{AddonBundle => PluginBundle}/Helper/AddonHelper.php (79%) rename app/bundles/{AddonBundle => PluginBundle}/Helper/EventHelper.php (88%) rename app/bundles/{AddonBundle => PluginBundle}/Helper/IntegrationHelper.php (87%) rename app/bundles/{AddonBundle => PluginBundle}/Helper/oAuthHelper.php (98%) rename app/bundles/{AddonBundle => PluginBundle}/Integration/AbstractIntegration.php (99%) rename app/bundles/{AddonBundle/MauticAddonBundle.php => PluginBundle/MauticPluginBundle.php} (74%) rename app/bundles/{AddonBundle => PluginBundle}/Model/AddonModel.php (86%) rename app/bundles/{AddonBundle/Security/Permissions/AddonPermissions.php => PluginBundle/Security/Permissions/PluginPermissions.php} (79%) rename app/bundles/{AddonBundle => PluginBundle}/Translations/en_US/flashes.ini (75%) rename app/bundles/{AddonBundle => PluginBundle}/Translations/en_US/messages.ini (73%) rename app/bundles/{AddonBundle => PluginBundle}/Views/Auth/auth.html.php (100%) rename app/bundles/{AddonBundle => PluginBundle}/Views/Auth/postauth.html.php (100%) rename app/bundles/{AddonBundle => PluginBundle}/Views/FormTheme/Integration/_integration_details_featureSettings_leadFields_row.html.php (100%) rename app/bundles/{AddonBundle => PluginBundle}/Views/FormTheme/Integration/_integration_details_featureSettings_row.html.php (100%) rename app/bundles/{AddonBundle => PluginBundle}/Views/FormTheme/Integration/_integration_details_supportedFeatures_row.html.php (100%) rename app/bundles/{AddonBundle => PluginBundle}/Views/FormTheme/Integration/integration_fields_row.html.php (100%) rename app/bundles/{AddonBundle => PluginBundle}/Views/Integration/form.html.php (94%) rename app/bundles/{AddonBundle => PluginBundle}/Views/Integration/grid.html.php (77%) rename app/bundles/{AddonBundle => PluginBundle}/Views/Integration/index.html.php (83%) rename {addons => plugins}/MauticCloudStorageBundle/Assets/img/rackspace.png (100%) rename {addons => plugins}/MauticCloudStorageBundle/Config/config.php (75%) rename {addons => plugins}/MauticCloudStorageBundle/EventListener/RemoteAssetBrowseSubscriber.php (85%) rename {addons => plugins}/MauticCloudStorageBundle/Form/Type/OpenStackType.php (94%) rename {addons => plugins}/MauticCloudStorageBundle/Form/Type/RackspaceType.php (95%) rename {addons => plugins}/MauticCloudStorageBundle/Integration/AmazonS3Integration.php (96%) rename {addons => plugins}/MauticCloudStorageBundle/Integration/CloudStorageIntegration.php (93%) rename {addons => plugins}/MauticCloudStorageBundle/Integration/OpenStackIntegration.php (97%) rename {addons => plugins}/MauticCloudStorageBundle/Integration/RackspaceIntegration.php (97%) rename {addons => plugins}/MauticCloudStorageBundle/MauticCloudStorageBundle.php (66%) rename {addons => plugins}/MauticCloudStorageBundle/Translations/en_US/messages.ini (100%) rename {addons => plugins}/MauticCrmBundle/Api/CrmApi.php (61%) rename {addons => plugins}/MauticCrmBundle/Api/SalesforceApi.php (95%) rename {addons => plugins}/MauticCrmBundle/Api/SugarcrmApi.php (94%) rename {addons => plugins}/MauticCrmBundle/Api/VtigerApi.php (93%) rename {addons => plugins}/MauticCrmBundle/Api/ZohoApi.php (93%) rename {addons => plugins}/MauticCrmBundle/Assets/img/cobalt.png (100%) rename {addons => plugins}/MauticCrmBundle/Assets/img/salesforce.png (100%) rename {addons => plugins}/MauticCrmBundle/Assets/img/sugarcrm.png (100%) rename {addons => plugins}/MauticCrmBundle/Assets/img/vtiger.png (100%) rename {addons => plugins}/MauticCrmBundle/Assets/img/zoho.png (100%) rename {addons => plugins}/MauticCrmBundle/Config/config.php (100%) rename {addons => plugins}/MauticCrmBundle/Integration/CrmAbstractIntegration.php (89%) rename {addons => plugins}/MauticCrmBundle/Integration/SalesforceIntegration.php (98%) rename {addons => plugins}/MauticCrmBundle/Integration/SugarcrmIntegration.php (98%) rename {addons => plugins}/MauticCrmBundle/Integration/VtigerIntegration.php (99%) rename {addons => plugins}/MauticCrmBundle/Integration/ZohoIntegration.php (99%) rename {addons => plugins}/MauticCrmBundle/MauticCrmBundle.php (60%) rename {addons => plugins}/MauticCrmBundle/Translations/en_US/messages.ini (100%) rename {addons => plugins}/MauticCrmBundle/Views/Form/config.html.php (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Api/ConstantContactApi.php (94%) rename {addons => plugins}/MauticEmailMarketingBundle/Api/EmailMarketingApi.php (82%) rename {addons => plugins}/MauticEmailMarketingBundle/Api/IcontactApi.php (94%) rename {addons => plugins}/MauticEmailMarketingBundle/Api/MailchimpApi.php (92%) rename {addons => plugins}/MauticEmailMarketingBundle/Assets/img/constantcontact.png (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Assets/img/icontact.png (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Assets/img/mailchimp.png (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Config/config.php (78%) rename {addons => plugins}/MauticEmailMarketingBundle/Form/Type/ConstantContactType.php (92%) rename {addons => plugins}/MauticEmailMarketingBundle/Form/Type/IcontactType.php (91%) rename {addons => plugins}/MauticEmailMarketingBundle/Form/Type/MailchimpType.php (94%) rename {addons => plugins}/MauticEmailMarketingBundle/Integration/ConstantContactIntegration.php (98%) rename {addons => plugins}/MauticEmailMarketingBundle/Integration/EmailAbstractIntegration.php (91%) rename {addons => plugins}/MauticEmailMarketingBundle/Integration/IcontactIntegration.php (99%) rename {addons => plugins}/MauticEmailMarketingBundle/Integration/MailchimpIntegration.php (98%) rename {addons => plugins}/MauticEmailMarketingBundle/MauticEmailMarketingBundle.php (56%) rename {addons => plugins}/MauticEmailMarketingBundle/Translations/en_US/messages.ini (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Views/FormTheme/EmailMarketing/emailmarketing_constantcontact_row.html.php (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Views/FormTheme/EmailMarketing/emailmarketing_icontact_row.html.php (100%) rename {addons => plugins}/MauticEmailMarketingBundle/Views/FormTheme/EmailMarketing/emailmarketing_mailchimp_row.html.php (100%) rename {addons => plugins}/MauticSocialBundle/Assets/img/facebook.png (100%) rename {addons => plugins}/MauticSocialBundle/Assets/img/foursquare.png (100%) rename {addons => plugins}/MauticSocialBundle/Assets/img/googleplus.png (100%) rename {addons => plugins}/MauticSocialBundle/Assets/img/instagram.png (100%) rename {addons => plugins}/MauticSocialBundle/Assets/img/linkedin.png (100%) rename {addons => plugins}/MauticSocialBundle/Assets/img/twitter.png (100%) rename {addons => plugins}/MauticSocialBundle/Config/config.php (74%) rename {addons => plugins}/MauticSocialBundle/Form/Type/FacebookType.php (98%) rename {addons => plugins}/MauticSocialBundle/Form/Type/GooglePlusType.php (97%) rename {addons => plugins}/MauticSocialBundle/Form/Type/LinkedInType.php (96%) rename {addons => plugins}/MauticSocialBundle/Form/Type/TwitterType.php (98%) rename {addons => plugins}/MauticSocialBundle/Integration/FacebookIntegration.php (98%) rename {addons => plugins}/MauticSocialBundle/Integration/FoursquareIntegration.php (99%) rename {addons => plugins}/MauticSocialBundle/Integration/GooglePlusIntegration.php (99%) rename {addons => plugins}/MauticSocialBundle/Integration/InstagramIntegration.php (98%) rename {addons => plugins}/MauticSocialBundle/Integration/LinkedInIntegration.php (94%) rename {addons => plugins}/MauticSocialBundle/Integration/SocialIntegration.php (98%) rename {addons => plugins}/MauticSocialBundle/Integration/TwitterIntegration.php (98%) rename {addons => plugins}/MauticSocialBundle/MauticSocialBundle.php (67%) rename {addons => plugins}/MauticSocialBundle/Translations/en_US/messages.ini (100%) rename {addons => plugins}/MauticSocialBundle/Views/Integration/Facebook/share.html.php (100%) rename {addons => plugins}/MauticSocialBundle/Views/Integration/GooglePlus/share.html.php (100%) rename {addons => plugins}/MauticSocialBundle/Views/Integration/LinkedIn/share.html.php (100%) rename {addons => plugins}/MauticSocialBundle/Views/Integration/Twitter/share.html.php (100%) rename {addons => plugins}/index.html (100%) diff --git a/.htaccess b/.htaccess index e5780467e6e..51d0ef9dd85 100644 --- a/.htaccess +++ b/.htaccess @@ -50,7 +50,7 @@ # When mod_rewrite is not available, we instruct a temporary redirect of # the start page to the front controller explicitly so that the website # and the generated links can still be used. - RedirectMatch 302 ^(?!/(index\.php|index_dev\.php|app|addons|media|upgrade))(/(.*))$ /index.php$2 + RedirectMatch 302 ^(?!/(index\.php|index_dev\.php|app|plugins|media|upgrade))(/(.*))$ /index.php$2 # RedirectTemp cannot be used instead diff --git a/app/AppKernel.php b/app/AppKernel.php index 1c559214adb..ff05ab32872 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -53,7 +53,7 @@ class AppKernel extends Kernel /** * @var array */ - private $addonBundles = array(); + private $pluginBundles = array(); /** * {@inheritdoc} @@ -158,7 +158,7 @@ public function registerBundles() } //dynamically register Mautic Addon Bundles - $searchPath = dirname(__DIR__) . '/addons'; + $searchPath = dirname(__DIR__) . '/plugins'; $finder = new \Symfony\Component\Finder\Finder(); $finder->files() ->followLinks() @@ -169,7 +169,7 @@ public function registerBundles() foreach ($finder as $file) { $dirname = basename($file->getRelativePath()); $filename = substr($file->getFilename(), 0, -4); - $class = '\\MauticAddon' . '\\' . $dirname . '\\' . $filename; + $class = '\\MauticPlugin' . '\\' . $dirname . '\\' . $filename; if (class_exists($class)) { $bundles[] = new $class(); } @@ -228,13 +228,13 @@ public function boot() define('MAUTIC_TABLE_PREFIX', $prefix); } - $registeredAddonBundles = $this->container->getParameter('mautic.addon.bundles'); + $registeredPluginBundles = $this->container->getParameter('mautic.plugin.bundles'); - $addonBundles = array(); + $pluginBundles = array(); foreach ($this->getBundles() as $name => $bundle) { - if ($bundle instanceof \Mautic\AddonBundle\Bundle\AddonBundleBase) { + if ($bundle instanceof \Mautic\PluginBundle\Bundle\PluginBundleBase) { //boot after it's been check to see if it's enabled - $addonBundles[$name] = $bundle; + $pluginBundles[$name] = $bundle; //set the container for the addon helper $bundle->setContainer($this->container); @@ -250,14 +250,14 @@ public function boot() $dispatcher = $factory->getDispatcher(); // It's only after we've booted that we have access to the container, so here is where we will check if addon bundles are enabled then deal with them accordingly - foreach ($addonBundles as $name => $bundle) { + foreach ($pluginBundles as $name => $bundle) { if (!$bundle->isEnabled()) { unset($this->bundles[$name]); unset($this->bundleMap[$name]); // remove listeners as well - if (isset($registeredAddonBundles[$name]['config']['services'])) { - foreach ($registeredAddonBundles[$name]['config']['services'] as $serviceGroup => $services) { + if (isset($registeredPluginBundles[$name]['config']['services'])) { + foreach ($registeredPluginBundles[$name]['config']['services'] as $serviceGroup => $services) { foreach ($services as $serviceName => $details) { if ($serviceGroup == 'events') { $details['tag'] = 'kernel.event_subscriber'; @@ -283,14 +283,14 @@ public function boot() } } - unset($registeredAddonBundles[$name]); + unset($registeredPluginBundles[$name]); } else { // boot the bundle $bundle->boot(); } } - $this->addonBundles = $registeredAddonBundles; + $this->addonBundles = $registeredPluginBundles; $this->booted = true; } @@ -300,7 +300,7 @@ public function boot() * * @return array */ - public function getAddonBundles() + public function getPluginBundles() { return $this->addonBundles; } diff --git a/app/bundles/AddonBundle/Bundle/AddonBundleBase.php b/app/bundles/AddonBundle/Bundle/AddonBundleBase.php deleted file mode 100644 index d9d6805567d..00000000000 --- a/app/bundles/AddonBundle/Bundle/AddonBundleBase.php +++ /dev/null @@ -1,67 +0,0 @@ -container->get('mautic.factory')->getHelper('addon'); - return $helper->isEnabled($this->getName()); - } - - /** - * Called by AddonController::reloadAction when adding a new addon that's not already installed - * - * @param MauticFactory $factory - */ - static public function onInstall(MauticFactory $factory) - { - - } - - /** - * Called by AddonController::reloadAction when the addon version does not match what's installed - * - * @param Addon $addon - * @param MauticFactory $factory - */ - static public function onUpdate(Addon $addon, MauticFactory $factory) - { - - } - - /** - * Called by AddonController::reloadAction when an addon is uninstalled - * - * @todo NOT IMPLEMENTED YET IN THE ADDON MANAGER - * - * @param Addon $addon - * @param MauticFactory $factory - */ - static public function onUninstall(Addon $addon, MauticFactory $factory) - { - - } -} diff --git a/app/bundles/AddonBundle/Config/config.php b/app/bundles/AddonBundle/Config/config.php deleted file mode 100644 index 84c8552a86f..00000000000 --- a/app/bundles/AddonBundle/Config/config.php +++ /dev/null @@ -1,105 +0,0 @@ - array( - 'main' => array( - 'mautic_integration_auth_callback' => array( - 'path' => '/addon/integrations/authcallback/{integration}', - 'controller' => 'MauticAddonBundle:Auth:authCallback' - ), - 'mautic_integration_auth_postauth' => array( - 'path' => '/addon/integrations/authstatus', - 'controller' => 'MauticAddonBundle:Auth:authStatus' - ), - 'mautic_addon_integration_index' => array( - 'path' => '/addon/integrations', - 'controller' => 'MauticAddonBundle:Integration:index' - ), - 'mautic_addon_integration_edit' => array( - 'path' => '/addon/integrations/edit/{name}', - 'controller' => 'MauticAddonBundle:Integration:edit' - ), - 'mautic_addon_index' => array( - 'path' => '/addon/{page}', - 'controller' => 'MauticAddonBundle:Addon:index' - ), - 'mautic_addon_action' => array( - 'path' => '/addon/{objectAction}/{objectId}', - 'controller' => 'MauticAddonBundle:Addon:execute' - ) - ) - ), - - 'menu' => array( - 'admin' => array( - 'priority' => 50, - 'items' => array( - 'mautic.addon.addons' => array( - 'id' => 'mautic_addon_root', - 'iconClass' => 'fa-plus-circle', - 'access' => 'addon:addons:manage', - 'route' => 'mautic_addon_index' - ) - ) - ) - ), - - 'services' => array( - 'events' => array( - 'mautic.addon.pointbundle.subscriber' => array( - 'class' => 'Mautic\AddonBundle\EventListener\PointSubscriber' - ), - 'mautic.addon.formbundle.subscriber' => array( - 'class' => 'Mautic\AddonBundle\EventListener\FormSubscriber' - ), - 'mautic.addon.campaignbundle.subscriber' => array( - 'class' => 'Mautic\AddonBundle\EventListener\CampaignSubscriber' - ) - ), - 'forms' => array( - 'mautic.form.type.integration.details' => array( - 'class' => 'Mautic\AddonBundle\Form\Type\DetailsType', - 'alias' => 'integration_details' - ), - 'mautic.form.type.integration.settings' => array( - 'class' => 'Mautic\AddonBundle\Form\Type\FeatureSettingsType', - 'arguments' => 'mautic.factory', - 'alias' => 'integration_featuresettings' - ), - 'mautic.form.type.integration.fields' => array( - 'class' => 'Mautic\AddonBundle\Form\Type\FieldsType', - 'alias' => 'integration_fields' - ), - 'mautic.form.type.integration.keys' => array( - 'class' => 'Mautic\AddonBundle\Form\Type\KeysType', - 'alias' => 'integration_keys' - ), - 'mautic.form.type.integration.list' => array( - 'class' => 'Mautic\AddonBundle\Form\Type\IntegrationsListType', - 'arguments' => 'mautic.factory', - 'alias' => 'integration_list' - ), - 'mautic.form.type.integration.config' => array( - 'class' => 'Mautic\AddonBundle\Form\Type\IntegrationConfigType', - 'alias' => 'integration_config' - ) - ), - 'other' => array( - 'mautic.helper.integration' => array( - 'class' => 'Mautic\AddonBundle\Helper\IntegrationHelper', - 'arguments' => 'mautic.factory' - ), - 'mautic.helper.addon' => array( - 'class' => 'Mautic\AddonBundle\Helper\AddonHelper', - 'arguments' => 'mautic.factory' - ) - ) - ) -); \ No newline at end of file diff --git a/app/bundles/AddonBundle/Controller/AddonController.php b/app/bundles/AddonBundle/Controller/AddonController.php deleted file mode 100644 index 56d6036e12b..00000000000 --- a/app/bundles/AddonBundle/Controller/AddonController.php +++ /dev/null @@ -1,255 +0,0 @@ -factory->getModel('addon'); - - if (!$this->factory->getSecurity()->isGranted('addon:addons:manage')) { - return $this->accessDenied(); - } - - if ($this->request->getMethod() == 'POST') { - $this->setListFilters(); - } - - //set limits - $limit = $this->factory->getSession()->get('mautic.addon.limit', $this->factory->getParameter('default_pagelimit')); - $start = ($page === 1) ? 0 : (($page - 1) * $limit); - if ($start < 0) { - $start = 0; - } - - $search = $this->request->get('search', $this->factory->getSession()->get('mautic.addon.filter', '')); - $this->factory->getSession()->set('mautic.addon.filter', $search); - - $filter = array('string' => $search, 'force' => array( - array( - 'column' => 'i.isMissing', - 'expr' => 'eq', - 'value' => false - ) - )); - - $orderBy = $this->factory->getSession()->get('mautic.addon.orderby', 'i.name'); - $orderByDir = $this->factory->getSession()->get('mautic.addon.orderbydir', 'DESC'); - - $addons = $model->getEntities( - array( - 'start' => $start, - 'limit' => $limit, - 'filter' => $filter, - 'orderBy' => $orderBy, - 'orderByDir' => $orderByDir - ) - ); - - $count = count($addons); - if ($count && $count < ($start + 1)) { - //the number of entities are now less then the current page so redirect to the last page - $lastPage = ($count === 1) ? 1 : (ceil($count / $limit)) ?: 1; - $this->factory->getSession()->set('mautic.addon.page', $lastPage); - $returnUrl = $this->generateUrl('mautic_addon_index', array('page' => $lastPage)); - - return $this->postActionRedirect(array( - 'returnUrl' => $returnUrl, - 'viewParameters' => array('page' => $lastPage), - 'contentTemplate' => 'MauticAddonBundle:Addon:index', - 'passthroughVars' => array( - 'activeLink' => '#mautic_addon_index', - 'mauticContent' => 'addon' - ) - )); - } - - //set what page currently on so that we can return here after form submission/cancellation - $this->factory->getSession()->set('mautic.addon.page', $page); - - $tmpl = $this->request->isXmlHttpRequest() ? $this->request->get('tmpl', 'index') : 'index'; - - return $this->delegateView(array( - 'viewParameters' => array( - 'searchValue' => $search, - 'items' => $addons, - 'page' => $page, - 'limit' => $limit, - 'model' => $model, - 'tmpl' => $tmpl, - 'integrationHelper' => $this->factory->getHelper('integration') - ), - 'contentTemplate' => 'MauticAddonBundle:Addon:list.html.php', - 'passthroughVars' => array( - 'activeLink' => '#mautic_addon_index', - 'mauticContent' => 'addon', - 'route' => $this->generateUrl('mautic_addon_index', array('page' => $page)) - ) - )); - } - - /** - * Scans the addon bundles directly and loads bundles which are not registered to the database - * - * @param int $objectId Unused in this action - * - * @return \Symfony\Component\HttpFoundation\JsonResponse - */ - protected function reloadAction ($objectId) - { - if (!$this->factory->getSecurity()->isGranted('addon:addons:manage')) { - return $this->accessDenied(); - } - - /** @var \Mautic\AddonBundle\Model\AddonModel $model */ - $model = $this->factory->getModel('addon'); - /** @var \Mautic\AddonBundle\Entity\AddonRepository $repo */ - $repo = $model->getRepository(); - $addons = $this->factory->getParameter('addon.bundles'); - $added = $disabled = $updated = 0; - - $installedAddons = $repo->getInstalled(); - - $persist = array(); - foreach ($installedAddons as $bundle => $addon) { - $persistUpdate = false; - if (!isset($addons[$bundle])) { - if (!$addon->getIsMissing()) { - //files are no longer found - $addon->setIsEnabled(false); - $addon->setIsMissing(true); - $disabled++; - } - } else { - if ($addon->getIsMissing()) { - //was lost but now is found - $addon->setIsMissing(false); - $persistUpdate = true; - } - - $file = $addons[$bundle]['directory'] . '/Config/config.php'; - - //update details of the bundle - if (file_exists($file)) { - $details = include $file; - - //compare versions to see if an update is necessary - $version = isset($details['version']) ? $details['version'] : ''; - if (!empty($version) && version_compare($addon->getVersion(), $version) == -1) { - $updated++; - - //call the update callback - $callback = $addons[$bundle]['bundleClass']; - $callback::onUpdate($addon, $this->factory); - $persistUpdate = true; - } - - $addon->setVersion($version); - - $addon->setName( - isset($details['name']) ? $details['name'] : $addons[$bundle]['base'] - ); - - if (isset($details['description'])) { - $addon->setDescription($details['description']); - } - - if (isset($details['author'])) { - $addon->setAuthor($details['author']); - } - } - - unset($addons[$bundle]); - } - if ($persistUpdate) { - $persist[] = $addon; - } - } - - //rest are new - foreach ($addons as $addon) { - $added++; - $entity = new Addon(); - $entity->setBundle($addon['bundle']); - $entity->setIsEnabled(false); - - $file = $addon['directory'] . '/Config/config.php'; - - //update details of the bundle - if (file_exists($file)) { - $details = include $file; - - if (isset($details['version'])) { - $entity->setVersion($details['version']); - }; - - $entity->setName( - isset($details['name']) ? $details['name'] : $addon['base'] - ); - - if (isset($details['description'])) { - $entity->setDescription($details['description']); - } - - if (isset($details['author'])) { - $entity->setAuthor($details['author']); - } - } - - //call the install callback - $callback = $addon['bundleClass']; - $callback::onInstall($this->factory); - - $persist[] = $entity; - } - - if (!empty($persist)) { - $model->saveEntities($persist); - } - - if ($updated || $disabled) { - //clear the cache if addons were updated or disabled - $this->clearCache(); - } - - // Alert the user to the number of additions - $this->addFlash('mautic.addon.notice.reloaded', array( - '%added%' => $added, - '%disabled%' => $disabled, - '%updated%' => $updated - )); - - $viewParameters = array( - 'page' => $this->factory->getSession()->get('mautic.addon.page') - ); - - // Refresh the index contents - return $this->postActionRedirect(array( - 'returnUrl' => $this->generateUrl('mautic_addon_index', $viewParameters), - 'viewParameters' => $viewParameters, - 'contentTemplate' => 'MauticAddonBundle:Addon:index', - 'passthroughVars' => array( - 'activeLink' => '#mautic_addon_index', - 'mauticContent' => 'addon' - ) - )); - } -} diff --git a/app/bundles/AddonBundle/Views/Addon/index.html.php b/app/bundles/AddonBundle/Views/Addon/index.html.php deleted file mode 100644 index 56549625c6d..00000000000 --- a/app/bundles/AddonBundle/Views/Addon/index.html.php +++ /dev/null @@ -1,40 +0,0 @@ -extend('MauticCoreBundle:Default:content.html.php'); -$view['slots']->set('mauticContent', 'addon'); -$view['slots']->set('headerTitle', $view['translator']->trans('mautic.addon.manage.addons')); - -$view['slots']->set('actions', $view->render('MauticCoreBundle:Helper:page_actions.html.php', array( - 'customButtons' => array( - array( - 'attr' => array( - 'data-toggle' => 'ajax', - 'href' => $view['router']->generate('mautic_addon_action', array('objectAction' => 'reload')) - ), - 'btnText' => $view["translator"]->trans('mautic.addon.reload.addons'), - 'iconClass' => 'fa fa-cubes', - 'tooltip' => 'mautic.addon.reload.addons.tooltip' - ) - ) -))); -?> - -
- render('MauticCoreBundle:Helper:list_toolbar.html.php', array( - 'searchValue' => $searchValue, - 'searchHelp' => 'mautic.addon.help.searchcommands', - 'action' => $currentRoute, - 'routeBase' => 'addon', - 'templateButtons' => array() - )); ?> -
- output('_content'); ?> -
-
diff --git a/app/bundles/AddonBundle/Views/Addon/list.html.php b/app/bundles/AddonBundle/Views/Addon/list.html.php deleted file mode 100644 index 062b4540cec..00000000000 --- a/app/bundles/AddonBundle/Views/Addon/list.html.php +++ /dev/null @@ -1,91 +0,0 @@ -extend('MauticAddonBundle:Addon:index.html.php'); -} -?> - -
- - - - - render('MauticCoreBundle:Helper:tableheader.html.php', array( - 'sessionVar' => 'addon', - 'orderBy' => 'i.name', - 'text' => 'mautic.core.name', - 'class' => 'col-addon-name', - 'default' => true - )); - - echo $view->render('MauticCoreBundle:Helper:tableheader.html.php', array( - 'sessionVar' => 'addon', - 'orderBy' => 'i.id', - 'text' => 'mautic.core.id', - 'class' => 'col-addon-id' - )); - ?> - - - - - - - - - - - -
- render('MauticCoreBundle:Helper:publishstatus_icon.html.php',array( - 'item' => $item, - 'model' => 'addon', - 'backdrop' => true - )); ?> - getIntegrationCount($item->getBundle())): ?> - $item->getId())); ?>" data-toggle="ajax"> - getName(); ?> - - - getName(); ?> - - getId(); ?>
- -
- - render('MauticCoreBundle:Helper:noresults.html.php'); ?> - diff --git a/app/bundles/AssetBundle/Controller/AjaxController.php b/app/bundles/AssetBundle/Controller/AjaxController.php index b98d35da9f0..0d37514e592 100644 --- a/app/bundles/AssetBundle/Controller/AjaxController.php +++ b/app/bundles/AssetBundle/Controller/AjaxController.php @@ -75,10 +75,10 @@ protected function fetchRemoteFilesAction(Request $request) return $this->sendJsonResponse(array('success' => 0)); } - /** @var \Mautic\AddonBundle\Helper\IntegrationHelper $integrationHelper */ + /** @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper */ $integrationHelper = $this->factory->getHelper('integration'); - /** @var \Mautic\AddonBundle\Integration\AbstractIntegration $integration */ + /** @var \Mautic\PluginBundle\Integration\AbstractIntegration $integration */ $integration = $integrationHelper->getIntegrationObject($provider); $event = new RemoteAssetBrowseEvent($integration); diff --git a/app/bundles/AssetBundle/Controller/AssetController.php b/app/bundles/AssetBundle/Controller/AssetController.php index 6a4d879ef0e..c45939811f1 100644 --- a/app/bundles/AssetBundle/Controller/AssetController.php +++ b/app/bundles/AssetBundle/Controller/AssetController.php @@ -351,7 +351,7 @@ public function newAction () } // Check for integrations to cloud providers - /** @var \Mautic\AddonBundle\Helper\IntegrationHelper $integrationHelper */ + /** @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper */ $integrationHelper = $this->factory->getHelper('integration'); $integrations = $integrationHelper->getIntegrationObjects(null, array('cloud_storage')); @@ -516,7 +516,7 @@ public function editAction ($objectId, $ignorePost = false) } // Check for integrations to cloud providers - /** @var \Mautic\AddonBundle\Helper\IntegrationHelper $integrationHelper */ + /** @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper */ $integrationHelper = $this->factory->getHelper('integration'); $integrations = $integrationHelper->getIntegrationObjects(null, array('cloud_storage')); @@ -723,7 +723,7 @@ public function batchDeleteAction () public function remoteAction () { // Check for integrations to cloud providers - /** @var \Mautic\AddonBundle\Helper\IntegrationHelper $integrationHelper */ + /** @var \Mautic\PluginBundle\Helper\IntegrationHelper $integrationHelper */ $integrationHelper = $this->factory->getHelper('integration'); $integrations = $integrationHelper->getIntegrationObjects(null, array('cloud_storage')); diff --git a/app/bundles/AssetBundle/Event/RemoteAssetBrowseEvent.php b/app/bundles/AssetBundle/Event/RemoteAssetBrowseEvent.php index 0169378b4b4..f933d5a2c18 100644 --- a/app/bundles/AssetBundle/Event/RemoteAssetBrowseEvent.php +++ b/app/bundles/AssetBundle/Event/RemoteAssetBrowseEvent.php @@ -10,7 +10,7 @@ namespace Mautic\AssetBundle\Event; use Gaufrette\Adapter; -use Mautic\AddonBundle\Integration\AbstractIntegration; +use Mautic\PluginBundle\Integration\AbstractIntegration; use Mautic\CoreBundle\Event\CommonEvent; /** diff --git a/app/bundles/AssetBundle/Views/Remote/browse.html.php b/app/bundles/AssetBundle/Views/Remote/browse.html.php index 2ec27e861e1..65cee075d70 100644 --- a/app/bundles/AssetBundle/Views/Remote/browse.html.php +++ b/app/bundles/AssetBundle/Views/Remote/browse.html.php @@ -24,7 +24,7 @@