ctdo.de/app/php/util.php

38 lines
1.0 KiB
PHP
Raw Permalink Normal View History

<?php
function css_link($src) {
return '<link rel="stylesheet" href="'.$src.'">';
}
function generate_nav($active_page, $pages, $page_names) {
$output = array();
foreach ($pages as $key => $page) {
if ($page == $active_page)
$output[] = ['page' => $page, 'name' => $page_names[$key], 'active' => TRUE];
else
$output[] = ['page' => $page, 'name' => $page_names[$key], 'active' => FALSE];
}
return $output;
}
2023-05-06 21:51:56 +00:00
function html_link($href, $class, $innerHTML, $blank) {
if($blank)
return '<a href="'.$href.'" class="'.$class.'" target="_blank">'.$innerHTML.'</a>';
else
return '<a href="'.$href.'" class="'.$class.'">'.$innerHTML.'</a>';
}
2023-05-06 21:51:56 +00:00
function get_web_json($url) {
$data = json_decode(file_get_contents($url), true);
return $data;
}
2023-05-06 21:51:56 +00:00
function str_mass_replace($searchs, $replacers, $string) {
foreach ($searchs as $key => $search) {
$string = str_replace($search, $replacers[$key], $string);
2023-05-06 21:51:56 +00:00
}
return $string;
}
?>