diff --git a/app/Bots/CasinoBot.php b/app/Bots/CasinoBot.php index 077a298af3..af3ab6401b 100644 --- a/app/Bots/CasinoBot.php +++ b/app/Bots/CasinoBot.php @@ -94,7 +94,7 @@ public function putDonate($amount = 0, $note = '') $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()) { diff --git a/app/Bots/IRCAnnounceBot.php b/app/Bots/IRCAnnounceBot.php index b44e86da5d..a7f9df39a4 100644 --- a/app/Bots/IRCAnnounceBot.php +++ b/app/Bots/IRCAnnounceBot.php @@ -34,8 +34,8 @@ public function __construct() $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 @@ private function connect() 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 @@ private function connect() 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) diff --git a/app/Bots/NerdBot.php b/app/Bots/NerdBot.php index b983275707..71cd6322a5 100644 --- a/app/Bots/NerdBot.php +++ b/app/Bots/NerdBot.php @@ -100,7 +100,7 @@ public function getBanker($duration = 'default') 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 @@ public function getSnatched($duration = 'default') 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 @@ public function getLeeched($duration = 'default') 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 @@ public function getSeeded($duration = 'default') 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 @@ public function getFreeleech($duration = 'default') 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 @@ public function getDoubleUpload($duration = 'default') 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 @@ public function getPeers($duration = 'default') 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 @@ public function getBans($duration = 'default') 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 @@ public function getWarnings($duration = 'default') 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 @@ public function getUploads($duration = 'default') 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 @@ public function getLogins($duration = 'default') 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 @@ public function getRegistrations($duration = 'default') 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 @@ public function putDonate($amount = 0, $note = '') $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()) { diff --git a/app/Bots/SystemBot.php b/app/Bots/SystemBot.php index 1381c94acf..45182c9ca5 100644 --- a/app/Bots/SystemBot.php +++ b/app/Bots/SystemBot.php @@ -98,7 +98,7 @@ public function putGift($receiver = '', $amount = 0, $note = '') $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 @@ public function putGift($receiver = '', $amount = 0, $note = '') $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!'; diff --git a/app/Console/Commands/AutoGraveyard.php b/app/Console/Commands/AutoGraveyard.php index e709ec79c8..502cf74f0a 100644 --- a/app/Console/Commands/AutoGraveyard.php +++ b/app/Console/Commands/AutoGraveyard.php @@ -82,7 +82,7 @@ public function handle() $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 @@ public function handle() $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(); } diff --git a/app/Console/Commands/AutoNerdStat.php b/app/Console/Commands/AutoNerdStat.php index 0e1cb485ff..554fadd7c2 100644 --- a/app/Console/Commands/AutoNerdStat.php +++ b/app/Console/Commands/AutoNerdStat.php @@ -123,25 +123,25 @@ public function handle() // 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); } } } diff --git a/app/Console/Commands/AutoPreWarning.php b/app/Console/Commands/AutoPreWarning.php index 29bf462e4e..0cd746b4dc 100644 --- a/app/Console/Commands/AutoPreWarning.php +++ b/app/Console/Commands/AutoPreWarning.php @@ -69,8 +69,8 @@ public function handle() $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(); diff --git a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php index f45363c359..4de6630482 100644 --- a/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php +++ b/app/Console/Commands/AutoRecycleClaimedTorrentRequests.php @@ -68,7 +68,7 @@ public function handle() 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(); diff --git a/app/Console/Commands/AutoRemoveFeaturedTorrent.php b/app/Console/Commands/AutoRemoveFeaturedTorrent.php index 1278bb086c..6fb1798a25 100644 --- a/app/Console/Commands/AutoRemoveFeaturedTorrent.php +++ b/app/Console/Commands/AutoRemoveFeaturedTorrent.php @@ -69,7 +69,7 @@ public function handle() $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 diff --git a/app/Console/Commands/AutoWarning.php b/app/Console/Commands/AutoWarning.php index a5169c11d7..eb45ce763e 100644 --- a/app/Console/Commands/AutoWarning.php +++ b/app/Console/Commands/AutoWarning.php @@ -66,7 +66,7 @@ public function handle() $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(); diff --git a/app/Console/Commands/FetchReleaseYears.php b/app/Console/Commands/FetchReleaseYears.php index 86b2b9b34c..69c1a3630f 100644 --- a/app/Console/Commands/FetchReleaseYears.php +++ b/app/Console/Commands/FetchReleaseYears.php @@ -60,8 +60,8 @@ public function handle() ->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 @@ public function handle() 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 @@ public function handle() 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 @@ public function handle() 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 diff --git a/app/Console/Commands/GitUpdater.php b/app/Console/Commands/GitUpdater.php index 8341bacec4..55e3fde803 100644 --- a/app/Console/Commands/GitUpdater.php +++ b/app/Console/Commands/GitUpdater.php @@ -191,7 +191,7 @@ private function manualUpdate($updating) $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 @@ private function manualUpdate($updating) 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 @@ private function restore(array $paths) $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 @@ private function permissions() 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 @@ private function validatePath($path) 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); } } } diff --git a/app/Console/ConsoleTools.php b/app/Console/ConsoleTools.php index 20f7413bd0..e66fcba3e8 100644 --- a/app/Console/ConsoleTools.php +++ b/app/Console/ConsoleTools.php @@ -27,32 +27,32 @@ trait ConsoleTools private function cyan($line) { - $this->io->writeln("\n$line"); + $this->io->writeln(sprintf('%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$line"); + $this->io->writeln(sprintf('%s', $line)); } private function green($line) { - $this->io->writeln("\n$line"); + $this->io->writeln(sprintf('%s', $line)); } private function red($line) { - $this->io->writeln("\n$line"); + $this->io->writeln(sprintf('%s', $line)); } private function blue($line) { - $this->io->writeln("\n$line"); + $this->io->writeln(sprintf('%s', $line)); } private function done() @@ -69,22 +69,22 @@ private function header($line) private function alertSuccess($line) { - $this->io->writeln("\n[ !! $line !! ]"); + $this->io->writeln(sprintf('[ !! %s !! ]', $line)); } private function alertDanger($line) { - $this->io->writeln("\n[ !! $line !! ]"); + $this->io->writeln(sprintf('[ !! %s !! ]', $line)); } private function alertInfo($line) { - $this->io->writeln("\n[ !! $line !! ]"); + $this->io->writeln(sprintf('[ !! %s !! ]', $line)); } private function alertWarning($line) { - $this->io->writeln("\n[ !! $line !! ]"); + $this->io->writeln(sprintf('[ !! %s !! ]', $line)); } private function commands(array $commands, $silent = false) @@ -114,7 +114,7 @@ private function process($command, $silent = false) try { $process->checkTimeout(); } catch (ProcessTimedOutException $e) { - $this->red("'{$command}' timed out.!"); + $this->red(sprintf('\'%s\' timed out.!', $command)); } if (!$silent) { diff --git a/app/Helpers/Helpers.php b/app/Helpers/Helpers.php index 9d106142f0..acc9006197 100644 --- a/app/Helpers/Helpers.php +++ b/app/Helpers/Helpers.php @@ -22,7 +22,7 @@ function hrefProfile($user) { $appurl = appurl(); - return "{$appurl}/users/{$user->username}"; + return sprintf('%s/users/%s', $appurl, $user->username); } } @@ -31,7 +31,7 @@ function hrefArticle($article) { $appurl = appurl(); - return "{$appurl}/articles/{$article->id}"; + return sprintf('%s/articles/%s', $appurl, $article->id); } } @@ -40,7 +40,7 @@ function hrefTorrent($torrent) { $appurl = appurl(); - return "{$appurl}/torrents/{$torrent->id}"; + return sprintf('%s/torrents/%s', $appurl, $torrent->id); } } @@ -49,7 +49,7 @@ function hrefRequest($torrentRequest) { $appurl = appurl(); - return "{$appurl}/requests/{$torrentRequest->id}"; + return sprintf('%s/requests/%s', $appurl, $torrentRequest->id); } } @@ -58,7 +58,7 @@ function hrefPoll($poll) { $appurl = appurl(); - return "{$appurl}/polls/{$poll->id}"; + return sprintf('%s/polls/%s', $appurl, $poll->id); } } @@ -67,6 +67,6 @@ function hrefPlaylist($playlist) { $appurl = appurl(); - return "{$appurl}/playlists/{$playlist->id}"; + return sprintf('%s/playlists/%s', $appurl, $playlist->id); } } diff --git a/app/Helpers/LanguageCensor.php b/app/Helpers/LanguageCensor.php index c8c0c4fe52..7d8139a64f 100644 --- a/app/Helpers/LanguageCensor.php +++ b/app/Helpers/LanguageCensor.php @@ -65,7 +65,7 @@ public static function censor($source) 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 .= "{$match}"; + $result .= sprintf('%s', $match); $ignore = $word_length - 1; } elseif ($ignore > 0) { $ignore--; diff --git a/app/Helpers/Linkify.php b/app/Helpers/Linkify.php index f5cebf0a36..67a2d55353 100644 --- a/app/Helpers/Linkify.php +++ b/app/Helpers/Linkify.php @@ -20,7 +20,7 @@ public function linky($text) $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, "{$url[0]} ", $text); + return preg_replace($reg_exUrl, sprintf('%s ', $url[0], $url[0]), $text); } return $text; diff --git a/app/Helpers/TorrentHelper.php b/app/Helpers/TorrentHelper.php index 9db04f3e08..770c8ba685 100644 --- a/app/Helpers/TorrentHelper.php +++ b/app/Helpers/TorrentHelper.php @@ -47,7 +47,7 @@ public static function approveHelper($id) $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 @@ public static function approveHelper($id) $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 @@ public static function approveHelper($id) 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.']'); } } } diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index d7d555e4bf..91f2de58a4 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -193,11 +193,11 @@ public function store(Request $request, Torrent $torrent) // 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:' ); } diff --git a/app/Http/Controllers/AnnounceController.php b/app/Http/Controllers/AnnounceController.php index e80aad64de..e23487016b 100644 --- a/app/Http/Controllers/AnnounceController.php +++ b/app/Http/Controllers/AnnounceController.php @@ -123,7 +123,7 @@ public function announce(Request $request, $passkey) } // 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 @@ public function announce(Request $request, $passkey) } // 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 @@ public function announce(Request $request, $passkey) $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(); }); diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index aff3e9858f..84a93fea8d 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -164,17 +164,17 @@ public function register(Request $request, $code = null) // 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(); diff --git a/app/Http/Controllers/BonusController.php b/app/Http/Controllers/BonusController.php index b7a3eca078..353c30d4df 100644 --- a/app/Http/Controllers/BonusController.php +++ b/app/Http/Controllers/BonusController.php @@ -294,7 +294,7 @@ public function doItemExchange($userID, $itemID) $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 @@ public function sendGift(Request $request) $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 @@ public function sendGift(Request $request) $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') { diff --git a/app/Http/Controllers/CommentController.php b/app/Http/Controllers/CommentController.php index 8bf09edfbc..57766b6b34 100644 --- a/app/Http/Controllers/CommentController.php +++ b/app/Http/Controllers/CommentController.php @@ -101,11 +101,11 @@ public function article(Request $request, $id) // 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 @@ public function playlist(Request $request, $id) // 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 @@ public function torrent(Request $request, $id) // 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 @@ public function request(Request $request, $id) // 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 @@ public function quickthanks(Request $request, $id) $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 @@ public function quickthanks(Request $request, $id) $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]) diff --git a/app/Http/Controllers/ForumController.php b/app/Http/Controllers/ForumController.php index c03e8fab75..c027bbca42 100644 --- a/app/Http/Controllers/ForumController.php +++ b/app/Http/Controllers/ForumController.php @@ -139,7 +139,7 @@ public function search(Request $request) 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 @@ public function search(Request $request) $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'; diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php index aed2bf7162..2eac11c728 100644 --- a/app/Http/Controllers/LikeController.php +++ b/app/Http/Controllers/LikeController.php @@ -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 @@ public function store(Request $request, $postId) 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(); diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 60aef05e0b..666dcb46db 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -105,7 +105,7 @@ public function store(Request $request) $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:' ); } diff --git a/app/Http/Controllers/PollController.php b/app/Http/Controllers/PollController.php index 16638413d2..87b36f62db 100644 --- a/app/Http/Controllers/PollController.php +++ b/app/Http/Controllers/PollController.php @@ -105,7 +105,7 @@ public function vote(VoteOnPoll $request) $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]) diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index e6e92d0763..e1dd5e02d1 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -93,8 +93,8 @@ public function reply(Request $request, $id) } $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 @@ public function reply(Request $request, $id) $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 @@ public function postEdit(Request $request, $postId) { $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'); diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index 6c3dfd1716..b103756738 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -324,7 +324,7 @@ public function addrequest(Request $request) '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 @@ public function addrequest(Request $request) $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 @@ public function addrequest(Request $request) // 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 @@ public function addBonus(Request $request, $id) $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 @@ public function addBonus(Request $request, $id) $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 @@ public function addBonus(Request $request, $id) // 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 @@ public function approveRequest(Request $request, $id) $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 @@ public function approveRequest(Request $request, $id) // 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 @@ public function approveRequest(Request $request, $id) 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 @@ public function deleteRequest(Request $request, $id) $torrentRequest->delete(); return redirect()->route('requests') - ->withSuccess("You have deleted {$name}"); + ->withSuccess(sprintf('You have deleted %s', $name)); } return redirect()->route('request', ['id' => $id]) diff --git a/app/Http/Controllers/Staff/GiftController.php b/app/Http/Controllers/Staff/GiftController.php index 42dc41bfdb..afa212f44b 100644 --- a/app/Http/Controllers/Staff/GiftController.php +++ b/app/Http/Controllers/Staff/GiftController.php @@ -71,8 +71,8 @@ public function store(Request $request) $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') diff --git a/app/Http/Controllers/Staff/ModerationController.php b/app/Http/Controllers/Staff/ModerationController.php index 606d584747..9e9487faf9 100644 --- a/app/Http/Controllers/Staff/ModerationController.php +++ b/app/Http/Controllers/Staff/ModerationController.php @@ -79,11 +79,11 @@ public function approve($id) // 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 @@ public function postpone(Request $request) $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 @@ public function reject(Request $request) $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') diff --git a/app/Http/Controllers/Staff/PollController.php b/app/Http/Controllers/Staff/PollController.php index 1e220e9007..3e086dc3f0 100644 --- a/app/Http/Controllers/Staff/PollController.php +++ b/app/Http/Controllers/Staff/PollController.php @@ -93,7 +93,7 @@ public function store(StorePoll $request) $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 @@ public function update(StorePoll $request, $id) $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(); diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index 73e6b74fe1..3cc38ebb3d 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -82,11 +82,11 @@ public function update(Request $request, $id) $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') diff --git a/app/Http/Controllers/TopicController.php b/app/Http/Controllers/TopicController.php index d813d5d8a6..c27aba8c9b 100644 --- a/app/Http/Controllers/TopicController.php +++ b/app/Http/Controllers/TopicController.php @@ -207,10 +207,10 @@ public function newTopic(Request $request, $id) // 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); diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index b740c4b753..d217690d11 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -1117,10 +1117,10 @@ public function deleteTorrent(Request $request) $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 @@ public function deleteTorrent(Request $request) 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 @@ public function upload(Request $request) // 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 @@ public function bumpTorrent(Request $request, $id) $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 @@ public function bumpTorrent(Request $request, $id) $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 @@ public function grantFL(Request $request, $id) $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 @@ public function grantFeatured(Request $request, $id) $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 @@ public function grantDoubleUp(Request $request, $id) $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 @@ public function reseedTorrent(Request $request, $id) $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]) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 736cba015d..b17b623fcc 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1982,7 +1982,7 @@ public function downloadHistoryTorrents(Request $request, $username) } // Zip File Name - $zipFileName = "{$user->username}.zip"; + $zipFileName = sprintf('%s.zip', $user->username); // Create ZipArchive Obj $zip = new ZipArchive(); @@ -1997,7 +1997,7 @@ public function downloadHistoryTorrents(Request $request, $username) $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)) { diff --git a/app/Http/Middleware/HtmlEncrypt.php b/app/Http/Middleware/HtmlEncrypt.php index 1161ee1ed4..70a4589697 100644 --- a/app/Http/Middleware/HtmlEncrypt.php +++ b/app/Http/Middleware/HtmlEncrypt.php @@ -64,14 +64,14 @@ public function encryptHtml($content) $this->addHexValue('%'.$a); }); - $script = ""; + $script = sprintf('', $nonce, $this->hex); if (config('html-encrypt.disable_right_click')) { - $script .= ""; + $script .= sprintf('', $nonce); } if (config('html-encrypt.disable_ctrl_and_F12_key')) { - $script .= ""; + $script .= sprintf('', $nonce); } return $script; diff --git a/app/Http/Middleware/Http2ServerPush.php b/app/Http/Middleware/Http2ServerPush.php index 1949ee12ab..85d947e260 100644 --- a/app/Http/Middleware/Http2ServerPush.php +++ b/app/Http/Middleware/Http2ServerPush.php @@ -160,7 +160,7 @@ private function buildLinkHeaderString($url) $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); } /** diff --git a/app/Http/Middleware/ProAjaxMiddleware.php b/app/Http/Middleware/ProAjaxMiddleware.php index 2a0e8d85ac..90b7c92a49 100644 --- a/app/Http/Middleware/ProAjaxMiddleware.php +++ b/app/Http/Middleware/ProAjaxMiddleware.php @@ -118,8 +118,8 @@ public function getFlashMessage($request) { $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; } diff --git a/app/Listeners/AchievementUnlocked.php b/app/Listeners/AchievementUnlocked.php index 6a26e95f45..4afce1ce06 100644 --- a/app/Listeners/AchievementUnlocked.php +++ b/app/Listeners/AchievementUnlocked.php @@ -44,7 +44,7 @@ public function handle(Unlocked $event) $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) ); } } diff --git a/app/Models/Poll.php b/app/Models/Poll.php index e84388c40d..ce49babc01 100644 --- a/app/Models/Poll.php +++ b/app/Models/Poll.php @@ -122,7 +122,7 @@ public function makeSlugFromTitle($title) $slug = strlen($title) > 20 ? substr(Str::slug($title), 0, 20) : Str::slug($title); $count = $this->where('slug', 'LIKE', "%$slug%")->count(); - return $count ? "{$slug}-{$count}" : $slug; + return $count ? sprintf('%s-%s', $slug, $count) : $slug; } /** diff --git a/app/Notifications/NewBon.php b/app/Notifications/NewBon.php index ad2ae792bd..3b2c04645e 100644 --- a/app/Notifications/NewBon.php +++ b/app/Notifications/NewBon.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewCommentTag.php b/app/Notifications/NewCommentTag.php index 4ae5fc6071..e6e2622cf9 100644 --- a/app/Notifications/NewCommentTag.php +++ b/app/Notifications/NewCommentTag.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewFollow.php b/app/Notifications/NewFollow.php index cbd4e51aa7..07e230c3ba 100644 --- a/app/Notifications/NewFollow.php +++ b/app/Notifications/NewFollow.php @@ -73,7 +73,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewPost.php b/app/Notifications/NewPost.php index eb3819b45b..39f32d690a 100644 --- a/app/Notifications/NewPost.php +++ b/app/Notifications/NewPost.php @@ -70,14 +70,14 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewPostTag.php b/app/Notifications/NewPostTag.php index 9580064d0e..a8dc0d416f 100644 --- a/app/Notifications/NewPostTag.php +++ b/app/Notifications/NewPostTag.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewPostTip.php b/app/Notifications/NewPostTip.php index a43ed91ae4..c401446093 100644 --- a/app/Notifications/NewPostTip.php +++ b/app/Notifications/NewPostTip.php @@ -72,7 +72,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewRequestBounty.php b/app/Notifications/NewRequestBounty.php index c0cceea368..74e324c95b 100644 --- a/app/Notifications/NewRequestBounty.php +++ b/app/Notifications/NewRequestBounty.php @@ -72,7 +72,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewRequestClaim.php b/app/Notifications/NewRequestClaim.php index d4566c51fb..0f63a698f4 100644 --- a/app/Notifications/NewRequestClaim.php +++ b/app/Notifications/NewRequestClaim.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewRequestFill.php b/app/Notifications/NewRequestFill.php index bc1fa1f234..b04fade804 100644 --- a/app/Notifications/NewRequestFill.php +++ b/app/Notifications/NewRequestFill.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewRequestFillApprove.php b/app/Notifications/NewRequestFillApprove.php index a1a0c07814..4247137364 100644 --- a/app/Notifications/NewRequestFillApprove.php +++ b/app/Notifications/NewRequestFillApprove.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewRequestFillReject.php b/app/Notifications/NewRequestFillReject.php index b67fe55164..1bafe10745 100644 --- a/app/Notifications/NewRequestFillReject.php +++ b/app/Notifications/NewRequestFillReject.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewRequestUnclaim.php b/app/Notifications/NewRequestUnclaim.php index 2c0bd6ac3f..85b31a93de 100644 --- a/app/Notifications/NewRequestUnclaim.php +++ b/app/Notifications/NewRequestUnclaim.php @@ -68,7 +68,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewReseedRequest.php b/app/Notifications/NewReseedRequest.php index cd38fa689f..93f817e923 100644 --- a/app/Notifications/NewReseedRequest.php +++ b/app/Notifications/NewReseedRequest.php @@ -59,8 +59,8 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewTopic.php b/app/Notifications/NewTopic.php index 03e9921c0c..071f67fbb1 100644 --- a/app/Notifications/NewTopic.php +++ b/app/Notifications/NewTopic.php @@ -69,7 +69,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewUpload.php b/app/Notifications/NewUpload.php index d4681a395f..1024bb168f 100644 --- a/app/Notifications/NewUpload.php +++ b/app/Notifications/NewUpload.php @@ -65,8 +65,8 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Notifications/NewUploadTip.php b/app/Notifications/NewUploadTip.php index 4c5559cfa7..a4fa1a6216 100644 --- a/app/Notifications/NewUploadTip.php +++ b/app/Notifications/NewUploadTip.php @@ -72,7 +72,7 @@ public function toArray($notifiable) 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), ]; } } diff --git a/app/Observers/TorrentObserver.php b/app/Observers/TorrentObserver.php index e1ace1eb8a..a5bab81ef7 100644 --- a/app/Observers/TorrentObserver.php +++ b/app/Observers/TorrentObserver.php @@ -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 @@ public function created(Torrent $torrent) */ 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 @@ public function updated(Torrent $torrent) */ 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 @@ public function retrieved(Torrent $torrent) */ public function deleted(Torrent $torrent) { - Cache::forget("torrent.{$torrent->info_hash}"); + Cache::forget(sprintf('torrent.%s', $torrent->info_hash)); } /** @@ -75,6 +75,6 @@ public function deleted(Torrent $torrent) */ public function restored(Torrent $torrent) { - Cache::put("torrent.{$torrent->info_hash}", $torrent); + Cache::put(sprintf('torrent.%s', $torrent->info_hash), $torrent); } } diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index e75f8be101..3c7b207ce7 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -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 @@ public function created(User $user) */ public function updated(User $user) { - Cache::put("user.{$user->passkey}", $user); + Cache::put(sprintf('user.%s', $user->passkey), $user); } /** @@ -51,7 +51,7 @@ public function updated(User $user) */ public function retrieved(User $user) { - Cache::add("user.{$user->passkey}", $user); + Cache::add(sprintf('user.%s', $user->passkey), $user); } /** @@ -63,7 +63,7 @@ public function retrieved(User $user) */ public function deleted(User $user) { - Cache::forget("user.{$user->passkey}"); + Cache::forget(sprintf('user.%s', $user->passkey)); } /** @@ -75,6 +75,6 @@ public function deleted(User $user) */ public function restored(User $user) { - Cache::put("user.{$user->passkey}", $user); + Cache::put(sprintf('user.%s', $user->passkey), $user); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index fd777d45cf..3e399f5bff 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -80,7 +80,7 @@ public function boot() // Hidden Captcha Blade::directive('hiddencaptcha', function ($mustBeEmptyField = '_username') { - return ""; + return sprintf('', $mustBeEmptyField); }); $this->app['validator']->extendImplicit( diff --git a/app/Repositories/ChatRepository.php b/app/Repositories/ChatRepository.php index 1194f1bca8..0ab187fcaa 100644 --- a/app/Repositories/ChatRepository.php +++ b/app/Repositories/ChatRepository.php @@ -369,8 +369,8 @@ public function statusFindOrFail($id) protected function censorMessage($message) { foreach (config('censor.redact') as $word) { - if (preg_match("/\b$word(?=[.,]|$|\s)/mi", $message)) { - $message = str_replace($word, "{$word}", $message); + if (preg_match(sprintf('/\b%s(?=[.,]|$|\s)/mi', $word), $message)) { + $message = str_replace($word, sprintf('%s', $word), $message); } } diff --git a/app/Traits/Auditable.php b/app/Traits/Auditable.php index c878b24802..7021c9aefc 100644 --- a/app/Traits/Auditable.php +++ b/app/Traits/Auditable.php @@ -78,7 +78,7 @@ protected static function generate($action, $old = [], $new = []) $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