Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-02-22 23:03:13 +01:00
parent c8181621af
commit 58b2373712
19 changed files with 19094 additions and 49 deletions

View File

@@ -15,7 +15,7 @@ class S
public function number_display( $value )
{
return number_format( $value, 2, ',', ' ' ) . ' zł';
return number_format( (float) $value, 2, ',', ' ' ) . ' zł';
}
public static function prepar_request( $query )
@@ -32,6 +32,7 @@ class S
public static function seo( $val, $delete_rhombs = false )
{
$val = (string) $val;
$array_rep1 = array( '*', '_', ' ', '+', '"', "'", '?', '-', ',', '!', '~', '<', '>', '@', '#', '$', '%', '^', '&', '*' . '(', ')' . '-', '=', '\\', '|', '[', ']', ':', '(', ')' );
$array_rep2 = array( '-', '-', '-', '-', '', '', '', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '', '-', '-', '-', '-', '-', '-', '-', '-' );
@@ -47,6 +48,7 @@ class S
static public function no_pl_excel( $val )
{
$val = (string) $val;
$table = Array(
"\xc4\x85" => "a", "\xc4\x84" => "A", "\xc4\x87" => "c", "\xc4\x86" => "C",
"\xc4\x99" => "e", "\xc4\x98" => "E", "\xc5\x82" => "l", "\xc5\x81" => "L",
@@ -62,6 +64,7 @@ class S
public static function noPL( $val )
{
$val = (string) $val;
$table = array(
"А" => "a", "Б" => "b", "В" => "v", "Г" => "g", "Д" => "d",
"Е" => "e", "Ё" => "yo", "Ж" => "zh", "З" => "z", "И" => "i",
@@ -129,6 +132,7 @@ class S
public static function json_to_array( $json )
{
$values = [];
$values_tmp = json_decode( $json, true );
if ( is_array( $values_tmp ) ) foreach ( $values_tmp as $val )
@@ -148,7 +152,7 @@ class S
public static function get_session( $var )
{
return $_SESSION[ $var ];
return $_SESSION[ $var ] ?? null;
}
public static function del_session( $var ) {
@@ -164,21 +168,13 @@ class S
{
if ( isset( $_POST[ $var ] ) )
{
if ( is_string( $_POST[ $var ] ) )
return $_POST[ $var ];
else
return $_POST[ $var ];
return $_POST[ $var ];
}
else
if ( isset( $_GET[ $var ] ) )
{
if ( isset( $_GET[ $var ] ) )
{
if ( is_string( $_GET[ $var ] ) )
return $_GET[ $var ];
else
return $_GET[ $var ];
}
return $_GET[ $var ];
}
return null;
}
public static function pre( $data , $type = '' )
@@ -235,13 +231,13 @@ class S
{
foreach ( $file as $file_tmp )
{
if ( file_exists( $file_tmp ) )
if ( !empty( $file_tmp ) && file_exists( $file_tmp ) )
$mail -> AddAttachment( $file_tmp );
}
}
else
{
if ( file_exists( $file ) )
if ( !empty( $file ) && file_exists( $file ) )
$mail -> AddAttachment( $file );
}