mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
Updated sandwich function
Function changes tags to links, plus color coded.
This commit is contained in:
parent
53495469db
commit
e872baf7b4
1 changed files with 16 additions and 2 deletions
|
@ -63,11 +63,25 @@ function getreports($conn, $count = 10) {
|
||||||
return $query->fetchAll();
|
return $query->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sandwitch($str){
|
function sandwitch($str){
|
||||||
$output = "";
|
$output = "";
|
||||||
$arr = explode(",", $str);
|
$arr = explode(",", $str);
|
||||||
foreach ($arr as $word){
|
foreach ($arr as $word){
|
||||||
$output .= '<span class="tag is-info">'.trim($word).'</span>';
|
$word = ucfirst($word);
|
||||||
|
if (stripos($word, 'nsfw') !== false) {
|
||||||
|
$word = strtoupper($word);
|
||||||
|
$tagcolor = "tag is-danger";
|
||||||
|
}
|
||||||
|
elseif (stripos($word, 'SAFE') !== false) {
|
||||||
|
$word = strtoupper($word);
|
||||||
|
$tagcolor = "tag is-success";
|
||||||
|
}
|
||||||
|
elseif (strstr($word, '/')){
|
||||||
|
$tagcolor = "tag is-primary";
|
||||||
|
}else{
|
||||||
|
$tagcolor = "tag is-info";
|
||||||
|
}
|
||||||
|
$output .= '<a href="/archive?q='.trim($word).'"><span class="' . $tagcolor . '">'.trim($word).'</span>';
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue