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


PHP MauticFactory::getPluginBundles方法代码示例

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


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

示例1: getPluginBundles

 /**
  * @return array
  */
 protected function getPluginBundles()
 {
     return $this->factory->getPluginBundles();
 }
开发者ID:kasobus,项目名称:EDENS-Mautic,代码行数:7,代码来源:CorePermissions.php

示例2: getIntegrationObjects

 /**
  * Get a list of integration helper classes
  *
  * @param array|string $specificIntegrations
  * @param array        $withFeatures
  * @param bool         $alphabetical
  * @param null|int     $pluginFilter
  * @param bool|false   $publishedOnly
  *
  * @return mixed
  */
 public function getIntegrationObjects($specificIntegrations = null, $withFeatures = null, $alphabetical = false, $pluginFilter = null, $publishedOnly = false)
 {
     static $integrations = array(), $available = array(), $byFeatureList = array(), $byPlugin = array();
     // Build the service classes
     if (empty($available)) {
         $em = $this->factory->getEntityManager();
         $available = array();
         // Get currently installed integrations
         $integrationSettings = $this->getIntegrationSettings();
         // And we'll be scanning the addon bundles for additional classes, so have that data on standby
         $plugins = $this->factory->getPluginBundles();
         // Get a list of already installed integrations
         $pluginModel = $this->factory->getModel('plugin');
         $integrationRepo = $em->getRepository('MauticPluginBundle:Integration');
         //get a list of plugins for filter
         $installedPlugins = $pluginModel->getEntities(array('hydration_mode' => 'hydrate_array', 'index' => 'bundle'));
         $newIntegrations = array();
         // Scan the plugins for integration classes
         foreach ($plugins as $plugin) {
             // Do not list the integration if the bundle has not been "installed"
             if (!isset($installedPlugins[$plugin['bundle']])) {
                 continue;
             }
             if (is_dir($plugin['directory'] . '/Integration')) {
                 $finder = new Finder();
                 $finder->files()->name('*Integration.php')->in($plugin['directory'] . '/Integration')->ignoreDotFiles(true);
                 $id = $installedPlugins[$plugin['bundle']]['id'];
                 $byPlugin[$id] = array();
                 $pluginReference = $em->getReference('MauticPluginBundle:Plugin', $id);
                 $pluginNamespace = str_replace('MauticPlugin', '', $plugin['bundle']);
                 foreach ($finder as $file) {
                     $integrationName = substr($file->getBaseName(), 0, -15);
                     if (!isset($integrationSettings[$integrationName])) {
                         $newIntegration = new Integration();
                         $newIntegration->setName($integrationName)->setPlugin($pluginReference);
                         $integrationSettings[$integrationName] = $newIntegration;
                         // Initiate the class in order to get the features supported
                         $class = "\\MauticPlugin\\" . $pluginNamespace . "\\Integration\\" . $integrationName . "Integration";
                         $reflectionClass = new \ReflectionClass($class);
                         if ($reflectionClass->isInstantiable()) {
                             $integrations[$integrationName] = new $class($this->factory);
                             $features = $integrations[$integrationName]->getSupportedFeatures();
                             $newIntegration->setSupportedFeatures($features);
                             // Go ahead and stash it since it's built already
                             $integrations[$integrationName]->setIntegrationSettings($newIntegration);
                             $newIntegrations[] = $newIntegration;
                             unset($newIntegration);
                         } else {
                             // Something is bad so ignore
                             continue;
                         }
                     }
                     /** @var \Mautic\PluginBundle\Entity\Integration $settings */
                     $settings = $integrationSettings[$integrationName];
                     $available[$integrationName] = array('integration' => $integrationName, 'settings' => $settings, 'namespace' => $pluginNamespace);
                     // Sort by feature and plugin for later
                     $features = $settings->getSupportedFeatures();
                     foreach ($features as $feature) {
                         if (!isset($byFeatureList[$feature])) {
                             $byFeatureList[$feature] = array();
                         }
                         $byFeatureList[$feature][] = $integrationName;
                     }
                     $byPlugin[$id][] = $integrationName;
                 }
                 // Save newly found integrations
                 if (!empty($newIntegrations)) {
                     $integrationRepo->saveEntities($newIntegrations);
                     unset($newIntegrations);
                 }
             }
         }
     }
     // Ensure appropriate formats
     if ($specificIntegrations !== null && !is_array($specificIntegrations)) {
         $specificIntegrations = array($specificIntegrations);
     }
     if ($withFeatures !== null && !is_array($withFeatures)) {
         $withFeatures = array($withFeatures);
     }
     // Build the integrations wanted
     if (!empty($pluginFilter)) {
         // Filter by plugin
         $filteredIntegrations = $byPlugin[$pluginFilter];
     } elseif (!empty($specificIntegrations)) {
         // Filter by specific integrations
         $filteredIntegrations = $specificIntegrations;
     } else {
         // All services by default
//.........这里部分代码省略.........
开发者ID:Yame-,项目名称:mautic,代码行数:101,代码来源:IntegrationHelper.php


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