@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | use Zikula\ExtensionsModule\ExtensionEvents; |
38 | 38 | use Zikula\ExtensionsModule\Installer\ExtensionInstallerInterface; |
39 | 39 | |
40 | -class ExtensionHelper |
|
41 | -{ |
|
40 | +class ExtensionHelper |
|
41 | +{ |
|
42 | 42 | /** |
43 | 43 | * @var ContainerInterface |
44 | 44 | */ |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ExtensionStateHelper $stateHelper, |
83 | 83 | CacheClearer $cacheClearer, |
84 | 84 | EventDispatcherInterface $eventDispatcher |
85 | - ) { |
|
85 | + ) { |
|
86 | 86 | $this->container = $container; |
87 | 87 | $this->translator = $translator; |
88 | 88 | $this->variableApi = $variableApi; |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function install(ExtensionEntity $extension): bool |
99 | 99 | { |
100 | - if (Constant::STATE_NOTALLOWED === $extension->getState()) { |
|
100 | + if (Constant::STATE_NOTALLOWED === $extension->getState()) { |
|
101 | 101 | throw new RuntimeException($this->translator->trans('Error! Not allowed to install %extension%.', ['%extension%' => $extension->getName()])); |
102 | 102 | } |
103 | - if (10 < $extension->getState()) { |
|
103 | + if (10 < $extension->getState()) { |
|
104 | 104 | throw new RuntimeException($this->translator->trans('Error! %extension% is not compatible with this version of Zikula.', ['%extension%' => $extension->getName()])); |
105 | 105 | } |
106 | 106 | |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | $extensionBundle = $this->container->get('kernel')->getBundle($extension->getName()); |
109 | 109 | |
110 | 110 | $installer = $this->getExtensionInstallerInstance($extensionBundle); |
111 | - if (null !== $installer) { |
|
111 | + if (null !== $installer) { |
|
112 | 112 | $result = $installer->install(); |
113 | - if (!$result) { |
|
113 | + if (!$result) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | } |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function upgrade(ExtensionEntity $extension): bool |
131 | 131 | { |
132 | - if (Constant::STATE_NOTALLOWED === $extension->getState()) { |
|
132 | + if (Constant::STATE_NOTALLOWED === $extension->getState()) { |
|
133 | 133 | throw new RuntimeException($this->translator->trans('Error! Not allowed to upgrade %extension%.', ['%extension%' => $extension->getDisplayname()])); |
134 | 134 | } |
135 | - if (10 < $extension->getState()) { |
|
135 | + if (10 < $extension->getState()) { |
|
136 | 136 | throw new RuntimeException($this->translator->trans('Error! %extension% is not compatible with this version of Zikula.', ['%extension%' => $extension->getDisplayname()])); |
137 | 137 | } |
138 | 138 | |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | // Check status of Dependencies here to be sure they are met for upgraded extension. #3647 |
143 | 143 | |
144 | 144 | $installer = $this->getExtensionInstallerInstance($extensionBundle); |
145 | - if (null !== $installer) { |
|
145 | + if (null !== $installer) { |
|
146 | 146 | $result = $installer->upgrade($extension->getVersion()); |
147 | - if (is_string($result)) { |
|
148 | - if ($result !== $extension->getVersion()) { |
|
147 | + if (is_string($result)) { |
|
148 | + if ($result !== $extension->getVersion()) { |
|
149 | 149 | // persist the last successful updated version |
150 | 150 | $extension->setVersion($result); |
151 | 151 | $this->container->get('doctrine')->getManager()->flush(); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | return false; |
155 | 155 | } |
156 | - if (true !== $result) { |
|
156 | + if (true !== $result) { |
|
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $this->stateHelper->updateState($extension->getId(), Constant::STATE_ACTIVE); |
167 | 167 | $this->cacheClearer->clear('symfony'); |
168 | 168 | |
169 | - if ($this->container->getParameter('installed')) { |
|
169 | + if ($this->container->getParameter('installed')) { |
|
170 | 170 | // Upgrade succeeded, issue event. |
171 | 171 | $event = new ExtensionStateEvent($extensionBundle, $extension->toArray()); |
172 | 172 | $this->eventDispatcher->dispatch($event, ExtensionEvents::EXTENSION_UPGRADE); |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | public function uninstall(ExtensionEntity $extension): bool |
182 | 182 | { |
183 | 183 | if (Constant::STATE_NOTALLOWED === $extension->getState() |
184 | - || ZikulaKernel::isCoreExtension($extension->getName())) { |
|
184 | + || ZikulaKernel::isCoreExtension($extension->getName())) { |
|
185 | 185 | throw new RuntimeException($this->translator->trans('Error! No permission to uninstall %extension%.', ['%extension%' => $extension->getDisplayname()])); |
186 | 186 | } |
187 | - if (Constant::STATE_UNINITIALISED === $extension->getState()) { |
|
187 | + if (Constant::STATE_UNINITIALISED === $extension->getState()) { |
|
188 | 188 | throw new RuntimeException($this->translator->trans('Error! %extension% is not yet installed, therefore it cannot be uninstalled.', ['%extension%' => $extension->getDisplayname()])); |
189 | 189 | } |
190 | 190 | |
191 | 191 | // allow event to prevent extension removal |
192 | 192 | $vetoEvent = new GenericEvent($extension); |
193 | 193 | $this->eventDispatcher->dispatch($vetoEvent, ExtensionEvents::REMOVE_VETO); |
194 | - if ($vetoEvent->isPropagationStopped()) { |
|
194 | + if ($vetoEvent->isPropagationStopped()) { |
|
195 | 195 | return false; |
196 | 196 | } |
197 | 197 | |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | $extensionBundle = $this->container->get('kernel')->getBundle($extension->getName()); |
200 | 200 | |
201 | 201 | $installer = $this->getExtensionInstallerInstance($extensionBundle); |
202 | - if (null !== $installer) { |
|
202 | + if (null !== $installer) { |
|
203 | 203 | $result = $installer->uninstall(); |
204 | - if (!$result) { |
|
204 | + if (!$result) { |
|
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function uninstallArray(array $extensions): bool |
229 | 229 | { |
230 | - foreach ($extensions as $extension) { |
|
231 | - if (!$extension instanceof ExtensionEntity) { |
|
230 | + foreach ($extensions as $extension) { |
|
231 | + if (!$extension instanceof ExtensionEntity) { |
|
232 | 232 | throw new InvalidArgumentException(); |
233 | 233 | } |
234 | 234 | $result = $this->uninstall($extension); |
235 | - if (!$result) { |
|
235 | + if (!$result) { |
|
236 | 236 | return false; |
237 | 237 | } |
238 | 238 | } |
@@ -266,17 +266,17 @@ discard block |
||
266 | 266 | private function getExtensionInstallerInstance(AbstractExtension $extension): ?ExtensionInstallerInterface |
267 | 267 | { |
268 | 268 | $className = $extension->getInstallerClass(); |
269 | - if (!class_exists($className)) { |
|
269 | + if (!class_exists($className)) { |
|
270 | 270 | return null; |
271 | 271 | } |
272 | 272 | $reflectionInstaller = new ReflectionClass($className); |
273 | - if (!$reflectionInstaller->isSubclassOf(ExtensionInstallerInterface::class)) { |
|
273 | + if (!$reflectionInstaller->isSubclassOf(ExtensionInstallerInterface::class)) { |
|
274 | 274 | throw new RuntimeException($this->translator->trans('%extension% must implement ExtensionInstallerInterface', ['%extension%' => $className])); |
275 | 275 | } |
276 | 276 | /** @var ExtensionInstallerInterface $installer */ |
277 | 277 | $installer = $reflectionInstaller->newInstance(); |
278 | 278 | $installer->setExtension($extension); |
279 | - if ($installer instanceof ContainerAwareInterface) { |
|
279 | + if ($installer instanceof ContainerAwareInterface) { |
|
280 | 280 | $installer->setContainer($this->container); |
281 | 281 | } |
282 | 282 |
@@ -45,7 +45,7 @@ |
||
45 | 45 | { |
46 | 46 | $text = preg_replace_callback( |
47 | 47 | '/<a [^>]*href\s*=\s*\"?([^>\"]*)\"?[^>]*>(.*?)<\/a.*?>/i', |
48 | - function ($matches) { |
|
48 | + function($matches) { |
|
49 | 49 | $this->links[] = html_entity_decode($matches[1]); |
50 | 50 | // return the replaced link |
51 | 51 | return '<strong><em>' . $matches[2] . '</em></strong> <small>[' . count($this->links) . ']</small>'; |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | use Twig\Environment; |
18 | 18 | use Zikula\ExtensionsModule\AbstractCoreTheme; |
19 | 19 | |
20 | -class ZikulaPrinterTheme extends AbstractCoreTheme |
|
21 | -{ |
|
20 | +class ZikulaPrinterTheme extends AbstractCoreTheme |
|
21 | +{ |
|
22 | 22 | private $links = []; |
23 | 23 | |
24 | 24 | /** |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | { |
64 | 64 | $translator = $this->getContainer()->get('translator'); |
65 | 65 | $text = ''; |
66 | - if (empty($this->links)) { |
|
66 | + if (empty($this->links)) { |
|
67 | 67 | return $text; |
68 | 68 | } |
69 | 69 | |
70 | 70 | $text .= '<div><strong>' . $translator->trans('Links') . '</strong>'; |
71 | 71 | $text .= '<ol>'; |
72 | 72 | $this->links = array_unique($this->links); |
73 | - foreach ($this->links as $key => $link) { |
|
73 | + foreach ($this->links as $key => $link) { |
|
74 | 74 | // check for an e-mail address |
75 | - if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$/i", $link)) { |
|
75 | + if (preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$/i", $link)) { |
|
76 | 76 | $linkText = $link; |
77 | 77 | $link = 'mailto:' . $link; |
78 | - } else { |
|
78 | + } else { |
|
79 | 79 | $linkText = $link; |
80 | 80 | } |
81 | 81 | $linkText = htmlspecialchars($linkText, ENT_QUOTES); |
@@ -15,6 +15,6 @@ |
||
15 | 15 | |
16 | 16 | use Zikula\ExtensionsModule\AbstractCoreTheme; |
17 | 17 | |
18 | -class ZikulaBootstrapTheme extends AbstractCoreTheme |
|
19 | -{ |
|
18 | +class ZikulaBootstrapTheme extends AbstractCoreTheme |
|
19 | +{ |
|
20 | 20 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | use Zikula\ExtensionsModule\Entity\ExtensionEntity; |
24 | 24 | use Zikula\MenuModule\Block\MenuBlock; |
25 | 25 | |
26 | -class BlockHelper |
|
27 | -{ |
|
26 | +class BlockHelper |
|
27 | +{ |
|
28 | 28 | /** |
29 | 29 | * @var EntityManagerInterface |
30 | 30 | */ |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | EntityManagerInterface $entityManager, |
45 | 45 | TranslatorInterface $translator, |
46 | 46 | ContainerInterface $container |
47 | - ) { |
|
47 | + ) { |
|
48 | 48 | $this->entityManager = $entityManager; |
49 | 49 | $this->translator = $translator; |
50 | 50 | $this->container = $container; |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | use Zikula\ExtensionsModule\ExtensionVariablesTrait; |
28 | 28 | use Zikula\PermissionsModule\Api\ApiInterface\PermissionApiInterface; |
29 | 29 | |
30 | -abstract class AbstractController extends BaseController |
|
31 | -{ |
|
30 | +abstract class AbstractController extends BaseController |
|
31 | +{ |
|
32 | 32 | use TranslatorTrait; |
33 | 33 | use ExtensionVariablesTrait; |
34 | 34 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | PermissionApiInterface $permissionApi, |
56 | 56 | VariableApiInterface $variableApi, |
57 | 57 | TranslatorInterface $translator |
58 | - ) { |
|
58 | + ) { |
|
59 | 59 | $this->extension = $extension; |
60 | 60 | $this->name = $extension->getName(); |
61 | 61 | $this->permissionApi = $permissionApi; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | // load optional bootstrap |
74 | 74 | $bootstrap = $extension->getPath() . '/bootstrap.php'; |
75 | - if (file_exists($bootstrap)) { |
|
75 | + if (file_exists($bootstrap)) { |
|
76 | 76 | include_once $bootstrap; |
77 | 77 | } |
78 | 78 | } |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | define('ACCESS_DELETE', 700); |
55 | 55 | define('ACCESS_ADMIN', 800); |
56 | 56 | |
57 | -abstract class ZikulaKernel extends Kernel implements ZikulaHttpKernelInterface |
|
58 | -{ |
|
57 | +abstract class ZikulaKernel extends Kernel implements ZikulaHttpKernelInterface |
|
58 | +{ |
|
59 | 59 | public const VERSION = '3.0.0'; |
60 | 60 | |
61 | 61 | public const PHP_MINIMUM_VERSION = '7.2.5'; |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private $autoloader; |
115 | 115 | |
116 | - public function boot() |
|
117 | - { |
|
118 | - if (null === $this->autoloader) { |
|
116 | + public function boot() |
|
117 | + { |
|
118 | + if (null === $this->autoloader) { |
|
119 | 119 | $this->getAutoloader(); |
120 | 120 | } |
121 | 121 | |
122 | 122 | parent::boot(); |
123 | 123 | |
124 | - foreach ($this->bundles as $name => $bundle) { |
|
125 | - if ($bundle instanceof AbstractModule && !isset($this->modules[$name])) { |
|
124 | + foreach ($this->bundles as $name => $bundle) { |
|
125 | + if ($bundle instanceof AbstractModule && !isset($this->modules[$name])) { |
|
126 | 126 | $this->modules[$name] = $bundle; |
127 | - } elseif ($bundle instanceof AbstractTheme && !isset($this->themes[$name])) { |
|
127 | + } elseif ($bundle instanceof AbstractTheme && !isset($this->themes[$name])) { |
|
128 | 128 | $this->themes[$name] = $bundle; |
129 | 129 | } |
130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | public function getModule(string $moduleName): AbstractModule |
134 | 134 | { |
135 | - if (!isset($this->modules[$moduleName])) { |
|
135 | + if (!isset($this->modules[$moduleName])) { |
|
136 | 136 | throw new InvalidArgumentException(sprintf('Module "%s" does not exist or it is not enabled.', $moduleName)); |
137 | 137 | } |
138 | 138 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | public function getTheme(string $themeName): AbstractTheme |
153 | 153 | { |
154 | - if (!isset($this->themes[$themeName])) { |
|
154 | + if (!isset($this->themes[$themeName])) { |
|
155 | 155 | throw new InvalidArgumentException(sprintf('Theme "%s" does not exist or it is not enabled.', $themeName)); |
156 | 156 | } |
157 | 157 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | public function getJustBundles(): array |
167 | 167 | { |
168 | 168 | $bundles = []; |
169 | - foreach ($this->bundles as $bundle) { |
|
170 | - if (!$bundle instanceof AbstractExtension) { |
|
169 | + foreach ($this->bundles as $bundle) { |
|
170 | + if (!$bundle instanceof AbstractExtension) { |
|
171 | 171 | $bundles[] = $bundle; |
172 | 172 | } |
173 | 173 | } |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | |
178 | 178 | public function isBundle(string $name): bool |
179 | 179 | { |
180 | - try { |
|
180 | + try { |
|
181 | 181 | $this->getBundle($name); |
182 | 182 | |
183 | 183 | return true; |
184 | - } catch (Exception $exception) { |
|
184 | + } catch (Exception $exception) { |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | } |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | |
194 | 194 | public function getAutoloader(): object |
195 | 195 | { |
196 | - if (null === $this->autoloader) { |
|
196 | + if (null === $this->autoloader) { |
|
197 | 197 | $loaders = spl_autoload_functions(); |
198 | - if ($loaders[0][0] instanceof DebugClassLoader) { |
|
198 | + if ($loaders[0][0] instanceof DebugClassLoader) { |
|
199 | 199 | $classLoader = $loaders[0][0]->getClassLoader(); |
200 | - if (is_callable($classLoader) && is_object($classLoader[0])) { |
|
200 | + if (is_callable($classLoader) && is_object($classLoader[0])) { |
|
201 | 201 | $this->autoloader = $classLoader[0]; |
202 | - } elseif (is_object($classLoader)) { |
|
202 | + } elseif (is_object($classLoader)) { |
|
203 | 203 | $this->autoloader = $classLoader; |
204 | 204 | } |
205 | - } else { |
|
205 | + } else { |
|
206 | 206 | $this->autoloader = $loaders[0][0]; |
207 | 207 | } |
208 | 208 | } |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | public function isClassInBundle(string $class): bool |
214 | 214 | { |
215 | 215 | /* @var BundleInterface $bundle */ |
216 | - foreach ($this->getBundles() as $bundle) { |
|
217 | - if (0 === mb_strpos($class, $bundle->getNamespace())) { |
|
216 | + foreach ($this->getBundles() as $bundle) { |
|
217 | + if (0 === mb_strpos($class, $bundle->getNamespace())) { |
|
218 | 218 | return $bundle instanceof AbstractExtension; |
219 | 219 | } |
220 | 220 | } |