Add forceFrontend parameter to force controller transformations for the frontend
authorJoshua Rüsweg <josh@bastelstu.be>
Thu, 1 Feb 2018 11:38:35 +0000 (12:38 +0100)
committerJoshua Rüsweg <josh@bastelstu.be>
Thu, 1 Feb 2018 12:01:52 +0000 (13:01 +0100)
wcfsetup/install/files/lib/system/request/ControllerMap.class.php

index 60da31ff5646742a4bffc59eb23ce26375a33439..066c24d02efcd7f9d13da8ea12b8e9502535c4a4 100644 (file)
@@ -156,16 +156,21 @@ class ControllerMap extends SingletonFactory {
         * 
         * @param       string          $application    application identifier
         * @param       string          $controller     controller class, e.g. 'MembersList'
+        * @param       boolean         $forceFrontend  force transformation for frontend
         * @return      string          url representation of controller, e.g. 'members-list'
         */
-       public function lookup($application, $controller) {
+       public function lookup($application, $controller, $forceFrontend = null) {
                $lookupKey = $application . '-' . $controller;
                
                if (isset($this->lookupCache[$lookupKey])) {
                        return $this->lookupCache[$lookupKey];
                }
                
-               if (!class_exists(WCFACP::class, false) && isset($this->customUrls['reverse'][$application]) && isset($this->customUrls['reverse'][$application][$controller])) {
+               if ($forceFrontend === null) {
+                       $forceFrontend = !class_exists(WCFACP::class, false);
+               }
+               
+               if ($forceFrontend && isset($this->customUrls['reverse'][$application]) && isset($this->customUrls['reverse'][$application][$controller])) {
                        $urlController = $this->customUrls['reverse'][$application][$controller];
                }
                else {