1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/**
* PHPPgAdmin v6.0.0-RC2
*/
namespace PHPPgAdmin\Decorators;
class BranchUrlDecorator extends Decorator
{
public function __construct($base, $queryVars = null)
{
$this->b = $base;
if (null !== $queryVars) {
$this->q = $queryVars;
}
}
public function value($fields)
{
$url = Decorator::get_sanitized_value($this->b, $fields);
if (false === $url) {
return '';
}
if (!empty($this->q)) {
$queryVars = Decorator::get_sanitized_value($this->q, $fields);
$sep = '?';
ksort($queryVars);
foreach ($queryVars as $var => $value) {
$varname = Decorator::value_url($var, $fields);
$varvalue = Decorator::value_url($value, $fields);
$url .= $sep.$varname.'='.$varvalue;
$sep = '&';
}
}
if (strpos($url, '/src/views') === false) {
$url = str_replace('//', '/', '/src/views/'.$url);
}
if (\SUBFOLDER !== '' && (0 === strpos($url, '/')) && (0 !== strpos($url, \SUBFOLDER))) {
$url = str_replace('//', '/', \SUBFOLDER.'/'.$url);
}
return str_replace('.php', '', $url);
}
}
|