@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $empty = true; |
| 88 | 88 | |
| 89 | 89 | foreach ($values as $value) { |
| 90 | - if (! $value || !trim($value)) { |
|
| 90 | + if (!$value || !trim($value)) { |
|
| 91 | 91 | continue; |
| 92 | 92 | } |
| 93 | 93 | $empty = false; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | -if (! function_exists('contract')) { |
|
| 100 | +if (!function_exists('contract')) { |
|
| 101 | 101 | function contract($instance, $contract) |
| 102 | 102 | { |
| 103 | 103 | return $instance instanceof $contract; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $text = cleanupHTML($text, $clean); |
| 127 | 127 | } |
| 128 | 128 | $teaser = substr($text, 0, $max); |
| 129 | - return strlen($text) <= $max ? $teaser : $teaser . $ending; |
|
| 129 | + return strlen($text) <= $max ? $teaser : $teaser.$ending; |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | function cleanupHTML($value, $whitelist = null) |
| 166 | 166 | { |
| 167 | 167 | if (!function_exists('cleanupHTML')) { |
| 168 | - require_once __DIR__ . '/vendors/htmlLawed.php'; |
|
| 168 | + require_once __DIR__.'/vendors/htmlLawed.php'; |
|
| 169 | 169 | } |
| 170 | 170 | if (is_null($whitelist)) { |
| 171 | 171 | $whitelist = '<code><span><div><label><a><br><p><b><i><del><strike><u><img><video><audio><iframe><object><embed><param><blockquote><mark><cite><small><ul><ol><li><hr><dl><dt><dd><sup><sub><big><pre><code><figure><figcaption><strong><em><table><tr><td><th><tbody><thead><tfoot><h1><h2><h3><h4><h5><h6>'; |
@@ -251,16 +251,16 @@ discard block |
||
| 251 | 251 | 'scheme', 'host', 'port', 'path', 'query', 'fragment' |
| 252 | 252 | ], null), $parsed_url, $overrides); |
| 253 | 253 | |
| 254 | - $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'] . '://' : null; |
|
| 255 | - $port = $parsed_url['port'] ? ':' . $parsed_url['port'] : null; |
|
| 256 | - $fragment = $parsed_url['fragment'] ? '#' . $parsed_url['fragment'] : null; |
|
| 254 | + $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'].'://' : null; |
|
| 255 | + $port = $parsed_url['port'] ? ':'.$parsed_url['port'] : null; |
|
| 256 | + $fragment = $parsed_url['fragment'] ? '#'.$parsed_url['fragment'] : null; |
|
| 257 | 257 | |
| 258 | - $baseurl = $scheme . $parsed_url['host'] . $port . $parsed_url['path']; |
|
| 258 | + $baseurl = $scheme.$parsed_url['host'].$port.$parsed_url['path']; |
|
| 259 | 259 | $current_query = []; |
| 260 | 260 | |
| 261 | 261 | $_query = explode('&', $parsed_url['query']); |
| 262 | 262 | |
| 263 | - array_map(function ($v) use (&$current_query) { |
|
| 263 | + array_map(function($v) use (&$current_query) { |
|
| 264 | 264 | if (!$v) { |
| 265 | 265 | return; |
| 266 | 266 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $query = urldecode(http_build_query(array_merge($current_query, $query_params))); |
| 280 | 280 | |
| 281 | - return $baseurl . '?' . $query . $fragment; |
|
| 281 | + return $baseurl.'?'.$query.$fragment; |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -287,9 +287,9 @@ discard block |
||
| 287 | 287 | { |
| 288 | 288 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
| 289 | 289 | if (php_sapi_name() == 'cli') { |
| 290 | - print_r("\e[1;30m dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "\e[40m\n"); |
|
| 291 | - } else { |
|
| 292 | - print_r("[dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "]\n"); |
|
| 290 | + print_r("\e[1;30m dumped at: ".str_replace(base_path(), '', $trace[0]['file']).", line: ".$trace[0]['line']."\e[40m\n"); |
|
| 291 | + }else { |
|
| 292 | + print_r("[dumped at: ".str_replace(base_path(), '', $trace[0]['file']).", line: ".$trace[0]['line']."]\n"); |
|
| 293 | 293 | } |
| 294 | 294 | return dd($var, ...$moreVars); |
| 295 | 295 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public static function fromKeys($keys) |
| 21 | 21 | { |
| 22 | - $keys = (array) $keys; |
|
| 22 | + $keys = (array)$keys; |
|
| 23 | 23 | $collection = collect(); |
| 24 | 24 | |
| 25 | 25 | /** @var Managers */ |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public static function fromTags($tags) |
| 35 | 35 | { |
| 36 | - $tags = (array) $tags; |
|
| 36 | + $tags = (array)$tags; |
|
| 37 | 37 | $collection = collect(); |
| 38 | 38 | |
| 39 | 39 | /** @var Managers */ |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private static function fromManagers(Collection $collection) |
| 54 | 54 | { |
| 55 | - return new static(...$collection->reject(function ($manager) { |
|
| 55 | + return new static(...$collection->reject(function($manager) { |
|
| 56 | 56 | return !$manager->can('index'); |
| 57 | - })->map(function ($manager) { |
|
| 57 | + })->map(function($manager) { |
|
| 58 | 58 | return new NavItem($manager->details()->plural, $manager->route('index'), [ |
| 59 | 59 | 'key' => $manager->details()->key, |
| 60 | 60 | 'tags' => app(Register::class)->filterByKey($manager->details()->key)->first()->tags() |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function rejectKeys($keys) |
| 66 | 66 | { |
| 67 | - $keys = (array) $keys; |
|
| 67 | + $keys = (array)$keys; |
|
| 68 | 68 | |
| 69 | 69 | foreach ($this->items as $k => $item) { |
| 70 | 70 | if (in_array($item->details('key', ''), $keys)) { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | public function rejectTags($tags) |
| 79 | 79 | { |
| 80 | - $tags = (array) $tags; |
|
| 80 | + $tags = (array)$tags; |
|
| 81 | 81 | |
| 82 | 82 | foreach ($this->items as $k => $item) { |
| 83 | 83 | if (count(array_intersect($item->details('tags', []), $tags)) > 0) { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $output = ''; |
| 120 | 120 | |
| 121 | 121 | foreach ($this->items as $item) { |
| 122 | - $output .= '<a class="block nav-item ' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">'; |
|
| 122 | + $output .= '<a class="block nav-item '.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">'; |
|
| 123 | 123 | $output .= $title ?? ucfirst($item->title()); |
| 124 | 124 | $output .= '</a>'; |
| 125 | 125 | } |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $items = ''; |
| 148 | 148 | foreach ($this->items as $item) { |
| 149 | - $items .= '<a class="block squished --link-with-bg ' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">'; |
|
| 149 | + $items .= '<a class="block squished --link-with-bg '.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">'; |
|
| 150 | 150 | $items .= $item->title(); |
| 151 | 151 | $items .= '</a>'; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Surround within vue dropdown |
| 155 | 155 | $output = '<dropdown>'; |
| 156 | - $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'. ($title ?? 'Collecties') .'</span>'; |
|
| 156 | + $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.($title ?? 'Collecties').'</span>'; |
|
| 157 | 157 | $output .= '<div v-cloak class="dropdown-box inset-s">'; |
| 158 | 158 | $output .= $items; |
| 159 | 159 | $output .= '</div>'; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public static function rolesForSelect($includeDeveloperRole = false) |
| 20 | 20 | { |
| 21 | - $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function ($role) { |
|
| 21 | + $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function($role) { |
|
| 22 | 22 | return $role->name == 'developer'; |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | public function getPermissionsForIndex() |
| 41 | 41 | { |
| 42 | - $this->permissions->each(function ($permission) { |
|
| 42 | + $this->permissions->each(function($permission) { |
|
| 43 | 43 | $model = explode("_", $permission->name, 2)[1]; |
| 44 | 44 | $temp = $this->permission; |
| 45 | 45 | $temp[$model][] = explode("_", $permission->name, 2)[0]; |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $permission = 'update-page'; |
| 65 | 65 | |
| 66 | - if (in_array($verb, ['index','show'])) { |
|
| 66 | + if (in_array($verb, ['index', 'show'])) { |
|
| 67 | 67 | $permission = 'view-page'; |
| 68 | - } elseif (in_array($verb, ['create','store'])) { |
|
| 68 | + } elseif (in_array($verb, ['create', 'store'])) { |
|
| 69 | 69 | $permission = 'create-page'; |
| 70 | 70 | } elseif (in_array($verb, ['delete'])) { |
| 71 | 71 | $permission = 'delete-page'; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
| 74 | + if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
| 75 | 75 | throw NotAllowedManagerRoute::notAllowedPermission($permission, $this); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public function saveFields(): Manager |
| 104 | 104 | { |
| 105 | 105 | // Store the morph_key upon creation |
| 106 | - if (! $this->model->morph_key) { |
|
| 106 | + if (!$this->model->morph_key) { |
|
| 107 | 107 | $this->model->morph_key = $this->model->morphKey(); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (is_array_empty($translation)) { |
| 143 | 143 | |
| 144 | 144 | // Nullify all values |
| 145 | - $trans[$locale] = array_map(function ($value) { |
|
| 145 | + $trans[$locale] = array_map(function($value) { |
|
| 146 | 146 | return null; |
| 147 | 147 | }, $translation); |
| 148 | 148 | continue; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (is_string($file)) { |
| 60 | 60 | $image_name = json_decode($file)->output->name; |
| 61 | 61 | $asset = $this->addAsset(json_decode($file)->output->image, $type, null, $image_name, $model); |
| 62 | - } else { |
|
| 62 | + }else { |
|
| 63 | 63 | $image_name = $file->getClientOriginalName(); |
| 64 | 64 | $asset = $this->addAsset($file, $type, null, $image_name, $model); |
| 65 | 65 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | if (is_string($file)) { |
| 84 | 84 | $asset = AssetUploader::uploadFromBase64($file, $filename); |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $asset = AssetUploader::upload($file, $filename); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | private function sluggifyFilename($filename): string |
| 128 | 128 | { |
| 129 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
| 129 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
| 130 | 130 | $filename = substr($filename, 0, strrpos($filename, '.')); |
| 131 | - $filename = str_slug($filename) . '.' . $extension; |
|
| 131 | + $filename = str_slug($filename).'.'.$extension; |
|
| 132 | 132 | |
| 133 | 133 | return $filename; |
| 134 | 134 | } |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | if ($file instanceof UploadedFile && !$file->isValid()) { |
| 145 | 145 | if ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
| 146 | 146 | throw new FileTooBigException( |
| 147 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' . |
|
| 148 | - 'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . |
|
| 149 | - 'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' |
|
| 147 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '. |
|
| 148 | + 'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. |
|
| 149 | + 'post_max_size: '.(int)(ini_get('post_max_size')).'MB' |
|
| 150 | 150 | ); |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | public function apply($value = null): Closure |
| 17 | 17 | { |
| 18 | - return $this->query && $this->query instanceof Closure ? $this->query : function ($query) { |
|
| 18 | + return $this->query && $this->query instanceof Closure ? $this->query : function($query) { |
|
| 19 | 19 | return $query; |
| 20 | 20 | }; |
| 21 | 21 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Thinktomorrow\Chief\Fields\Types; |
| 5 | 5 | |