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

43 lines
895 B
PHP
Raw Normal View History

<?php
2016-02-03 22:22:56 +00:00
/**
* Holds the url generation class.
2016-02-05 12:26:31 +00:00
*
2016-02-03 22:22:56 +00:00
* @package Sakura
*/
namespace Sakura;
/**
2016-04-01 21:44:31 +00:00
* URL generator.
2016-02-05 12:26:31 +00:00
*
* @package Sakura
2016-02-02 21:04:15 +00:00
* @author Julian van de Groep <me@flash.moe>
*/
class Urls
{
2016-02-02 21:04:15 +00:00
/**
* Format a URL.
2016-02-05 12:26:31 +00:00
*
2016-04-01 21:44:31 +00:00
* @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
2016-02-05 12:26:31 +00:00
*
2016-04-01 21:44:31 +00:00
* @return null|string url
2016-02-02 21:04:15 +00:00
*/
public function format($lid, $args = [], $rewrite = null, $b = true)
{
2016-04-01 21:44:31 +00:00
if ($b) {
$a = implode('.', $args);
$a = str_replace("usertitle", "title", $a);
return Router::route("settings.{$a}");
}
// Format urls
2016-04-01 21:44:31 +00:00
$formatted = vsprintf('/settings.php?cat=%s&mode=%s', $args);
// Return the formatted url
return $formatted;
}
}