@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $filter = '' |
| 61 | 61 | ): Response { |
| 62 | 62 | PermissionHelper::controllerPermissionCheck('retour:dashboard'); |
| 63 | - $data = []; |
|
| 63 | + $data = [ ]; |
|
| 64 | 64 | $sortField = 'hitCount'; |
| 65 | 65 | $sortType = 'DESC'; |
| 66 | 66 | // Figure out the sorting type |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // Query the db table |
| 75 | 75 | $offset = ($page - 1) * $per_page; |
| 76 | 76 | $query = (new Query()) |
| 77 | - ->from(['{{%retour_stats}}']) |
|
| 77 | + ->from([ '{{%retour_stats}}' ]) |
|
| 78 | 78 | ->offset($offset) |
| 79 | 79 | ->limit($per_page) |
| 80 | 80 | ->orderBy("{$sortField} {$sortType}"); |
@@ -85,23 +85,23 @@ discard block |
||
| 85 | 85 | $stats = $query->all(); |
| 86 | 86 | // Add in the `addLink` field |
| 87 | 87 | foreach ($stats as &$stat) { |
| 88 | - $stat['addLink'] = ''; |
|
| 89 | - if (!$stat['handledByRetour']) { |
|
| 90 | - $encodedUrl = urlencode('/'.ltrim($stat['redirectSrcUrl'], '/')); |
|
| 91 | - $stat['addLink'] = UrlHelper::cpUrl('retour/add-redirect/'.$encodedUrl); |
|
| 88 | + $stat[ 'addLink' ] = ''; |
|
| 89 | + if (!$stat[ 'handledByRetour' ]) { |
|
| 90 | + $encodedUrl = urlencode('/' . ltrim($stat[ 'redirectSrcUrl' ], '/')); |
|
| 91 | + $stat[ 'addLink' ] = UrlHelper::cpUrl('retour/add-redirect/' . $encodedUrl); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | // Format the data for the API |
| 95 | 95 | if ($stats) { |
| 96 | - $data['data'] = $stats; |
|
| 96 | + $data[ 'data' ] = $stats; |
|
| 97 | 97 | $query = (new Query()) |
| 98 | - ->from(['{{%retour_stats}}']); |
|
| 98 | + ->from([ '{{%retour_stats}}' ]); |
|
| 99 | 99 | if ($filter !== '') { |
| 100 | 100 | $query->where("`redirectSrcUrl` LIKE '%{$filter}%'"); |
| 101 | 101 | $query->orWhere("`referrerUrl` LIKE '%{$filter}%'"); |
| 102 | 102 | } |
| 103 | 103 | $count = $query->count(); |
| 104 | - $data['links']['pagination'] = [ |
|
| 104 | + $data[ 'links' ][ 'pagination' ] = [ |
|
| 105 | 105 | 'total' => $count, |
| 106 | 106 | 'per_page' => $per_page, |
| 107 | 107 | 'current_page' => $page, |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $filter = '' |
| 135 | 135 | ): Response { |
| 136 | 136 | PermissionHelper::controllerPermissionCheck('retour:redirects'); |
| 137 | - $data = []; |
|
| 137 | + $data = [ ]; |
|
| 138 | 138 | $sortField = 'hitCount'; |
| 139 | 139 | $sortType = 'DESC'; |
| 140 | 140 | // Figure out the sorting type |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | // Query the db table |
| 149 | 149 | $offset = ($page - 1) * $per_page; |
| 150 | 150 | $query = (new Query()) |
| 151 | - ->from(['{{%retour_static_redirects}}']) |
|
| 151 | + ->from([ '{{%retour_static_redirects}}' ]) |
|
| 152 | 152 | ->offset($offset) |
| 153 | 153 | ->limit($per_page) |
| 154 | 154 | ->orderBy("{$sortField} {$sortType}"); |
@@ -159,20 +159,20 @@ discard block |
||
| 159 | 159 | $redirects = $query->all(); |
| 160 | 160 | // Add in the `deleteLink` field |
| 161 | 161 | foreach ($redirects as &$redirect) { |
| 162 | - $redirect['deleteLink'] = UrlHelper::cpUrl('retour/delete-redirect/'.$redirect['id']); |
|
| 163 | - $redirect['redirectSrcUrl'].= '|'.UrlHelper::cpUrl('retour/edit-redirect/'.$redirect['id']); |
|
| 162 | + $redirect[ 'deleteLink' ] = UrlHelper::cpUrl('retour/delete-redirect/' . $redirect[ 'id' ]); |
|
| 163 | + $redirect[ 'redirectSrcUrl' ] .= '|' . UrlHelper::cpUrl('retour/edit-redirect/' . $redirect[ 'id' ]); |
|
| 164 | 164 | } |
| 165 | 165 | // Format the data for the API |
| 166 | 166 | if ($redirects) { |
| 167 | - $data['data'] = $redirects; |
|
| 167 | + $data[ 'data' ] = $redirects; |
|
| 168 | 168 | $query = (new Query()) |
| 169 | - ->from(['{{%retour_static_redirects}}']); |
|
| 169 | + ->from([ '{{%retour_static_redirects}}' ]); |
|
| 170 | 170 | if ($filter !== '') { |
| 171 | 171 | $query->where("`redirectSrcUrl` LIKE '%{$filter}%'"); |
| 172 | 172 | $query->orWhere("`redirectDestUrl` LIKE '%{$filter}%'"); |
| 173 | 173 | } |
| 174 | 174 | $count = $query->count(); |
| 175 | - $data['links']['pagination'] = [ |
|
| 175 | + $data[ 'links' ][ 'pagination' ] = [ |
|
| 176 | 176 | 'total' => $count, |
| 177 | 177 | 'per_page' => $per_page, |
| 178 | 178 | 'current_page' => $page, |