Correzione nomi di alcune funzioni

Correzione delle funzioni
- starts_with in string_starts_with
- ends_with in string_ends_with
- str_contains in string_contains
- str_to_lower in string_lowercase
- str_to_upper in string_uppercase
per maggiore coerenza e per evitare problemi con PHP 8.
This commit is contained in:
Dasc3er 2020-10-29 16:48:37 +01:00
parent 5fe1a5cf59
commit fdd130bf1b
44 changed files with 82 additions and 82 deletions

View File

@ -348,7 +348,7 @@ if ($structure->permission == 'rw') {
$query = 'SELECT `id`, `html_name` AS `name` FROM `zz_fields` WHERE '.$custom_where;
$customs = $dbo->fetchArray($query);
if (!starts_with(post('op'), 'delete')) {
if (!string_starts_with(post('op'), 'delete')) {
$values = [];
foreach ($customs as $custom) {
if (post($custom['name']) !== null) {
@ -357,7 +357,7 @@ if ($structure->permission == 'rw') {
}
// Inserimento iniziale
if (starts_with(post('op'), 'add')) {
if (string_starts_with(post('op'), 'add')) {
// Informazioni di log
Filter::set('get', 'id_record', $id_record);
@ -371,7 +371,7 @@ if ($structure->permission == 'rw') {
}
// Aggiornamento
elseif (starts_with(post('op'), 'update')) {
elseif (string_starts_with(post('op'), 'update')) {
$query = 'SELECT `zz_field_record`.`id_field` FROM `zz_field_record` JOIN `zz_fields` ON `zz_fields`.`id` = `zz_field_record`.`id_field` WHERE id_record = '.prepare($id_record).' AND '.$custom_where;
$customs_present = $dbo->fetchArray($query);
$customs_present = array_column($customs_present, 'id_field');

View File

@ -96,7 +96,7 @@ echo '
redirectOperation($id_module, isset($id_parent) ? $id_parent : $id_record);
// Interfaccia per la modifica dell'ordine e della visibilità delle colonne (Amministratore)
if ($user->is_admin && str_contains($module['option'], '|select|')) {
if ($user->is_admin && string_contains($module['option'], '|select|')) {
echo '
<button type="button" class="btn btn-xs btn-primary pull-right" onclick="modificaColonne(this)">
<i class="fa fa-th-list"></i> '.tr('Modifica colonne').'

View File

@ -40,7 +40,7 @@ if (!empty($id_record)) {
Util\Query::setSegments(true);
}
// Replace automatico del campo deleted_at se non specifico a una tabella
if (!str_contains($query, '.`deleted_at`') && !str_contains($query, '.deleted_at')) {
if (!string_contains($query, '.`deleted_at`') && !string_contains($query, '.deleted_at')) {
$query = str_replace(['AND `deleted_at` IS NULL', '`deleted_at` IS NULL AND', '`deleted_at` IS NULL', 'AND deleted_at IS NULL', 'deleted_at IS NULL AND', 'deleted_at IS NULL'], '', $query);
}
@ -106,7 +106,7 @@ if (empty($record) || !$has_access) {
echo '
</a>
</li>';
$hide_left_sidebar = Auth::check() && (setting('Nascondere la barra dei plugin di default'));
echo '
@ -126,9 +126,9 @@ if (empty($record) || !$has_access) {
$(".control-sidebar-toggle").bind("click", function() {
$("aside.content-wrapper, .main-footer").toggleClass("with-control-sidebar");
$(".control-sidebar").toggleClass("control-sidebar-shown");
});
});
</script>
</ul>

View File

@ -26,7 +26,7 @@ if (Auth::check()) {
</section><!-- /.content -->
</aside><!-- /.content-wrapper -->
<footer class="main-footer '.(str_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php') ? 'with-control-sidebar' : '').'">
<footer class="main-footer '.(string_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php') ? 'with-control-sidebar' : '').'">
<a class="hidden-xs" href="'.tr('https://www.openstamanager.com').'" title="'.tr("Il gestionale open source per l'assistenza tecnica e la fatturazione").'." target="_blank"><strong>'.tr('OpenSTAManager').'</strong></a>
<span class="pull-right hidden-xs">
<strong>'.tr('Versione').'</strong> '.$version.'

View File

@ -73,8 +73,8 @@ if (post('db_host') !== null) {
$privileges = current($result);
if (
str_contains($privileges, ' ON `'.$db_name.'`.*') ||
str_contains($privileges, ' ON *.*')
string_contains($privileges, ' ON `'.$db_name.'`.*') ||
string_contains($privileges, ' ON *.*')
) {
$pieces = explode(', ', explode(' ON ', str_replace('GRANT ', '', $privileges))[0]);

View File

@ -110,9 +110,9 @@ foreach ($settings as $name => $values) {
$ini = str_replace(['k', 'M'], ['000', '000000'], ini_get($name));
$real = str_replace(['k', 'M'], ['000', '000000'], $description);
if (starts_with($real, '>')) {
if (string_starts_with($real, '>')) {
$status = $ini >= substr($real, 1);
} elseif (starts_with($real, '<')) {
} elseif (string_starts_with($real, '<')) {
$status = $ini <= substr($real, 1);
} else {
$status = ($real == $ini);

View File

@ -63,7 +63,7 @@ if (Auth::check()) {
$array = $_SESSION['module_'.$id_module];
if (!empty($array)) {
foreach ($array as $field => $value) {
if (!empty($value) && starts_with($field, 'search_')) {
if (!empty($value) && string_starts_with($field, 'search_')) {
$field_name = str_replace('search_', '', $field);
echo '
@ -433,7 +433,7 @@ if (Auth::check()) {
<!-- /.sidebar -->
</aside>';
if (str_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
if (string_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
// Menu laterale per la visualizzazione dei plugin
echo '
<aside class="control-sidebar control-sidebar-light control-sidebar-shown">
@ -496,15 +496,15 @@ if (Auth::check()) {
echo '
<!-- Right side column. Contains the navbar and content of the page -->
<aside class="content-wrapper '.(str_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php') ? 'with-control-sidebar' : '').'">
<aside class="content-wrapper '.(string_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php') ? 'with-control-sidebar' : '').'">
<!-- Main content -->
<section class="content">
<div class="row">';
if (str_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
if (string_contains($_SERVER['SCRIPT_FILENAME'], 'editor.php')) {
$location = 'editor_right';
} elseif (str_contains($_SERVER['SCRIPT_FILENAME'], 'controller.php')) {
} elseif (string_contains($_SERVER['SCRIPT_FILENAME'], 'controller.php')) {
$location = 'controller_right';
}

View File

@ -308,7 +308,7 @@ function redirectOperation($id_module, $id_record)
// Scelta del redirect dopo un submit
if (!empty($backto)) {
$hash = filter('hash');
$hash = !starts_with($hash, '#') ? '#'.$hash : $hash;
$hash = !string_starts_with($hash, '#') ? '#'.$hash : $hash;
$hash = $hash == '#tab_0' ? '' : $hash;
if ($backto == 'record-edit') {

View File

@ -98,7 +98,7 @@ if (!function_exists('array_deep_clean')) {
}
}
if (!function_exists('starts_with')) {
if (!function_exists('string_starts_with')) {
/**
* Check if a string starts with the given string.
*
@ -107,14 +107,14 @@ if (!function_exists('starts_with')) {
*
* @return bool
*/
function starts_with($string, $starts_with)
function string_starts_with($string, $starts_with)
{
//return strpos($string, $starts_with) === 0;
//return strpos($string, $string_starts_with) === 0;
return S::create($string)->startsWith($starts_with);
}
}
if (!function_exists('ends_with')) {
if (!function_exists('string_ends_with')) {
/**
* Check if a string ends with the given string.
*
@ -123,14 +123,14 @@ if (!function_exists('ends_with')) {
*
* @return bool
*/
function ends_with($string, $ends_with)
function string_ends_with($string, $ends_with)
{
//return substr($string, -strlen($ends_with)) === $ends_with;
//return substr($string, -strlen($string_ends_with)) === $string_ends_with;
return S::create($string)->endsWith($ends_with);
}
}
if (!function_exists('str_contains')) {
if (!function_exists('string_contains')) {
/**
* Check if a string contains the given string.
*
@ -139,14 +139,14 @@ if (!function_exists('str_contains')) {
*
* @return bool
*/
function str_contains($string, $contains)
function string_contains($string, $contains)
{
//return strpos($string, $contains) !== false;
return S::create($string)->contains($contains);
}
}
if (!function_exists('str_to_lower')) {
if (!function_exists('string_lowercase')) {
/**
* Converts a string in the lower-case version.
*
@ -154,13 +154,13 @@ if (!function_exists('str_to_lower')) {
*
* @return string
*/
function str_to_lower($string)
function string_lowercase($string)
{
return S::create($string)->toLowerCase()->__toString();
}
}
if (!function_exists('str_to_upper')) {
if (!function_exists('string_uppercase')) {
/**
* Converts a string in the upper-case version.
*
@ -168,7 +168,7 @@ if (!function_exists('str_to_upper')) {
*
* @return string
*/
function str_to_upper($string)
function string_uppercase($string)
{
return S::create($string)->toUpperCase()->__toString();
}

View File

@ -75,7 +75,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
$text = str_replace($term, "<span class='highlight'>".$term.'</span>', $r[$name]);
$result['labels'][] = $name.': '.$text.'<br/>';
@ -121,7 +121,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
$text = str_replace($term, "<span class='highlight'>".$term.'</span>', $r[$name]);
$result['labels'][] = $name.': '.$text.'<br/>';

View File

@ -56,7 +56,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
$text = str_replace($term, "<span class='highlight'>".$term.'</span>', $r[$name]);
$result['labels'][] = $name.': '.$text.'<br/>';

View File

@ -50,7 +50,7 @@ if (!is_writable($backup_dir) || !is_readable($backup_dir)) {
echo '<p>'.tr('Il backup è molto importante perché permette di creare una copia della propria installazione e relativi dati per poterla poi ripristinare in seguito a errori, cancellazioni accidentali o guasti hardware').'.</p>';
if (starts_with($backup_dir, base_dir())) {
if (string_starts_with($backup_dir, base_dir())) {
echo '
<div class="alert alert-warning">
<i class="fa fa-warning"></i> '.tr('Per motivi di sicurezza si consiglia di modificare il percorso della cartella di backup al di fuori della cartella di OSM, possibilmente in una unità esterna').'.
@ -170,7 +170,7 @@ if (file_exists($backup_dir)) {
$backups_file = [];
foreach ($backups as $key => $backup) {
if (ends_with($backup, '.zip')) {
if (string_ends_with($backup, '.zip')) {
$backups_zip[$key] = $backup;
} else {
$backups_file[$key] = $backup;

View File

@ -58,7 +58,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
if ($name == 'Righe') {
$result['labels'][] = tr('Termine presente nelle righe del documento').'<br/>';
} else {

View File

@ -60,7 +60,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
if ($name == 'Righe') {
$result['labels'][] = tr('Termine presente nelle righe del documento').'<br/>';
} else {

View File

@ -56,7 +56,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
$text = str_replace($term, "<span class='highlight'>".$term.'</span>', $r[$name]);
$result['labels'][] = $name.': '.$text.'<br/>';

View File

@ -72,7 +72,7 @@ if (empty($id_record)) {
$nomi_disponibili[$key] = [];
$names = isset($value['names']) ? $value['names'] : [$value['label']];
foreach ($names as $name) {
$nomi_disponibili[$key][] = trim(str_to_lower($name));
$nomi_disponibili[$key][] = trim(string_lowercase($name));
}
}
@ -95,7 +95,7 @@ if (empty($id_record)) {
$selezionato = null;
foreach ($fields as $key => $value) {
// Confronto per l'individuazione della relativa colonna
$nome = trim(str_to_lower($prima_riga[$column]));
$nome = trim(string_lowercase($prima_riga[$column]));
if (in_array($nome, $nomi_disponibili[$key])) {
$escludi_prima_riga = 1;
$selezionato = $key;

View File

@ -60,7 +60,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
$text = str_replace($term, "<span class='highlight'>".$term.'</span>', $r[$name]);
$result['labels'][] = $name.': '.$text.'<br/>';

View File

@ -106,7 +106,7 @@ class Sync extends Resource implements RetrieveInterface, UpdateInterface
$description = $event['DESCRIPTION'];
// Individuazione idriga di in_interventi_tecnici
if (str_contains($event['UID'], '-')) {
if (string_contains($event['UID'], '-')) {
$idriga = 'NEW';
} else {
$idriga = $event['UID'];

View File

@ -58,7 +58,7 @@ foreach ($rs as $r) {
// Campi da evidenziare
$result['labels'] = [];
foreach ($fields as $name => $value) {
if (str_contains($r[$name], $term)) {
if (string_contains($r[$name], $term)) {
$text = str_replace($term, "<span class='highlight'>".$term.'</span>', $r[$name]);
$result['labels'][] = $name.': '.$text.'<br/>';

View File

@ -21,7 +21,7 @@ include_once __DIR__.'/../../core.php';
switch (post('op')) {
case 'update':
$pattern = str_contains(post('pattern'), '#') ? post('pattern') : '####';
$pattern = string_contains(post('pattern'), '#') ? post('pattern') : '####';
$predefined = post('predefined');
$module = post('module');
@ -61,7 +61,7 @@ switch (post('op')) {
break;
case 'add':
$pattern = str_contains(post('pattern'), '#') ? post('pattern') : '####';
$pattern = string_contains(post('pattern'), '#') ? post('pattern') : '####';
$predefined = post('predefined');
$module = post('module');

View File

@ -87,7 +87,7 @@ $_SESSION['module_'.$record['id_module']]['id_segment'] = $previous_module;
<?php
if (str_contains($current_module['option'], '|segment')) {
if (string_contains($current_module['option'], '|segment')) {
?>
<!-- Campi extra -->
<div class="panel panel-primary">

View File

@ -37,7 +37,7 @@ switch (filter('op')) {
$temp_name = $_FILES['blob']['tmp_name'];
$name = $_FILES['blob']['name'];
if (ends_with($name, '.zip')) {
if (string_ends_with($name, '.zip')) {
$directory = FatturaElettronica::getImportDirectory();
Util\Zip::extract($temp_name, $directory);

View File

@ -52,7 +52,7 @@ class FatturaElettronica
{
$this->file = static::getImportDirectory().'/'.$name;
if (ends_with($name, '.p7m')) {
if (string_ends_with($name, '.p7m')) {
$file = XML::decodeP7M($this->file);
if (!empty($file)) {

View File

@ -49,7 +49,7 @@ class Ricevuta
$file = static::getImportDirectory().'/'.$name;
// Estrazione implicita per il formato ZIP
if (ends_with($name, '.zip')) {
if (string_ends_with($name, '.zip')) {
$original_file = $file;
$extraction_dir = static::getImportDirectory().'/tmp';

View File

@ -94,7 +94,7 @@ class AJAX
*/
public static function selectResults($query, $where, $filter = [], $search = [], $limit = [], $custom = [])
{
if (str_contains($query, '|filter|')) {
if (string_contains($query, '|filter|')) {
$query = str_replace('|filter|', !empty($filter) ? 'WHERE '.implode(' OR ', $filter) : '', $query);
} elseif (!empty($filter)) {
$where[] = '('.implode(' OR ', $filter).')';

View File

@ -86,7 +86,7 @@ class Manager
$value = substr($value, 1, -1);
// Individuazione della tipologia (array o string)
$where[$key] = str_contains($value, ',') ? explode(',', $value) : $value;
$where[$key] = string_contains($value, ',') ? explode(',', $value) : $value;
}
// Ordinamento personalizzato

View File

@ -301,7 +301,7 @@ class App
*/
public static function filepath($path, $file = null)
{
$path = str_contains($path, base_dir()) ? $path : base_dir().'/'.ltrim($path, '/');
$path = string_contains($path, base_dir()) ? $path : base_dir().'/'.ltrim($path, '/');
$path = empty($file) ? $path : rtrim($path, '/').'/'.$file;
$original_file = str_replace('|custom|', '', $path);

View File

@ -169,7 +169,7 @@ class Backup
],
];
if (starts_with($backup_dir, slashes(base_dir()))) {
if (string_starts_with($backup_dir, slashes(base_dir()))) {
$ignores['dirs'][] = basename($backup_dir);
}

View File

@ -303,7 +303,7 @@ class Database extends Util\Singleton
*/
public function fetchOne($query, $parameters = [])
{
if (!str_contains($query, 'LIMIT')) {
if (!string_contains($query, 'LIMIT')) {
$query .= ' LIMIT 1';
}

View File

@ -486,7 +486,7 @@ class HTMLBuilder
foreach ($values as $key => $value) {
// Fix per la presenza di apici doppi
$value = prepareToField(is_array($value) ? implode(' ', $value) : $value);
if (str_contains($result, '|'.$key.'|')) {
if (string_contains($result, '|'.$key.'|')) {
$result = str_replace('|'.$key.'|', $value, $result);
} elseif (!empty($value) || is_numeric($value)) {
$attributes[] = $key.'="'.$value.'"';

View File

@ -246,7 +246,7 @@ class DefaultHandler implements HandlerInterface
if (isset($values['decimals'])) {
if (is_numeric($values['decimals'])) {
$decimals = $values['decimals'];
} elseif (starts_with($values['decimals'], 'qta')) {
} elseif (string_starts_with($values['decimals'], 'qta')) {
$decimals = setting('Cifre decimali per quantità');
$values['decimals'] = $decimals;

View File

@ -84,14 +84,14 @@ class SelectHandler implements HandlerInterface
}
// Gestione del select da query specifica (se il campo "values" è impostato a "query=SQL")
elseif (starts_with($values['values'], 'query=')) {
elseif (string_starts_with($values['values'], 'query=')) {
$query = substr($values['values'], strlen('query='));
$result .= $this->selectQuery($query, $values['value']);
}
// Gestione del select dal formato JSON parziale (valori singoli)
elseif (starts_with($values['values'], 'list=')) {
elseif (string_starts_with($values['values'], 'list=')) {
$list = substr($values['values'], strlen('list='));
$result .= $this->selectList(json_decode('{'.$list.'}', true), $values);

View File

@ -177,15 +177,15 @@ class HTMLWrapper implements WrapperInterface
{
$result = $string;
if (starts_with($string, 'add|')) {
if (string_starts_with($string, 'add|')) {
$result = $this->add($values, $extras, $string);
$values['icon-custom'] = 'no-padding';
} elseif (starts_with($string, 'choice|')) {
} elseif (string_starts_with($string, 'choice|')) {
$result = $this->choice($values, $extras, $string);
$values['icon-custom'] = 'no-padding';
}
if (str_contains($string, '<button')) {
if (string_contains($string, '<button')) {
$values['icon-custom'] = 'no-padding';
}

View File

@ -301,7 +301,7 @@ class Formatter
$values = str_split(strrev($integer), 4);
foreach ($values as $key => $value) {
if (strlen($value) == 4 && ends_with($value, $current['thousands'])) {
if (strlen($value) == 4 && string_ends_with($value, $current['thousands'])) {
$values[$key] = substr($value, 0, -1);
}
}

View File

@ -282,7 +282,7 @@ class Modules
$alternativo = is_bool($alternativo) && $alternativo ? $testo : $alternativo;
// Aggiunta automatica dell'icona di riferimento
if (!str_contains($testo, '<i ')) {
if (!string_contains($testo, '<i ')) {
$testo = $testo.' <i class="fa fa-external-link"></i>';
}

View File

@ -379,7 +379,7 @@ class Prints
$report = str_replace('$table$', $table, $report);
// Footer di default
if (!str_contains($report, '<page_footer>')) {
if (!string_contains($report, '<page_footer>')) {
$report .= '<page_footer>$default_footer$</page_footer>';
}

View File

@ -175,7 +175,7 @@ class Update
{
$version = self::getVersion();
return str_contains($version, 'beta');
return string_contains($version, 'beta');
}
/**
@ -517,7 +517,7 @@ class Update
{
$version = str_replace('.', '_', $update['version']);
$old_standard = str_contains($update['version'], '_');
$old_standard = string_contains($update['version'], '_');
if (empty($update['directory']) && !$old_standard) {
return 'update/'.$version;
}
@ -544,7 +544,7 @@ class Update
*/
protected static function getFile($file)
{
$file = (str_contains($file, base_dir().DIRECTORY_SEPARATOR)) ? $file : base_dir().DIRECTORY_SEPARATOR.$file;
$file = (string_contains($file, base_dir().DIRECTORY_SEPARATOR)) ? $file : base_dir().DIRECTORY_SEPARATOR.$file;
$result = '';

View File

@ -158,7 +158,7 @@ class Ini
$tipo = ($array[$sezione]['tipo'] == 'input') ? 'text' : $array[$sezione]['tipo'];
$valore = $array[$sezione]['valore'];
$opzioni = str_contains($array[$sezione]['opzioni'] ?: '', ',') ? explode(',', $array[$sezione]['opzioni']) : [];
$opzioni = string_contains($array[$sezione]['opzioni'] ?: '', ',') ? explode(',', $array[$sezione]['opzioni']) : [];
$values = [];
foreach ($opzioni as $o) {
$values[] = '\"'.addslashes(addslashes($o)).'\": \"'.addslashes(addslashes($o)).'\"';

View File

@ -53,7 +53,7 @@ class Query
*/
public static function readQuery($element)
{
if (str_contains($element['option'], '|select|')) {
if (string_contains($element['option'], '|select|')) {
$result = self::readNewQuery($element);
} else {
$result = self::readOldQuery($element);
@ -173,7 +173,7 @@ class Query
$search_query = $total['search_inside'][$pos];
// Campo con ricerca personalizzata
if (str_contains($search_query, '|search|')) {
if (string_contains($search_query, '|search|')) {
$pieces = explode(',', $value);
foreach ($pieces as $piece) {
$piece = trim($piece);
@ -195,12 +195,12 @@ class Query
// Gestione confronti
$real_value = trim(str_replace(['&lt;', '&gt;'], ['<', '>'], $value));
$more = starts_with($real_value, '>=') || starts_with($real_value, '> =') || starts_with($real_value, '>');
$minus = starts_with($real_value, '<=') || starts_with($real_value, '< =') || starts_with($real_value, '<');
$equal = starts_with($real_value, '=');
$more = string_starts_with($real_value, '>=') || string_starts_with($real_value, '> =') || string_starts_with($real_value, '>');
$minus = string_starts_with($real_value, '<=') || string_starts_with($real_value, '< =') || string_starts_with($real_value, '<');
$equal = string_starts_with($real_value, '=');
if ($minus || $more || $equal) {
$sign = str_contains($real_value, '=') ? '=' : '';
$sign = string_contains($real_value, '=') ? '=' : '';
if ($more) {
$sign = '>'.$sign;
} elseif ($minus) {
@ -314,7 +314,7 @@ class Query
$results = [];
if (!empty($sums)) {
foreach ($sums as $key => $sum) {
if (str_contains($key, 'sum_')) {
if (string_contains($key, 'sum_')) {
$results[str_replace('sum_', '', $key)] = Translator::numberToLocale($sum);
}
}

View File

@ -78,7 +78,7 @@ class Validate
}
// Controllo sulla sintassi
if (starts_with($vat_number, 'IT') && !static::vatCheckIT($vat_number)) {
if (string_starts_with($vat_number, 'IT') && !static::vatCheckIT($vat_number)) {
$result['valid-format'] = false;
return $result;

View File

@ -50,7 +50,7 @@ foreach ($prefixes as $prefix) {
$replaces[$prefix.'pec'] = !empty($replaces[$prefix.'pec']) ? 'PEC: '.$replaces[$prefix.'pec'] : '';
foreach ($replaces as $key => $value) {
if (starts_with($key, $prefix)) {
if (string_starts_with($key, $prefix)) {
$replaces[$key] = empty($value) ? $value : $value.'<br/>';
}
}

View File

@ -34,7 +34,7 @@ $search_filters = [];
if (is_array($_SESSION['module_'.$id_module])) {
foreach ($_SESSION['module_'.$id_module] as $field => $value) {
if (!empty($value) && starts_with($field, 'search_')) {
if (!empty($value) && string_starts_with($field, 'search_')) {
$field_name = str_replace('search_', '', $field);
$field_name = str_replace('__', ' ', $field_name);
$field_name = str_replace('-', ' ', $field_name);

View File

@ -34,7 +34,7 @@ $search_filters = [];
if (is_array($_SESSION['module_'.$id_module])) {
foreach ($_SESSION['module_'.$id_module] as $field => $value) {
if (!empty($value) && starts_with($field, 'search_')) {
if (!empty($value) && string_starts_with($field, 'search_')) {
$field_name = str_replace('search_', '', $field);
$field_name = str_replace('__', ' ', $field_name);
$field_name = str_replace('-', ' ', $field_name);

View File

@ -39,7 +39,7 @@ if (empty($file)) {
$backup = $backups[$i];
// Individuazione del database nel backup
if (ends_with($backup, '.zip')) {
if (string_ends_with($backup, '.zip')) {
$zip = new ZipArchive();
$zip->open($backup);
@ -85,7 +85,7 @@ $count = count($queries);
// Individuazione del dump di co_movimenti
$query = null;
for ($i = 0; $i < $count; ++$i) {
if (starts_with($queries[$i], 'INSERT INTO `co_movimenti`')) {
if (string_starts_with($queries[$i], 'INSERT INTO `co_movimenti`')) {
$query = $queries[$i];
}
}