| @@ -43,7 +43,7 @@ discard block | ||
| 43 | 43 | |
| 44 | 44 |          if (!empty($string)) { | 
| 45 | 45 | $string = strip_tags($string); | 
| 46 | - $result = (string)Stringy::create($string)->truncate($length, $substring); | |
| 46 | + $result = (string) Stringy::create($string)->truncate($length, $substring); | |
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | return $result; | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | |
| 68 | 68 |          if (!empty($string)) { | 
| 69 | 69 | $string = strip_tags($string); | 
| 70 | - $result = (string)Stringy::create($string)->safeTruncate($length, $substring); | |
| 70 | + $result = (string) Stringy::create($string)->safeTruncate($length, $substring); | |
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | 73 | return $result; | 
| @@ -5,12 +5,12 @@ | ||
| 5 | 5 |  ini_set('date.timezone', 'UTC'); | 
| 6 | 6 | |
| 7 | 7 | // Use the current installation of Craft | 
| 8 | -define('CRAFT_STORAGE_PATH', __DIR__ . '/_craft/storage'); | |
| 9 | -define('CRAFT_TEMPLATES_PATH', __DIR__ . '/_craft/templates'); | |
| 10 | -define('CRAFT_CONFIG_PATH', __DIR__ . '/_craft/config'); | |
| 11 | -define('CRAFT_MIGRATIONS_PATH', __DIR__ . '/_craft/migrations'); | |
| 12 | -define('CRAFT_TRANSLATIONS_PATH', __DIR__ . '/_craft/translations'); | |
| 13 | -define('CRAFT_VENDOR_PATH', dirname(__DIR__) . '/vendor'); | |
| 8 | +define('CRAFT_STORAGE_PATH', __DIR__.'/_craft/storage'); | |
| 9 | +define('CRAFT_TEMPLATES_PATH', __DIR__.'/_craft/templates'); | |
| 10 | +define('CRAFT_CONFIG_PATH', __DIR__.'/_craft/config'); | |
| 11 | +define('CRAFT_MIGRATIONS_PATH', __DIR__.'/_craft/migrations'); | |
| 12 | +define('CRAFT_TRANSLATIONS_PATH', __DIR__.'/_craft/translations'); | |
| 13 | +define('CRAFT_VENDOR_PATH', dirname(__DIR__).'/vendor'); | |
| 14 | 14 |  define('CRAFT_TESTS_PATH', __DIR__); | 
| 15 | 15 | |
| 16 | 16 | $devMode = true; | 
| @@ -102,14 +102,14 @@ discard block | ||
| 102 | 102 |                      if (strcmp($oldUri, $newUri) !== 0) { | 
| 103 | 103 | // Handle trailing slash config setting | 
| 104 | 104 |                          if (Craft::$app->config->general->addTrailingSlashesToUrls) { | 
| 105 | - $oldUri = rtrim($oldUri, '/') . '/'; | |
| 106 | - $newUri = rtrim($newUri, '/') . '/'; | |
| 105 | + $oldUri = rtrim($oldUri, '/').'/'; | |
| 106 | + $newUri = rtrim($newUri, '/').'/'; | |
| 107 | 107 | } | 
| 108 | 108 | // Handle the URL match type | 
| 109 | 109 |                          if (Retour::$settings->uriChangeRedirectSrcMatch === 'fullurl') { | 
| 110 | 110 |                              try { | 
| 111 | 111 |                                  if ($redirectSiteId !== null) { | 
| 112 | - $redirectSiteId = (int)$redirectSiteId; | |
| 112 | + $redirectSiteId = (int) $redirectSiteId; | |
| 113 | 113 | } | 
| 114 | 114 | $oldUri = \craft\helpers\UrlHelper::siteUrl($oldUri, null, null, $redirectSiteId); | 
| 115 | 115 | $newUri = UrlHelper::siteUrl($newUri, null, null, $redirectSiteId); | 
| @@ -127,7 +127,7 @@ discard block | ||
| 127 | 127 | 'siteId' => $redirectSiteId, | 
| 128 | 128 | ]; | 
| 129 | 129 | // Trigger a 'beforeSaveEntryRedirect' event | 
| 130 | - $isNew = (int)$redirectConfig['id'] === 0; | |
| 130 | + $isNew = (int) $redirectConfig['id'] === 0; | |
| 131 | 131 | $event = new RedirectEvent([ | 
| 132 | 132 | 'isNew' => $isNew, | 
| 133 | 133 | 'legacyUrl' => $redirectConfig['redirectSrcUrl'], | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | $siteId = reset($variables['enabledSiteIds']); | 
| 90 | 90 | } | 
| 91 | 91 |                  } else { | 
| 92 | -                    self::requirePermission('editSite:' . $siteId); | |
| 92 | +                    self::requirePermission('editSite:'.$siteId); | |
| 93 | 93 | } | 
| 94 | 94 | } | 
| 95 | 95 | } | 
| @@ -114,7 +114,7 @@ discard block | ||
| 114 | 114 |              } else { | 
| 115 | 115 | $variables['sitesMenuLabel'] = Craft::t( | 
| 116 | 116 | 'site', | 
| 117 | - $sites->getSiteById((int)$variables['currentSiteId'])->name | |
| 117 | + $sites->getSiteById((int) $variables['currentSiteId'])->name | |
| 118 | 118 | ); | 
| 119 | 119 | } | 
| 120 | 120 |          } else { | 
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 |          if ($siteHandle !== null) { | 
| 138 | 138 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); | 
| 139 | 139 |              if (!$site) { | 
| 140 | -                throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); | |
| 140 | +                throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); | |
| 141 | 141 | } | 
| 142 | 142 | $siteId = $site->id; | 
| 143 | 143 |          } else { | 
| @@ -60,7 +60,7 @@ | ||
| 60 | 60 | return; | 
| 61 | 61 | } | 
| 62 | 62 | // Make sure there is a leading / | 
| 63 | - $value = '/' . ltrim($value, '/'); | |
| 63 | + $value = '/'.ltrim($value, '/'); | |
| 64 | 64 | $model->$attribute = $value; | 
| 65 | 65 | } | 
| 66 | 66 | } | 
| @@ -31,7 +31,7 @@ | ||
| 31 | 31 | /** | 
| 32 | 32 | * @inheritdoc | 
| 33 | 33 | */ | 
| 34 | - protected array|bool|int $allowAnonymous = [ | |
| 34 | + protected array | bool | int $allowAnonymous = [ | |
| 35 | 35 | 'get-redirects', | 
| 36 | 36 | ]; | 
| 37 | 37 | |
| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | // Protected Properties | 
| 43 | 43 | // ========================================================================= | 
| 44 | 44 | |
| 45 | - protected array|bool|int $allowAnonymous = []; | |
| 45 | + protected array | bool | int $allowAnonymous = []; | |
| 46 | 46 | |
| 47 | 47 | // Public Methods | 
| 48 | 48 | // ========================================================================= | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | $variables['docsUrl'] = self::DOCUMENTATION_URL; | 
| 85 | 85 | $variables['pluginName'] = $pluginName; | 
| 86 | 86 | $variables['title'] = $templateTitle; | 
| 87 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; | |
| 87 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; | |
| 88 | 88 | $variables['crumbs'] = [ | 
| 89 | 89 | [ | 
| 90 | 90 | 'label' => $pluginName, | 
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | ], | 
| 93 | 93 | [ | 
| 94 | 94 | 'label' => $templateTitle, | 
| 95 | -                'url' => UrlHelper::cpUrl('retour/redirects' . $siteHandleUri), | |
| 95 | +                'url' => UrlHelper::cpUrl('retour/redirects'.$siteHandleUri), | |
| 96 | 96 | ], | 
| 97 | 97 | ]; | 
| 98 | 98 |          $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; | 
| @@ -153,13 +153,13 @@ discard block | ||
| 153 | 153 |          if ($redirect->siteId) { | 
| 154 | 154 | $site = $sites->getSiteById($redirect->siteId); | 
| 155 | 155 |              if ($site) { | 
| 156 | -                MultiSiteHelper::requirePermission('editSite:' . $site->uid); | |
| 156 | +                MultiSiteHelper::requirePermission('editSite:'.$site->uid); | |
| 157 | 157 | } | 
| 158 | 158 | } | 
| 159 | 159 |          if ($siteId) { | 
| 160 | 160 | $site = $sites->getSiteById($siteId); | 
| 161 | 161 |              if ($site) { | 
| 162 | -                MultiSiteHelper::requirePermission('editSite:' . $site->uid); | |
| 162 | +                MultiSiteHelper::requirePermission('editSite:'.$site->uid); | |
| 163 | 163 | } | 
| 164 | 164 | } | 
| 165 | 165 | $pluginName = Retour::$settings->pluginName; | 
| @@ -195,7 +195,7 @@ discard block | ||
| 195 | 195 | ], | 
| 196 | 196 | [ | 
| 197 | 197 | 'label' => $templateTitle, | 
| 198 | -                'url' => UrlHelper::cpUrl('retour/edit-redirect/' . $redirectId), | |
| 198 | +                'url' => UrlHelper::cpUrl('retour/edit-redirect/'.$redirectId), | |
| 199 | 199 | ], | 
| 200 | 200 | ]; | 
| 201 | 201 |          $variables['docTitle'] = "{$pluginName} - Redirects - {$templateTitle}"; | 
| @@ -253,7 +253,7 @@ discard block | ||
| 253 | 253 |          if ($redirectConfig === null) { | 
| 254 | 254 |              throw new NotFoundHttpException('Redirect not found'); | 
| 255 | 255 | } | 
| 256 | - $redirectConfig['id'] = (int)$redirectConfig['id']; | |
| 256 | + $redirectConfig['id'] = (int) $redirectConfig['id']; | |
| 257 | 257 | // Handle enforcing trailing slashes | 
| 258 | 258 | $generalConfig = Craft::$app->getConfig()->getGeneral(); | 
| 259 | 259 |          if ($generalConfig->addTrailingSlashesToUrls && $redirectConfig['redirectMatchType'] === 'exactmatch') { | 
| @@ -337,7 +337,7 @@ discard block | ||
| 337 | 337 | $variables['docsUrl'] = self::DOCUMENTATION_URL; | 
| 338 | 338 | $variables['pluginName'] = $pluginName; | 
| 339 | 339 | $variables['title'] = $templateTitle; | 
| 340 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; | |
| 340 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; | |
| 341 | 341 | $variables['crumbs'] = [ | 
| 342 | 342 | [ | 
| 343 | 343 | 'label' => $pluginName, | 
| @@ -345,7 +345,7 @@ discard block | ||
| 345 | 345 | ], | 
| 346 | 346 | [ | 
| 347 | 347 | 'label' => $templateTitle, | 
| 348 | -                'url' => UrlHelper::cpUrl('retour/shortlinks' . $siteHandleUri), | |
| 348 | +                'url' => UrlHelper::cpUrl('retour/shortlinks'.$siteHandleUri), | |
| 349 | 349 | ], | 
| 350 | 350 | ]; | 
| 351 | 351 |          $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; | 
| @@ -400,13 +400,13 @@ discard block | ||
| 400 | 400 |          if (!preg_match('/\.[^\/]+$/', $url) && strpos($url, '?') === false) { | 
| 401 | 401 | // If it's a root relative URL, assume it's a site URL | 
| 402 | 402 |              if (UrlHelper::isRootRelativeUrl($url)) { | 
| 403 | - return rtrim($url, '/') . '/'; | |
| 403 | + return rtrim($url, '/').'/'; | |
| 404 | 404 | } | 
| 405 | 405 | // If the URL matches any of the site's base URLs, assume it's a site URL | 
| 406 | 406 | $sites = Craft::$app->getSites()->getAllSites(); | 
| 407 | 407 |              foreach ($sites as $site) { | 
| 408 | 408 |                  if (strpos($url, $site->getBaseUrl()) === 0) { | 
| 409 | - return rtrim($url, '/') . '/'; | |
| 409 | + return rtrim($url, '/').'/'; | |
| 410 | 410 | } | 
| 411 | 411 | } | 
| 412 | 412 | } | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | // Protected Properties | 
| 41 | 41 | // ========================================================================= | 
| 42 | 42 | |
| 43 | - protected array|bool|int $allowAnonymous = []; | |
| 43 | + protected array | bool | int $allowAnonymous = []; | |
| 44 | 44 | |
| 45 | 45 | // Public Methods | 
| 46 | 46 | // ========================================================================= | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | $variables['docsUrl'] = self::DOCUMENTATION_URL; | 
| 85 | 85 | $variables['pluginName'] = $pluginName; | 
| 86 | 86 | $variables['title'] = $templateTitle; | 
| 87 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; | |
| 87 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; | |
| 88 | 88 | $variables['crumbs'] = [ | 
| 89 | 89 | [ | 
| 90 | 90 | 'label' => $pluginName, | 
| @@ -92,7 +92,7 @@ discard block | ||
| 92 | 92 | ], | 
| 93 | 93 | [ | 
| 94 | 94 | 'label' => $templateTitle, | 
| 95 | -                'url' => UrlHelper::cpUrl('retour/dashboard' . $siteHandleUri), | |
| 95 | +                'url' => UrlHelper::cpUrl('retour/dashboard'.$siteHandleUri), | |
| 96 | 96 | ], | 
| 97 | 97 | ]; | 
| 98 | 98 |          $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | // Protected Properties | 
| 41 | 41 | // ========================================================================= | 
| 42 | 42 | |
| 43 | - protected array|bool|int $allowAnonymous = []; | |
| 43 | + protected array | bool | int $allowAnonymous = []; | |
| 44 | 44 | |
| 45 | 45 | // Public Methods | 
| 46 | 46 | // ========================================================================= | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 | * @return Response The rendered result | 
| 54 | 54 | * @throws ForbiddenHttpException | 
| 55 | 55 | */ | 
| 56 | - public function actionPluginSettings(Settings|bool|null $settings = null): Response | |
| 56 | + public function actionPluginSettings(Settings | bool | null $settings = null): Response | |
| 57 | 57 |      { | 
| 58 | 58 | $variables = []; | 
| 59 | 59 |          PermissionHelper::controllerPermissionCheck('retour:settings'); |