Simplified extra functions

This commit is contained in:
Julian Prieber 2023-07-10 18:49:55 +02:00
parent 4aa5a86a2b
commit eef549b5ff
3 changed files with 30 additions and 32 deletions

View File

@ -1,29 +0,0 @@
<?php
function external_file_get_contents($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0');
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function uri($path) {
$url = str_replace(['http://', 'https://'], '', url(''));
return "//" . $url . "/" . $path;
}
function footer($key)
{
$upperStr = strtoupper($key);
if (env('TITLE_FOOTER_'.$upperStr) == "") {
$title = __('messages.footer.'.$key);
} else {
$title = env('TITLE_FOOTER_'.$upperStr);
}
return $title;
}

View File

@ -96,3 +96,31 @@ function analyzeImageBrightness($file) {
</div> </div>
'; ';
} }
function external_file_get_contents($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0');
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function uri($path) {
$url = str_replace(['http://', 'https://'], '', url(''));
return "//" . $url . "/" . $path;
}
function footer($key)
{
$upperStr = strtoupper($key);
if (env('TITLE_FOOTER_'.$upperStr) == "") {
$title = __('messages.footer.'.$key);
} else {
$title = env('TITLE_FOOTER_'.$upperStr);
}
return $title;
}

View File

@ -32,8 +32,7 @@
}, },
"autoload": { "autoload": {
"files": [ "files": [
"app/Functions/findfile.php", "app/Functions/functions.php"
"app/Functions/externalfiles.php"
], ],
"psr-4": { "psr-4": {
"App\\": "app/", "App\\": "app/",