From 1d4e248f3c7dcb8a57431a01b6b9bdbb8f6574f9 Mon Sep 17 00:00:00 2001 From: JoeforJoomla Boy Date: Mon, 22 Oct 2018 23:35:10 +0200 Subject: [PATCH 1/2] Update SiteRouter.php --- libraries/src/Router/SiteRouter.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/libraries/src/Router/SiteRouter.php b/libraries/src/Router/SiteRouter.php index b0666252ec423..379ee42f3a743 100644 --- a/libraries/src/Router/SiteRouter.php +++ b/libraries/src/Router/SiteRouter.php @@ -616,6 +616,35 @@ public function getComponentRouter($component) { $this->componentRouters[$component] = $componentInstance->createRouter($this->app, $this->menu); } + + // Keep support for components implementing the new format but don't implement the RouterServiceInterface + if (!isset($this->componentRouters[$component])) + { + $compname = ucfirst(substr($component, 4)); + $class = $compname . 'Router'; + + if (!class_exists($class)) + { + // Use the component routing handler if it exists + $path = JPATH_SITE . '/components/' . $component . '/router.php'; + + // Use the custom routing handler if it exists + if (file_exists($path)) + { + require_once $path; + } + } + + if (class_exists($class)) + { + $reflection = new \ReflectionClass($class); + + if (in_array('Joomla\\CMS\\Component\\Router\\RouterInterface', $reflection->getInterfaceNames())) + { + $this->componentRouters[$component] = new $class($this->app, $this->menu); + } + } + } if (!isset($this->componentRouters[$component])) { From 048a97328b9c3af18b2a39a7e6409be86c72619e Mon Sep 17 00:00:00 2001 From: JoeforJoomla Boy Date: Tue, 23 Oct 2018 02:11:48 +0200 Subject: [PATCH 2/2] Update SiteRouter.php --- libraries/src/Router/SiteRouter.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/src/Router/SiteRouter.php b/libraries/src/Router/SiteRouter.php index 379ee42f3a743..89d032608235c 100644 --- a/libraries/src/Router/SiteRouter.php +++ b/libraries/src/Router/SiteRouter.php @@ -616,29 +616,29 @@ public function getComponentRouter($component) { $this->componentRouters[$component] = $componentInstance->createRouter($this->app, $this->menu); } - + // Keep support for components implementing the new format but don't implement the RouterServiceInterface if (!isset($this->componentRouters[$component])) { $compname = ucfirst(substr($component, 4)); $class = $compname . 'Router'; - + if (!class_exists($class)) { // Use the component routing handler if it exists $path = JPATH_SITE . '/components/' . $component . '/router.php'; - + // Use the custom routing handler if it exists if (file_exists($path)) { require_once $path; } } - + if (class_exists($class)) { $reflection = new \ReflectionClass($class); - + if (in_array('Joomla\\CMS\\Component\\Router\\RouterInterface', $reflection->getInterfaceNames())) { $this->componentRouters[$component] = new $class($this->app, $this->menu);