vendor/contao/manager-plugin/src/PluginLoader.php line 43

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * This file is part of Contao.
  5.  *
  6.  * (c) Leo Feyer
  7.  *
  8.  * @license LGPL-3.0-or-later
  9.  */
  10. namespace Contao\ManagerPlugin;
  11. use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
  12. use Contao\ManagerPlugin\Config\ConfigPluginInterface;
  13. use Contao\ManagerPlugin\Config\ExtensionPluginInterface;
  14. use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
  15. /**
  16.  * This class has been auto-generated. It will be overwritten at every run of
  17.  * "composer install" or "composer update".
  18.  *
  19.  * @see \Contao\ManagerPlugin\Composer\Installer
  20.  */
  21. class PluginLoader
  22. {
  23.     public const BUNDLE_PLUGINS BundlePluginInterface::class;
  24.     public const CONFIG_PLUGINS ConfigPluginInterface::class;
  25.     public const EXTENSION_PLUGINS ExtensionPluginInterface::class;
  26.     public const ROUTING_PLUGINS RoutingPluginInterface::class;
  27.     /**
  28.      * @var array
  29.      */
  30.     private $plugins;
  31.     /**
  32.      * @var array
  33.      */
  34.     private $disabled = [];
  35.     public function __construct(string $installedJson null, array $plugins null)
  36.     {
  37.         if (null !== $installedJson) {
  38.             @trigger_error('Passing the path to the Composer installed.json as first argument is no longer supported in version 2.3.'E_USER_DEPRECATED);
  39.         }
  40.         $this->plugins $plugins ?: [
  41.             'codefog/tags-bundle' => new \Codefog\TagsBundle\ContaoManager\Plugin(),
  42.             'heimrichhannot/contao-filename-sanitizer-bundle' => new \HeimrichHannot\FilenameSanitizerBundle\ContaoManager\Plugin(),
  43.             'heimrichhannot/contao-request-bundle' => new \HeimrichHannot\RequestBundle\ContaoManager\Plugin(),
  44.             'heimrichhannot/contao-status_messages' => new \HeimrichHannot\StatusMessages\ContaoManager\Plugin(),
  45.             'madeyourday/contao-rocksolid-custom-elements' => new \MadeYourDay\RockSolidCustomElements\ContaoManagerPlugin(),
  46.             'romeniwebdesign/contao-custom-articles-bundle' => new \Rwd\ContaoCustomArticlesBundle\ContaoManager\Plugin(),
  47.             'terminal42/contao-node' => new \Terminal42\NodeBundle\ContaoManager\Plugin(),
  48.             'contao/core-bundle' => new \Contao\CoreBundle\ContaoManager\Plugin(),
  49.             'contao/news-bundle' => new \Contao\NewsBundle\ContaoManager\Plugin(),
  50.             'codefog/contao-news_categories' => new \Codefog\NewsCategoriesBundle\ContaoManager\Plugin(),
  51.             'contao/calendar-bundle' => new \Contao\CalendarBundle\ContaoManager\Plugin(),
  52.             'contao/comments-bundle' => new \Contao\CommentsBundle\ContaoManager\Plugin(),
  53.             'contao/faq-bundle' => new \Contao\FaqBundle\ContaoManager\Plugin(),
  54.             'contao/listing-bundle' => new \Contao\ListingBundle\ContaoManager\Plugin(),
  55.             'contao/installation-bundle' => new \Contao\InstallationBundle\ContaoManager\Plugin(),
  56.             'contao/newsletter-bundle' => new \Contao\NewsletterBundle\ContaoManager\Plugin(),
  57.             'heimrichhannot/contao-utils-bundle' => new \HeimrichHannot\UtilsBundle\ContaoManager\Plugin(),
  58.             'heimrichhannot/contao-ajax-bundle' => new \HeimrichHannot\AjaxBundle\ContaoManager\Plugin(),
  59.             'heimrichhannot/contao-multi-column-editor-bundle' => new \HeimrichHannot\MultiColumnEditorBundle\ContaoManager\Plugin(),
  60.             'markocupic/contao-news-infinite-scroll-bundle' => new \Markocupic\ContaoNewsInfiniteScrollBundle\ContaoManager\Plugin(),
  61.             'numero2/contao-opengraph3' => new \numero2\Opengraph3Bundle\ContaoManager\Plugin(),
  62.             'terminal42/contao-fineuploader' => new \Terminal42\FineUploaderBundle\ContaoManager\Plugin(),
  63.             'terminal42/contao-folderpage' => new \Terminal42\FolderpageBundle\ContaoManager\Plugin(),
  64.             'contao/manager-bundle' => new \Contao\ManagerBundle\ContaoManager\Plugin(),
  65.         ];
  66.     }
  67.     /**
  68.      * Returns all active plugin instances.
  69.      *
  70.      * @return array<string,BundlePluginInterface>
  71.      */
  72.     public function getInstances(): array
  73.     {
  74.         return array_diff_key($this->pluginsarray_flip($this->disabled));
  75.     }
  76.     /**
  77.      * Returns the active plugin instances of a given type (see class constants).
  78.      *
  79.      * @return array<string,BundlePluginInterface>
  80.      */
  81.     public function getInstancesOf(string $typebool $reverseOrder false): array
  82.     {
  83.         $plugins array_filter(
  84.             $this->getInstances(),
  85.             function ($plugin) use ($type) {
  86.                 return is_a($plugin$type);
  87.             }
  88.         );
  89.         if ($reverseOrder) {
  90.             $plugins array_reverse($pluginstrue);
  91.         }
  92.         return array_diff_key($pluginsarray_flip($this->disabled));
  93.     }
  94.     /**
  95.      * @return string[]
  96.      */
  97.     public function getDisabledPackages(): array
  98.     {
  99.         return $this->disabled;
  100.     }
  101.     public function setDisabledPackages(array $packages): void
  102.     {
  103.         $this->disabled $packages;
  104.     }
  105. }