diff options
author | Thomas Lange <code@nerdmind.de> | 2021-06-26 14:46:02 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-06-26 14:46:02 +0200 |
commit | 4b454db4f0de0c9547a5f20ac33cd7adfcc3b34f (patch) | |
tree | 2b627199559e0992a6b18282f47a7d149deffd1a /admin | |
parent | 08011d0724d131de9a9b50693eb19b84ceedc038 (diff) | |
download | blog-4b454db4f0de0c9547a5f20ac33cd7adfcc3b34f.tar.gz blog-4b454db4f0de0c9547a5f20ac33cd7adfcc3b34f.tar.xz blog-4b454db4f0de0c9547a5f20ac33cd7adfcc3b34f.zip |
Use shorthand ternary operator
Diffstat (limited to 'admin')
-rw-r--r-- | admin/page/insert.php | 8 | ||||
-rw-r--r-- | admin/page/update.php | 8 | ||||
-rw-r--r-- | admin/post/insert.php | 8 | ||||
-rw-r--r-- | admin/post/update.php | 8 | ||||
-rw-r--r-- | admin/user/insert.php | 12 | ||||
-rw-r--r-- | admin/user/update.php | 12 |
6 files changed, 28 insertions, 28 deletions
diff --git a/admin/page/insert.php b/admin/page/insert.php index 8ec69ea..e1e2412 100644 --- a/admin/page/insert.php +++ b/admin/page/insert.php @@ -26,10 +26,10 @@ $Page = new ORM\Entities\Page; #=============================================================================== if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'insert')) { $Page->set('user', HTTP::POST('user')); - $Page->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : generateSlug(HTTP::POST('name'))); - $Page->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL); - $Page->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL); - $Page->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL); + $Page->set('slug', HTTP::POST('slug') ?: generateSlug(HTTP::POST('name'))); + $Page->set('name', HTTP::POST('name') ?: NULL); + $Page->set('body', HTTP::POST('body') ?: NULL); + $Page->set('argv', HTTP::POST('argv') ?: NULL); $Page->set('time_insert', HTTP::POST('time_insert') ?: date('Y-m-d H:i:s')); $Page->set('time_update', HTTP::POST('time_update') ?: date('Y-m-d H:i:s')); diff --git a/admin/page/update.php b/admin/page/update.php index 2db0bc1..4afb5fb 100644 --- a/admin/page/update.php +++ b/admin/page/update.php @@ -28,10 +28,10 @@ if(!$Page = $PageRepository->find(HTTP::GET('id'))) { #=============================================================================== if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'update')) { $Page->set('user', HTTP::POST('user')); - $Page->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : generateSlug(HTTP::POST('name'))); - $Page->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL); - $Page->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL); - $Page->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL); + $Page->set('slug', HTTP::POST('slug') ?: generateSlug(HTTP::POST('name'))); + $Page->set('name', HTTP::POST('name') ?: NULL); + $Page->set('body', HTTP::POST('body') ?: NULL); + $Page->set('argv', HTTP::POST('argv') ?: NULL); $Page->set('time_insert', HTTP::POST('time_insert') ?: date('Y-m-d H:i:s')); $Page->set('time_update', HTTP::POST('time_update') ?: date('Y-m-d H:i:s')); diff --git a/admin/post/insert.php b/admin/post/insert.php index 72f40b6..70435cc 100644 --- a/admin/post/insert.php +++ b/admin/post/insert.php @@ -26,10 +26,10 @@ $Post = new ORM\Entities\Post; #=============================================================================== if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'insert')) { $Post->set('user', HTTP::POST('user')); - $Post->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : generateSlug(HTTP::POST('name'))); - $Post->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL); - $Post->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL); - $Post->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL); + $Post->set('slug', HTTP::POST('slug') ?: generateSlug(HTTP::POST('name'))); + $Post->set('name', HTTP::POST('name') ?: NULL); + $Post->set('body', HTTP::POST('body') ?: NULL); + $Post->set('argv', HTTP::POST('argv') ?: NULL); $Post->set('time_insert', HTTP::POST('time_insert') ?: date('Y-m-d H:i:s')); $Post->set('time_update', HTTP::POST('time_update') ?: date('Y-m-d H:i:s')); diff --git a/admin/post/update.php b/admin/post/update.php index df0956b..9091e59 100644 --- a/admin/post/update.php +++ b/admin/post/update.php @@ -28,10 +28,10 @@ if(!$Post = $PostRepository->find(HTTP::GET('id'))) { #=============================================================================== if(HTTP::issetPOST('user', 'slug', 'name', 'body', 'argv', 'time_insert', 'time_update', 'update')) { $Post->set('user', HTTP::POST('user')); - $Post->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : generateSlug(HTTP::POST('name'))); - $Post->set('name', HTTP::POST('name') ? HTTP::POST('name') : NULL); - $Post->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL); - $Post->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL); + $Post->set('slug', HTTP::POST('slug') ?: generateSlug(HTTP::POST('name'))); + $Post->set('name', HTTP::POST('name') ?: NULL); + $Post->set('body', HTTP::POST('body') ?: NULL); + $Post->set('argv', HTTP::POST('argv') ?: NULL); $Post->set('time_insert', HTTP::POST('time_insert') ?: date('Y-m-d H:i:s')); $Post->set('time_update', HTTP::POST('time_update') ?: date('Y-m-d H:i:s')); diff --git a/admin/user/insert.php b/admin/user/insert.php index 67b62fa..4a49492 100644 --- a/admin/user/insert.php +++ b/admin/user/insert.php @@ -24,13 +24,13 @@ $User = new ORM\Entities\User; # Check for insert request #=============================================================================== if(HTTP::issetPOST('slug', 'username', 'password', 'fullname', 'mailaddr', 'body', 'argv', 'time_insert', 'time_update', 'insert')) { - $User->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : generateSlug(HTTP::POST('username'))); - $User->set('username', HTTP::POST('username') ? HTTP::POST('username') : NULL); + $User->set('slug', HTTP::POST('slug') ?: generateSlug(HTTP::POST('username'))); + $User->set('username', HTTP::POST('username') ?: NULL); $User->set('password', HTTP::POST('password') ? password_hash(HTTP::POST('password'), PASSWORD_BCRYPT, ['cost' => 10]) : FALSE); - $User->set('fullname', HTTP::POST('fullname') ? HTTP::POST('fullname') : NULL); - $User->set('mailaddr', HTTP::POST('mailaddr') ? HTTP::POST('mailaddr') : NULL); - $User->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL); - $User->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL); + $User->set('fullname', HTTP::POST('fullname') ?: NULL); + $User->set('mailaddr', HTTP::POST('mailaddr') ?: NULL); + $User->set('body', HTTP::POST('body') ?: NULL); + $User->set('argv', HTTP::POST('argv') ?: NULL); $User->set('time_insert', HTTP::POST('time_insert') ?: date('Y-m-d H:i:s')); $User->set('time_update', HTTP::POST('time_update') ?: date('Y-m-d H:i:s')); diff --git a/admin/user/update.php b/admin/user/update.php index 1f3309b..5a90ec3 100644 --- a/admin/user/update.php +++ b/admin/user/update.php @@ -26,13 +26,13 @@ if(!$User = $UserRepository->find(HTTP::GET('id'))) { # Check for update request #=============================================================================== if(HTTP::issetPOST('slug', 'username', 'password', 'fullname', 'mailaddr', 'body', 'argv', 'time_insert', 'time_update', 'update')) { - $User->set('slug', HTTP::POST('slug') ? HTTP::POST('slug') : generateSlug(HTTP::POST('username'))); - $User->set('username', HTTP::POST('username') ? HTTP::POST('username') : NULL); + $User->set('slug', HTTP::POST('slug') ?: generateSlug(HTTP::POST('username'))); + $User->set('username', HTTP::POST('username') ?: NULL); $User->set('password', HTTP::POST('password') ? password_hash(HTTP::POST('password'), PASSWORD_BCRYPT, ['cost' => 10]) : FALSE); - $User->set('fullname', HTTP::POST('fullname') ? HTTP::POST('fullname') : NULL); - $User->set('mailaddr', HTTP::POST('mailaddr') ? HTTP::POST('mailaddr') : NULL); - $User->set('body', HTTP::POST('body') ? HTTP::POST('body') : NULL); - $User->set('argv', HTTP::POST('argv') ? HTTP::POST('argv') : NULL); + $User->set('fullname', HTTP::POST('fullname') ?: NULL); + $User->set('mailaddr', HTTP::POST('mailaddr') ?: NULL); + $User->set('body', HTTP::POST('body') ?: NULL); + $User->set('argv', HTTP::POST('argv') ?: NULL); $User->set('time_insert', HTTP::POST('time_insert') ?: date('Y-m-d H:i:s')); $User->set('time_update', HTTP::POST('time_update') ?: date('Y-m-d H:i:s')); |