Added option to force lower-case URLs
authorAlexander Ebert <ebert@woltlab.com>
Tue, 12 Aug 2014 13:58:52 +0000 (15:58 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 12 Aug 2014 13:58:52 +0000 (15:58 +0200)
com.woltlab.wcf/option.xml
wcfsetup/install/files/lib/system/request/LinkHandler.class.php
wcfsetup/install/files/lib/system/request/Route.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 3ab21a856a84a0c80868b82b1fab61d19a06aab8..06eff797c63203f9d3a9810e11b94679b4b2817c 100644 (file)
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
                        </option>
+                       <option name="url_to_lowercase">
+                               <categoryname>general.page.seo</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>1</defaultvalue>
+                       </option>
                        <option name="url_title_component_replacement">
                                <categoryname>general.page.seo</categoryname>
                                <optiontype>textarea</optiontype>
index 4b80cec09bc81980c9161a07555a24cd5ef919cc..43523329882c1b41e24931049b36bca3806b000b 100644 (file)
@@ -155,11 +155,15 @@ class LinkHandler extends SingletonFactory {
                        // trim to 80 characters
                        $parameters['title'] = rtrim(mb_substr($parameters['title'], 0, 80), '-');
                        
+                       if (URL_TO_LOWERCASE) {
+                               $parameters['title'] = mb_strtolower($parameters['title']);
+                       }
+                       
                        // encode title
                        if ($encodeTitle) $parameters['title'] = rawurlencode($parameters['title']);
                }
                
-               $parameters['controller'] = $controller;
+               $parameters['controller'] = (URL_TO_LOWERCASE) ? mb_strtolower($controller) : $controller;
                $routeURL = RouteHandler::getInstance()->buildRoute($parameters, $isACP);
                if (!$isRaw && !empty($url)) {
                        $routeURL .= (strpos($routeURL, '?') === false) ? '?' : '&';
index 4559b1cc7a7927f4636a96ff36c0c9b03c3fe1ac..9e78bef8f8936634a72656e9aa9e36dcafe8e69a 100644 (file)
@@ -269,7 +269,7 @@ class Route {
                        }
                        else if (!RequestHandler::getInstance()->isACPRequest()) {
                                $landingPage = PageMenu::getInstance()->getLandingPage();
-                               if ($landingPage !== null && ($landingPage->getController() == $components['controller'])) {
+                               if ($landingPage !== null && strcasecmp($landingPage->getController(), $components['controller']) == 0) {
                                        $ignoreController = true;
                                }
                        }
index 93c702f9c9388c5f7a8b53ba07e5022569bb5a8a..236164f03312f061383d6b1010f544eb33749df9 100644 (file)
@@ -1006,6 +1006,8 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
        <li>WCF 2.0: „index.php/Thread/123-Title/“</li>
        <li>WCF 2.1+: „?Thread/123-Title/“</li>
 </ul>]]></item>
+               <item name="wcf.acp.option.url_to_lowercase"><![CDATA[Durchgehende Kleinschreibung in Links aktivieren]]></item>
+               <item name="wcf.acp.option.url_to_lowercase.description"><![CDATA[Links verwenden keine Großbuchstaben mehr, aus „Thread/1-Dies-ist-ein-Test/“ wird „thread/1-dies-ist-ein-test/“.]]></item>
                <item name="wcf.acp.option.module_ad"><![CDATA[Werbung]]></item>
                <item name="wcf.acp.option.captcha_type"><![CDATA[Captcha-Art]]></item>
                <item name="wcf.acp.option.register_use_captcha"><![CDATA[Captcha in Registrierung aktivieren]]></item>
index 4674fbbd8d3d044ebcfaa61c0952ab03eaf32f47..38e8f87d79a6cdbcc89bceea4ec199b0a0862122 100644 (file)
@@ -1005,6 +1005,8 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
        <li>WCF 2.0: „index.php/Thread/123-Title/“</li>
        <li>WCF 2.1+: „?Thread/123-Title/“</li>
 </ul>]]></item>
+               <item name="wcf.acp.option.url_to_lowercase"><![CDATA[Force lower-case links]]></item>
+               <item name="wcf.acp.option.url_to_lowercase.description"><![CDATA[Links will no longer contain uppercase letters turning links like “Thread/1-Hello-I-am-John-Doe/” into “thread/1-hello-i-am-john-doe/”.]]></item>
                <item name="wcf.acp.option.module_ad"><![CDATA[Ads]]></item>
                <item name="wcf.acp.option.captcha_type"><![CDATA[Captcha Type]]></item>
                <item name="wcf.acp.option.register_use_captcha"><![CDATA[Enable Captcha protection during registration]]></item>