Adopted composer autoload way

Split up classes into separate way, to allow autoloader to do it's work

Signed-off-by: Diederik de Groot <ddegroot@talon.nl>
This commit is contained in:
Diederik de Groot
2020-03-22 10:15:31 +01:00
parent fcf7e52370
commit 5064cb3e36
34 changed files with 1292 additions and 1023 deletions

33
lib/Utils.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
//
// Helper functions
//
declare(strict_types=1);
namespace PROVISION;
class Utils {
static function utf8_urldecode($str) {
$str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($str));
return html_entity_decode($str,0,'UTF-8');;
}
static public function log_debug($message) {
global $logger;
if ($logger) {
$logger->log('LOG_DEBUG', $message);
}
}
static function log_error($message) {
global $logger;
if ($logger) {
$logger->log('LOG_ERROR', $message);
}
}
static function log_error_and_throw($message) {
log_error($message);
throw new Exception($message);
}
}
?>