This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/libraries/Urls.php
2016-04-01 23:44:31 +02:00

43 lines
895 B
PHP

<?php
/**
* Holds the url generation class.
*
* @package Sakura
*/
namespace Sakura;
/**
* URL generator.
*
* @package Sakura
* @author Julian van de Groep <me@flash.moe>
*/
class Urls
{
/**
* Format a URL.
*
* @param string $lid doesn't do anything
* @param array $args [category, mode]
* @param bool $rewrite doesn't do anything either
* @param bool $b hackjob for the settings panel
*
* @return null|string url
*/
public function format($lid, $args = [], $rewrite = null, $b = true)
{
if ($b) {
$a = implode('.', $args);
$a = str_replace("usertitle", "title", $a);
return Router::route("settings.{$a}");
}
// Format urls
$formatted = vsprintf('/settings.php?cat=%s&mode=%s', $args);
// Return the formatted url
return $formatted;
}
}