Skip to content

Instantly share code, notes, and snippets.

@flaviozantut
Created September 10, 2012 18:54
Show Gist options
  • Save flaviozantut/3692947 to your computer and use it in GitHub Desktop.
Save flaviozantut/3692947 to your computer and use it in GitHub Desktop.
Standard comment block
<?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