Created
September 10, 2012 18:54
-
-
Save flaviozantut/3692947 to your computer and use it in GitHub Desktop.
Standard comment block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Dash lib | |
* | |
* @category Admin | |
* @package Dash | |
* @author Flavio Zantut <[email protected]> | |
* @license MIT License <http://www.opensource.org/licenses/mit> | |
* @link http://link.com | |
*/ | |
namespace Dash; | |
/** | |
* Url Class | |
* | |
* @category Admin | |
* @package Dash | |
* @author Flavio Zantut <[email protected]> | |
* @license MIT License <http://www.opensource.org/licenses/mit> | |
* @link http://link.com | |
*/ | |
class Url | |
{ | |
/** | |
* switch site language | |
* | |
* @param string $lang Idioma | |
* @param string $url Site url | |
* | |
* @return string | |
*/ | |
public static function switchUri($lang, $url = '') | |
{ | |
$url = $url or \URL::full(); | |
$idiomas = implode("|", \Config::get('application.languages')); | |
$url = preg_replace("/\/({$idiomas})\//", "/$lang/", $url); | |
return $url; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment