@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | try { |
292 | 292 | $siteId = $redirect['siteId'] ?? null; |
293 | 293 | if ($siteId !== null) { |
294 | - $siteId = (int)$siteId; |
|
294 | + $siteId = (int) $siteId; |
|
295 | 295 | } |
296 | 296 | $dest = UrlHelper::siteUrl($dest, null, null, $siteId); |
297 | 297 | } catch (\yii\base\Exception $e) { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | // That's ok |
307 | 307 | } |
308 | 308 | if (!empty($queryString)) { |
309 | - $dest = strtok($dest, '?') . '?' . $queryString; |
|
309 | + $dest = strtok($dest, '?').'?'.$queryString; |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | $redirectMatchType = $redirect['redirectMatchType'] ?? 'notfound'; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | public function getRedirectFromCache($url, int $siteId = 0) |
424 | 424 | { |
425 | 425 | $cache = Craft::$app->getCache(); |
426 | - $cacheKey = $this::CACHE_KEY . md5($url) . $siteId; |
|
426 | + $cacheKey = $this::CACHE_KEY.md5($url).$siteId; |
|
427 | 427 | $redirect = $cache->get($cacheKey); |
428 | 428 | Craft::info( |
429 | 429 | Craft::t( |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | } catch (SiteNotFoundException $e) { |
452 | 452 | $siteId = 1; |
453 | 453 | } |
454 | - $cacheKey = $this::CACHE_KEY . md5($url) . $siteId; |
|
454 | + $cacheKey = $this::CACHE_KEY.md5($url).$siteId; |
|
455 | 455 | // Create the dependency tags |
456 | 456 | $dependency = new TagDependency([ |
457 | 457 | 'tags' => [ |
458 | 458 | $this::GLOBAL_REDIRECTS_CACHE_TAG, |
459 | - $this::GLOBAL_REDIRECTS_CACHE_TAG . $siteId, |
|
459 | + $this::GLOBAL_REDIRECTS_CACHE_TAG.$siteId, |
|
460 | 460 | ], |
461 | 461 | ]); |
462 | 462 | $cache->set($cacheKey, $redirect, Retour::$cacheDuration, $dependency); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | foreach ($redirects as $redirect) { |
497 | 497 | // Figure out what type of source matching to do |
498 | 498 | $redirectSrcMatch = $redirect['redirectSrcMatch'] ?? 'pathonly'; |
499 | - $redirectEnabled = (bool)$redirect['enabled']; |
|
499 | + $redirectEnabled = (bool) $redirect['enabled']; |
|
500 | 500 | if ($redirectEnabled === true) { |
501 | 501 | switch ($redirectSrcMatch) { |
502 | 502 | case 'pathonly': |
@@ -537,12 +537,12 @@ discard block |
||
537 | 537 | |
538 | 538 | // Do a regex match |
539 | 539 | case 'regexmatch': |
540 | - $matchRegEx = '`' . $redirect['redirectSrcUrlParsed'] . '`i'; |
|
540 | + $matchRegEx = '`'.$redirect['redirectSrcUrlParsed'].'`i'; |
|
541 | 541 | try { |
542 | 542 | if (preg_match($matchRegEx, $url) === 1) { |
543 | 543 | $this->incrementRedirectHitCount($redirect); |
544 | 544 | // If we're not associated with an EntryID, handle capture group replacement |
545 | - if ((int)$redirect['associatedElementId'] === 0) { |
|
545 | + if ((int) $redirect['associatedElementId'] === 0) { |
|
546 | 546 | $redirect['redirectDestUrl'] = preg_replace( |
547 | 547 | $matchRegEx, |
548 | 548 | $redirect['redirectDestUrl'], |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | } |
571 | 571 | } catch (\Exception $e) { |
572 | 572 | // That's fine |
573 | - Craft::error('Invalid Redirect Regex: ' . $matchRegEx, __METHOD__); |
|
573 | + Craft::error('Invalid Redirect Regex: '.$matchRegEx, __METHOD__); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | break; |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | foreach (Craft::$app->getPlugins()->getAllPlugins() as $plugin) { |
679 | 679 | /** @var Plugin $plugin */ |
680 | 680 | if (method_exists($plugin, 'retourMatch')) { |
681 | - $result[$plugin->getHandle()] = $plugin->name . Craft::t('retour', ' Match'); |
|
681 | + $result[$plugin->getHandle()] = $plugin->name.Craft::t('retour', ' Match'); |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | $db = Craft::$app->getDb(); |
903 | 903 | // Trigger a 'beforeDeleteRedirect' event |
904 | 904 | $redirectConfig = $this->getRedirectById($id); |
905 | - $isNew = (int)$redirectConfig['id'] === 0; |
|
905 | + $isNew = (int) $redirectConfig['id'] === 0; |
|
906 | 906 | $event = new RedirectEvent([ |
907 | 907 | 'isNew' => $isNew, |
908 | 908 | 'legacyUrl' => $redirectConfig['redirectSrcUrlParsed'], |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | 'id' => $redirectConfig['id'], |
964 | 964 | ] |
965 | 965 | )->execute(); |
966 | - Craft::debug('Rows affected: ' . $rowsAffected, __METHOD__); |
|
966 | + Craft::debug('Rows affected: '.$rowsAffected, __METHOD__); |
|
967 | 967 | } catch (\Exception $e) { |
968 | 968 | Craft::error($e->getMessage(), __METHOD__); |
969 | 969 | } |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | // Get the validated model attributes and save them to the db |
1095 | 1095 | $redirectConfig = $redirect->getAttributes(); |
1096 | 1096 | // 0 for a siteId needs to be converted to null |
1097 | - if (empty($redirectConfig['siteId']) || (int)$redirectConfig['siteId'] === 0) { |
|
1097 | + if (empty($redirectConfig['siteId']) || (int) $redirectConfig['siteId'] === 0) { |
|
1098 | 1098 | $redirectConfig['siteId'] = null; |
1099 | 1099 | } |
1100 | 1100 | // Throw an event to before saving the redirect |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | // See if a redirect exists with this source URL already |
1107 | - if ((int)$redirectConfig['id'] === 0) { |
|
1107 | + if ((int) $redirectConfig['id'] === 0) { |
|
1108 | 1108 | // Query the db table |
1109 | 1109 | $redirect = (new Query()) |
1110 | 1110 | ->from(['{{%retour_static_redirects}}']) |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | // Trigger a 'beforeSaveRedirect' event |
1120 | - $isNew = (int)$redirectConfig['id'] === 0; |
|
1120 | + $isNew = (int) $redirectConfig['id'] === 0; |
|
1121 | 1121 | $event = new RedirectEvent([ |
1122 | 1122 | 'isNew' => $isNew, |
1123 | 1123 | 'legacyUrl' => $redirectConfig['redirectSrcUrlParsed'], |
@@ -1220,17 +1220,17 @@ discard block |
||
1220 | 1220 | */ |
1221 | 1221 | public function excludeUri($uri): bool |
1222 | 1222 | { |
1223 | - $uri = '/' . ltrim($uri, '/'); |
|
1223 | + $uri = '/'.ltrim($uri, '/'); |
|
1224 | 1224 | if (!empty(Retour::$settings->excludePatterns)) { |
1225 | 1225 | foreach (Retour::$settings->excludePatterns as $excludePattern) { |
1226 | - $pattern = '`' . $excludePattern['pattern'] . '`i'; |
|
1226 | + $pattern = '`'.$excludePattern['pattern'].'`i'; |
|
1227 | 1227 | try { |
1228 | 1228 | if (preg_match($pattern, $uri) === 1) { |
1229 | 1229 | return true; |
1230 | 1230 | } |
1231 | 1231 | } catch (\Exception $e) { |
1232 | 1232 | // That's fine |
1233 | - Craft::error('Invalid exclude URI Regex: ' . $pattern, __METHOD__); |
|
1233 | + Craft::error('Invalid exclude URI Regex: '.$pattern, __METHOD__); |
|
1234 | 1234 | } |
1235 | 1235 | } |
1236 | 1236 | } |