diff --git a/app/Console/Commands/Export/ExportsData.php b/app/Console/Commands/Export/ExportsData.php index 83fd906dc6..a4cc991d89 100644 --- a/app/Console/Commands/Export/ExportsData.php +++ b/app/Console/Commands/Export/ExportsData.php @@ -273,7 +273,7 @@ class ExportsData extends Command */ private function exportData(array $options, array $data): void { - $date = \Safe\date('Y_m_d'); + $date = date('Y_m_d'); foreach ($data as $key => $content) { $file = sprintf('%s%s_%s.csv', $options['directory'], $date, $key); if (false === $options['force'] && file_exists($file)) { @@ -283,7 +283,7 @@ class ExportsData extends Command $this->friendlyWarning(sprintf('File "%s" exists already but will be replaced.', $file)); } // continue to write to file. - \Safe\file_put_contents($file, $content); + file_put_contents($file, $content); $this->friendlyPositive(sprintf('Wrote %s-export to file "%s".', $key, $file)); } } diff --git a/app/Console/Commands/System/ForcesDecimalSize.php b/app/Console/Commands/System/ForcesDecimalSize.php index eaec52cdfb..66340b4c6c 100644 --- a/app/Console/Commands/System/ForcesDecimalSize.php +++ b/app/Console/Commands/System/ForcesDecimalSize.php @@ -130,7 +130,7 @@ class ForcesDecimalSize extends Command // if sqlite, add function? if ('sqlite' === (string) config('database.default')) { DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) { - \Safe\mb_regex_encoding('UTF-8'); + mb_regex_encoding('UTF-8'); $pattern = trim($pattern, '"'); return (false !== mb_ereg($pattern, (string) $value)) ? 1 : 0; @@ -234,7 +234,7 @@ class ForcesDecimalSize extends Command /** @var Builder $query */ $query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->where('account_meta.name', 'currency_id') - ->where('account_meta.data', \Safe\json_encode((string) $currency->id)) + ->where('account_meta.data', json_encode((string) $currency->id)) ; $query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void { foreach ($fields as $field) { @@ -338,7 +338,7 @@ class ForcesDecimalSize extends Command ->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->where('account_meta.name', 'currency_id') - ->where('account_meta.data', \Safe\json_encode((string) $currency->id)) + ->where('account_meta.data', json_encode((string) $currency->id)) ->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression): void { foreach ($fields as $field) { $q->orWhere( @@ -394,7 +394,7 @@ class ForcesDecimalSize extends Command ->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->where('account_meta.name', 'currency_id') - ->where('account_meta.data', \Safe\json_encode((string) $currency->id)) + ->where('account_meta.data', json_encode((string) $currency->id)) ->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void { foreach ($fields as $field) { $q->orWhere( @@ -448,7 +448,7 @@ class ForcesDecimalSize extends Command $query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->where('account_meta.name', 'currency_id') - ->where('account_meta.data', \Safe\json_encode((string) $currency->id)) + ->where('account_meta.data', json_encode((string) $currency->id)) ->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void { foreach ($fields as $field) { $q->orWhere( diff --git a/app/Console/Commands/System/OutputsInstructions.php b/app/Console/Commands/System/OutputsInstructions.php index 9dd17f2fff..0d3e64d854 100644 --- a/app/Console/Commands/System/OutputsInstructions.php +++ b/app/Console/Commands/System/OutputsInstructions.php @@ -111,8 +111,8 @@ class OutputsInstructions extends Command */ private function showLogo(): void { - $today = \Safe\date('m-d'); - $month = \Safe\date('m'); + $today = date('m-d'); + $month = date('m'); // variation in colors and effects just because I can! // default is Ukraine flag: $colors = ['blue', 'blue', 'blue', 'yellow', 'yellow', 'yellow', 'default', 'default']; diff --git a/app/Console/Commands/System/ScansAttachments.php b/app/Console/Commands/System/ScansAttachments.php index 001f2ec80c..b5fad33afa 100644 --- a/app/Console/Commands/System/ScansAttachments.php +++ b/app/Console/Commands/System/ScansAttachments.php @@ -63,15 +63,15 @@ class ScansAttachments extends Command app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage())); $decryptedContent = $encryptedContent; } - $tempFileName = \Safe\tempnam(sys_get_temp_dir(), 'FireflyIII'); + $tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII'); if (false === $tempFileName) { app('log')->error(sprintf('Could not create temporary file for attachment #%d', $attachment->id)); exit(1); } - \Safe\file_put_contents($tempFileName, $decryptedContent); - $attachment->md5 = (string) \Safe\md5_file($tempFileName); - $attachment->mime = (string) \Safe\mime_content_type($tempFileName); + file_put_contents($tempFileName, $decryptedContent); + $attachment->md5 = (string) md5_file($tempFileName); + $attachment->mime = (string) mime_content_type($tempFileName); $attachment->save(); $this->friendlyInfo(sprintf('Fixed attachment #%d', $attachment->id)); } diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index 0cad167ccb..894c73daa2 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -57,7 +57,7 @@ class VerifySecurityAlerts extends Command return 0; } $content = $disk->get('alerts.json'); - $json = \Safe\json_decode($content, true, 10); + $json = json_decode($content, true, 10); /** @var array $array */ foreach ($json as $array) { diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index 9bc4477888..89a961925c 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -167,7 +167,7 @@ class RemovesDatabaseDecryption extends Command { // try to json_decrypt the value. try { - $newValue = \Safe\json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value; + $newValue = json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value; } catch (\JsonException $e) { $message = sprintf('Could not JSON decode preference row #%d: %s. This does not have to be a problem.', $id, $e->getMessage()); $this->friendlyError($message); diff --git a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php index 39a715ced9..d20f763945 100644 --- a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php @@ -100,7 +100,7 @@ class UpgradesRecurrenceMetaData extends Command if ('tags' === $meta->name) { $array = explode(',', $meta->value); - $value = \Safe\json_encode($array, JSON_THROW_ON_ERROR); + $value = json_encode($array, JSON_THROW_ON_ERROR); } RecurrenceTransactionMeta::create( diff --git a/app/Console/Commands/Upgrade/UpgradesToGroups.php b/app/Console/Commands/Upgrade/UpgradesToGroups.php index ee5b35aa71..137a9f8bea 100644 --- a/app/Console/Commands/Upgrade/UpgradesToGroups.php +++ b/app/Console/Commands/Upgrade/UpgradesToGroups.php @@ -366,8 +366,8 @@ class UpgradesToGroups extends Command { $groupId = DB::table('transaction_groups')->insertGetId( [ - 'created_at' => \Safe\date('Y-m-d H:i:s'), - 'updated_at' => \Safe\date('Y-m-d H:i:s'), + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), 'title' => null, 'user_id' => $array['user_id'], ] diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php index a6707e8b40..5c308c1d08 100644 --- a/app/Factory/PiggyBankFactory.php +++ b/app/Factory/PiggyBankFactory.php @@ -284,7 +284,7 @@ class PiggyBankFactory Log::debug(sprintf('Will link account #%d with info: ', $account->id), $toBeLinked[$account->id]); } } - Log::debug(sprintf('Link information: %s', \Safe\json_encode($toBeLinked))); + Log::debug(sprintf('Link information: %s', json_encode($toBeLinked))); if (0 !== count($toBeLinked)) { $piggyBank->accounts()->sync($toBeLinked); } diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 0a75ea3e0c..6a1ecbece5 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -323,7 +323,7 @@ class TransactionJournalFactory unset($dataRow['import_hash_v2'], $dataRow['original_source']); try { - $json = \Safe\json_encode($dataRow, JSON_THROW_ON_ERROR); + $json = json_encode($dataRow, JSON_THROW_ON_ERROR); } catch (\JsonException $e) { Log::error(sprintf('Could not encode dataRow: %s', $e->getMessage())); $json = microtime(); @@ -352,7 +352,7 @@ class TransactionJournalFactory ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') ->whereNotNull('transaction_journals.id') ->where('transaction_journals.user_id', $this->user->id) - ->where('data', \Safe\json_encode($hash, JSON_THROW_ON_ERROR)) + ->where('data', json_encode($hash, JSON_THROW_ON_ERROR)) ->with(['transactionJournal', 'transactionJournal.transactionGroup']) ->first(['journal_meta.*']) ; diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php index 3624250767..75e313a313 100644 --- a/app/Handlers/Events/VersionCheckEventHandler.php +++ b/app/Handlers/Events/VersionCheckEventHandler.php @@ -73,7 +73,7 @@ class VersionCheckEventHandler $diff = $now - $lastCheckTime->data; Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); if ($diff < 604800) { - Log::debug(sprintf('Checked for updates less than a week ago (on %s).', \Safe\date('Y-m-d H:i:s', $lastCheckTime->data))); + Log::debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data))); return; } @@ -105,7 +105,7 @@ class VersionCheckEventHandler $diff = $now - $lastCheckTime->data; Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); if ($diff < 604800 * 4) { - Log::debug(sprintf('Warned about updates less than four weeks ago (on %s).', \Safe\date('Y-m-d H:i:s', $lastCheckTime->data))); + Log::debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data))); return; } diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index 3d8583805e..01ed7bb275 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -118,7 +118,7 @@ class AttachmentHelper implements AttachmentHelperInterface public function saveAttachmentFromApi(Attachment $attachment, string $content): bool { Log::debug(sprintf('Now in %s', __METHOD__)); - $resource = \Safe\tmpfile(); + $resource = tmpfile(); if (false === $resource) { Log::error('Cannot create temp-file for file upload.'); @@ -133,17 +133,17 @@ class AttachmentHelper implements AttachmentHelperInterface $path = stream_get_meta_data($resource)['uri']; Log::debug(sprintf('Path is %s', $path)); - $result = \Safe\fwrite($resource, $content); + $result = fwrite($resource, $content); if (false === $result) { Log::error('Could not write temp file.'); return false; } Log::debug(sprintf('Wrote %d bytes to temp file.', $result)); - $finfo = \Safe\finfo_open(FILEINFO_MIME_TYPE); + $finfo = finfo_open(FILEINFO_MIME_TYPE); if (false === $finfo) { Log::error('Could not open finfo.'); - \Safe\fclose($resource); + fclose($resource); return false; } @@ -151,7 +151,7 @@ class AttachmentHelper implements AttachmentHelperInterface $allowedMime = config('firefly.allowedMimes'); if (!in_array($mime, $allowedMime, true)) { Log::error(sprintf('Mime type %s is not allowed for API file upload.', $mime)); - \Safe\fclose($resource); + fclose($resource); return false; } @@ -163,7 +163,7 @@ class AttachmentHelper implements AttachmentHelperInterface $this->uploadDisk->put($file, $content); // update attachment. - $attachment->md5 = (string) \Safe\md5_file($path); + $attachment->md5 = (string) md5_file($path); $attachment->mime = $mime; $attachment->size = strlen($content); $attachment->uploaded = true; @@ -225,7 +225,7 @@ class AttachmentHelper implements AttachmentHelperInterface $attachment = new Attachment(); // create Attachment object. $attachment->user()->associate($user); $attachment->attachable()->associate($model); - $attachment->md5 = (string) \Safe\md5_file($file->getRealPath()); + $attachment->md5 = (string) md5_file($file->getRealPath()); $attachment->filename = $file->getClientOriginalName(); $attachment->mime = $file->getMimeType(); $attachment->size = $file->getSize(); @@ -333,7 +333,7 @@ class AttachmentHelper implements AttachmentHelperInterface */ protected function hasFile(UploadedFile $file, Model $model): bool { - $md5 = \Safe\md5_file($file->getRealPath()); + $md5 = md5_file($file->getRealPath()); $name = $file->getClientOriginalName(); $class = $model::class; $count = 0; diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index 37d99ee720..1fab2c652e 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -167,7 +167,7 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'external_id'); - $this->query->where('journal_meta.data', '!=', sprintf('%s', \Safe\json_encode($externalId))); + $this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($externalId))); $this->query->whereNull('journal_meta.deleted_at'); return $this; @@ -190,14 +190,14 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'external_url'); - $this->query->where('journal_meta.data', '!=', \Safe\json_encode($url)); + $this->query->where('journal_meta.data', '!=', json_encode($url)); return $this; } public function excludeInternalReference(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -211,14 +211,14 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'recurrence_id'); - $this->query->where('journal_meta.data', '!=', sprintf('%s', \Safe\json_encode($recurringId))); + $this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($recurringId))); return $this; } public function externalIdContains(string $externalId): GroupCollectorInterface { - $externalId = (string) \Safe\json_encode($externalId); + $externalId = (string) json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -230,7 +230,7 @@ trait MetaCollection public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface { - $externalId = (string) \Safe\json_encode($externalId); + $externalId = (string) json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -242,7 +242,7 @@ trait MetaCollection public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface { - $externalId = (string) \Safe\json_encode($externalId); + $externalId = (string) json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -254,7 +254,7 @@ trait MetaCollection public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface { - $externalId = (string) \Safe\json_encode($externalId); + $externalId = (string) json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -266,7 +266,7 @@ trait MetaCollection public function externalIdEnds(string $externalId): GroupCollectorInterface { - $externalId = (string) \Safe\json_encode($externalId); + $externalId = (string) json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -278,7 +278,7 @@ trait MetaCollection public function externalIdStarts(string $externalId): GroupCollectorInterface { - $externalId = (string) \Safe\json_encode($externalId); + $externalId = (string) json_encode($externalId); $externalId = str_replace('\\', '\\\\', trim($externalId, '"')); $this->joinMetaDataTables(); @@ -291,7 +291,7 @@ trait MetaCollection public function externalUrlContains(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) \Safe\json_encode($url); + $url = (string) json_encode($url); $url = str_replace('\\', '\\\\', trim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $url)); @@ -302,7 +302,7 @@ trait MetaCollection public function externalUrlDoesNotContain(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) \Safe\json_encode($url); + $url = (string) json_encode($url); $url = str_replace('\\', '\\\\', trim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->whereNotLike('journal_meta.data', sprintf('%%%s%%', $url)); @@ -313,7 +313,7 @@ trait MetaCollection public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) \Safe\json_encode($url); + $url = (string) json_encode($url); $url = str_replace('\\', '\\\\', ltrim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->whereNotLike('journal_meta.data', sprintf('%%%s', $url)); @@ -324,7 +324,7 @@ trait MetaCollection public function externalUrlDoesNotStart(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) \Safe\json_encode($url); + $url = (string) json_encode($url); $url = str_replace('\\', '\\\\', rtrim($url, '"')); // var_dump($url); @@ -337,7 +337,7 @@ trait MetaCollection public function externalUrlEnds(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) \Safe\json_encode($url); + $url = (string) json_encode($url); $url = str_replace('\\', '\\\\', ltrim($url, '"')); $this->query->where('journal_meta.name', '=', 'external_url'); $this->query->whereLike('journal_meta.data', sprintf('%%%s', $url)); @@ -348,7 +348,7 @@ trait MetaCollection public function externalUrlStarts(string $url): GroupCollectorInterface { $this->joinMetaDataTables(); - $url = (string) \Safe\json_encode($url); + $url = (string) json_encode($url); $url = str_replace('\\', '\\\\', rtrim($url, '"')); // var_dump($url); @@ -399,7 +399,7 @@ trait MetaCollection public function internalReferenceContains(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); // var_dump($internalReference); // exit; @@ -414,7 +414,7 @@ trait MetaCollection public function internalReferenceDoesNotContain(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -427,7 +427,7 @@ trait MetaCollection public function internalReferenceDoesNotEnd(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -440,7 +440,7 @@ trait MetaCollection public function internalReferenceDoesNotStart(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -453,7 +453,7 @@ trait MetaCollection public function internalReferenceEnds(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -466,7 +466,7 @@ trait MetaCollection public function internalReferenceStarts(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); @@ -704,7 +704,7 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'external_id'); - $this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($externalId))); + $this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($externalId))); $this->query->whereNull('journal_meta.deleted_at'); return $this; @@ -714,7 +714,7 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'external_url'); - $this->query->where('journal_meta.data', '=', \Safe\json_encode($url)); + $this->query->where('journal_meta.data', '=', json_encode($url)); $this->query->whereNull('journal_meta.deleted_at'); return $this; @@ -722,12 +722,12 @@ trait MetaCollection public function setInternalReference(string $internalReference): GroupCollectorInterface { - $internalReference = (string) \Safe\json_encode($internalReference); + $internalReference = (string) json_encode($internalReference); $internalReference = str_replace('\\', '\\\\', trim($internalReference, '"')); $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'internal_reference'); - $this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($internalReference))); + $this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($internalReference))); $this->query->whereNull('journal_meta.deleted_at'); return $this; @@ -737,7 +737,7 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'recurrence_id'); - $this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($recurringId))); + $this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($recurringId))); $this->query->whereNull('journal_meta.deleted_at'); return $this; @@ -747,7 +747,7 @@ trait MetaCollection { $this->joinMetaDataTables(); $this->query->where('journal_meta.name', '=', 'sepa_ct_id'); - $this->query->where('journal_meta.data', '=', sprintf('%s', \Safe\json_encode($sepaCT))); + $this->query->where('journal_meta.data', '=', sprintf('%s', json_encode($sepaCT))); $this->query->whereNull('journal_meta.deleted_at'); return $this; diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index 4cff722226..21dcb45a40 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -593,7 +593,7 @@ class GroupCollector implements GroupCollectorInterface if (array_key_exists('meta_name', $result) && in_array($result['meta_name'], $dates, true)) { $name = $result['meta_name']; if (array_key_exists('meta_data', $result) && '' !== (string) $result['meta_data']) { - $result[$name] = Carbon::createFromFormat('!Y-m-d', substr((string) \Safe\json_decode($result['meta_data']), 0, 10)); + $result[$name] = Carbon::createFromFormat('!Y-m-d', substr((string) json_decode($result['meta_data']), 0, 10)); } } diff --git a/app/Helpers/Webhook/Sha3SignatureGenerator.php b/app/Helpers/Webhook/Sha3SignatureGenerator.php index e1b77af37d..de301e3cd0 100644 --- a/app/Helpers/Webhook/Sha3SignatureGenerator.php +++ b/app/Helpers/Webhook/Sha3SignatureGenerator.php @@ -46,7 +46,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface $json = ''; try { - $json = \Safe\json_encode($message->message, JSON_THROW_ON_ERROR); + $json = json_encode($message->message, JSON_THROW_ON_ERROR); } catch (\JsonException $e) { app('log')->error('Could not generate hash.'); app('log')->error(sprintf('JSON value: %s', $json)); diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index e7e0819b0c..10ac06ba9b 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -101,7 +101,7 @@ class ForgotPasswordController extends Controller */ private function validateHost(): void { - $configuredHost = \Safe\parse_url((string) config('app.url'), PHP_URL_HOST); + $configuredHost = parse_url((string) config('app.url'), PHP_URL_HOST); if (false === $configuredHost || null === $configuredHost) { throw new FireflyException('Please set a valid and correct Firefly III URL in the APP_URL environment variable.'); } diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index c264db1a2c..f88d7eb99e 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -468,14 +468,14 @@ class AccountController extends Controller Log::debug('Balances exist at:'); foreach ($range as $key => $value) { $newRange[] = ['date' => $key, 'info' => $value]; - Log::debug(sprintf('%d - %s (%s)', count($newRange) - 1, $key, \Safe\json_encode($value))); + Log::debug(sprintf('%d - %s (%s)', count($newRange) - 1, $key, json_encode($value))); } $carbon = Carbon::createFromFormat('Y-m-d', $newRange[0]['date'])->endOfDay(); Log::debug(sprintf('Start of loop, $carbon is %s', $carbon->format('Y-m-d H:i:s'))); while ($end->gte($current)) { $momentBalance = $previous; // $theDate = $current->format('Y-m-d'); - Log::debug(sprintf('Now at %s, with momentBalance %s', $current->format('Y-m-d H:i:s'), \Safe\json_encode($momentBalance))); + Log::debug(sprintf('Now at %s, with momentBalance %s', $current->format('Y-m-d H:i:s'), json_encode($momentBalance))); // loop over the array with balances, find one that is earlier or on the same day. while ($carbon->lte($current) && array_key_exists($expectedIndex, $newRange)) { @@ -490,7 +490,7 @@ class AccountController extends Controller $carbon = Carbon::createFromFormat('Y-m-d', $newRange[$expectedIndex]['date'])->endOfDay(); } } - Log::debug(sprintf('momentBalance is now %s', \Safe\json_encode($momentBalance))); + Log::debug(sprintf('momentBalance is now %s', json_encode($momentBalance))); $return = $this->updateChartKeys($return, $momentBalance); $previous = $momentBalance; diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index f7e5922f1a..6510d1e8b7 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -83,15 +83,15 @@ abstract class Controller extends BaseController if ('true' === request()->get('force_default_layout') && 'v2' === config('view.layout')) { //config('view.layout','v1'); Config::set('view.layout', 'v1'); - View::getFinder()->setPaths([\Safe\realpath(base_path('resources/views'))]); // @phpstan-ignore-line + View::getFinder()->setPaths([realpath(base_path('resources/views'))]); // @phpstan-ignore-line } View::share('authGuard', $authGuard); View::share('logoutUrl', $logoutUrl); // upload size - $maxFileSize = Steam::phpBytes((string) \Safe\ini_get('upload_max_filesize')); - $maxPostSize = Steam::phpBytes((string) \Safe\ini_get('post_max_size')); + $maxFileSize = Steam::phpBytes((string) ini_get('upload_max_filesize')); + $maxPostSize = Steam::phpBytes((string) ini_get('post_max_size')); $uploadSize = min($maxFileSize, $maxPostSize); View::share('uploadSize', $uploadSize); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index ece11b3d14..4799310e4a 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -139,7 +139,7 @@ class DebugController extends Controller if ($handler instanceof RotatingFileHandler) { $logFile = $handler->getUrl(); if (null !== $logFile && file_exists($logFile)) { - $logContent = \Safe\file_get_contents($logFile); + $logContent = file_get_contents($logFile); } } } @@ -164,8 +164,8 @@ class DebugController extends Controller private function getSystemInformation(): array { - $maxFileSize = Steam::phpBytes((string) \Safe\ini_get('upload_max_filesize')); - $maxPostSize = Steam::phpBytes((string) \Safe\ini_get('post_max_size')); + $maxFileSize = Steam::phpBytes((string) ini_get('upload_max_filesize')); + $maxPostSize = Steam::phpBytes((string) ini_get('post_max_size')); $drivers = DB::availableDrivers(); $currentDriver = DB::getDriverName(); @@ -177,8 +177,8 @@ class DebugController extends Controller 'interface' => \PHP_SAPI, 'bits' => \PHP_INT_SIZE * 8, 'bcscale' => bcscale(), - 'display_errors' => \Safe\ini_get('display_errors'), - 'error_reporting' => $this->errorReporting((int) \Safe\ini_get('error_reporting')), + 'display_errors' => ini_get('display_errors'), + 'error_reporting' => $this->errorReporting((int) ini_get('error_reporting')), 'upload_size' => min($maxFileSize, $maxPostSize), 'all_drivers' => $drivers, 'current_driver' => $currentDriver, @@ -197,7 +197,7 @@ class DebugController extends Controller try { if (file_exists('/var/www/counter-main.txt')) { - $return['build'] = trim((string) \Safe\file_get_contents('/var/www/counter-main.txt')); + $return['build'] = trim((string) file_get_contents('/var/www/counter-main.txt')); app('log')->debug(sprintf('build is now "%s"', $return['build'])); } } catch (\Exception $e) { @@ -207,7 +207,7 @@ class DebugController extends Controller try { if (file_exists('/var/www/build-date-main.txt')) { - $return['build_date'] = trim((string) \Safe\file_get_contents('/var/www/build-date-main.txt')); + $return['build_date'] = trim((string) file_get_contents('/var/www/build-date-main.txt')); } } catch (\Exception $e) { app('log')->debug('Could not check build date, but thats ok.'); diff --git a/app/Http/Controllers/Export/IndexController.php b/app/Http/Controllers/Export/IndexController.php index d8a8da128a..9df0636db1 100644 --- a/app/Http/Controllers/Export/IndexController.php +++ b/app/Http/Controllers/Export/IndexController.php @@ -91,7 +91,7 @@ class IndexController extends Controller $generator->setStart($firstDate); $result = $generator->export(); - $name = sprintf('%s_transaction_export.csv', \Safe\date('Y_m_d')); + $name = sprintf('%s_transaction_export.csv', date('Y_m_d')); $quoted = sprintf('"%s"', addcslashes($name, '"\\')); // headers for CSV file. diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php index 7d91dd0a68..9b95b0035d 100644 --- a/app/Http/Controllers/Json/RecurrenceController.php +++ b/app/Http/Controllers/Json/RecurrenceController.php @@ -153,7 +153,7 @@ class RecurrenceController extends Controller */ public function suggest(Request $request): JsonResponse { - $string = '' === (string) $request->get('date') ? \Safe\date('Y-m-d') : (string) $request->get('date'); + $string = '' === (string) $request->get('date') ? date('Y-m-d') : (string) $request->get('date'); $today = today(config('app.timezone'))->startOfDay(); try { diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index e5561ccb10..bf8b12af22 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -110,7 +110,7 @@ class PreferencesController extends Controller if (is_array($fiscalYearStartStr)) { $fiscalYearStartStr = '01-01'; } - $fiscalYearStart = sprintf('%s-%s', \Safe\date('Y'), (string) $fiscalYearStartStr); + $fiscalYearStart = sprintf('%s-%s', date('Y'), (string) $fiscalYearStartStr); $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; $availableDarkModes = config('firefly.available_dark_modes'); @@ -149,7 +149,7 @@ class PreferencesController extends Controller // list of locales also has "equal" which makes it equal to whatever the language is. try { - $locales = \Safe\json_decode((string) \Safe\file_get_contents(resource_path(sprintf('locales/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR); + $locales = json_decode((string) file_get_contents(resource_path(sprintf('locales/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR); } catch (\JsonException $e) { app('log')->error($e->getMessage()); $locales = []; @@ -271,9 +271,9 @@ class PreferencesController extends Controller // custom fiscal year $customFiscalYear = 1 === (int) $request->get('customFiscalYear'); - $string = \Safe\strtotime((string) $request->get('fiscalYearStart')); + $string = strtotime((string) $request->get('fiscalYearStart')); if (false !== $string) { - $fiscalYearStart = \Safe\date('m-d', $string); + $fiscalYearStart = date('m-d', $string); Preferences::set('customFiscalYear', $customFiscalYear); Preferences::set('fiscalYearStart', $fiscalYearStart); } diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index 6a851d43a1..df765dc6fb 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -169,7 +169,7 @@ class InstallController extends Controller return; } - \Safe\file_put_contents($publicKey, (string) $key->getPublicKey()); - \Safe\file_put_contents($privateKey, $key->toString('PKCS1')); + file_put_contents($publicKey, (string) $key->getPublicKey()); + file_put_contents($privateKey, $key->toString('PKCS1')); } } diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php index d306b18c78..fad87c640a 100644 --- a/app/Http/Controllers/Transaction/CreateController.php +++ b/app/Http/Controllers/Transaction/CreateController.php @@ -116,7 +116,7 @@ class CreateController extends Controller $accountToTypes = config('firefly.account_to_transaction'); $defaultCurrency = $this->defaultCurrency; $previousUrl = $this->rememberPreviousUrl('transactions.create.url'); - $parts = \Safe\parse_url($previousUrl); + $parts = parse_url($previousUrl); $search = sprintf('?%s', $parts['query'] ?? ''); $previousUrl = str_replace($search, '', $previousUrl); if (!is_array($optionalFields)) { diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php index 1bf0ef9c9f..c638deb7c8 100644 --- a/app/Http/Controllers/Transaction/EditController.php +++ b/app/Http/Controllers/Transaction/EditController.php @@ -85,7 +85,7 @@ class EditController extends Controller $defaultCurrency = $this->defaultCurrency; $cash = $repository->getCashAccount(); $previousUrl = $this->rememberPreviousUrl('transactions.edit.url'); - $parts = \Safe\parse_url($previousUrl); + $parts = parse_url($previousUrl); $search = sprintf('?%s', $parts['query'] ?? ''); $previousUrl = str_replace($search, '', $previousUrl); diff --git a/app/Http/Middleware/AcceptHeaders.php b/app/Http/Middleware/AcceptHeaders.php index cb3745b904..54c9d1f643 100644 --- a/app/Http/Middleware/AcceptHeaders.php +++ b/app/Http/Middleware/AcceptHeaders.php @@ -71,7 +71,7 @@ class AcceptHeaders // throw bad request if trace id is not a UUID $uuid = $request->header('X-Trace-Id'); - if (is_string($uuid) && '' !== trim($uuid) && (1 !== \Safe\preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid)))) { + if (is_string($uuid) && '' !== trim($uuid) && (1 !== preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid)))) { throw new BadRequestHttpException('Bad X-Trace-Id header.'); } diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php index a961936c3e..44e78bcbdf 100644 --- a/app/Http/Requests/ReportFormRequest.php +++ b/app/Http/Requests/ReportFormRequest.php @@ -143,7 +143,7 @@ class ReportFormRequest extends FormRequest // validate as date // if regex for YYYY-MM-DD: $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/'; - $result = \Safe\preg_match($pattern, $string); + $result = preg_match($pattern, $string); if (false !== $result && 0 !== $result) { try { $date = new Carbon($parts[1]); @@ -181,7 +181,7 @@ class ReportFormRequest extends FormRequest // validate as date // if regex for YYYY-MM-DD: $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/'; - $result = \Safe\preg_match($pattern, $string); + $result = preg_match($pattern, $string); if (false !== $result && 0 !== $result) { try { $date = new Carbon($parts[0]); diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php index bc17d08316..5ba8d7f998 100644 --- a/app/Jobs/DownloadExchangeRates.php +++ b/app/Jobs/DownloadExchangeRates.php @@ -113,7 +113,7 @@ class DownloadExchangeRates implements ShouldQueue return; } $body = (string) $res->getBody(); - $json = \Safe\json_decode($body, true); + $json = json_decode($body, true); if (false === $json || null === $json) { app('log')->warning(sprintf('Trying to grab "%s" resulted in bad JSON.', $url)); diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 7b906b93a6..0b824a15c7 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -46,7 +46,7 @@ class MailError extends Job implements ShouldQueue $debug = $this->exception; unset($debug['stackTrace'], $debug['headers']); - app('log')->error(sprintf('Exception is: %s', \Safe\json_encode($debug))); + app('log')->error(sprintf('Exception is: %s', json_encode($debug))); } /** @@ -117,11 +117,11 @@ class MailError extends Job implements ShouldQueue if (!file_exists($file)) { Log::debug(sprintf('Wrote new file in "%s"', $file)); - \Safe\file_put_contents($file, \Safe\json_encode($limits, JSON_PRETTY_PRINT)); + file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT)); } if (file_exists($file)) { Log::debug(sprintf('Read file in "%s"', $file)); - $limits = \Safe\json_decode((string) \Safe\file_get_contents($file), true); + $limits = json_decode((string) file_get_contents($file), true); } // limit reached? foreach ($types as $type => $info) { @@ -149,7 +149,7 @@ class MailError extends Job implements ShouldQueue } ++$limits[$type]['sent']; } - \Safe\file_put_contents($file, \Safe\json_encode($limits, JSON_PRETTY_PRINT)); + file_put_contents($file, json_encode($limits, JSON_PRETTY_PRINT)); Log::debug('No limits reached, return FALSE.'); return false; diff --git a/app/Mail/InvitationMail.php b/app/Mail/InvitationMail.php index a41e6dbc6d..507e2d4ceb 100644 --- a/app/Mail/InvitationMail.php +++ b/app/Mail/InvitationMail.php @@ -43,7 +43,7 @@ class InvitationMail extends Mailable */ public function __construct(public string $invitee, public string $admin, public string $url) { - $this->host = (string) \Safe\parse_url($this->url, PHP_URL_HOST); + $this->host = (string) parse_url($this->url, PHP_URL_HOST); } /** diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php index baefb2f9b7..fa3b58a5b6 100644 --- a/app/Models/AccountMeta.php +++ b/app/Models/AccountMeta.php @@ -47,11 +47,11 @@ class AccountMeta extends Model public function getDataAttribute(mixed $value): string { - return (string) \Safe\json_decode($value, true); + return (string) json_decode($value, true); } public function setDataAttribute(mixed $value): void { - $this->attributes['data'] = \Safe\json_encode($value); + $this->attributes['data'] = json_encode($value); } } diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 93abb2cfc1..a6a137e975 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -50,7 +50,7 @@ class Configuration extends Model */ public function getDataAttribute($value) { - return \Safe\json_decode($value); + return json_decode($value); } /** @@ -58,6 +58,6 @@ class Configuration extends Model */ public function setDataAttribute($value): void { - $this->attributes['data'] = \Safe\json_encode($value); + $this->attributes['data'] = json_encode($value); } } diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php index 00e2aae961..09ac979206 100644 --- a/app/Models/TransactionJournalMeta.php +++ b/app/Models/TransactionJournalMeta.php @@ -52,7 +52,7 @@ class TransactionJournalMeta extends Model */ public function getDataAttribute($value) { - return \Safe\json_decode($value, false); + return json_decode($value, false); } /** @@ -60,7 +60,7 @@ class TransactionJournalMeta extends Model */ public function setDataAttribute($value): void { - $data = \Safe\json_encode($value); + $data = json_encode($value); $this->attributes['data'] = $data; $this->attributes['hash'] = hash('sha256', (string) $data); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a7d13a7dfe..00829e0538 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -46,7 +46,7 @@ class AppServiceProvider extends ServiceProvider 'Cache-Control' => 'no-store', ]; $uuid = (string) request()->header('X-Trace-Id'); - if ('' !== trim($uuid) && (1 === \Safe\preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid)))) { + if ('' !== trim($uuid) && (1 === preg_match('/^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i', trim($uuid)))) { $headers['X-Trace-Id'] = $uuid; } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index c498f6a5b1..5ca811f570 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -108,7 +108,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac ->where('accounts.active', true) ->where( static function (EloquentBuilder $q1) use ($number): void { - $json = \Safe\json_encode($number); + $json = json_encode($number); $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); } diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 9676766b6c..9228a88295 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -81,7 +81,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is being used in accounts: - $meta = AccountMeta::where('name', 'currency_id')->where('data', \Safe\json_encode((string) $currency->id))->count(); + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string) $currency->id))->count(); if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -89,7 +89,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // second search using integer check. - $meta = AccountMeta::where('name', 'currency_id')->where('data', \Safe\json_encode((int) $currency->id))->count(); + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int) $currency->id))->count(); if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -117,7 +117,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf // is being used in accounts (as integer) $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') ->whereNull('accounts.deleted_at') - ->where('account_meta.name', 'currency_id')->where('account_meta.data', \Safe\json_encode($currency->id))->count() + ->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count() ; if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index 689e1ace72..bbbac73933 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -68,16 +68,16 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $set = TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence): void { $q1->where('name', 'recurrence_id'); - $q1->where('data', \Safe\json_encode((string) $recurrence->id)); + $q1->where('data', json_encode((string) $recurrence->id)); })->get(['journal_meta.transaction_journal_id']); // there are X journals made for this recurrence. Any of them meant for today? foreach ($set as $journalMeta) { $count = TransactionJournalMeta::where(static function (Builder $q2) use ($date): void { $string = (string) $date; - app('log')->debug(sprintf('Search for date: %s', \Safe\json_encode($string))); + app('log')->debug(sprintf('Search for date: %s', json_encode($string))); $q2->where('name', 'recurrence_date'); - $q2->where('data', \Safe\json_encode($string)); + $q2->where('data', json_encode($string)); }) ->where('transaction_journal_id', $journalMeta->transaction_journal_id) ->count() @@ -232,7 +232,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte return TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') ->where('transaction_journals.user_id', $this->user->id) ->where('journal_meta.name', '=', 'recurrence_id') - ->where('journal_meta.data', '=', \Safe\json_encode((string) $recurrence->id)) + ->where('journal_meta.data', '=', json_encode((string) $recurrence->id)) ->get(['journal_meta.transaction_journal_id'])->pluck('transaction_journal_id')->toArray() ; } @@ -272,7 +272,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte /** @var RecurrenceMeta $meta */ foreach ($transaction->recurrenceTransactionMeta as $meta) { if ('tags' === $meta->name && '' !== $meta->value) { - $tags = \Safe\json_decode($meta->value, true, 512, JSON_THROW_ON_ERROR); + $tags = json_decode($meta->value, true, 512, JSON_THROW_ON_ERROR); } } @@ -285,7 +285,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte ->whereNull('transaction_journals.deleted_at') ->where('transaction_journals.user_id', $this->user->id) ->where('name', 'recurrence_id') - ->where('data', \Safe\json_encode((string) $recurrence->id)) + ->where('data', json_encode((string) $recurrence->id)) ->get()->pluck('transaction_journal_id')->toArray() ; $search = []; @@ -311,7 +311,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte ->whereNull('transaction_journals.deleted_at') ->where('transaction_journals.user_id', $this->user->id) ->where('name', 'recurrence_id') - ->where('data', \Safe\json_encode((string) $recurrence->id)) + ->where('data', json_encode((string) $recurrence->id)) ->get()->pluck('transaction_journal_id')->toArray() ; $search = []; diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index c9c3063685..0a76f9bda2 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -304,7 +304,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $return = []; foreach ($query as $row) { - $return[$row->name] = new Carbon(\Safe\json_decode($row->data, true, 512, JSON_THROW_ON_ERROR)); + $return[$row->name] = new Carbon(json_decode($row->data, true, 512, JSON_THROW_ON_ERROR)); } return new NullArrayObject($return); @@ -324,7 +324,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $return = []; foreach ($query as $row) { - $return[$row->name] = \Safe\json_decode($row->data); + $return[$row->name] = json_decode($row->data); } return new NullArrayObject($return); diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 5de94de9bd..9abc8554a3 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -54,7 +54,7 @@ class UserRepository implements UserRepositoryInterface // save old email as pref app('preferences')->setForUser($user, 'previous_email_latest', $oldEmail); - app('preferences')->setForUser($user, 'previous_email_'.\Safe\date('Y-m-d-H-i-s'), $oldEmail); + app('preferences')->setForUser($user, 'previous_email_'.date('Y-m-d-H-i-s'), $oldEmail); // set undo and confirm token: app('preferences')->setForUser($user, 'email_change_undo_token', bin2hex(random_bytes(16))); @@ -389,7 +389,7 @@ class UserRepository implements UserRepositoryInterface // save old email as pref app('preferences')->setForUser($user, 'admin_previous_email_latest', $oldEmail); - app('preferences')->setForUser($user, 'admin_previous_email_'.\Safe\date('Y-m-d-H-i-s'), $oldEmail); + app('preferences')->setForUser($user, 'admin_previous_email_'.date('Y-m-d-H-i-s'), $oldEmail); $user->email = $newEmail; $user->save(); diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index f7aae4dfce..c57870fe2c 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -66,7 +66,7 @@ class AccountRepository implements AccountRepositoryInterface ->where('accounts.active', true) ->where( static function (EloquentBuilder $q1) use ($number): void { - $json = \Safe\json_encode($number); + $json = json_encode($number); $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); } diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php index 092ef4b50c..da56f7630f 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php @@ -81,7 +81,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // is being used in accounts: - $meta = AccountMeta::where('name', 'currency_id')->where('data', \Safe\json_encode((string) $currency->id))->count(); + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string) $currency->id))->count(); if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -89,7 +89,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // second search using integer check. - $meta = AccountMeta::where('name', 'currency_id')->where('data', \Safe\json_encode((int) $currency->id))->count(); + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int) $currency->id))->count(); if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -117,7 +117,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface // is being used in accounts (as integer) $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') ->whereNull('accounts.deleted_at') - ->where('account_meta.name', 'currency_id')->where('account_meta.data', \Safe\json_encode($currency->id))->count() + ->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count() ; if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); diff --git a/app/Rules/IsValidBulkClause.php b/app/Rules/IsValidBulkClause.php index 148d5600b1..57bd227f04 100644 --- a/app/Rules/IsValidBulkClause.php +++ b/app/Rules/IsValidBulkClause.php @@ -63,7 +63,7 @@ class IsValidBulkClause implements ValidationRule private function basicValidation(string $value): bool { try { - $array = \Safe\json_decode($value, true, 8, JSON_THROW_ON_ERROR); + $array = json_decode($value, true, 8, JSON_THROW_ON_ERROR); } catch (\JsonException) { $this->error = (string) trans('validation.json'); diff --git a/app/Rules/IsValidPositiveAmount.php b/app/Rules/IsValidPositiveAmount.php index 5f3cc94f66..89d7ada4a6 100644 --- a/app/Rules/IsValidPositiveAmount.php +++ b/app/Rules/IsValidPositiveAmount.php @@ -40,7 +40,7 @@ class IsValidPositiveAmount implements ValidationRule { if (is_array($value)) { $fail('validation.numeric')->translate(); - $message = sprintf('IsValidPositiveAmount: "%s" is not a number.', \Safe\json_encode($value)); + $message = sprintf('IsValidPositiveAmount: "%s" is not a number.', json_encode($value)); Log::debug($message); Log::channel('audit')->info($message); diff --git a/app/Rules/UniqueAccountNumber.php b/app/Rules/UniqueAccountNumber.php index 3e02e2c7e9..f51a54caaa 100644 --- a/app/Rules/UniqueAccountNumber.php +++ b/app/Rules/UniqueAccountNumber.php @@ -133,7 +133,7 @@ class UniqueAccountNumber implements ValidationRule ->where('accounts.user_id', auth()->user()->id) ->where('account_types.type', $type) ->where('account_meta.name', '=', 'account_number') - ->where('account_meta.data', \Safe\json_encode($accountNumber)) + ->where('account_meta.data', json_encode($accountNumber)) ; if (null !== $this->account) { diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php index 29499570bc..452d3d32a7 100644 --- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php +++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php @@ -99,7 +99,7 @@ class UpdateRequest implements UpdateRequestInterface $body = (string) $res->getBody(); try { - $json = \Safe\json_decode($body, true, 512, JSON_THROW_ON_ERROR); + $json = json_decode($body, true, 512, JSON_THROW_ON_ERROR); } catch (\JsonException) { Log::error('Body is not valid JSON'); Log::error($body); diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php index 507f65e95e..a85b174a9e 100644 --- a/app/Services/Internal/Support/JournalServiceTrait.php +++ b/app/Services/Internal/Support/JournalServiceTrait.php @@ -260,7 +260,7 @@ trait JournalServiceTrait if (null === $account) { // final attempt, create it. if (AccountTypeEnum::ASSET->value === $preferredType) { - throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s', \Safe\json_encode($data))); + throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s', json_encode($data))); } // fix name of account if only IBAN is given: if ('' === (string) $data['name'] && '' !== (string) $data['iban']) { diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php index 95b5520599..9df6075d19 100644 --- a/app/Services/Internal/Support/RecurringTransactionTrait.php +++ b/app/Services/Internal/Support/RecurringTransactionTrait.php @@ -307,9 +307,9 @@ trait RecurringTransactionTrait /** @var null|RecurrenceMeta $entry */ $entry = $transaction->recurrenceTransactionMeta()->where('name', 'tags')->first(); if (null === $entry) { - $entry = RecurrenceTransactionMeta::create(['rt_id' => $transaction->id, 'name' => 'tags', 'value' => \Safe\json_encode($tags)]); + $entry = RecurrenceTransactionMeta::create(['rt_id' => $transaction->id, 'name' => 'tags', 'value' => json_encode($tags)]); } - $entry->value = \Safe\json_encode($tags); + $entry->value = json_encode($tags); $entry->save(); } if (0 === count($tags)) { diff --git a/app/Services/Webhook/StandardWebhookSender.php b/app/Services/Webhook/StandardWebhookSender.php index 264e754bc8..911fde75d9 100644 --- a/app/Services/Webhook/StandardWebhookSender.php +++ b/app/Services/Webhook/StandardWebhookSender.php @@ -80,7 +80,7 @@ class StandardWebhookSender implements WebhookSenderInterface app('log')->debug(sprintf('Trying to send webhook message #%d', $this->message->id)); try { - $json = \Safe\json_encode($this->message->message, JSON_THROW_ON_ERROR); + $json = json_encode($this->message->message, JSON_THROW_ON_ERROR); } catch (\JsonException $e) { app('log')->error('Did not send message because of a JSON error.'); app('log')->error($e->getMessage()); diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index c3aa19cbda..f3e3c68d34 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -67,7 +67,7 @@ class RemoteUserGuard implements Guard if (function_exists('apache_request_headers')) { Log::debug('Use apache_request_headers to find user ID.'); - $userID = request()->server($header) ?? \Safe\apache_request_headers()[$header] ?? null; + $userID = request()->server($header) ?? apache_request_headers()[$header] ?? null; } if (null === $userID || '' === $userID) { @@ -85,7 +85,7 @@ class RemoteUserGuard implements Guard $header = config('auth.guard_email'); if (null !== $header) { - $emailAddress = (string) (request()->server($header) ?? \Safe\apache_request_headers()[$header] ?? null); + $emailAddress = (string) (request()->server($header) ?? apache_request_headers()[$header] ?? null); $preference = app('preferences')->getForUser($retrievedUser, 'remote_guard_alt_email'); if ('' !== $emailAddress && null === $preference && $emailAddress !== $userID) { diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php index 2a95210a8c..381466b2c9 100644 --- a/app/Support/CacheProperties.php +++ b/app/Support/CacheProperties.php @@ -79,7 +79,7 @@ class CacheProperties $content = ''; foreach ($this->properties as $property) { try { - $content = sprintf('%s%s', $content, \Safe\json_encode($property, JSON_THROW_ON_ERROR)); + $content = sprintf('%s%s', $content, json_encode($property, JSON_THROW_ON_ERROR)); } catch (\JsonException) { // @ignoreException $content = sprintf('%s%s', $content, hash('sha256', (string) time())); diff --git a/app/Support/Cronjobs/UpdateCheckCronjob.php b/app/Support/Cronjobs/UpdateCheckCronjob.php index 980973e099..0cfb0a0967 100644 --- a/app/Support/Cronjobs/UpdateCheckCronjob.php +++ b/app/Support/Cronjobs/UpdateCheckCronjob.php @@ -63,7 +63,7 @@ class UpdateCheckCronjob extends AbstractCronjob $this->jobFired = false; $this->jobErrored = false; $this->jobSucceeded = true; - $this->message = sprintf('Checked for updates less than a week ago (on %s).', \Safe\date('Y-m-d H:i:s', $lastCheckTime->data)); + $this->message = sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)); return; } diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.php index 6fb55a9d22..59fe677edd 100644 --- a/app/Support/Http/Controllers/CreateStuff.php +++ b/app/Support/Http/Controllers/CreateStuff.php @@ -106,8 +106,8 @@ trait CreateStuff Log::alert('NO OAuth keys were found. They have been created.'); - \Safe\file_put_contents($publicKey, (string) $key->getPublicKey()); - \Safe\file_put_contents($privateKey, $key->toString('PKCS1')); + file_put_contents($publicKey, (string) $key->getPublicKey()); + file_put_contents($privateKey, $key->toString('PKCS1')); } /** diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php index 7f18f6fe3c..7307496f2e 100644 --- a/app/Support/Http/Controllers/RequestInformation.php +++ b/app/Support/Http/Controllers/RequestInformation.php @@ -46,7 +46,7 @@ trait RequestInformation final protected function getDomain(): string // get request info { $url = url()->to('/'); - $parts = \Safe\parse_url($url); + $parts = parse_url($url); return $parts['host'] ?? ''; } diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php index 4d61dc35d5..6ddde18a15 100644 --- a/app/Support/ParseDateString.php +++ b/app/Support/ParseDateString.php @@ -85,7 +85,7 @@ class ParseDateString // if regex for YYYY-MM-DD: $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { return $this->parseDefaultDate($date); } @@ -182,7 +182,7 @@ class ParseDateString // verify if correct $pattern = '/[+-]\d+[wqmdy]/'; - $result = \Safe\preg_match($pattern, $part); + $result = preg_match($pattern, $part); if (0 === $result || false === $result) { app('log')->error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part)); @@ -256,7 +256,7 @@ class ParseDateString protected function isDayRange(string $date): bool { $pattern = '/^xxxx-xx-(0[1-9]|[12]\d|3[01])$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { app('log')->debug(sprintf('"%s" is a day range.', $date)); @@ -283,7 +283,7 @@ class ParseDateString { // if regex for xxxx-MM-xx: $pattern = '/^xxxx-(0[1-9]|1[012])-xx$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { app('log')->debug(sprintf('"%s" is a month range.', $date)); @@ -311,7 +311,7 @@ class ParseDateString { // if regex for YYYY-xx-xx: $pattern = '/^(19|20)\d\d-xx-xx$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { app('log')->debug(sprintf('"%s" is a year range.', $date)); @@ -339,7 +339,7 @@ class ParseDateString { // if regex for xxxx-MM-DD: $pattern = '/^xxxx-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { app('log')->debug(sprintf('"%s" is a month/day range.', $date)); @@ -368,7 +368,7 @@ class ParseDateString { // if regex for YYYY-xx-DD: $pattern = '/^(19|20)\d\d-xx-(0[1-9]|[12]\d|3[01])$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { app('log')->debug(sprintf('"%s" is a day/year range.', $date)); @@ -397,7 +397,7 @@ class ParseDateString { // if regex for YYYY-MM-xx: $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-xx$/'; - $result = \Safe\preg_match($pattern, $date); + $result = preg_match($pattern, $date); if (false !== $result && 0 !== $result) { app('log')->debug(sprintf('"%s" is a month/year range.', $date)); diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 0e65fe7343..772b6bd36f 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -125,7 +125,7 @@ trait ConvertsDataTypes $string = str_replace($this->characters, "\x20", $string); // clear zalgo text (TODO also in API v2) - $string = \Safe\preg_replace('/(\pM{2})\pM+/u', '\1', $string); + $string = preg_replace('/(\pM{2})\pM+/u', '\1', $string); return trim((string) $string); } diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index a40c407e3f..ec5ef15e58 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -81,7 +81,7 @@ class AccountSearch implements GenericSearchInterface // meta data: $searchQuery->orWhere( static function (Builder $q) use ($originalQuery): void { - $json = \Safe\json_encode($originalQuery, JSON_THROW_ON_ERROR); + $json = json_encode($originalQuery, JSON_THROW_ON_ERROR); $q->where('account_meta.name', '=', 'account_number'); $q->whereLike('account_meta.data', $json); } @@ -108,7 +108,7 @@ class AccountSearch implements GenericSearchInterface // meta data: $searchQuery->Where( static function (Builder $q) use ($originalQuery): void { - $json = \Safe\json_encode($originalQuery, JSON_THROW_ON_ERROR); + $json = json_encode($originalQuery, JSON_THROW_ON_ERROR); $q->where('account_meta.name', 'account_number'); $q->where('account_meta.data', $json); } diff --git a/app/Support/Search/QueryParser/GdbotsQueryParser.php b/app/Support/Search/QueryParser/GdbotsQueryParser.php index aa802e0df0..eec1259988 100644 --- a/app/Support/Search/QueryParser/GdbotsQueryParser.php +++ b/app/Support/Search/QueryParser/GdbotsQueryParser.php @@ -54,7 +54,7 @@ class GdbotsQueryParser implements QueryParserInterface return new NodeGroup($nodes); } catch (\LogicException|\TypeError $e) { - \Safe\fwrite(STDERR, "Setting up GdbotsQueryParserTest\n"); + fwrite(STDERR, "Setting up GdbotsQueryParserTest\n"); app('log')->error($e->getMessage()); app('log')->error(sprintf('Could not parse search: "%s".', $query)); diff --git a/app/Support/Steam.php b/app/Support/Steam.php index b6da6a44dd..6001cdbdc0 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -184,8 +184,8 @@ class Steam ]; // clear zalgo text - $string = \Safe\preg_replace('/(\pM{2})\pM+/u', '\1', $string); - $string = \Safe\preg_replace('/\s+/', '', $string); + $string = preg_replace('/(\pM{2})\pM+/u', '\1', $string); + $string = preg_replace('/\s+/', '', $string); return str_replace($search, '', $string); } @@ -566,8 +566,8 @@ class Steam { // Log::debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl)); $returnUrl = $safeUrl; - $unknownHost = \Safe\parse_url($unknownUrl, PHP_URL_HOST); - $safeHost = \Safe\parse_url($safeUrl, PHP_URL_HOST); + $unknownHost = parse_url($unknownUrl, PHP_URL_HOST); + $safeHost = parse_url($safeUrl, PHP_URL_HOST); if (null !== $unknownHost && $unknownHost === $safeHost) { $returnUrl = $unknownUrl; diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php index e0c0fa0b7a..cda0721846 100644 --- a/app/Support/System/OAuthKeys.php +++ b/app/Support/System/OAuthKeys.php @@ -96,8 +96,8 @@ class OAuthKeys { $private = storage_path('oauth-private.key'); $public = storage_path('oauth-public.key'); - app('fireflyconfig')->set(self::PRIVATE_KEY, Crypt::encrypt(\Safe\file_get_contents($private))); - app('fireflyconfig')->set(self::PUBLIC_KEY, Crypt::encrypt(\Safe\file_get_contents($public))); + app('fireflyconfig')->set(self::PRIVATE_KEY, Crypt::encrypt(file_get_contents($private))); + app('fireflyconfig')->set(self::PUBLIC_KEY, Crypt::encrypt(file_get_contents($public))); } /** @@ -123,8 +123,8 @@ class OAuthKeys } $private = storage_path('oauth-private.key'); $public = storage_path('oauth-public.key'); - \Safe\file_put_contents($private, $privateContent); - \Safe\file_put_contents($public, $publicContent); + file_put_contents($private, $privateContent); + file_put_contents($public, $publicContent); return true; } diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 37e3fb2b45..94ec12be36 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -179,8 +179,8 @@ class General extends AbstractExtension return new TwigFilter( 'phphost', static function (string $string): string { - $proto = (string) \Safe\parse_url($string, PHP_URL_SCHEME); - $host = (string) \Safe\parse_url($string, PHP_URL_HOST); + $proto = (string) parse_url($string, PHP_URL_SCHEME); + $host = (string) parse_url($string, PHP_URL_HOST); return e(sprintf('%s://%s', $proto, $host)); } @@ -211,7 +211,7 @@ class General extends AbstractExtension { return new TwigFunction( 'phpdate', - static fn (string $str): string => \Safe\date($str) + static fn (string $str): string => date($str) ); } diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index bc338d4b22..df56cc8365 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -255,7 +255,7 @@ class TransactionGroupTwig extends AbstractExtension return today(config('app.timezone')); } - return new Carbon(\Safe\json_decode($entry->data, false)); + return new Carbon(json_decode($entry->data, false)); } ); } @@ -276,7 +276,7 @@ class TransactionGroupTwig extends AbstractExtension return ''; } - return \Safe\json_decode($entry->data, true); + return json_decode($entry->data, true); } ); } diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php index 5abe8b2615..251386c627 100644 --- a/app/Transformers/RecurrenceTransformer.php +++ b/app/Transformers/RecurrenceTransformer.php @@ -264,7 +264,7 @@ class RecurrenceTransformer extends AbstractTransformer break; case 'tags': - $array['tags'] = \Safe\json_decode($transactionMeta->value); + $array['tags'] = json_decode($transactionMeta->value); break; diff --git a/app/Transformers/WebhookMessageTransformer.php b/app/Transformers/WebhookMessageTransformer.php index 5271582bbb..f0fd5c056d 100644 --- a/app/Transformers/WebhookMessageTransformer.php +++ b/app/Transformers/WebhookMessageTransformer.php @@ -39,7 +39,7 @@ class WebhookMessageTransformer extends AbstractTransformer $json = '{}'; try { - $json = \Safe\json_encode($message->message, JSON_THROW_ON_ERROR); + $json = json_encode($message->message, JSON_THROW_ON_ERROR); } catch (\JsonException $e) { app('log')->error(sprintf('Could not encode webhook message #%d: %s', $message->id, $e->getMessage())); } diff --git a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php index c5651941d4..876d4269be 100644 --- a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php +++ b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php @@ -34,7 +34,7 @@ trait ValidatesBulkTransactionQuery $data = $validator->getData(); // assumption is all validation has already taken place and the query key exists. $query = $data['query'] ?? '[]'; - $json = \Safe\json_decode($query, true, 8, JSON_THROW_ON_ERROR); + $json = json_decode($query, true, 8, JSON_THROW_ON_ERROR); if ( array_key_exists('where', $json) diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 86409ed951..aa9b0d927c 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -110,7 +110,7 @@ class FireflyValidator extends Validator return false; } $regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i'; - $result = \Safe\preg_match($regex, $value); + $result = preg_match($regex, $value); if (false === $result || 0 === $result) { return false; } @@ -200,7 +200,7 @@ class FireflyValidator extends Validator $value = strtoupper($value); // replace characters outside of ASCI range. - $value = (string) \Safe\iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value); + $value = (string) iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $value); $search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; $replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35']; @@ -634,7 +634,7 @@ class FireflyValidator extends Validator ->whereNull('accounts.deleted_at') ->where('accounts.user_id', auth()->user()->id) ->where('account_meta.name', 'account_number') - ->where('account_meta.data', \Safe\json_encode($value)) + ->where('account_meta.data', json_encode($value)) ; if ($accountId > 0) {