@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | protected function setPeriodSelection() |
35 | 35 | { |
36 | - if (! $this->periodSelection) { |
|
36 | + if (!$this->periodSelection) { |
|
37 | 37 | $this->periodSelection = []; |
38 | 38 | foreach ([1, 2, 3, 4] as $count) { |
39 | 39 | $this->periodSelection[$count . ' weeks'] = trans_choice('{1} :count week |[2,*] :count weeks', $count); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | foreach ($this->periodSelection as $key => $period) { |
44 | - $default = $key == $this->defaultPeriod? ' (' . __('Default') . ')': ''; |
|
44 | + $default = $key == $this->defaultPeriod ? ' (' . __('Default') . ')' : ''; |
|
45 | 45 | |
46 | 46 | $this->periodSelection[$key] = $period . $default; |
47 | 47 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->canvas = $canvas; |
53 | 53 | |
54 | - if (! $this->file()) { |
|
54 | + if (!$this->file()) { |
|
55 | 55 | $canvas->set(__('Wrong parameters for file')); |
56 | 56 | return; |
57 | 57 | } |
@@ -71,12 +71,12 @@ discard block |
||
71 | 71 | |
72 | 72 | protected function file() |
73 | 73 | { |
74 | - return $this->file?: ($this->file = File::get($this->canvas->stickyGET('id'))); |
|
74 | + return $this->file ?: ($this->file = File::get($this->canvas->stickyGET('id'))); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | protected function addFileDetails($container = null) |
78 | 78 | { |
79 | - $container = $container?: $this->canvas; |
|
79 | + $container = $container ?: $this->canvas; |
|
80 | 80 | |
81 | 81 | $container->add(['Lister', 'template'=> new \atk4\ui\Template(' |
82 | 82 | <div class="item" style="margin: 0 15px 15px 0"> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | protected function addFileRemoteLinks($container = null) { |
93 | - $container = $container?: $this->canvas; |
|
93 | + $container = $container ?: $this->canvas; |
|
94 | 94 | |
95 | 95 | foreach ($this->file()->links()->where('created_by', Auth::id())->get() as $link) { |
96 | 96 | $container->add(['View', __('Remote access link expiring :expiry', ['expiry' => $link->expires_at])]); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $container->js(true, new jsExpression('new ClipboardJS(".copy-button")')); |
107 | 107 | |
108 | 108 | $container->on('click', '.delete-link', $container->add(['jsCallback', 'postTrigger' => 'link'])->set(function($j, $linkId) { |
109 | - if (! $link = FileRemoteAccess::find($linkId)) return; |
|
109 | + if (!$link = FileRemoteAccess::find($linkId)) return; |
|
110 | 110 | |
111 | 111 | $link->delete(); |
112 | 112 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $dropdown->setSource($this->periodSelection); |
135 | 135 | |
136 | 136 | $dropdown->onChange(function($value) { |
137 | - $period = array_search($value, $this->periodSelection)?: $this->defaultPeriod; |
|
137 | + $period = array_search($value, $this->periodSelection) ?: $this->defaultPeriod; |
|
138 | 138 | |
139 | 139 | FileRemoteAccess::grant($this->file(), $period); |
140 | 140 |
@@ -19,9 +19,9 @@ |
||
19 | 19 | public static function grant($file, $expires = self::DEFAULT_PERIOD) |
20 | 20 | { |
21 | 21 | return self::create([ |
22 | - 'file_id' => is_numeric($file)? $file: $file->id, |
|
22 | + 'file_id' => is_numeric($file) ? $file : $file->id, |
|
23 | 23 | 'token' => md5(uniqid(rand(), true)), |
24 | - 'created_by' => Auth::id()?: 0, |
|
24 | + 'created_by' => Auth::id() ?: 0, |
|
25 | 25 | 'expires_at' => date('Y-m-d H:i:s', strtotime($expires)), |
26 | 26 | ]); |
27 | 27 | } |
@@ -34,11 +34,11 @@ |
||
34 | 34 | $this->grid->setModel($this->getModel()); |
35 | 35 | |
36 | 36 | $this->grid->addDecorator('name', ['Multiformat', function($row, $column) { |
37 | - return [['Template', '<a href="#" class="file-modal" data-id="' . $row['id'] . '">' . $row[$column] . '</a>']]; |
|
37 | + return [['Template', '<a href="#" class="file-modal" data-id="' . $row['id'] . '">' . $row[$column] . '</a>']]; |
|
38 | 38 | }]); |
39 | 39 | |
40 | 40 | $this->grid->addDecorator('created_by', ['Multiformat', function($row, $column) { |
41 | - if (! $user = User::find($row[$column])) return ''; |
|
41 | + if (!$user = User::find($row[$column])) return ''; |
|
42 | 42 | |
43 | 43 | return [['Template', $user->name]]; |
44 | 44 | }]); |