mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 10:53:37 +00:00
Replace string operators.
This commit is contained in:
@@ -147,10 +147,7 @@ class OutputsInstructions extends Command
|
|||||||
*/
|
*/
|
||||||
private function showLine(): void
|
private function showLine(): void
|
||||||
{
|
{
|
||||||
$line = '+';
|
$this->line(sprintf('+%s+', str_repeat('-', 78)));
|
||||||
$line .= str_repeat('-', 78);
|
|
||||||
$line .= '+';
|
|
||||||
$this->line($line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -95,9 +95,9 @@ class IntroController extends Controller
|
|||||||
{
|
{
|
||||||
$specialPage ??= '';
|
$specialPage ??= '';
|
||||||
$route = str_replace('.', '_', $route);
|
$route = str_replace('.', '_', $route);
|
||||||
$key = 'shown_demo_'.$route;
|
$key = sprintf('shown_demo_%s', $route);
|
||||||
if ('' !== $specialPage) {
|
if ('' !== $specialPage) {
|
||||||
$key .= '_'.$specialPage;
|
$key = sprintf('%s_%s', $key, $specialPage);
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
app('log')->debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
||||||
app('preferences')->set($key, false);
|
app('preferences')->set($key, false);
|
||||||
@@ -114,9 +114,9 @@ class IntroController extends Controller
|
|||||||
public function postFinished(string $route, ?string $specialPage = null): JsonResponse
|
public function postFinished(string $route, ?string $specialPage = null): JsonResponse
|
||||||
{
|
{
|
||||||
$specialPage ??= '';
|
$specialPage ??= '';
|
||||||
$key = 'shown_demo_'.$route;
|
$key = sprintf('shown_demo_%s', $route);
|
||||||
if ('' !== $specialPage) {
|
if ('' !== $specialPage) {
|
||||||
$key .= '_'.$specialPage;
|
$key = sprintf('%s_%s', $key, $specialPage);
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
app('log')->debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
|
||||||
app('preferences')->set($key, true);
|
app('preferences')->set($key, true);
|
||||||
|
@@ -104,7 +104,7 @@ class EditController extends Controller
|
|||||||
$repetition = $recurrence->recurrenceRepetitions()->first();
|
$repetition = $recurrence->recurrenceRepetitions()->first();
|
||||||
$currentRepType = $repetition->repetition_type;
|
$currentRepType = $repetition->repetition_type;
|
||||||
if ('' !== $repetition->repetition_moment) {
|
if ('' !== $repetition->repetition_moment) {
|
||||||
$currentRepType .= ','.$repetition->repetition_moment;
|
$currentRepType = sprintf('%s,%s', $currentRepType,$repetition->repetition_moment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "return_to_edit").
|
// put previous url in session if not redirect from store (not "return_to_edit").
|
||||||
|
@@ -117,10 +117,7 @@ class GroupCloneService
|
|||||||
private function cloneNote(Note $note, TransactionJournal $newJournal, int $oldGroupId): void
|
private function cloneNote(Note $note, TransactionJournal $newJournal, int $oldGroupId): void
|
||||||
{
|
{
|
||||||
$newNote = $note->replicate();
|
$newNote = $note->replicate();
|
||||||
$newNote->text .= sprintf(
|
$newNote->text = sprintf("%s\n\n%s",$newNote->text, trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId]));
|
||||||
"\n\n%s",
|
|
||||||
trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId])
|
|
||||||
);
|
|
||||||
$newNote->noteable_id = $newJournal->id;
|
$newNote->noteable_id = $newJournal->id;
|
||||||
$newNote->save();
|
$newNote->save();
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support;
|
namespace FireflyIII\Support;
|
||||||
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CacheProperties.
|
* Class CacheProperties.
|
||||||
@@ -55,7 +56,7 @@ class CacheProperties
|
|||||||
*/
|
*/
|
||||||
public function get()
|
public function get()
|
||||||
{
|
{
|
||||||
return \Cache::get($this->hash);
|
return Cache::get($this->hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHash(): string
|
public function getHash(): string
|
||||||
@@ -70,7 +71,7 @@ class CacheProperties
|
|||||||
}
|
}
|
||||||
$this->hash();
|
$this->hash();
|
||||||
|
|
||||||
return \Cache::has($this->hash);
|
return Cache::has($this->hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function hash(): void
|
private function hash(): void
|
||||||
@@ -78,10 +79,10 @@ class CacheProperties
|
|||||||
$content = '';
|
$content = '';
|
||||||
foreach ($this->properties as $property) {
|
foreach ($this->properties as $property) {
|
||||||
try {
|
try {
|
||||||
$content .= \Safe\json_encode($property, JSON_THROW_ON_ERROR);
|
$content = sprintf('%s%s', $content, \Safe\json_encode($property, JSON_THROW_ON_ERROR));
|
||||||
} catch (\JsonException $e) {
|
} catch (\JsonException $e) {
|
||||||
// @ignoreException
|
// @ignoreException
|
||||||
$content .= hash('sha256', (string) time());
|
$content = sprintf('%s%s', $content, hash('sha256', (string) time()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->hash = substr(hash('sha256', $content), 0, 16);
|
$this->hash = substr(hash('sha256', $content), 0, 16);
|
||||||
@@ -92,6 +93,6 @@ class CacheProperties
|
|||||||
*/
|
*/
|
||||||
public function store($data): void
|
public function store($data): void
|
||||||
{
|
{
|
||||||
\Cache::forever($this->hash, $data);
|
Cache::forever($this->hash, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user