a38f202e17e7ee1ae26bf376be9d3bf77dd230ff
[GitHub/Stricted/Domain-Control-Panel.git] / lib / system / template / plugins / block.link.php
1 <?php
2
3 function smarty_block_link($params, $content, $template, &$repeat) {
4 if ($repeat) {
5 return;
6 }
7
8 if (!array_key_exists('controller', $params)) {
9 $params['controller'] = null;
10 }
11
12 if (!array_key_exists('id', $params)) {
13 $params['id'] = null;
14 }
15
16 if (!array_key_exists('title', $params)) {
17 $params['title'] = null;
18 }
19
20 $url = 'index.php?'.$params['controller'];
21
22 if (!empty($params['id'])) {
23 if (!empty($params['title'])) {
24 $url .= '/'.$params['id'].'-'.$params['title'];
25 }
26 else {
27 $url .= '/'.$params['id'];
28 }
29 }
30
31 if (!empty($content)) {
32 if (strpos($content, '&') !== 0) {
33 $url .= '&';
34 }
35
36 $url .= $content;
37 }
38
39 return @htmlspecialchars($url, ENT_COMPAT, 'UTF-8');
40 }