@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @var array The URIs for the element before it was saved |
| 91 | 91 | */ |
| 92 | - public $oldElementUris = []; |
|
| 92 | + public $oldElementUris = [ ]; |
|
| 93 | 93 | |
| 94 | 94 | // Public Methods |
| 95 | 95 | // ========================================================================= |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | Craft::t( |
| 115 | 115 | 'retour', |
| 116 | 116 | '{name} plugin loaded', |
| 117 | - ['name' => $this->name] |
|
| 117 | + [ 'name' => $this->name ] |
|
| 118 | 118 | ), |
| 119 | 119 | __METHOD__ |
| 120 | 120 | ); |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function getCpNavItem() |
| 136 | 136 | { |
| 137 | - $subNavs = []; |
|
| 137 | + $subNavs = [ ]; |
|
| 138 | 138 | $navItem = parent::getCpNavItem(); |
| 139 | 139 | $currentUser = Craft::$app->getUser()->getIdentity(); |
| 140 | 140 | // Only show sub-navs the user has permission to view |
| 141 | 141 | if ($currentUser->can('retour:dashboard')) { |
| 142 | - $subNavs['dashboard'] = [ |
|
| 142 | + $subNavs[ 'dashboard' ] = [ |
|
| 143 | 143 | 'label' => 'Dashboard', |
| 144 | 144 | 'url' => 'retour/dashboard', |
| 145 | 145 | ]; |
| 146 | 146 | } |
| 147 | 147 | if ($currentUser->can('retour:redirects')) { |
| 148 | - $subNavs['redirects'] = [ |
|
| 148 | + $subNavs[ 'redirects' ] = [ |
|
| 149 | 149 | 'label' => 'Redirects', |
| 150 | 150 | 'url' => 'retour/redirects', |
| 151 | 151 | ]; |
| 152 | 152 | } |
| 153 | 153 | if ($currentUser->can('retour:settings')) { |
| 154 | - $subNavs['settings'] = [ |
|
| 154 | + $subNavs[ 'settings' ] = [ |
|
| 155 | 155 | 'label' => 'Settings', |
| 156 | 156 | 'url' => 'retour/settings', |
| 157 | 157 | ]; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | Event::on( |
| 211 | 211 | Plugins::class, |
| 212 | 212 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 213 | - function (PluginEvent $event) { |
|
| 213 | + function(PluginEvent $event) { |
|
| 214 | 214 | if ($event->plugin === $this) { |
| 215 | 215 | // Invalidate our caches after we've been installed |
| 216 | 216 | $this->clearAllCaches(); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | Event::on( |
| 238 | 238 | CraftVariable::class, |
| 239 | 239 | CraftVariable::EVENT_INIT, |
| 240 | - function (Event $event) { |
|
| 240 | + function(Event $event) { |
|
| 241 | 241 | /** @var CraftVariable $variable */ |
| 242 | 242 | $variable = $event->sender; |
| 243 | 243 | $variable->set('retour', RetourVariable::class); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | Event::on( |
| 248 | 248 | Elements::class, |
| 249 | 249 | Elements::EVENT_BEFORE_SAVE_ELEMENT, |
| 250 | - function (ElementEvent $event) { |
|
| 250 | + function(ElementEvent $event) { |
|
| 251 | 251 | Craft::debug( |
| 252 | 252 | 'Elements::EVENT_BEFORE_SAVE_ELEMENT', |
| 253 | 253 | __METHOD__ |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | if ($oldElement !== null) { |
| 263 | 263 | // Stash the old URLs by element id, and do so only once, |
| 264 | 264 | // in case we are called more than once per request |
| 265 | - if (empty($this->oldElementUris[$oldElement->id])) { |
|
| 266 | - $this->oldElementUris[$oldElement->id] = $this->getAllElementUris($oldElement); |
|
| 265 | + if (empty($this->oldElementUris[ $oldElement->id ])) { |
|
| 266 | + $this->oldElementUris[ $oldElement->id ] = $this->getAllElementUris($oldElement); |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | Event::on( |
| 275 | 275 | Elements::class, |
| 276 | 276 | Elements::EVENT_AFTER_SAVE_ELEMENT, |
| 277 | - function (ElementEvent $event) { |
|
| 277 | + function(ElementEvent $event) { |
|
| 278 | 278 | Craft::debug( |
| 279 | 279 | 'Elements::EVENT_AFTER_SAVE_ELEMENT', |
| 280 | 280 | __METHOD__ |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | Event::on( |
| 291 | 291 | Plugins::class, |
| 292 | 292 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
| 293 | - function () { |
|
| 293 | + function() { |
|
| 294 | 294 | // Install these only after all other plugins have loaded |
| 295 | 295 | $request = Craft::$app->getRequest(); |
| 296 | 296 | // Only respond to non-console site requests |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | Event::on( |
| 315 | 315 | UrlManager::class, |
| 316 | 316 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 317 | - function (RegisterUrlRulesEvent $event) { |
|
| 317 | + function(RegisterUrlRulesEvent $event) { |
|
| 318 | 318 | Craft::debug( |
| 319 | 319 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
| 320 | 320 | __METHOD__ |
@@ -337,15 +337,15 @@ discard block |
||
| 337 | 337 | Event::on( |
| 338 | 338 | Dashboard::class, |
| 339 | 339 | Dashboard::EVENT_REGISTER_WIDGET_TYPES, |
| 340 | - function (RegisterComponentTypesEvent $event) { |
|
| 341 | - $event->types[] = RetourWidget::class; |
|
| 340 | + function(RegisterComponentTypesEvent $event) { |
|
| 341 | + $event->types[ ] = RetourWidget::class; |
|
| 342 | 342 | } |
| 343 | 343 | ); |
| 344 | 344 | // Handler: UrlManager::EVENT_REGISTER_CP_URL_RULES |
| 345 | 345 | Event::on( |
| 346 | 346 | UrlManager::class, |
| 347 | 347 | UrlManager::EVENT_REGISTER_CP_URL_RULES, |
| 348 | - function (RegisterUrlRulesEvent $event) { |
|
| 348 | + function(RegisterUrlRulesEvent $event) { |
|
| 349 | 349 | Craft::debug( |
| 350 | 350 | 'UrlManager::EVENT_REGISTER_CP_URL_RULES', |
| 351 | 351 | __METHOD__ |
@@ -361,20 +361,20 @@ discard block |
||
| 361 | 361 | Event::on( |
| 362 | 362 | UserPermissions::class, |
| 363 | 363 | UserPermissions::EVENT_REGISTER_PERMISSIONS, |
| 364 | - function (RegisterUserPermissionsEvent $event) { |
|
| 364 | + function(RegisterUserPermissionsEvent $event) { |
|
| 365 | 365 | Craft::debug( |
| 366 | 366 | 'UserPermissions::EVENT_REGISTER_PERMISSIONS', |
| 367 | 367 | __METHOD__ |
| 368 | 368 | ); |
| 369 | 369 | // Register our custom permissions |
| 370 | - $event->permissions[Craft::t('retour', 'Retour')] = $this->customAdminCpPermissions(); |
|
| 370 | + $event->permissions[ Craft::t('retour', 'Retour') ] = $this->customAdminCpPermissions(); |
|
| 371 | 371 | } |
| 372 | 372 | ); |
| 373 | 373 | // Handler: ClearCaches::EVENT_REGISTER_CACHE_OPTIONS |
| 374 | 374 | Event::on( |
| 375 | 375 | ClearCaches::class, |
| 376 | 376 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, |
| 377 | - function (RegisterCacheOptionsEvent $event) { |
|
| 377 | + function(RegisterCacheOptionsEvent $event) { |
|
| 378 | 378 | Craft::debug( |
| 379 | 379 | 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', |
| 380 | 380 | __METHOD__ |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | Event::on( |
| 400 | 400 | ErrorHandler::class, |
| 401 | 401 | ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION, |
| 402 | - function (ExceptionEvent $event) { |
|
| 402 | + function(ExceptionEvent $event) { |
|
| 403 | 403 | Craft::debug( |
| 404 | 404 | 'ErrorHandler::EVENT_BEFORE_HANDLE_EXCEPTION', |
| 405 | 405 | __METHOD__ |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | protected function handleElementUriChange(Element $element) |
| 442 | 442 | { |
| 443 | 443 | $uris = $this->getAllElementUris($element); |
| 444 | - $oldElementUris = $this->oldElementUris[$element->id]; |
|
| 444 | + $oldElementUris = $this->oldElementUris[ $element->id ]; |
|
| 445 | 445 | foreach ($uris as $siteId => $newUri) { |
| 446 | - if (!empty($oldElementUris[$siteId])) { |
|
| 447 | - $oldUri = $oldElementUris[$siteId]; |
|
| 446 | + if (!empty($oldElementUris[ $siteId ])) { |
|
| 447 | + $oldUri = $oldElementUris[ $siteId ]; |
|
| 448 | 448 | Craft::debug( |
| 449 | 449 | Craft::t( |
| 450 | 450 | 'retour', |
| 451 | 451 | 'Comparing old: {oldUri} to new: {newUri}', |
| 452 | - ['oldUri' => print_r($oldUri, true), 'newUri' => print_r($newUri, true)] |
|
| 452 | + [ 'oldUri' => print_r($oldUri, true), 'newUri' => print_r($newUri, true) ] |
|
| 453 | 453 | ), |
| 454 | 454 | __METHOD__ |
| 455 | 455 | ); |
@@ -476,12 +476,12 @@ discard block |
||
| 476 | 476 | */ |
| 477 | 477 | protected function getAllElementUris(Element $element): array |
| 478 | 478 | { |
| 479 | - $uris = []; |
|
| 479 | + $uris = [ ]; |
|
| 480 | 480 | $sites = Craft::$app->getSites()->getAllSites(); |
| 481 | 481 | foreach ($sites as $site) { |
| 482 | 482 | $uri = Craft::$app->getElements()->getElementUriForSite($element->id, $site->id); |
| 483 | 483 | if ($uri !== null) { |
| 484 | - $uris[$site->id] = $uri; |
|
| 484 | + $uris[ $site->id ] = $uri; |
|
| 485 | 485 | } |
| 486 | 486 | } |
| 487 | 487 | |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | Craft::t( |
| 490 | 490 | 'retour', |
| 491 | 491 | 'Getting Element URIs: {uris}', |
| 492 | - ['uris' => print_r($uris, true)] |
|
| 492 | + [ 'uris' => print_r($uris, true) ] |
|
| 493 | 493 | ), |
| 494 | 494 | __METHOD__ |
| 495 | 495 | ); |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | [ |
| 556 | 556 | 'key' => 'retour-redirect-caches', |
| 557 | 557 | 'label' => Craft::t('retour', 'Retour redirect caches'), |
| 558 | - 'action' => [self::$plugin->redirects, 'invalidateCaches'], |
|
| 558 | + 'action' => [ self::$plugin->redirects, 'invalidateCaches' ], |
|
| 559 | 559 | ], |
| 560 | 560 | ]; |
| 561 | 561 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | Craft::t( |
| 86 | 86 | 'retour', |
| 87 | 87 | '404 URL: {url}', |
| 88 | - ['url' => $url] |
|
| 88 | + [ 'url' => $url ] |
|
| 89 | 89 | ), |
| 90 | 90 | __METHOD__ |
| 91 | 91 | ); |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $response = Craft::$app->getResponse(); |
| 116 | 116 | if ($redirect !== null) { |
| 117 | - $dest = $redirect['redirectDestUrl']; |
|
| 118 | - $status = $redirect['redirectHttpCode']; |
|
| 117 | + $dest = $redirect[ 'redirectDestUrl' ]; |
|
| 118 | + $status = $redirect[ 'redirectHttpCode' ]; |
|
| 119 | 119 | Craft::info( |
| 120 | 120 | Craft::t( |
| 121 | 121 | 'retour', |
| 122 | 122 | 'Redirecting {url} to {dest} with status {status}', |
| 123 | - ['url' => $url, 'dest' => $dest, 'status' => $status] |
|
| 123 | + [ 'url' => $url, 'dest' => $dest, 'status' => $status ] |
|
| 124 | 124 | ), |
| 125 | 125 | __METHOD__ |
| 126 | 126 | ); |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | public function getRedirectFromCache($url) |
| 173 | 173 | { |
| 174 | 174 | $cache = Craft::$app->getCache(); |
| 175 | - $cacheKey = $this::CACHE_KEY.md5($url); |
|
| 175 | + $cacheKey = $this::CACHE_KEY . md5($url); |
|
| 176 | 176 | $redirect = $cache->get($cacheKey); |
| 177 | 177 | Craft::info( |
| 178 | 178 | Craft::t( |
| 179 | 179 | 'retour', |
| 180 | 180 | 'Cached redirect hit for {url}', |
| 181 | - ['url' => $url] |
|
| 181 | + [ 'url' => $url ] |
|
| 182 | 182 | ), |
| 183 | 183 | __METHOD__ |
| 184 | 184 | ); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function saveRedirectToCache($url, $redirect) |
| 194 | 194 | { |
| 195 | - $cacheKey = $this::CACHE_KEY.md5($url); |
|
| 195 | + $cacheKey = $this::CACHE_KEY . md5($url); |
|
| 196 | 196 | $cache = Craft::$app->getCache(); |
| 197 | 197 | // Get the current site id |
| 198 | 198 | $sites = Craft::$app->getSites(); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $dependency = new TagDependency([ |
| 206 | 206 | 'tags' => [ |
| 207 | 207 | $this::GLOBAL_REDIRECTS_CACHE_TAG, |
| 208 | - $this::GLOBAL_REDIRECTS_CACHE_TAG.$siteId, |
|
| 208 | + $this::GLOBAL_REDIRECTS_CACHE_TAG . $siteId, |
|
| 209 | 209 | ], |
| 210 | 210 | ]); |
| 211 | 211 | $cache->set($cacheKey, $redirect, Retour::$cacheDuration, $dependency); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | Craft::t( |
| 214 | 214 | 'retour', |
| 215 | 215 | 'Cached redirect saved for {url}', |
| 216 | - ['url' => $url] |
|
| 216 | + [ 'url' => $url ] |
|
| 217 | 217 | ), |
| 218 | 218 | __METHOD__ |
| 219 | 219 | ); |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | { |
| 230 | 230 | $result = null; |
| 231 | 231 | foreach ($redirects as $redirect) { |
| 232 | - $redirectMatchType = $redirect['redirectMatchType'] ?? null; |
|
| 232 | + $redirectMatchType = $redirect[ 'redirectMatchType' ] ?? null; |
|
| 233 | 233 | switch ($redirectMatchType) { |
| 234 | 234 | // Do a straight up match |
| 235 | 235 | case 'exactmatch': |
| 236 | - if (strcasecmp($redirect['redirectSrcUrlParsed'], $url) === 0) { |
|
| 236 | + if (strcasecmp($redirect[ 'redirectSrcUrlParsed' ], $url) === 0) { |
|
| 237 | 237 | $this->incrementRedirectHitCount($redirect); |
| 238 | 238 | $this->saveRedirectToCache($url, $redirect); |
| 239 | 239 | |
@@ -243,14 +243,14 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | // Do a regex match |
| 245 | 245 | case 'regexmatch': |
| 246 | - $matchRegEx = '`'.$redirect['redirectSrcUrlParsed'].'`i'; |
|
| 246 | + $matchRegEx = '`' . $redirect[ 'redirectSrcUrlParsed' ] . '`i'; |
|
| 247 | 247 | if (preg_match($matchRegEx, $url) === 1) { |
| 248 | 248 | $this->incrementRedirectHitCount($redirect); |
| 249 | 249 | // If we're not associated with an EntryID, handle capture group replacement |
| 250 | - if ((int)$redirect['associatedElementId'] === 0) { |
|
| 251 | - $redirect['redirectDestUrl'] = preg_replace( |
|
| 250 | + if ((int) $redirect[ 'associatedElementId' ] === 0) { |
|
| 251 | + $redirect[ 'redirectDestUrl' ] = preg_replace( |
|
| 252 | 252 | $matchRegEx, |
| 253 | - $redirect['redirectDestUrl'], |
|
| 253 | + $redirect[ 'redirectDestUrl' ], |
|
| 254 | 254 | $url |
| 255 | 255 | ); |
| 256 | 256 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | 'redirect' => &$redirect, |
| 270 | 270 | ], |
| 271 | 271 | ]; |
| 272 | - $result = \call_user_func_array([$plugin, 'retourMatch'], $args); |
|
| 272 | + $result = \call_user_func_array([ $plugin, 'retourMatch' ], $args); |
|
| 273 | 273 | if ($result) { |
| 274 | 274 | $this->incrementRedirectHitCount($redirect); |
| 275 | 275 | $this->saveRedirectToCache($url, $redirect); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | Craft::t( |
| 285 | 285 | 'retour', |
| 286 | 286 | 'Not handled: {url}', |
| 287 | - ['url' => $url] |
|
| 287 | + [ 'url' => $url ] |
|
| 288 | 288 | ), |
| 289 | 289 | __METHOD__ |
| 290 | 290 | ); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | foreach (Craft::$app->getPlugins()->getAllPlugins() as $plugin) { |
| 309 | 309 | /** @var Plugin $plugin */ |
| 310 | 310 | if (method_exists($plugin, 'retourMatch')) { |
| 311 | - $result[$plugin->getHandle()] = $plugin->name.Craft::t('retour', ' Match'); |
|
| 311 | + $result[ $plugin->getHandle() ] = $plugin->name . Craft::t('retour', ' Match'); |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | // Query the db table |
| 330 | 330 | $query = (new Query()) |
| 331 | - ->from(['{{%retour_static_redirects}}']) |
|
| 331 | + ->from([ '{{%retour_static_redirects}}' ]) |
|
| 332 | 332 | ->orderBy('redirectMatchType ASC, hitCount DESC'); |
| 333 | 333 | if ($limit) { |
| 334 | 334 | $query->limit($limit); |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | // Query the db table |
| 353 | 353 | $redirect = (new Query()) |
| 354 | - ->from(['{{%retour_static_redirects}}']) |
|
| 355 | - ->where(['id' => $id]) |
|
| 354 | + ->from([ '{{%retour_static_redirects}}' ]) |
|
| 355 | + ->where([ 'id' => $id ]) |
|
| 356 | 356 | ->one(); |
| 357 | 357 | |
| 358 | 358 | return $redirect; |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | { |
| 370 | 370 | // Query the db table |
| 371 | 371 | $redirect = (new Query()) |
| 372 | - ->from(['{{%retour_static_redirects}}']) |
|
| 373 | - ->where(['redirectSrcUrl' => $redirectSrcUrl]) |
|
| 372 | + ->from([ '{{%retour_static_redirects}}' ]) |
|
| 373 | + ->where([ 'redirectSrcUrl' => $redirectSrcUrl ]) |
|
| 374 | 374 | ->one(); |
| 375 | 375 | |
| 376 | 376 | return $redirect; |
@@ -410,8 +410,8 @@ discard block |
||
| 410 | 410 | public function incrementRedirectHitCount($redirectConfig) |
| 411 | 411 | { |
| 412 | 412 | if ($redirectConfig !== null) { |
| 413 | - $redirectConfig['hitCount']++; |
|
| 414 | - $redirectConfig['hitLastTime'] = Db::prepareDateForDb(new \DateTime()); |
|
| 413 | + $redirectConfig[ 'hitCount' ]++; |
|
| 414 | + $redirectConfig[ 'hitLastTime' ] = Db::prepareDateForDb(new \DateTime()); |
|
| 415 | 415 | $this->saveRedirect($redirectConfig); |
| 416 | 416 | } |
| 417 | 417 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | Craft::t( |
| 429 | 429 | 'retour', |
| 430 | 430 | 'Error validating redirect {id}: {errors}', |
| 431 | - ['id' => $redirect->id, 'errors' => print_r($redirect->getErrors(), true)] |
|
| 431 | + [ 'id' => $redirect->id, 'errors' => print_r($redirect->getErrors(), true) ] |
|
| 432 | 432 | ), |
| 433 | 433 | __METHOD__ |
| 434 | 434 | ); |
@@ -439,23 +439,23 @@ discard block |
||
| 439 | 439 | $redirectConfig = $redirect->getAttributes(); |
| 440 | 440 | $db = Craft::$app->getDb(); |
| 441 | 441 | // See if a redirect exists with this source URL already |
| 442 | - if ((int)$redirectConfig['id'] === 0) { |
|
| 442 | + if ((int) $redirectConfig[ 'id' ] === 0) { |
|
| 443 | 443 | // Query the db table |
| 444 | 444 | $redirect = (new Query()) |
| 445 | - ->from(['{{%retour_static_redirects}}']) |
|
| 446 | - ->where(['redirectSrcUrlParsed' => $redirectConfig['redirectSrcUrlParsed']]) |
|
| 445 | + ->from([ '{{%retour_static_redirects}}' ]) |
|
| 446 | + ->where([ 'redirectSrcUrlParsed' => $redirectConfig[ 'redirectSrcUrlParsed' ] ]) |
|
| 447 | 447 | ->one(); |
| 448 | 448 | // If it exists, update it rather than having duplicates |
| 449 | 449 | if (!empty($redirect)) { |
| 450 | - $redirectConfig['id'] = $redirect['id']; |
|
| 450 | + $redirectConfig[ 'id' ] = $redirect[ 'id' ]; |
|
| 451 | 451 | } |
| 452 | 452 | } |
| 453 | - if ((int)$redirectConfig['id'] !== 0) { |
|
| 453 | + if ((int) $redirectConfig[ 'id' ] !== 0) { |
|
| 454 | 454 | Craft::debug( |
| 455 | 455 | Craft::t( |
| 456 | 456 | 'retour', |
| 457 | 457 | 'Updating existing redirect: {redirect}', |
| 458 | - ['redirect' => print_r($redirectConfig, true)] |
|
| 458 | + [ 'redirect' => print_r($redirectConfig, true) ] |
|
| 459 | 459 | ), |
| 460 | 460 | __METHOD__ |
| 461 | 461 | ); |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | '{{%retour_static_redirects}}', |
| 466 | 466 | $redirectConfig, |
| 467 | 467 | [ |
| 468 | - 'id' => $redirectConfig['id'], |
|
| 468 | + 'id' => $redirectConfig[ 'id' ], |
|
| 469 | 469 | ] |
| 470 | 470 | )->execute(); |
| 471 | 471 | } catch (Exception $e) { |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | Craft::t( |
| 477 | 477 | 'retour', |
| 478 | 478 | 'Creating new redirect: {redirect}', |
| 479 | - ['redirect' => print_r($redirectConfig, true)] |
|
| 479 | + [ 'redirect' => print_r($redirectConfig, true) ] |
|
| 480 | 480 | ), |
| 481 | 481 | __METHOD__ |
| 482 | 482 | ); |
@@ -491,13 +491,13 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | // To prevent redirect loops, see if any static redirects have our redirectDestUrl as their redirectSrcUrl |
| 494 | - $testRedirectConfig = $this->getRedirectByRedirectSrcUrl($redirectConfig['redirectDestUrl']); |
|
| 494 | + $testRedirectConfig = $this->getRedirectByRedirectSrcUrl($redirectConfig[ 'redirectDestUrl' ]); |
|
| 495 | 495 | if ($testRedirectConfig !== null) { |
| 496 | 496 | Craft::debug( |
| 497 | 497 | Craft::t( |
| 498 | 498 | 'retour', |
| 499 | 499 | 'Deleting redirect to prevent a loop: {redirect}', |
| 500 | - ['redirect' => print_r($testRedirectConfig, true)] |
|
| 500 | + [ 'redirect' => print_r($testRedirectConfig, true) ] |
|
| 501 | 501 | ), |
| 502 | 502 | __METHOD__ |
| 503 | 503 | ); |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | try { |
| 506 | 506 | $db->createCommand()->delete( |
| 507 | 507 | '{{%retour_static_redirects}}', |
| 508 | - ['id' => $testRedirectConfig['id']] |
|
| 508 | + [ 'id' => $testRedirectConfig[ 'id' ] ] |
|
| 509 | 509 | )->execute(); |
| 510 | 510 | } catch (Exception $e) { |
| 511 | 511 | Craft::error($e->getMessage(), __METHOD__); |