File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8080 $ plugin_class = $ plugin . 'Plugin ' ;
8181
8282 if (file_exists ('./plugins/ ' . $ plugin_class . '.php ' )) {
83-
84- // use user plugin from /plugins/
8583 require_once ('./plugins/ ' . $ plugin_class . '.php ' );
86-
87- } elseif (class_exists ('\\Proxy \\Plugin \\' . $ plugin_class )) {
88-
89- // does the native plugin from php-proxy package with such name exist?
90- $ plugin_class = '\\Proxy \\Plugin \\' . $ plugin_class ;
84+ } else if (file_exists ('./plugins/ ' . $ plugin . '.php ' )) {
85+ require_once ('./plugins/ ' . $ plugin . '.php ' );
9186 }
9287
93- // otherwise plugin_class better be loaded already through composer.json and match namespace exactly \\Vendor\\Plugin\\SuperPlugin
94- // $proxy->getEventDispatcher()->addSubscriber(new $plugin_class());
88+ // where to search for this class?
89+ $ searchForClasses = [
90+ $ plugin ,
91+ $ plugin_class ,
92+ '\\Proxy \\Plugin \\' . $ plugin_class
93+ ];
9594
96- $ proxy ->addSubscriber (new $ plugin_class ());
95+ foreach ($ searchForClasses as $ class ) {
96+
97+ if (class_exists ($ class )) {
98+ $ proxy ->addSubscriber (new $ class ());
99+ }
100+ }
97101}
98102
99103try {
You can’t perform that action at this time.
0 commit comments