diff --git a/Blacklight/Binaries.php b/Blacklight/Binaries.php index 5caea8b4f..7a9fd05d2 100755 --- a/Blacklight/Binaries.php +++ b/Blacklight/Binaries.php @@ -10,6 +10,7 @@ use App\Models\BinaryBlacklist; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Database\QueryException; +use Illuminate\Support\Str; /** * Class Binaries. @@ -278,7 +279,7 @@ class Binaries } $this->log( - 'Updating completed in '.str_plural(' second', now()->diffInSeconds($allTime)), + 'Updating completed in '.Str::plural(' second', now()->diffInSeconds($allTime)), __FUNCTION__, 'primary' ); @@ -513,7 +514,7 @@ class Binaries if ($this->_echoCLI) { $this->colorCli->primary( PHP_EOL.'Group '.$groupMySQL['name'].' processed in '. - str_plural(' second', now()->diffInSeconds($startGroup)) + Str::plural(' second', now()->diffInSeconds($startGroup)) ); } } elseif ($this->_echoCLI) { diff --git a/Blacklight/libraries/TraktAPI.php b/Blacklight/libraries/TraktAPI.php index 2d12a58eb..885fda0e0 100755 --- a/Blacklight/libraries/TraktAPI.php +++ b/Blacklight/libraries/TraktAPI.php @@ -4,6 +4,7 @@ namespace Blacklight\libraries; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; +use Illuminate\Support\Str; /** * Class TraktAPI @@ -189,7 +190,7 @@ class TraktAPI default: $extended = 'min'; } - $array = $this->getJsonArray(self::API_URL.'movies/'.str_slug($movie), $extended); + $array = $this->getJsonArray(self::API_URL.'movies/'.Str::slug($movie), $extended); if (! $array) { return false; } @@ -247,7 +248,7 @@ class TraktAPI public function showSearch($show = '', $type = 'show') { $searchUrl = self::API_URL.'search?query='. - str_slug($show). + Str::slug($show). '&type='.$type; return $this->getJsonArray($searchUrl, ''); @@ -269,7 +270,7 @@ class TraktAPI if (empty($show)) { return null; } - $showUrl = self::API_URL.'shows/'.str_slug($show); + $showUrl = self::API_URL.'shows/'.Str::slug($show); if ($type === 'full') { $extended = 'full'; diff --git a/Blacklight/processing/ProcessReleases.php b/Blacklight/processing/ProcessReleases.php index 638803b6b..991eddd3e 100755 --- a/Blacklight/processing/ProcessReleases.php +++ b/Blacklight/processing/ProcessReleases.php @@ -19,6 +19,7 @@ use Blacklight\ReleaseImage; use App\Models\ReleasesGroups; use Blacklight\ReleaseCleaning; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Str; class ProcessReleases { @@ -314,7 +315,7 @@ class ProcessReleases $this->colorCli->primary( ($count === null ? 0 : $count->complete).' collections were found to be complete. Time: '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -357,7 +358,7 @@ class ProcessReleases true ); $totalTime = now()->diffInSeconds($startTime); - $this->colorCli->primary($totalTime.str_plural(' second', $totalTime), true); + $this->colorCli->primary($totalTime.Str::plural(' second', $totalTime), true); } } @@ -483,7 +484,7 @@ class ProcessReleases $minSizeDeleted.' smaller than, '. $maxSizeDeleted.' bigger than, '. $minFilesDeleted.' with less files than site/group settings in: '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -685,7 +686,7 @@ class ProcessReleases ' Releases added and '. number_format($duplicate). ' duplicate collections deleted in '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -744,8 +745,8 @@ class ProcessReleases if ($this->echoCLI) { $this->colorCli->primary( number_format($nzbCount).' NZBs created/Collections deleted in '. - $totalTime.str_plural(' second', $totalTime).PHP_EOL. - 'Total time: '.$totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime).PHP_EOL. + 'Total time: '.$totalTime.Str::plural(' second', $totalTime), true ); } @@ -788,7 +789,7 @@ class ProcessReleases $totalTime = now()->diffInSeconds($startTime); if ($this->echoCLI) { - $this->colorCli->primary($totalTime.str_plural(' second', $totalTime)); + $this->colorCli->primary($totalTime.Str::plural(' second', $totalTime)); } } @@ -860,7 +861,7 @@ class ProcessReleases if ($this->echoCLI) { $this->colorCli->primary( 'Finished deleting '.$deleted.' old collections/binaries/parts in '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -898,7 +899,7 @@ class ProcessReleases if ($this->echoCLI) { $this->colorCli->primary( 'Finished deleting '.$deleted.' orphaned collections in '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -934,7 +935,7 @@ class ProcessReleases if ($this->echoCLI) { $this->colorCli->primary( - 'Finished deleting '.$deleted.' binaries with no collections or parts in '.$totalTime.str_plural(' second', $totalTime), + 'Finished deleting '.$deleted.' binaries with no collections or parts in '.$totalTime.Str::plural(' second', $totalTime), true ); } @@ -971,7 +972,7 @@ class ProcessReleases if ($this->echoCLI) { $this->colorCli->primary( 'Finished deleting '.$deleted.' parts with no binaries in '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -1016,11 +1017,11 @@ class ProcessReleases if ($this->echoCLI) { $this->colorCli->primary( 'Finished deleting '.$deleted.' collections missed after NZB creation in '. - $colDelTime.str_plural(' second', $colDelTime).PHP_EOL. + $colDelTime.Str::plural(' second', $colDelTime).PHP_EOL. 'Removed '. number_format($deletedCount). ' parts/binaries/collection rows in '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -1117,7 +1118,7 @@ class ProcessReleases ' releases: '.PHP_EOL. $minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted. ' with less files than site/groups setting in: '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } @@ -1352,7 +1353,7 @@ class ProcessReleases $totalTime = now()->diffInSeconds($startTime); $this->colorCli->primary( 'Removed '.number_format($totalDeleted).' releases in '. - $totalTime.str_plural(' second', $totalTime), + $totalTime.Str::plural(' second', $totalTime), true ); } diff --git a/Blacklight/utility/SmartyUtils.php b/Blacklight/utility/SmartyUtils.php index d55465ed8..b7e77b727 100755 --- a/Blacklight/utility/SmartyUtils.php +++ b/Blacklight/utility/SmartyUtils.php @@ -19,6 +19,7 @@ * @copyright 2014 nZEDb */ use App\Models\Category; +use Illuminate\Support\Str; /** * Returns the value of the specified Category constant. @@ -155,7 +156,7 @@ function release_flag($text, $page) } if ($code !== '' && $page === 'browse') { - $www = str_finish(WWW_TOP, '/'); + $www = Str::finish(WWW_TOP, '/'); return ''.$language.''; diff --git a/Blacklight/utility/Utility.php b/Blacklight/utility/Utility.php index c7ac1e21c..28baccdb9 100755 --- a/Blacklight/utility/Utility.php +++ b/Blacklight/utility/Utility.php @@ -6,6 +6,7 @@ use App\Models\Settings; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; use Illuminate\Contracts\Pagination\LengthAwarePaginator; +use Illuminate\Support\Str; /** * Class Utility. @@ -251,10 +252,10 @@ class Utility if (! \defined('NN_COVERS')) { switch (true) { case $path[0] === '/' || $path[1] === ':' || $path[0] === '\\': - \define('NN_COVERS', str_finish($path, '/')); + \define('NN_COVERS', Str::finish($path, '/')); break; - case \strlen($path) > 0 && $path[0] !== '/' && $path[1] !== ':' && $path[0] !== '\\': - \define('NN_COVERS', realpath(NN_ROOT.str_finish($path, '/'))); + case $path !== '' && $path[0] !== '/' && $path[1] !== ':' && $path[0] !== '\\': + \define('NN_COVERS', realpath(NN_ROOT.Str::finish($path, '/'))); break; case empty($path): // Default to resources location. default: diff --git a/Changelog b/Changelog index d881af2fb..953801ec4 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2019-01-29 DariusIII + * Chg: Replace usage of str_ helper with Str class directly to prepare for Laravel 5.8 changes * Chg: Update vlucas/phpdotenv to version 2.6.1 * Chg: Update used libraries to their latest versions * Chg: Update BTC support to take into account current role expiration date diff --git a/app/Console/Commands/InstallNntmux.php b/app/Console/Commands/InstallNntmux.php index 43cff14c9..249b8e0eb 100644 --- a/app/Console/Commands/InstallNntmux.php +++ b/app/Console/Commands/InstallNntmux.php @@ -6,6 +6,7 @@ use App\Models\User; use App\Models\Settings; use Illuminate\Console\Command; use Illuminate\Support\Facades\File; +use Illuminate\Support\Str; use Symfony\Component\Process\Process; class InstallNntmux extends Command @@ -146,9 +147,9 @@ class InstallNntmux extends Command } return [ - 'nzb_path' => str_finish($nzb_path, '/'), - 'covers_path' => str_finish($covers_path, '/'), - 'unrar_path' => str_finish($unrar_path, '/'), + 'nzb_path' => Str::finish($nzb_path, '/'), + 'covers_path' => Str::finish($covers_path, '/'), + 'unrar_path' => Str::finish($unrar_path, '/'), ]; } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 03ecb71a2..d348a507a 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -14,6 +14,7 @@ use App\Models\ReleaseComment; use Blacklight\utility\Utility; use App\Jobs\SendAccountDeletedEmail; use Illuminate\Support\Facades\Validator; +use Illuminate\Support\Str; use Jrean\UserVerification\Facades\UserVerification; class ProfileController extends BasePageController @@ -186,7 +187,7 @@ class ProfileController extends BasePageController $request->input('nzbgeturl') ?? '', $request->input('nzbgetusername') ?? '', $request->input('nzbgetpassword') ?? '', - $request->has('saburl') ? str_finish($request->input('saburl'), '/') : '', + $request->has('saburl') ? Str::finish($request->input('saburl'), '/') : '', $request->input('sabapikey') ?? '', $request->input('sabpriority') ?? '', $request->input('sabapikeytype') ?? '',