refactor: encapsed strings to sprintf

This commit is contained in:
HDVinnie
2020-02-17 13:52:20 -05:00
parent 61fa3f8900
commit 605c337204
61 changed files with 245 additions and 218 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ class CasinoBot
$output = implode(' ', $note);
$v = validator(['bot_id' => $this->bot->id, 'amount'=> $amount, 'note'=> $output], [
'bot_id' => 'required|exists:bots,id|max:999',
'amount' => "required|numeric|min:1|max:{$this->target->seedbonus}",
'amount' => sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus),
'note' => 'required|string',
]);
if ($v->passes()) {
+7 -6
View File
@@ -34,8 +34,8 @@ class IRCAnnounceBot
$this->joinchannels = config('irc-bot.joinchannels');
$this->socket = fsockopen($this->server, $this->port);
$this->send_data("NICK {$this->username}");
$this->send_data("USER {$this->username} {$this->hostname} {$this->server} {$this->username}");
$this->send_data(sprintf('NICK %s', $this->username));
$this->send_data(sprintf('USER %s %s %s %s', $this->username, $this->hostname, $this->server, $this->username));
$this->connect();
}
@@ -56,7 +56,7 @@ class IRCAnnounceBot
if ($ex[0] == 'PING') {
$this->send_data('PONG '.$ex[1]);
if ($this->nickservpass) {
$this->send_data("NICKSERV IDENTIFY {$this->nickservpass}");
$this->send_data(sprintf('NICKSERV IDENTIFY %s', $this->nickservpass));
}
return;
@@ -66,17 +66,18 @@ class IRCAnnounceBot
private function send_data($data)
{
fwrite($this->socket, "$data\r\n");
fwrite($this->socket, sprintf('%s
', $data));
}
private function say($channel, $string)
{
$this->send_data("PRIVMSG $channel $string");
$this->send_data(sprintf('PRIVMSG %s %s', $channel, $string));
}
private function join($channel)
{
$this->send_data("JOIN $channel");
$this->send_data(sprintf('JOIN %s', $channel));
}
public function message($channel, $message)
+13 -13
View File
@@ -100,7 +100,7 @@ class NerdBot
cache()->put('nerdbot-banker', $banker, $this->expiresAt);
}
return "Currently [url=/users/{$banker->username}]{$banker->username}[/url] Is The Top BON Holder On ".config('other.title').'!';
return sprintf('Currently [url=/users/%s]%s[/url] Is The Top BON Holder On ', $banker->username, $banker->username).config('other.title').'!';
}
/**
@@ -118,7 +118,7 @@ class NerdBot
cache()->put('nerdbot-snatched', $snatched, $this->expiresAt);
}
return "Currently [url=/torrents/{$snatched->id}]{$snatched->name}[/url] Is The Most Snatched Torrent On ".config('other.title').'!';
return sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Snatched Torrent On ', $snatched->id, $snatched->name).config('other.title').'!';
}
/**
@@ -136,7 +136,7 @@ class NerdBot
cache()->put('nerdbot-leeched', $leeched, $this->expiresAt);
}
return "Currently [url=/torrents/{$leeched->id}]{$leeched->name}[/url] Is The Most Leeched Torrent On ".config('other.title').'!';
return sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Leeched Torrent On ', $leeched->id, $leeched->name).config('other.title').'!';
}
/**
@@ -154,7 +154,7 @@ class NerdBot
cache()->put('nerdbot-seeded', $seeded, $this->expiresAt);
}
return "Currently [url=/torrents/{$seeded->id}]{$seeded->name}[/url] Is The Most Seeded Torrent On ".config('other.title').'!';
return sprintf('Currently [url=/torrents/%s]%s[/url] Is The Most Seeded Torrent On ', $seeded->id, $seeded->name).config('other.title').'!';
}
/**
@@ -172,7 +172,7 @@ class NerdBot
cache()->put('nerdbot-fl', $fl, $this->expiresAt);
}
return "There Are Currently {$fl} Freeleech Torrents On ".config('other.title').'!';
return sprintf('There Are Currently %s Freeleech Torrents On ', $fl).config('other.title').'!';
}
/**
@@ -190,7 +190,7 @@ class NerdBot
cache()->put('nerdbot-doubleup', $du, $this->expiresAt);
}
return "There Are Currently {$du} Double Upload Torrents On ".config('other.title').'!';
return sprintf('There Are Currently %s Double Upload Torrents On ', $du).config('other.title').'!';
}
/**
@@ -208,7 +208,7 @@ class NerdBot
cache()->put('nerdbot-peers', $peers, $this->expiresAt);
}
return "Currently There Are {$peers} Peers On ".config('other.title').'!';
return sprintf('Currently There Are %s Peers On ', $peers).config('other.title').'!';
}
/**
@@ -226,7 +226,7 @@ class NerdBot
cache()->put('nerdbot-bans', $bans, $this->expiresAt);
}
return "In The Last 24 Hours {$bans} Users Have Been Banned From ".config('other.title').'!';
return sprintf('In The Last 24 Hours %s Users Have Been Banned From ', $bans).config('other.title').'!';
}
/**
@@ -244,7 +244,7 @@ class NerdBot
cache()->put('nerdbot-warnings', $warnings, $this->expiresAt);
}
return "In The Last 24 Hours {$warnings} Hit and Run Warnings Have Been Issued On ".config('other.title').'!';
return sprintf('In The Last 24 Hours %s Hit and Run Warnings Have Been Issued On ', $warnings).config('other.title').'!';
}
/**
@@ -262,7 +262,7 @@ class NerdBot
cache()->put('nerdbot-uploads', $uploads, $this->expiresAt);
}
return "In The Last 24 Hours {$uploads} Torrents Have Been Uploaded To ".config('other.title').'!';
return sprintf('In The Last 24 Hours %s Torrents Have Been Uploaded To ', $uploads).config('other.title').'!';
}
/**
@@ -280,7 +280,7 @@ class NerdBot
cache()->put('nerdbot-logins', $logins, $this->expiresAt);
}
return "In The Last 24 Hours {$logins} Unique Users Have Logged Into ".config('other.title').'!';
return sprintf('In The Last 24 Hours %s Unique Users Have Logged Into ', $logins).config('other.title').'!';
}
/**
@@ -298,7 +298,7 @@ class NerdBot
cache()->put('nerdbot-users', $users, $this->expiresAt);
}
return "In The Last 24 Hours {$users} Users Have Registered To ".config('other.title').'!';
return sprintf('In The Last 24 Hours %s Users Have Registered To ', $users).config('other.title').'!';
}
/**
@@ -354,7 +354,7 @@ class NerdBot
$output = implode(' ', $note);
$v = validator(['bot_id' => $this->bot->id, 'amount'=> $amount, 'note'=> $output], [
'bot_id' => 'required|exists:bots,id|max:999',
'amount' => "required|numeric|min:1|max:{$this->target->seedbonus}",
'amount' => sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus),
'note' => 'required|string',
]);
if ($v->passes()) {
+2 -2
View File
@@ -98,7 +98,7 @@ class SystemBot
$output = implode(' ', $note);
$v = validator(['receiver' => $receiver, 'amount'=> $amount, 'note'=> $output], [
'receiver' => 'required|string|exists:users,username',
'amount' => "required|numeric|min:1|max:{$this->target->seedbonus}",
'amount' => sprintf('required|numeric|min:1|max:%s', $this->target->seedbonus),
'note' => 'required|string',
]);
if ($v->passes()) {
@@ -133,7 +133,7 @@ class SystemBot
$recipient_url = hrefProfile($recipient);
$this->chat->systemMessage(
"[url={$profile_url}]{$this->target->username}[/url] has gifted {$value} BON to [url={$recipient_url}]{$recipient->username}[/url]"
sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $this->target->username, $value, $recipient_url, $recipient->username)
);
return 'Your gift to '.$recipient->username.' for '.$amount.' BON has been sent!';
+2 -2
View File
@@ -82,7 +82,7 @@ class AutoGraveyard extends Command
$appurl = config('app.url');
$this->chat->systemMessage(
"Ladies and Gents, [url={$appurl}/users/{$user->username}]{$user->username}[/url] has successfully resurrected [url={$appurl}/torrents/{$torrent->id}]{$torrent->name}[/url]. :zombie:"
sprintf('Ladies and Gents, [url=%s/users/%s]%s[/url] has successfully resurrected [url=%s/torrents/%s]%s[/url]. :zombie:', $appurl, $user->username, $user->username, $appurl, $torrent->id, $torrent->name)
);
// Send Private Message
@@ -90,7 +90,7 @@ class AutoGraveyard extends Command
$pm->sender_id = 1;
$pm->receiver_id = $user->id;
$pm->subject = 'Successful Graveyard Resurrection';
$pm->message = "You have successfully resurrected [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] :zombie: ! Thank you for bringing a torrent back from the dead! Enjoy the freeleech tokens!
$pm->message = sprintf('You have successfully resurrected [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] :zombie: ! Thank you for bringing a torrent back from the dead! Enjoy the freeleech tokens!
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]';
$pm->save();
}
+14 -14
View File
@@ -123,25 +123,25 @@ class AutoNerdStat extends Command
// Select A Random Nerd Stat
$statArray = [
"In The Last 24 Hours [color=#93c47d][b]{$logins}[/b][/color] Unique Users Have Logged Into ".config('other.title').'!',
"In The Last 24 Hours [color=#93c47d][b]{$uploads}[/b][/color] Torrents Have Been Uploaded To ".config('other.title').'!',
"In The Last 24 Hours [color=#93c47d][b]{$users}[/b][/color] Users Have Registered To ".config('other.title').'!',
"There Are Currently [color=#93c47d][b]{$fl}[/b][/color] Freeleech Torrents On ".config('other.title').'!',
"There Are Currently [color=#93c47d][b]{$du}[/b][/color] Double Upload Torrents On ".config('other.title').'!',
"Currently [url={$seeded_url}]{$seeded->name}[/url] Is The Best Seeded Torrent On ".config('other.title').'!',
"Currently [url={$leeched_url}]{$leeched->name}[/url] Is The Most Leeched Torrent On ".config('other.title').'!',
"Currently [url={$snatched_url}]{$snatched->name}[/url] Is The Most Snatched Torrent On ".config('other.title').'!',
"Currently [url={$banker_url}]{$banker->username}[/url] Is The Top BON Holder On ".config('other.title').'!',
"Currently There Are [color=#93c47d][b]{$peers}[/b][/color] Peers On ".config('other.title').'!',
"In The Last 24 Hours [color=#dd7e6b][b]{$bans}[/b][/color] Users Have Been Banned From ".config('other.title').'!',
"In The Last 24 Hours [color=#dd7e6b][b]{$warnings}[/b][/color] Hit and Run Warnings Have Been Issued On ".config('other.title').'!',
config('other.title')." Birthday Is [b]{$bday}[/b]!",
sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Unique Users Have Logged Into ', $logins).config('other.title').'!',
sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Torrents Have Been Uploaded To ', $uploads).config('other.title').'!',
sprintf('In The Last 24 Hours [color=#93c47d][b]%s[/b][/color] Users Have Registered To ', $users).config('other.title').'!',
sprintf('There Are Currently [color=#93c47d][b]%s[/b][/color] Freeleech Torrents On ', $fl).config('other.title').'!',
sprintf('There Are Currently [color=#93c47d][b]%s[/b][/color] Double Upload Torrents On ', $du).config('other.title').'!',
sprintf('Currently [url=%s]%s[/url] Is The Best Seeded Torrent On ', $seeded_url, $seeded->name).config('other.title').'!',
sprintf('Currently [url=%s]%s[/url] Is The Most Leeched Torrent On ', $leeched_url, $leeched->name).config('other.title').'!',
sprintf('Currently [url=%s]%s[/url] Is The Most Snatched Torrent On ', $snatched_url, $snatched->name).config('other.title').'!',
sprintf('Currently [url=%s]%s[/url] Is The Top BON Holder On ', $banker_url, $banker->username).config('other.title').'!',
sprintf('Currently There Are [color=#93c47d][b]%s[/b][/color] Peers On ', $peers).config('other.title').'!',
sprintf('In The Last 24 Hours [color=#dd7e6b][b]%s[/b][/color] Users Have Been Banned From ', $bans).config('other.title').'!',
sprintf('In The Last 24 Hours [color=#dd7e6b][b]%s[/b][/color] Hit and Run Warnings Have Been Issued On ', $warnings).config('other.title').'!',
config('other.title').sprintf(' Birthday Is [b]%s[/b]!', $bday),
config('other.title').' Is King!',
];
$selected = mt_rand(0, count($statArray) - 1);
// Auto Shout Nerd Stat
$this->chat->systemMessage("{$statArray[$selected]}", 2);
$this->chat->systemMessage(sprintf('%s', $statArray[$selected]), 2);
}
}
}
+2 -2
View File
@@ -69,8 +69,8 @@ class AutoPreWarning extends Command
$pm->sender_id = 1;
$pm->receiver_id = $pre->user->id;
$pm->subject = 'Hit and Run Warning Incoming';
$pm->message = 'You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for '.config('hitrun.prewarn')." days on Torrent {$pre->torrent->name}
and have not yet met the required seedtime rules set by ".config('other.title').". If you fail to seed it within {$timeleft} day(s) you will receive a automated WARNING which will last ".config('hitrun.expire').' days![/b]
$pm->message = 'You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for '.config('hitrun.prewarn').sprintf(' days on Torrent %s
and have not yet met the required seedtime rules set by ', $pre->torrent->name).config('other.title').sprintf('. If you fail to seed it within %s day(s) you will receive a automated WARNING which will last ', $timeleft).config('hitrun.expire').' days![/b]
[color=red][b] THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]';
$pm->save();
@@ -68,7 +68,7 @@ class AutoRecycleClaimedTorrentRequests extends Command
if ($requestClaim) {
$tr_url = hrefRequest($torrentRequest);
$this->chat->systemMessage(
"[url={$tr_url}]{$torrentRequest->name}[/url] claim has been reset due to not being filled within 7 days."
sprintf('[url=%s]%s[/url] claim has been reset due to not being filled within 7 days.', $tr_url, $torrentRequest->name)
);
$requestClaim->delete();
@@ -69,7 +69,7 @@ class AutoRemoveFeaturedTorrent extends Command
$appurl = config('app.url');
$this->chat->systemMessage(
"Ladies and Gents, [url={$appurl}/torrents/{$torrent->id}]{$torrent->name}[/url] is no longer featured. :poop:"
sprintf('Ladies and Gents, [url=%s/torrents/%s]%s[/url] is no longer featured. :poop:', $appurl, $torrent->id, $torrent->name)
);
// Delete The Record From DB
+1 -1
View File
@@ -66,7 +66,7 @@ class AutoWarning extends Command
$warning->user_id = $hr->user->id;
$warning->warned_by = '1';
$warning->torrent = $hr->torrent->id;
$warning->reason = "Hit and Run Warning For Torrent {$hr->torrent->name}";
$warning->reason = sprintf('Hit and Run Warning For Torrent %s', $hr->torrent->name);
$warning->expires_on = $current->copy()->addDays(config('hitrun.expire'));
$warning->active = '1';
$warning->save();
+19 -12
View File
@@ -60,8 +60,8 @@ class FetchReleaseYears extends Command
->whereNull('release_year')
->count();
$this->alert("{$withyear} Torrents Already Have A Release Year Value");
$this->alert("{$withoutyear} Torrents Are Missing A Release Year Value");
$this->alert(sprintf('%s Torrents Already Have A Release Year Value', $withyear));
$this->alert(sprintf('%s Torrents Are Missing A Release Year Value', $withoutyear));
foreach ($torrents as $torrent) {
$meta = null;
@@ -75,10 +75,12 @@ class FetchReleaseYears extends Command
if (isset($meta->releaseYear) && $meta->releaseYear > '1900') {
$torrent->release_year = $meta->releaseYear;
$torrent->save();
$this->info("({$torrent->category->name}) Release Year Fetched For Torrent {$torrent->name} \n");
$this->info(sprintf('(%s) Release Year Fetched For Torrent %s
', $torrent->category->name, $torrent->name));
} else {
$this->warn("({$torrent->category->name}) No Release Year Found For Torrent {$torrent->name}
{$appurl}/torrents/{$torrent->id} \n");
$this->warn(sprintf('(%s) No Release Year Found For Torrent %s
%s/torrents/%s
', $torrent->category->name, $torrent->name, $appurl, $torrent->id));
}
}
@@ -91,10 +93,12 @@ class FetchReleaseYears extends Command
if (isset($meta->releaseYear) && $meta->releaseYear > '1900') {
$torrent->release_year = $meta->releaseYear;
$torrent->save();
$this->info("({$torrent->category->name}) Release Year Fetched For Torrent {$torrent->name} \n");
$this->info(sprintf('(%s) Release Year Fetched For Torrent %s
', $torrent->category->name, $torrent->name));
} else {
$this->warn("({$torrent->category->name}) No Release Year Found For Torrent {$torrent->name}
{$appurl}/torrents/{$torrent->id} \n");
$this->warn(sprintf('(%s) No Release Year Found For Torrent %s
%s/torrents/%s
', $torrent->category->name, $torrent->name, $appurl, $torrent->id));
}
}
@@ -105,15 +109,18 @@ class FetchReleaseYears extends Command
if (isset($meta->first_release_date) && $meta->first_release_date > '1900') {
$torrent->release_year = date('Y', strtotime($meta->first_release_date));
$torrent->save();
$this->info("({$torrent->category->name}) Release Year Fetched For Torrent {$torrent->name} \n");
$this->info(sprintf('(%s) Release Year Fetched For Torrent %s
', $torrent->category->name, $torrent->name));
} else {
$this->warn("({$torrent->category->name}) No Release Year Found For Torrent {$torrent->name}
{$appurl}/torrents/{$torrent->id} \n");
$this->warn(sprintf('(%s) No Release Year Found For Torrent %s
%s/torrents/%s
', $torrent->category->name, $torrent->name, $appurl, $torrent->id));
}
}
if ($torrent->category->no_meta || $torrent->category->music_meta) {
$this->warn("(SKIPPED) {$torrent->name} Is In A Category That Does Not Have Meta. \n");
$this->warn(sprintf('(SKIPPED) %s Is In A Category That Does Not Have Meta.
', $torrent->name));
}
// sleep for 1 second
+8 -8
View File
@@ -191,7 +191,7 @@ class GitUpdater extends Command
$this->red('Updating will cause you to LOSE any changes you might have made to the file!');
foreach ($updating as $file) {
if ($this->io->confirm("Update $file", true)) {
if ($this->io->confirm(sprintf('Update %s', $file), true)) {
$this->updateFile($file);
}
}
@@ -201,7 +201,7 @@ class GitUpdater extends Command
private function updateFile($file)
{
$this->process("git checkout origin/master -- $file");
$this->process(sprintf('git checkout origin/master -- %s', $file));
}
private function backup(array $paths)
@@ -235,7 +235,7 @@ class GitUpdater extends Command
$from .= '/*';
}
$this->process("$this->copy_command $from $to");
$this->process(sprintf('%s %s %s', $this->copy_command, $from, $to));
}
$this->commands([
@@ -308,7 +308,7 @@ class GitUpdater extends Command
private function validatePath($path)
{
if (!is_file(base_path($path)) && !is_dir(base_path($path))) {
$this->red("The path '$path' is invalid");
$this->red(sprintf('The path \'%s\' is invalid', $path));
//$this->call('up');
//die();
}
@@ -316,12 +316,12 @@ class GitUpdater extends Command
private function createBackupPath($path)
{
if (!is_dir(storage_path("gitupdate/$path")) && !is_file(base_path($path))) {
mkdir(storage_path("gitupdate/$path"), 0775, true);
if (!is_dir(storage_path(sprintf('gitupdate/%s', $path))) && !is_file(base_path($path))) {
mkdir(storage_path(sprintf('gitupdate/%s', $path)), 0775, true);
} elseif (is_file(base_path($path)) && dirname($path) !== '.') {
$path = dirname($path);
if (!is_dir(storage_path("gitupdate/$path"))) {
mkdir(storage_path("gitupdate/$path"), 0775, true);
if (!is_dir(storage_path(sprintf('gitupdate/%s', $path)))) {
mkdir(storage_path(sprintf('gitupdate/%s', $path)), 0775, true);
}
}
}
+20 -11
View File
@@ -27,32 +27,37 @@ trait ConsoleTools
private function cyan($line)
{
$this->io->writeln("\n<fg=cyan>$line</>");
$this->io->writeln(sprintf('
<fg=cyan>%s</>', $line));
}
private function white($line)
{
$this->io->writeln("\n$line");
$this->io->writeln(PHP_EOL . $line);
}
private function magenta($line)
{
$this->io->writeln("\n<fg=magenta>$line</>");
$this->io->writeln(sprintf('
<fg=magenta>%s</>', $line));
}
private function green($line)
{
$this->io->writeln("\n<fg=green>$line</>");
$this->io->writeln(sprintf('
<fg=green>%s</>', $line));
}
private function red($line)
{
$this->io->writeln("\n<fg=red>$line</>");
$this->io->writeln(sprintf('
<fg=red>%s</>', $line));
}
private function blue($line)
{
$this->io->writeln("\n<fg=blue>$line</>");
$this->io->writeln(sprintf('
<fg=blue>%s</>', $line));
}
private function done()
@@ -69,22 +74,26 @@ trait ConsoleTools
private function alertSuccess($line)
{
$this->io->writeln("\n<fg=white>[</><fg=green> !! $line !! </><fg=white>]</>");
$this->io->writeln(sprintf('
<fg=white>[</><fg=green> !! %s !! </><fg=white>]</>', $line));
}
private function alertDanger($line)
{
$this->io->writeln("\n<fg=white>[</><fg=red> !! $line !! </><fg=white>]</>");
$this->io->writeln(sprintf('
<fg=white>[</><fg=red> !! %s !! </><fg=white>]</>', $line));
}
private function alertInfo($line)
{
$this->io->writeln("\n<fg=white>[</><fg=cyan> !! $line !! </><fg=white>]</>");
$this->io->writeln(sprintf('
<fg=white>[</><fg=cyan> !! %s !! </><fg=white>]</>', $line));
}
private function alertWarning($line)
{
$this->io->writeln("\n<fg=white>[</><fg=yellow> !! $line !! </><fg=white>]</>");
$this->io->writeln(sprintf('
<fg=white>[</><fg=yellow> !! %s !! </><fg=white>]</>', $line));
}
private function commands(array $commands, $silent = false)
@@ -114,7 +123,7 @@ trait ConsoleTools
try {
$process->checkTimeout();
} catch (ProcessTimedOutException $e) {
$this->red("'{$command}' timed out.!");
$this->red(sprintf('\'%s\' timed out.!', $command));
}
if (!$silent) {
+6 -6
View File
@@ -22,7 +22,7 @@ if (!function_exists('hrefProfile')) {
{
$appurl = appurl();
return "{$appurl}/users/{$user->username}";
return sprintf('%s/users/%s', $appurl, $user->username);
}
}
@@ -31,7 +31,7 @@ if (!function_exists('hrefArticle')) {
{
$appurl = appurl();
return "{$appurl}/articles/{$article->id}";
return sprintf('%s/articles/%s', $appurl, $article->id);
}
}
@@ -40,7 +40,7 @@ if (!function_exists('hrefTorrent')) {
{
$appurl = appurl();
return "{$appurl}/torrents/{$torrent->id}";
return sprintf('%s/torrents/%s', $appurl, $torrent->id);
}
}
@@ -49,7 +49,7 @@ if (!function_exists('hrefRequest')) {
{
$appurl = appurl();
return "{$appurl}/requests/{$torrentRequest->id}";
return sprintf('%s/requests/%s', $appurl, $torrentRequest->id);
}
}
@@ -58,7 +58,7 @@ if (!function_exists('hrefPoll')) {
{
$appurl = appurl();
return "{$appurl}/polls/{$poll->id}";
return sprintf('%s/polls/%s', $appurl, $poll->id);
}
}
@@ -67,6 +67,6 @@ if (!function_exists('hrefPlaylist')) {
{
$appurl = appurl();
return "{$appurl}/playlists/{$playlist->id}";
return sprintf('%s/playlists/%s', $appurl, $playlist->id);
}
}
+1 -1
View File
@@ -65,7 +65,7 @@ class LanguageCensor
for ($i = 0; $i < $length; $i++) {
if ((is_countable($indexes) ? count($indexes) : 0) > 0 && $indexes[0] == $i) {
$match = substr($source, $indexes[0], $word_length);
$result .= "<span class='censor'>{$match}</span>";
$result .= sprintf('<span class=\'censor\'>%s</span>', $match);
$ignore = $word_length - 1;
} elseif ($ignore > 0) {
$ignore--;
+1 -1
View File
@@ -20,7 +20,7 @@ class Linkify
$reg_exUrl = "/^(?!\[url=)(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)/";
if (preg_match($reg_exUrl, $text, $url)) {
return preg_replace($reg_exUrl, "<a href='{$url[0]}'>{$url[0]}</a> ", $text);
return preg_replace($reg_exUrl, sprintf('<a href=\'%s\'>%s</a> ', $url[0], $url[0]), $text);
}
return $text;
+4 -4
View File
@@ -47,7 +47,7 @@ class TorrentHelper
$wishes = Wish::where('imdb', '=', 'tt'.$torrent->imdb)->whereNull('source')->get();
if ($wishes) {
foreach ($wishes as $wish) {
$wish->source = "{$appurl}/torrents/{$torrent->id}";
$wish->source = sprintf('%s/torrents/%s', $appurl, $torrent->id);
$wish->save();
// Send Private Message
@@ -55,7 +55,7 @@ class TorrentHelper
$pm->sender_id = 1;
$pm->receiver_id = $wish->user_id;
$pm->subject = 'Wish List Notice!';
$pm->message = "The following item, {$wish->title}, from your wishlist has been uploaded to {$appname}! You can view it [url={$appurl}/torrents/".$torrent->id.'] HERE [/url]
$pm->message = sprintf('The following item, %s, from your wishlist has been uploaded to %s! You can view it [url=%s/torrents/', $wish->title, $appname, $appurl).$torrent->id.'] HERE [/url]
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]';
$pm->save();
}
@@ -100,11 +100,11 @@ class TorrentHelper
if ($anon == 0) {
$bot->message(config('irc-bot.channels'), '['.$appname.'] User '.$username.' has uploaded '.$torrent->name.' grab it now!');
$bot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type.'] [Size:'.$torrent->getSize().']');
$bot->message(config('irc-bot.channels'), "[Link: {$appurl}/torrents/".$id.']');
$bot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']');
} else {
$bot->message(config('irc-bot.channels'), '['.$appname.'] An anonymous user has uploaded '.$torrent->name.' grab it now!');
$bot->message(config('irc-bot.channels'), '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type.'] [Size: '.$torrent->getSize().']');
$bot->message(config('irc-bot.channels'), "[Link: {$appurl}/torrents/".$id.']');
$bot->message(config('irc-bot.channels'), sprintf('[Link: %s/torrents/', $appurl).$id.']');
}
}
}
@@ -193,11 +193,11 @@ class TorrentController extends BaseController
// Announce To Shoutbox
if ($anon == 0) {
$this->chat->systemMessage(
"User [url={$appurl}/users/".$username.']'.$username."[/url] has uploaded [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
);
} else {
$this->chat->systemMessage(
"An anonymous user has uploaded [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
);
}
+3 -3
View File
@@ -123,7 +123,7 @@ class AnnounceController extends Controller
}
// Check Passkey Against Cache or Users Table
$user = Cache::get("user.{$passkey}") ?? User::where('passkey', '=', $passkey)->first();
$user = Cache::get(sprintf('user.%s', $passkey)) ?? User::where('passkey', '=', $passkey)->first();
// If Passkey Doesn't Exist Return Error to Client
if ($user === null) {
@@ -206,7 +206,7 @@ class AnnounceController extends Controller
}
// Check Info Hash Against Cache or Torrents Table
$torrent = Cache::get("torrent.{$info_hash}") ?? Torrent::select(['id', 'status', 'free', 'doubleup', 'times_completed', 'seeders', 'leechers'])->withAnyStatus()->where('info_hash', '=', $info_hash)->first();
$torrent = Cache::get(sprintf('torrent.%s', $info_hash)) ?? Torrent::select(['id', 'status', 'free', 'doubleup', 'times_completed', 'seeders', 'leechers'])->withAnyStatus()->where('info_hash', '=', $info_hash)->first();
// If Torrent Doesnt Exsist Return Error to Client
if ($torrent === null) {
@@ -236,7 +236,7 @@ class AnnounceController extends Controller
$peers = Peer::where('torrent_id', '=', $torrent->id)->take(50)->get()->toArray();
// Pull Count On Users Peers Per Torrent For Rate Limiting
$connections = Cache::remember("user_connections.{$torrent->id}", 1800, function () use ($torrent, $user) {
$connections = Cache::remember(sprintf('user_connections.%s', $torrent->id), 1800, function () use ($torrent, $user) {
return Peer::where('torrent_id', '=', $torrent->id)->where('user_id', '=', $user->id)->count();
});
@@ -164,17 +164,17 @@ class RegisterController extends Controller
// Select A Random Welcome Message
$profile_url = hrefProfile($user);
$welcomeArray = [
"[url={$profile_url}]{$user->username}[/url], Welcome to ".config('other.title').'! Hope you enjoy the community :rocket:',
"[url={$profile_url}]{$user->username}[/url], We've been expecting you :space_invader:",
"[url={$profile_url}]{$user->username}[/url] has arrived. Party's over. :cry:",
"It's a bird! It's a plane! Nevermind, it's just [url={$profile_url}]{$user->username}[/url].",
"Ready player [url={$profile_url}]{$user->username}[/url].",
"A wild [url={$profile_url}]{$user->username}[/url] appeared.",
'Welcome to '.config('other.title')." [url={$profile_url}]{$user->username}[/url]. We were expecting you ( ͡° ͜ʖ ͡°)",
sprintf('[url=%s]%s[/url], Welcome to ', $profile_url, $user->username).config('other.title').'! Hope you enjoy the community :rocket:',
sprintf('[url=%s]%s[/url], We\'ve been expecting you :space_invader:', $profile_url, $user->username),
sprintf('[url=%s]%s[/url] has arrived. Party\'s over. :cry:', $profile_url, $user->username),
sprintf('It\'s a bird! It\'s a plane! Nevermind, it\'s just [url=%s]%s[/url].', $profile_url, $user->username),
sprintf('Ready player [url=%s]%s[/url].', $profile_url, $user->username),
sprintf('A wild [url=%s]%s[/url] appeared.', $profile_url, $user->username),
'Welcome to '.config('other.title').sprintf(' [url=%s]%s[/url]. We were expecting you ( ͡° ͜ʖ ͡°)', $profile_url, $user->username),
];
$selected = mt_rand(0, count($welcomeArray) - 1);
$this->chat->systemMessage(
"{$welcomeArray[$selected]}"
sprintf('%s', $welcomeArray[$selected])
);
// Send Welcome PM
$pm = new PrivateMessage();
+3 -3
View File
@@ -294,7 +294,7 @@ class BonusController extends Controller
$pm->sender_id = 1;
$pm->receiver_id = $user_acc->id;
$pm->subject = 'Personal 24 Hour Freeleech Activated';
$pm->message = "Your [b]Personal 24 Hour Freeleech[/b] session has started! It will expire on {$current->addDays(1)->toDayDateTimeString()} [b]".config('app.timezone').'[/b]!
$pm->message = sprintf('Your [b]Personal 24 Hour Freeleech[/b] session has started! It will expire on %s [b]', $current->addDays(1)->toDayDateTimeString()).config('app.timezone').'[/b]!
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]';
$pm->save();
} else {
@@ -332,7 +332,7 @@ class BonusController extends Controller
$v = validator($request->all(), [
'to_username' => 'required|exists:users,username|max:180',
'bonus_points' => "required|numeric|min:1|max:{$user->seedbonus}",
'bonus_points' => sprintf('required|numeric|min:1|max:%s', $user->seedbonus),
'bonus_message' => 'required|string',
]);
@@ -374,7 +374,7 @@ class BonusController extends Controller
$recipient_url = hrefProfile($recipient);
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has gifted {$value} BON to [url={$recipient_url}]{$recipient->username}[/url]"
sprintf('[url=%s]%s[/url] has gifted %s BON to [url=%s]%s[/url]', $profile_url, $user->username, $value, $recipient_url, $recipient->username)
);
if ($dest == 'profile') {
+12 -12
View File
@@ -101,11 +101,11 @@ class CommentController extends Controller
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on article [url={$article_url}]{$article->title}[/url]"
sprintf('[url=%s]%s[/url] has left a comment on article [url=%s]%s[/url]', $profile_url, $user->username, $article_url, $article->title)
);
} else {
$this->chat->systemMessage(
"An anonymous user has left a comment on article [url={$article_url}]{$article->title}[/url]"
sprintf('An anonymous user has left a comment on article [url=%s]%s[/url]', $article_url, $article->title)
);
}
if ($this->tag->hasTags($request->input('content'))) {
@@ -192,11 +192,11 @@ class CommentController extends Controller
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on playlist [url={$playlist_url}]{$playlist->name}[/url]"
sprintf('[url=%s]%s[/url] has left a comment on playlist [url=%s]%s[/url]', $profile_url, $user->username, $playlist_url, $playlist->name)
);
} else {
$this->chat->systemMessage(
"An anonymous user has left a comment on playlist [url={$playlist_url}]{$playlist->name}[/url]"
sprintf('An anonymous user has left a comment on playlist [url=%s]%s[/url]', $playlist_url, $playlist->name)
);
}
if ($this->tag->hasTags($request->input('content'))) {
@@ -287,11 +287,11 @@ class CommentController extends Controller
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name)
);
} else {
$this->chat->systemMessage(
"An anonymous user has left a comment on torrent [url={$torrent_url}]{$torrent->name}[/url]"
sprintf('An anonymous user has left a comment on torrent [url=%s]%s[/url]', $torrent_url, $torrent->name)
);
}
if ($this->tag->hasTags($request->input('content'))) {
@@ -378,11 +378,11 @@ class CommentController extends Controller
// Auto Shout
if ($comment->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
sprintf('[url=%s]%s[/url] has left a comment on Request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $tr->name)
);
} else {
$this->chat->systemMessage(
"An anonymous user has left a comment on Request [url={$tr_url}]{$tr->name}[/url]"
sprintf('An anonymous user has left a comment on Request [url=%s]%s[/url]', $tr_url, $tr->name)
);
}
//Notification
@@ -463,9 +463,9 @@ class CommentController extends Controller
$uploader_url = hrefProfile($uploader);
$thankArray = [
"Thanks for the upload [url={$uploader_url}][color={$uploader->group->color}][b]{$uploader->username}[/b][/color][/url] :vulcan_tone2:",
"Beautiful upload [url={$uploader_url}][color={$uploader->group->color}][b]{$uploader->username}[/b][/color][/url] :fire:",
"Cheers [url={$uploader_url}][color={$uploader->group->color}][b]{$uploader->username}[/b][/color][/url] for the upload :beers:",
sprintf('Thanks for the upload [url=%s][color=%s][b]%s[/b][/color][/url] :vulcan_tone2:', $uploader_url, $uploader->group->color, $uploader->username),
sprintf('Beautiful upload [url=%s][color=%s][b]%s[/b][/color][/url] :fire:', $uploader_url, $uploader->group->color, $uploader->username),
sprintf('Cheers [url=%s][color=%s][b]%s[/b][/color][/url] for the upload :beers:', $uploader_url, $uploader->group->color, $uploader->username),
];
}
@@ -506,7 +506,7 @@ class CommentController extends Controller
$torrent_url = hrefTorrent($torrent);
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has left a comment on Torrent [url={$torrent_url}]{$torrent->name}[/url]"
sprintf('[url=%s]%s[/url] has left a comment on Torrent [url=%s]%s[/url]', $profile_url, $user->username, $torrent_url, $torrent->name)
);
return redirect()->route('torrent', ['id' => $torrent->id])
+2 -2
View File
@@ -139,7 +139,7 @@ class ForumController extends Controller
if ($request->has('body') && $request->input('body') != '') {
if ($request->has('sorting') && $request->input('sorting') != null) {
$sorting = "posts.{$request->input('sorting')}";
$sorting = sprintf('posts.%s', $request->input('sorting'));
$direction = $request->input('direction');
} else {
$sorting = 'posts.id';
@@ -148,7 +148,7 @@ class ForumController extends Controller
$results = $result->orderBy($sorting, $direction)->paginate(25);
} else {
if ($request->has('sorting') && $request->input('sorting') != null) {
$sorting = "topics.{$request->input('sorting')}";
$sorting = sprintf('topics.%s', $request->input('sorting'));
$direction = $request->input('direction');
} else {
$sorting = 'topics.last_reply_at';
+2 -2
View File
@@ -30,7 +30,7 @@ class LikeController extends Controller
public function store(Request $request, $postId)
{
$post = Post::findOrFail($postId);
$postUrl = "forums/topics/{$post->topic->id}?page={$post->getPageNumber()}#post-{$postId}";
$postUrl = sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId);
$user = $request->user();
$like = $user->likes()->where('post_id', '=', $post->id)->where('like', '=', 1)->first();
@@ -66,7 +66,7 @@ class LikeController extends Controller
public function destroy(Request $request, $postId)
{
$post = Post::findOrFail($postId);
$postUrl = "forums/topics/{$post->topic->id}?page={$post->getPageNumber()}#post-{$postId}";
$postUrl = sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId);
$user = $request->user();
$like = $user->likes()->where('post_id', '=', $post->id)->where('like', '=', 1)->first();
+1 -1
View File
@@ -105,7 +105,7 @@ class PlaylistController extends Controller
$appurl = config('app.url');
if ($playlist->is_private != 1) {
$this->chat->systemMessage(
"User [url={$appurl}/".$user->username.'.'.$user->id.']'.$user->username."[/url] has created a new playlist [url={$appurl}/playlists/".$playlist->id.']'.$playlist->name.'[/url] check it out now! :slight_smile:'
sprintf('User [url=%s/', $appurl).$user->username.'.'.$user->id.']'.$user->username.sprintf('[/url] has created a new playlist [url=%s/playlists/', $appurl).$playlist->id.']'.$playlist->name.'[/url] check it out now! :slight_smile:'
);
}
+1 -1
View File
@@ -105,7 +105,7 @@ class PollController extends Controller
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has voted on poll [url={$poll_url}]{$poll->title}[/url]"
sprintf('[url=%s]%s[/url] has voted on poll [url=%s]%s[/url]', $profile_url, $user->username, $poll_url, $poll->title)
);
return redirect()->route('poll_results', ['id' => $poll->id])
+7 -7
View File
@@ -93,8 +93,8 @@ class PostController extends Controller
}
$post->save();
$appurl = config('app.url');
$href = "{$appurl}/forums/topics/{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$message = "{$user->username} has tagged you in a forum post. You can view it [url=$href] HERE [/url]";
$href = sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id);
$message = sprintf('%s has tagged you in a forum post. You can view it [url=%s] HERE [/url]', $user->username, $href);
if ($this->tag->hasTags($request->input('content'))) {
if ($this->tag->contains($request->input('content'), '@here') && $user->group->is_modo) {
$users = collect([]);
@@ -143,10 +143,10 @@ class PostController extends Controller
$forum->save();
// Post To Chatbox
$appurl = config('app.url');
$postUrl = "{$appurl}/forums/topics/{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$realUrl = "/forums/topics/{$topic->id}?page={$post->getPageNumber()}#post-{$post->id}";
$profileUrl = "{$appurl}/users/{$user->username}";
$this->chat->systemMessage("[url=$profileUrl]{$user->username}[/url] has left a reply on topic [url={$postUrl}]{$topic->name}[/url]");
$postUrl = sprintf('%s/forums/topics/%s?page=%s#post-%s', $appurl, $topic->id, $post->getPageNumber(), $post->id);
$realUrl = sprintf('/forums/topics/%s?page=%s#post-%s', $topic->id, $post->getPageNumber(), $post->id);
$profileUrl = sprintf('%s/users/%s', $appurl, $user->username);
$this->chat->systemMessage(sprintf('[url=%s]%s[/url] has left a reply on topic [url=%s]%s[/url]', $profileUrl, $user->username, $postUrl, $topic->name));
// Notify All Subscribers Of New Reply
if ($topic->first_user_poster_id != $user->id) {
$topic->notifyStarter($user, $topic, $post);
@@ -205,7 +205,7 @@ class PostController extends Controller
{
$user = $request->user();
$post = Post::findOrFail($postId);
$postUrl = "forums/topics/{$post->topic->id}?page={$post->getPageNumber()}#post-{$postId}";
$postUrl = sprintf('forums/topics/%s?page=%s#post-%s', $post->topic->id, $post->getPageNumber(), $postId);
abort_unless($user->group->is_modo || $user->id === $post->user_id, 403);
$post->content = $request->input('content');
+14 -14
View File
@@ -324,7 +324,7 @@ class RequestController extends Controller
'category_id' => 'required|exists:categories,id',
'type' => 'required',
'description' => 'required|string',
'bounty' => "required|numeric|min:0|max:{$user->seedbonus}",
'bounty' => sprintf('required|numeric|min:0|max:%s', $user->seedbonus),
'anon' => 'required',
]);
@@ -345,7 +345,7 @@ class RequestController extends Controller
$BonTransactions->cost = $request->input('bounty');
$BonTransactions->sender = $user->id;
$BonTransactions->receiver = 0;
$BonTransactions->comment = "new request - {$request->input('name')}";
$BonTransactions->comment = sprintf('new request - %s', $request->input('name'));
$BonTransactions->save();
$user->seedbonus -= $request->input('bounty');
$user->save();
@@ -354,11 +354,11 @@ class RequestController extends Controller
// Auto Shout
if ($tr->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has created a new request [url={$tr_url}]{$tr->name}[/url]"
sprintf('[url=%s]%s[/url] has created a new request [url=%s]%s[/url]', $profile_url, $user->username, $tr_url, $tr->name)
);
} else {
$this->chat->systemMessage(
"An anonymous user has created a new request [url={$tr_url}]{$tr->name}[/url]"
sprintf('An anonymous user has created a new request [url=%s]%s[/url]', $tr_url, $tr->name)
);
}
@@ -464,7 +464,7 @@ class RequestController extends Controller
$tr->created_at = Carbon::now();
$v = validator($request->all(), [
'bonus_value' => "required|numeric|min:100|max:{$user->seedbonus}",
'bonus_value' => sprintf('required|numeric|min:100|max:%s', $user->seedbonus),
]);
if ($v->fails()) {
@@ -484,7 +484,7 @@ class RequestController extends Controller
$BonTransactions->cost = $request->input('bonus_value');
$BonTransactions->sender = $user->id;
$BonTransactions->receiver = 0;
$BonTransactions->comment = "adding bonus to {$tr->name}";
$BonTransactions->comment = sprintf('adding bonus to %s', $tr->name);
$BonTransactions->save();
$user->seedbonus -= $request->input('bonus_value');
$user->save();
@@ -493,11 +493,11 @@ class RequestController extends Controller
// Auto Shout
if ($requestsBounty->anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$user->username}[/url] has added {$request->input('bonus_value')} BON bounty to request [url={$tr_url}]{$tr->name}[/url]"
sprintf('[url=%s]%s[/url] has added %s BON bounty to request [url=%s]%s[/url]', $profile_url, $user->username, $request->input('bonus_value'), $tr_url, $tr->name)
);
} else {
$this->chat->systemMessage(
"An anonymous user added {$request->input('bonus_value')} BON bounty to request [url={$tr_url}]{$tr->name}[/url]"
sprintf('An anonymous user added %s BON bounty to request [url=%s]%s[/url]', $request->input('bonus_value'), $tr_url, $tr->name)
);
}
$sender = $request->input('anon') == 1 ? 'Anonymous' : $user->username;
@@ -590,7 +590,7 @@ class RequestController extends Controller
$BonTransactions->cost = $fill_amount;
$BonTransactions->sender = 0;
$BonTransactions->receiver = $fill_user->id;
$BonTransactions->comment = "{$fill_user->username} has filled {$tr->name} and has been awarded {$fill_amount} BONUS.";
$BonTransactions->comment = sprintf('%s has filled %s and has been awarded %s BONUS.', $fill_user->username, $tr->name, $fill_amount);
$BonTransactions->save();
$fill_user->seedbonus += $fill_amount;
@@ -608,11 +608,11 @@ class RequestController extends Controller
// Auto Shout
if ($tr->filled_anon == 0) {
$this->chat->systemMessage(
"[url={$profile_url}]{$fill_user->username}[/url] has filled request, [url={$tr_url}]{$tr->name}[/url]"
sprintf('[url=%s]%s[/url] has filled request, [url=%s]%s[/url]', $profile_url, $fill_user->username, $tr_url, $tr->name)
);
} else {
$this->chat->systemMessage(
"An anonymous user has filled request, [url={$tr_url}]{$tr->name}[/url]"
sprintf('An anonymous user has filled request, [url=%s]%s[/url]', $tr_url, $tr->name)
);
}
@@ -623,11 +623,11 @@ class RequestController extends Controller
if ($tr->filled_anon == 0) {
return redirect()->route('request', ['id' => $id])
->withSuccess("You have approved {$tr->name} and the bounty has been awarded to {$fill_user->username}");
->withSuccess(sprintf('You have approved %s and the bounty has been awarded to %s', $tr->name, $fill_user->username));
}
return redirect()->route('request', ['id' => $id])
->withSuccess("You have approved {$tr->name} and the bounty has been awarded to a anonymous user");
->withSuccess(sprintf('You have approved %s and the bounty has been awarded to a anonymous user', $tr->name));
} else {
return redirect()->route('request', ['id' => $id])
->withErrors("You don't have access to approve this request");
@@ -690,7 +690,7 @@ class RequestController extends Controller
$torrentRequest->delete();
return redirect()->route('requests')
->withSuccess("You have deleted {$name}");
->withSuccess(sprintf('You have deleted %s', $name));
}
return redirect()->route('request', ['id' => $id])
@@ -71,8 +71,8 @@ class GiftController extends Controller
$pm->sender_id = 1;
$pm->receiver_id = $recipient->id;
$pm->subject = 'You Have Received A System Generated Gift';
$pm->message = "We just wanted to let you know that staff member, {$staff->username}, has credited your account with {$seedbonus} Bonus Points, {$invites} Invites and {$fl_tokens} Freeleech Tokens.
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]";
$pm->message = sprintf('We just wanted to let you know that staff member, %s, has credited your account with %s Bonus Points, %s Invites and %s Freeleech Tokens.
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]', $staff->username, $seedbonus, $invites, $fl_tokens);
$pm->save();
return redirect()->route('staff.gifts.index')
@@ -79,11 +79,11 @@ class ModerationController extends Controller
// Announce To Shoutbox
if ($anon == 0) {
$this->chat->systemMessage(
"User [url={$appurl}/users/".$username.']'.$username."[/url] has uploaded [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
);
} else {
$this->chat->systemMessage(
"An anonymous user has uploaded [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
);
}
@@ -122,8 +122,12 @@ class ModerationController extends Controller
$pm = new PrivateMessage();
$pm->sender_id = $user->id;
$pm->receiver_id = $torrent->user_id;
$pm->subject = "Your upload, {$torrent->name} ,has been postponed by {$user->username}";
$pm->message = "Greetings, \n\n Your upload, {$torrent->name} ,has been postponed. Please see below the message from the staff member. \n\n{$request->input('message')}";
$pm->subject = sprintf('Your upload, %s ,has been postponed by %s', $torrent->name, $user->username);
$pm->message = sprintf('Greetings,
Your upload, %s ,has been postponed. Please see below the message from the staff member.
%s', $torrent->name, $request->input('message'));
$pm->save();
return redirect()->route('staff.moderation.index')
@@ -155,8 +159,12 @@ class ModerationController extends Controller
$pm = new PrivateMessage();
$pm->sender_id = $user->id;
$pm->receiver_id = $torrent->user_id;
$pm->subject = "Your upload, {$torrent->name} ,has been rejected by {$user->username}";
$pm->message = "Greetings, \n\n Your upload {$torrent->name} has been rejected. Please see below the message from the staff member. \n\n{$request->input('message')}";
$pm->subject = sprintf('Your upload, %s ,has been rejected by %s', $torrent->name, $user->username);
$pm->message = sprintf('Greetings,
Your upload %s has been rejected. Please see below the message from the staff member.
%s', $torrent->name, $request->input('message'));
$pm->save();
return redirect()->route('staff.moderation.index')
@@ -93,7 +93,7 @@ class PollController extends Controller
$poll_url = hrefPoll($poll);
$this->chat->systemMessage(
"A new poll has been created [url={$poll_url}]{$poll->title}[/url] vote on it now! :slight_smile:"
sprintf('A new poll has been created [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title)
);
return redirect()->route('staff.polls.index')
@@ -174,7 +174,7 @@ class PollController extends Controller
$poll_url = hrefPoll($poll);
$this->chat->systemMessage(
"A poll has been updated [url={$poll_url}]{$poll->title}[/url] vote on it now! :slight_smile:"
sprintf('A poll has been updated [url=%s]%s[/url] vote on it now! :slight_smile:', $poll_url, $poll->title)
);
$poll->save();
@@ -82,11 +82,11 @@ class ReportController extends Controller
$pm->sender_id = $user->id;
$pm->receiver_id = $report->reporter_id;
$pm->subject = 'Your Report Has A New Verdict';
$pm->message = "[b]REPORT TITLE:[/b] {$report->title}
$pm->message = sprintf('[b]REPORT TITLE:[/b] %s
[b]ORIGINAL MESSAGE:[/b] {$report->message}
[b]ORIGINAL MESSAGE:[/b] %s
[b]VERDICT:[/b] {$report->verdict}";
[b]VERDICT:[/b] %s', $report->title, $report->message, $report->verdict);
$pm->save();
return redirect()->route('staff.reports.index')
+3 -3
View File
@@ -207,10 +207,10 @@ class TopicController extends Controller
// Post To ShoutBox
$appurl = config('app.url');
$topicUrl = "{$appurl}/forums/topics/{$topic->id}";
$profileUrl = "{$appurl}/users/{$user->username}";
$topicUrl = sprintf('%s/forums/topics/%s', $appurl, $topic->id);
$profileUrl = sprintf('%s/users/%s', $appurl, $user->username);
$this->chat->systemMessage("[url={$profileUrl}]{$user->username}[/url] has created a new topic [url={$topicUrl}]{$topic->name}[/url]");
$this->chat->systemMessage(sprintf('[url=%s]%s[/url] has created a new topic [url=%s]%s[/url]', $profileUrl, $user->username, $topicUrl, $topic->name));
//Achievements
$user->unlock(new UserMadeFirstPost(), 1);
+17 -15
View File
@@ -1117,10 +1117,10 @@ class TorrentController extends Controller
$pmuser = new PrivateMessage();
$pmuser->sender_id = 1;
$pmuser->receiver_id = $pm->user_id;
$pmuser->subject = "Torrent Deleted! - {$torrent->name}";
$pmuser->message = "[b]Attention:[/b] Torrent {$torrent->name} has been removed from our site. Our system shows that you were either the uploader, a seeder or a leecher on said torrent. We just wanted to let you know you can safely remove it from your client.
[b]Removal Reason:[/b] {$request->message}
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]";
$pmuser->subject = sprintf('Torrent Deleted! - %s', $torrent->name);
$pmuser->message = sprintf('[b]Attention:[/b] Torrent %s has been removed from our site. Our system shows that you were either the uploader, a seeder or a leecher on said torrent. We just wanted to let you know you can safely remove it from your client.
[b]Removal Reason:[/b] %s
[color=red][b]THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]', $torrent->name, $request->message);
$pmuser->save();
}
@@ -1156,7 +1156,9 @@ class TorrentController extends Controller
foreach ($v->errors()->all() as $error) {
$errors .= $error."\n";
}
\Log::notice("Deletion of torrent failed due to: \n\n{$errors}");
\Log::notice(sprintf('Deletion of torrent failed due to:
%s', $errors));
return redirect()->route('home.index')
->withErrors('Unable to delete Torrent');
@@ -1379,11 +1381,11 @@ class TorrentController extends Controller
// Announce To Shoutbox
if ($anon == 0) {
$this->chat->systemMessage(
"User [url={$appurl}/users/".$username.']'.$username."[/url] has uploaded [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
sprintf('User [url=%s/users/', $appurl).$username.']'.$username.sprintf('[/url] has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
);
} else {
$this->chat->systemMessage(
"An anonymous user has uploaded [url={$appurl}/torrents/".$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
sprintf('An anonymous user has uploaded [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] grab it now! :slight_smile:'
);
}
@@ -1497,7 +1499,7 @@ class TorrentController extends Controller
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"Attention, [url={$torrent_url}]{$torrent->name}[/url] has been bumped to the top by [url={$profile_url}]{$user->username}[/url]! It could use more seeds!"
sprintf('Attention, [url=%s]%s[/url] has been bumped to the top by [url=%s]%s[/url]! It could use more seeds!', $torrent_url, $torrent->name, $profile_url, $user->username)
);
// Announce To IRC
@@ -1506,7 +1508,7 @@ class TorrentController extends Controller
$bot = new IRCAnnounceBot();
$bot->message('#announce', '['.$appname.'] User '.$user->username.' has bumped '.$torrent->name.' , it could use more seeds!');
$bot->message('#announce', '[Category: '.$torrent->category->name.'] [Type: '.$torrent->type.'] [Size:'.$torrent->getSize().']');
$bot->message('#announce', "[Link: $torrent_url]");
$bot->message('#announce', sprintf('[Link: %s]', $torrent_url));
}
return redirect()->route('torrent', ['id' => $torrent->id])
@@ -1554,13 +1556,13 @@ class TorrentController extends Controller
$torrent->free = '1';
$this->chat->systemMessage(
"Ladies and Gents, [url={$torrent_url}]{$torrent->name}[/url] has been granted 100% FreeLeech! Grab It While You Can! :fire:"
sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted 100% FreeLeech! Grab It While You Can! :fire:', $torrent_url, $torrent->name)
);
} else {
$torrent->free = '0';
$this->chat->systemMessage(
"Ladies and Gents, [url={$torrent_url}]{$torrent->name}[/url] has been revoked of its 100% FreeLeech! :poop:"
sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its 100% FreeLeech! :poop:', $torrent_url, $torrent->name)
);
}
@@ -1599,7 +1601,7 @@ class TorrentController extends Controller
$torrent_url = hrefTorrent($torrent);
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"Ladies and Gents, [url={$torrent_url}]{$torrent->name}[/url] has been added to the Featured Torrents Slider by [url={$profile_url}]{$user->username}[/url]! Grab It While You Can! :fire:"
sprintf('Ladies and Gents, [url=%s]%s[/url] has been added to the Featured Torrents Slider by [url=%s]%s[/url]! Grab It While You Can! :fire:', $torrent_url, $torrent->name, $profile_url, $user->username)
);
return redirect()->route('torrent', ['id' => $torrent->id])
@@ -1630,12 +1632,12 @@ class TorrentController extends Controller
$torrent->doubleup = '1';
$this->chat->systemMessage(
"Ladies and Gents, [url={$torrent_url}]{$torrent->name}[/url] has been granted Double Upload! Grab It While You Can! :fire:"
sprintf('Ladies and Gents, [url=%s]%s[/url] has been granted Double Upload! Grab It While You Can! :fire:', $torrent_url, $torrent->name)
);
} else {
$torrent->doubleup = '0';
$this->chat->systemMessage(
"Ladies and Gents, [url={$torrent_url}]{$torrent->name}[/url] has been revoked of its Double Upload! :poop:"
sprintf('Ladies and Gents, [url=%s]%s[/url] has been revoked of its Double Upload! :poop:', $torrent_url, $torrent->name)
);
}
$torrent->save();
@@ -1669,7 +1671,7 @@ class TorrentController extends Controller
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"Ladies and Gents, a reseed request was just placed on [url={$torrent_url}]{$torrent->name}[/url] can you help out :question:"
sprintf('Ladies and Gents, a reseed request was just placed on [url=%s]%s[/url] can you help out :question:', $torrent_url, $torrent->name)
);
return redirect()->route('torrent', ['id' => $torrent->id])
+2 -2
View File
@@ -1982,7 +1982,7 @@ class UserController extends Controller
}
// Zip File Name
$zipFileName = "{$user->username}.zip";
$zipFileName = sprintf('%s.zip', $user->username);
// Create ZipArchive Obj
$zip = new ZipArchive();
@@ -1997,7 +1997,7 @@ class UserController extends Controller
$torrent = Torrent::withAnyStatus()->where('info_hash', '=', $historyTorrent)->first();
// Define The Torrent Filename
$tmpFileName = "{$torrent->slug}.torrent";
$tmpFileName = sprintf('%s.torrent', $torrent->slug);
// The Torrent File Exist?
if (!file_exists(getcwd().'/files/torrents/'.$torrent->file_name)) {
+3 -3
View File
@@ -64,14 +64,14 @@ class HtmlEncrypt
$this->addHexValue('%'.$a);
});
$script = "<script type='text/javascript' nonce='{$nonce}'>document.writeln(unescape('{$this->hex}'));</script>";
$script = sprintf('<script type=\'text/javascript\' nonce=\'%s\'>document.writeln(unescape(\'%s\'));</script>', $nonce, $this->hex);
if (config('html-encrypt.disable_right_click')) {
$script .= "<script type='text/javascript' nonce='{$nonce}'>let body = document.getElementsByTagName('body')[0];var att = document.createAttribute('oncontextmenu');att.value = 'return false'';body.setAttributeNode(att);</script>";
$script .= sprintf('<script type=\'text/javascript\' nonce=\'%s\'>let body = document.getElementsByTagName(\'body\')[0];var att = document.createAttribute(\'oncontextmenu\');att.value = \'return false\'\';body.setAttributeNode(att);</script>', $nonce);
}
if (config('html-encrypt.disable_ctrl_and_F12_key')) {
$script .= "<script type='text/javascript' nonce='{$nonce}'>document.onkeydown=function(e){if(e.ctrlKey || e.keyCode == 123){return false}}</script>";
$script .= sprintf('<script type=\'text/javascript\' nonce=\'%s\'>document.onkeydown=function(e){if(e.ctrlKey || e.keyCode == 123){return false}}</script>', $nonce);
}
return $script;
+1 -1
View File
@@ -160,7 +160,7 @@ class Http2ServerPush
$url = $basePath.ltrim($url, $basePath);
}
return is_null($type) ? null : "<{$url}>; rel=preload; as={$type}";
return is_null($type) ? null : sprintf('<%s>; rel=preload; as=%s', $url, $type);
}
/**
+2 -2
View File
@@ -118,8 +118,8 @@ class ProAjaxMiddleware
{
$session = $request->session();
$flash_message['type'] = $session->get("{$this->flash_name}.type");
$flash_message['message'] = $session->get("{$this->flash_name}.message");
$flash_message['type'] = $session->get(sprintf('%s.type', $this->flash_name));
$flash_message['message'] = $session->get(sprintf('%s.message', $this->flash_name));
return $flash_message;
}
+1 -1
View File
@@ -44,7 +44,7 @@ class AchievementUnlocked
$profile_url = hrefProfile($user);
$this->chat->systemMessage(
"User [url={$profile_url}]{$user->username}[/url] has unlocked the {$event->progress->details->name} achievement :medal:"
sprintf('User [url=%s]%s[/url] has unlocked the %s achievement :medal:', $profile_url, $user->username, $event->progress->details->name)
);
}
}
+2 -2
View File
@@ -120,9 +120,9 @@ class Poll extends Model
public function makeSlugFromTitle($title)
{
$slug = strlen($title) > 20 ? substr(Str::slug($title), 0, 20) : Str::slug($title);
$count = $this->where('slug', 'LIKE', "%$slug%")->count();
$count = $this->where('slug', 'LIKE', sprintf('%%s%', $slug))->count();
return $count ? "{$slug}-{$count}" : $slug;
return $count ? sprintf('%s-%s', $slug, $count) : $slug;
}
/**
+1 -1
View File
@@ -68,7 +68,7 @@ class NewBon extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Gifted You '.$this->transaction->cost.' BON',
'body' => $this->sender.' has gifted you '.$this->transaction->cost.' BON with the following note: '.$this->transaction->comment,
'url' => "/users/{$this->transaction->senderObj->username}",
'url' => sprintf('/users/%s', $this->transaction->senderObj->username),
];
}
}
+3 -3
View File
@@ -68,7 +68,7 @@ class NewCommentTag extends Notification implements ShouldQueue
return [
'title' => $this->tagger.' Has Tagged You In A Torrent Comment',
'body' => $this->tagger.' has tagged you in a Comment for Torrent '.$this->comment->torrent->name,
'url' => "/torrents/{$this->comment->torrent->id}",
'url' => sprintf('/torrents/%s', $this->comment->torrent->id),
];
}
@@ -76,14 +76,14 @@ class NewCommentTag extends Notification implements ShouldQueue
return [
'title' => $this->tagger.' Has Tagged You In A Request Comment',
'body' => $this->tagger.' has tagged you in a Comment for Request '.$this->comment->request->name,
'url' => "/requests/{$this->comment->request->id}",
'url' => sprintf('/requests/%s', $this->comment->request->id),
];
}
return [
'title' => $this->tagger.' Has Tagged You In An Article Comment',
'body' => $this->tagger.' has tagged you in a Comment for Article '.$this->comment->article->title,
'url' => "/articles/{$this->comment->article->id}",
'url' => sprintf('/articles/%s', $this->comment->article->id),
];
}
}
+1 -1
View File
@@ -73,7 +73,7 @@ class NewFollow extends Notification implements ShouldQueue
return [
'title' => $this->sender->username.' Has Followed You!',
'body' => $this->sender->username.' has started to follow you so they will get notifications about your activities.',
'url' => "/users/{$this->sender->username}",
'url' => sprintf('/users/%s', $this->sender->username),
];
}
}
+2 -2
View File
@@ -70,14 +70,14 @@ class NewPost extends Notification implements ShouldQueue
return [
'title' => $this->poster->username.' Has Posted In A Subscribed Topic',
'body' => $this->poster->username.' has left a new post in Subscribed Topic '.$this->post->topic->name,
'url' => "/forums/topics/{$this->post->topic->id}?page={$this->post->getPageNumber()}#post-{$this->post->id}",
'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id),
];
}
return [
'title' => $this->poster->username.' Has Posted In A Topic You Started',
'body' => $this->poster->username.' has left a new post in Your Topic '.$this->post->topic->name,
'url' => "/forums/topics/{$this->post->topic->id}?page={$this->post->getPageNumber()}#post-{$this->post->id}",
'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id),
];
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ class NewPostTag extends Notification implements ShouldQueue
return [
'title' => $this->tagger.' Has Tagged You In A Post',
'body' => $this->tagger.' has tagged you in a Post in Topic '.$this->post->topic->name,
'url' => "/forums/topics/{$this->post->topic->id}?page={$this->post->getPageNumber()}#post-{$this->post->id}",
'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id),
];
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ class NewPostTip extends Notification implements ShouldQueue
return [
'title' => $this->tipper.' Has Tipped You '.$this->amount.' BON For A Forum Post',
'body' => $this->tipper.' has tipped one of your Forum posts in '.$this->post->topic->name,
'url' => "/forums/topics/{$this->post->topic->id}?page={$this->post->getPageNumber()}#post-{$this->post->id}",
'url' => sprintf('/forums/topics/%s?page=%s#post-%s', $this->post->topic->id, $this->post->getPageNumber(), $this->post->id),
];
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ class NewRequestBounty extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Added A Bounty Of '.$this->amount.' To A Requested Torrent',
'body' => $this->sender.' has added a bounty to one of your Requested Torrents '.$this->tr->name,
'url' => "/requests/{$this->tr->id}",
'url' => sprintf('/requests/%s', $this->tr->id),
];
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ class NewRequestClaim extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Claimed One Of Your Requested Torrents',
'body' => $this->sender.' has claimed your Requested Torrent '.$this->tr->name,
'url' => "/requests/{$this->tr->id}",
'url' => sprintf('/requests/%s', $this->tr->id),
];
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ class NewRequestFill extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Filled One Of Your Torrent Requests',
'body' => $this->sender.' has filled one of your Requested Torrents '.$this->tr->name,
'url' => "/requests/{$this->tr->id}",
'url' => sprintf('/requests/%s', $this->tr->id),
];
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ class NewRequestFillApprove extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Approved Your Fill Of A Requested Torrent',
'body' => $this->sender.' has approved your fill of Requested Torrent '.$this->tr->name,
'url' => "/requests/{$this->tr->id}",
'url' => sprintf('/requests/%s', $this->tr->id),
];
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ class NewRequestFillReject extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Rejected Your Fill Of A Requested Torrent',
'body' => $this->sender.' has rejected your fill of Requested Torrent '.$this->tr->name,
'url' => "/requests/{$this->tr->id}",
'url' => sprintf('/requests/%s', $this->tr->id),
];
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ class NewRequestUnclaim extends Notification implements ShouldQueue
return [
'title' => $this->sender.' Has Unclaimed One Of Your Requested Torrents',
'body' => $this->sender.' has unclaimed your Requested Torrent '.$this->tr->name,
'url' => "/requests/{$this->tr->id}",
'url' => sprintf('/requests/%s', $this->tr->id),
];
}
}
+2 -2
View File
@@ -59,8 +59,8 @@ class NewReseedRequest extends Notification implements ShouldQueue
return [
'title' => 'New Reseed Request',
'body' => "Some time ago, you downloaded: {$this->torrent->name}. Now its dead and someone has requested a reseed on it. If you still have this torrent in storage, please consider reseeding it!",
'url' => "{$appurl}/torrents/{$this->torrent->id}",
'body' => sprintf('Some time ago, you downloaded: %s. Now its dead and someone has requested a reseed on it. If you still have this torrent in storage, please consider reseeding it!', $this->torrent->name),
'url' => sprintf('%s/torrents/%s', $appurl, $this->torrent->id),
];
}
}
+1 -1
View File
@@ -69,7 +69,7 @@ class NewTopic extends Notification implements ShouldQueue
return [
'title' => $this->poster->username.' Has Posted In A Subscribed Forum',
'body' => $this->poster->username.' has started a new topic in '.$this->topic->forum->name,
'url' => "/forums/topics/{$this->topic->id}",
'url' => sprintf('/forums/topics/%s', $this->topic->id),
];
}
}
+2 -2
View File
@@ -65,8 +65,8 @@ class NewUpload extends Notification implements ShouldQueue
return [
'title' => $this->torrent->user->username.' Has Uploaded A New Torrent',
'body' => "{$this->torrent->user->username}, whom you are following has uploaded Torrent {$this->torrent->name}",
'url' => "/torrents/{$this->torrent->id}",
'body' => sprintf('%s, whom you are following has uploaded Torrent %s', $this->torrent->user->username, $this->torrent->name),
'url' => sprintf('/torrents/%s', $this->torrent->id),
];
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ class NewUploadTip extends Notification implements ShouldQueue
return [
'title' => $this->tipper.' Has Tipped You '.$this->amount.' BON For An Uploaded Torrent',
'body' => $this->tipper.' has tipped one of your Uploaded Torrents '.$this->torrent->name,
'url' => "/torrents/{$this->torrent->id}",
'url' => sprintf('/torrents/%s', $this->torrent->id),
];
}
}
+5 -5
View File
@@ -27,7 +27,7 @@ class TorrentObserver
*/
public function created(Torrent $torrent)
{
Cache::put("torrent.{$torrent->info_hash}", $torrent);
Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent);
}
/**
@@ -39,7 +39,7 @@ class TorrentObserver
*/
public function updated(Torrent $torrent)
{
Cache::put("torrent.{$torrent->info_hash}", $torrent);
Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent);
}
/**
@@ -51,7 +51,7 @@ class TorrentObserver
*/
public function retrieved(Torrent $torrent)
{
Cache::add("torrent.{$torrent->info_hash}", $torrent);
Cache::add(sprintf('torrent.%s', $torrent->info_hash), $torrent);
}
/**
@@ -63,7 +63,7 @@ class TorrentObserver
*/
public function deleted(Torrent $torrent)
{
Cache::forget("torrent.{$torrent->info_hash}");
Cache::forget(sprintf('torrent.%s', $torrent->info_hash));
}
/**
@@ -75,6 +75,6 @@ class TorrentObserver
*/
public function restored(Torrent $torrent)
{
Cache::put("torrent.{$torrent->info_hash}", $torrent);
Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent);
}
}
+5 -5
View File
@@ -27,7 +27,7 @@ class UserObserver
*/
public function created(User $user)
{
Cache::put("user.{$user->passkey}", $user);
Cache::put(sprintf('user.%s', $user->passkey), $user);
}
/**
@@ -39,7 +39,7 @@ class UserObserver
*/
public function updated(User $user)
{
Cache::put("user.{$user->passkey}", $user);
Cache::put(sprintf('user.%s', $user->passkey), $user);
}
/**
@@ -51,7 +51,7 @@ class UserObserver
*/
public function retrieved(User $user)
{
Cache::add("user.{$user->passkey}", $user);
Cache::add(sprintf('user.%s', $user->passkey), $user);
}
/**
@@ -63,7 +63,7 @@ class UserObserver
*/
public function deleted(User $user)
{
Cache::forget("user.{$user->passkey}");
Cache::forget(sprintf('user.%s', $user->passkey));
}
/**
@@ -75,6 +75,6 @@ class UserObserver
*/
public function restored(User $user)
{
Cache::put("user.{$user->passkey}", $user);
Cache::put(sprintf('user.%s', $user->passkey), $user);
}
}
+1 -1
View File
@@ -80,7 +80,7 @@ class AppServiceProvider extends ServiceProvider
// Hidden Captcha
Blade::directive('hiddencaptcha', function ($mustBeEmptyField = '_username') {
return "<?= App\Helpers\HiddenCaptcha::render($mustBeEmptyField); ?>";
return sprintf('<?= App\Helpers\HiddenCaptcha::render(%s); ?>', $mustBeEmptyField);
});
$this->app['validator']->extendImplicit(
+2 -2
View File
@@ -369,8 +369,8 @@ class ChatRepository
protected function censorMessage($message)
{
foreach (config('censor.redact') as $word) {
if (preg_match("/\b$word(?=[.,]|$|\s)/mi", $message)) {
$message = str_replace($word, "<span class='censor'>{$word}</span>", $message);
if (preg_match(sprintf('/\b%s(?=[.,]|$|\s)/mi', $word), $message)) {
$message = str_replace($word, sprintf('<span class=\'censor\'>%s</span>', $word), $message);
}
}
+1 -1
View File
@@ -78,7 +78,7 @@ trait Auditable
$data = [];
switch ($action) {
default:
throw new \InvalidArgumentException("Unknown action `{$action}`.");
throw new \InvalidArgumentException(sprintf('Unknown action `%s`.', $action));
break;
case 'create':
// Expect new data to be filled