Skip to content

Commit 84c2441

Browse files
committed
Merge branch 'master' into dev
2 parents d6e8d5e + c065d6d commit 84c2441

18 files changed

+130
-63
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Global
2+
.composer
3+
composer.lock
4+
package-lock.json
5+
vendor/
6+
node_modules/
7+
dist/
8+
9+
# Flextype Site Specific
10+
var/
11+
112
# OS Generated
213
.DS_Store*
314
ehthumbs.db

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<a name="1.4.0"></a>
2+
# [1.4.0](https://github.com/flextype-plugins/admin) (2020-12-07)
3+
4+
### Features
5+
6+
* **core** update code base for new Flextype 0.9.12
7+
18
<a name="1.3.1"></a>
29
# [1.3.1(https://github.com/flextype-plugins/admin) (2020-08-26)
310

app/Controllers/ApiAccessController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;
@@ -142,9 +142,9 @@ public function addProcess(Request $request, Response $response) : Response
142142
'calls' => (int) 0,
143143
'state' => $post_data['state'],
144144
'uuid' => $uuid,
145-
'created_by' => Session::get('uuid'),
145+
'created_by' => flextype('session')->get('uuid'),
146146
'created_at' => $time,
147-
'updated_by' => Session::get('uuid'),
147+
'updated_by' => flextype('session')->get('uuid'),
148148
'updated_at' => $time,
149149
])
150150
)) {
@@ -227,7 +227,7 @@ public function editProcess(Request $request, Response $response) : Response
227227
'uuid' => $post_data['uuid'],
228228
'created_by' => $post_data['created_by'],
229229
'created_at' => $post_data['created_at'],
230-
'updated_by' => Session::get('uuid'),
230+
'updated_by' => flextype('session')->get('uuid'),
231231
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
232232
])
233233
)) {

app/Controllers/ApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;

app/Controllers/ApiEntriesController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;
@@ -142,9 +142,9 @@ public function addProcess(Request $request, Response $response) : Response
142142
'calls' => (int) 0,
143143
'state' => $post_data['state'],
144144
'uuid' => $uuid,
145-
'created_by' => Session::get('uuid'),
145+
'created_by' => flextype('session')->get('uuid'),
146146
'created_at' => $time,
147-
'updated_by' => Session::get('uuid'),
147+
'updated_by' => flextype('session')->get('uuid'),
148148
'updated_at' => $time,
149149
])
150150
)) {
@@ -227,7 +227,7 @@ public function editProcess(Request $request, Response $response) : Response
227227
'uuid' => $post_data['uuid'],
228228
'created_by' => $post_data['created_by'],
229229
'created_at' => $post_data['created_at'],
230-
'updated_by' => Session::get('uuid'),
230+
'updated_by' => flextype('session')->get('uuid'),
231231
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
232232
])
233233
)) {

app/Controllers/ApiFilesController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;
@@ -142,9 +142,9 @@ public function addProcess(Request $request, Response $response) : Response
142142
'calls' => (int) 0,
143143
'state' => $post_data['state'],
144144
'uuid' => $uuid,
145-
'created_by' => Session::get('uuid'),
145+
'created_by' => flextype('session')->get('uuid'),
146146
'created_at' => $time,
147-
'updated_by' => Session::get('uuid'),
147+
'updated_by' => flextype('session')->get('uuid'),
148148
'updated_at' => $time,
149149
])
150150
)) {
@@ -227,7 +227,7 @@ public function editProcess(Request $request, Response $response) : Response
227227
'uuid' => $post_data['uuid'],
228228
'created_by' => $post_data['created_by'],
229229
'created_at' => $post_data['created_at'],
230-
'updated_by' => Session::get('uuid'),
230+
'updated_by' => flextype('session')->get('uuid'),
231231
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
232232
])
233233
)) {

app/Controllers/ApiFoldersController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;
@@ -140,9 +140,9 @@ public function addProcess(Request $request, Response $response) : Response
140140
'calls' => (int) 0,
141141
'state' => $post_data['state'],
142142
'uuid' => $uuid,
143-
'created_by' => Session::get('uuid'),
143+
'created_by' => flextype('session')->get('uuid'),
144144
'created_at' => $time,
145-
'updated_by' => Session::get('uuid'),
145+
'updated_by' => flextype('session')->get('uuid'),
146146
'updated_at' => $time,
147147
])
148148
)) {
@@ -225,7 +225,7 @@ public function editProcess(Request $request, Response $response) : Response
225225
'uuid' => $post_data['uuid'],
226226
'created_by' => $post_data['created_by'],
227227
'created_at' => $post_data['created_at'],
228-
'updated_by' => Session::get('uuid'),
228+
'updated_by' => flextype('session')->get('uuid'),
229229
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
230230
])
231231
)) {

app/Controllers/ApiImagesController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;
@@ -140,9 +140,9 @@ public function addProcess(Request $request, Response $response) : Response
140140
'calls' => (int) 0,
141141
'state' => $post_data['state'],
142142
'uuid' => $uuid,
143-
'created_by' => Session::get('uuid'),
143+
'created_by' => flextype('session')->get('uuid'),
144144
'created_at' => $time,
145-
'updated_by' => Session::get('uuid'),
145+
'updated_by' => flextype('session')->get('uuid'),
146146
'updated_at' => $time,
147147
])
148148
)) {
@@ -225,7 +225,7 @@ public function editProcess(Request $request, Response $response) : Response
225225
'uuid' => $post_data['uuid'],
226226
'created_by' => $post_data['created_by'],
227227
'created_at' => $post_data['created_at'],
228-
'updated_by' => Session::get('uuid'),
228+
'updated_by' => flextype('session')->get('uuid'),
229229
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
230230
])
231231
)) {

app/Controllers/ApiRegistryController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Flextype\Plugin\Admin\Controllers;
66

77
use Flextype\Component\Filesystem\Filesystem;
8-
use Flextype\Component\Session\Session;
8+
99
use Psr\Http\Message\ResponseInterface as Response;
1010
use Psr\Http\Message\ServerRequestInterface as Request;
1111
use Ramsey\Uuid\Uuid;
@@ -140,9 +140,9 @@ public function addProcess(Request $request, Response $response) : Response
140140
'calls' => (int) 0,
141141
'state' => $post_data['state'],
142142
'uuid' => $uuid,
143-
'created_by' => Session::get('uuid'),
143+
'created_by' => flextype('session')->get('uuid'),
144144
'created_at' => $time,
145-
'updated_by' => Session::get('uuid'),
145+
'updated_by' => flextype('session')->get('uuid'),
146146
'updated_at' => $time,
147147
])
148148
)) {
@@ -225,7 +225,7 @@ public function editProcess(Request $request, Response $response) : Response
225225
'uuid' => $post_data['uuid'],
226226
'created_by' => $post_data['created_by'],
227227
'created_at' => $post_data['created_at'],
228-
'updated_by' => Session::get('uuid'),
228+
'updated_by' => flextype('session')->get('uuid'),
229229
'updated_at' => date(flextype('registry')->get('flextype.settings.date_format'), time()),
230230
])
231231
)) {

app/Controllers/EntriesController.php

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Flextype\Plugin\Admin\Controllers;
44

55
use Flextype\Component\Filesystem\Filesystem;
6-
use Flextype\Component\Session\Session;
6+
77
use Flextype\Component\Arrays\Arrays;
88
use function Flextype\Component\I18n\__;
99
use Respect\Validation\Validator as v;
@@ -82,7 +82,7 @@ public function index(Request $request, Response $response) : Response
8282
}
8383
}
8484

85-
$entry_current = flextype('entries')->fetch($this->getEntryID($query));
85+
$entry_current = flextype('entries')->fetchSingle($this->getEntryID($query))->toArray();
8686

8787
if (isset($entry_current['items_view'])) {
8888
$items_view = $entry_current['items_view'];
@@ -92,12 +92,16 @@ public function index(Request $request, Response $response) : Response
9292

9393
$entries_list = [];
9494
$entries_collection = [];
95-
$entries_collection = collect(flextype('entries')->fetchCollection($this->getEntryID($query), ['depth' => ['1']]))->orderBy('published_at', 'DESC')->all();
95+
$entries_collection = arrays(flextype('entries')
96+
->fetchCollection($this->getEntryID($query),
97+
['depth' => ['1']]))
98+
->sortBy('published_at', 'DESC')
99+
->toArray();
96100

97101
foreach ($entries_collection as $slug => $body) {
98102
$entries_list[$slug] = $body;
99-
if (find()->in(PATH['project'] . '/entries/' . $slug)->depth('>=1')->depth('<=2')->hasResults()) {
100-
$entries_list[$slug] += ['has_children' => true];
103+
if (filesystem()->find()->in(PATH['project'] . '/entries/' . $slug)->depth('>=1')->depth('<=2')->hasResults()) {
104+
$entries_list[$slug]['has_children'] = true;
101105
}
102106
}
103107

@@ -158,7 +162,7 @@ public function add(Request $request, Response $response) : Response
158162
$response,
159163
'plugins/admin/templates/content/entries/add.html',
160164
[
161-
'entries_list' => collect(flextype('entries')->fetchCollection($this->getEntryID($query)))->orderBy('order_by', 'ASC')->all(),
165+
'entries_list' => arrays(flextype('entries')->fetchCollection($this->getEntryID($query)))->sortBy('order_by', 'ASC')->toArray(),
162166
'menu_item' => 'entries',
163167
'current_id' => $this->getEntryID($query),
164168
'parts' => $parts,
@@ -231,7 +235,7 @@ public function addProcess(Request $request, Response $response) : Response
231235
if (flextype('fieldsets')->has($data['fieldset'])) {
232236

233237
// Get fieldset
234-
$fieldset = flextype('fieldsets')->fetch($data['fieldset']);
238+
$fieldset = flextype('fieldsets')->fetchSingle($data['fieldset']);
235239

236240
// Init entry data
237241
$data_from_post = [];
@@ -332,7 +336,7 @@ public function type(Request $request, Response $response) : Response
332336
$parts = [0 => ''];
333337
}
334338

335-
$entry = flextype('entries')->fetch($this->getEntryID($query));
339+
$entry = flextype('entries')->fetchSingle($this->getEntryID($query))->toArray();
336340

337341
$fieldsets = [];
338342

@@ -400,7 +404,7 @@ public function typeProcess(Request $request, Response $response) : Response
400404

401405
$id = $post_data['id'];
402406

403-
$entry = flextype('entries')->fetch($id);
407+
$entry = flextype('entries')->fetchSingle($id)->toArray();
404408

405409
Arrays::delete($entry, 'slug');
406410
Arrays::delete($entry, 'id');
@@ -451,7 +455,7 @@ public function move(Request $request, Response $response) : Response
451455
$entry_id_current = array_pop($parts);
452456

453457
// Fetch entry
454-
$entry = flextype('entries')->fetch($this->getEntryID($query));
458+
$entry = flextype('entries')->fetchSingle($this->getEntryID($query))->toArray();
455459

456460
// Set Entries IDs in parts
457461
if (isset($query['id'])) {
@@ -462,7 +466,7 @@ public function move(Request $request, Response $response) : Response
462466

463467
// Get entries list
464468
$entries_list['/'] = '/';
465-
foreach (flextype('entries')->fetchCollection('', ['depth' => '>0', 'order_by' => ['field' => ['id']]]) as $_entry) {
469+
foreach (flextype('entries')->fetchCollection('', ['depth' => '>0', 'order_by' => ['field' => ['id']]])->toArray() as $_entry) {
466470
if ($_entry['id'] != '') {
467471
$entries_list[$_entry['id']] = $_entry['id'];
468472
} else {
@@ -515,11 +519,11 @@ public function moveProcess(Request $request, Response $response)
515519
$entry_id_current = $data['entry_id_current'];
516520

517521
if (!flextype('entries')->has($data['parent_entry'] . '/' . $entry_id_current)) {
518-
if (flextype('entries')->rename(
522+
if (flextype('entries')->move(
519523
$data['entry_id_path_current'],
520524
$data['parent_entry'] . '/' . $entry_id_current
521525
)) {
522-
flextype('media_folders')->rename('entries/' . $data['entry_id_path_current'], 'entries/' . $data['parent_entry'] . '/' . $entry_id_current);
526+
flextype('media_folders')->move('entries/' . $data['entry_id_path_current'], 'entries/' . $data['parent_entry'] . '/' . $entry_id_current);
523527

524528
flextype('flash')->addMessage('success', __('admin_message_entry_moved'));
525529
} else {
@@ -601,11 +605,11 @@ public function renameProcess(Request $request, Response $response) : Response
601605
$name = $data['name'];
602606
}
603607

604-
if (flextype('entries')->rename(
608+
if (flextype('entries')->move(
605609
$data['entry_path_current'],
606610
$data['entry_parent'] . '/' . $name)
607611
) {
608-
flextype('media_folders')->rename('entries/' . $data['entry_path_current'], 'entries/' . $data['entry_parent'] . '/' . flextype('slugify')->slugify($data['name']));
612+
flextype('media_folders')->move('entries/' . $data['entry_path_current'], 'entries/' . $data['entry_parent'] . '/' . flextype('slugify')->slugify($data['name']));
609613
flextype('flash')->addMessage('success', __('admin_message_entry_renamed'));
610614
} else {
611615
flextype('flash')->addMessage('error', __('admin_message_entry_was_not_renamed'));
@@ -659,9 +663,12 @@ public function duplicateProcess(Request $request, Response $response) : Respons
659663
$random_date = date("Ymd_His");
660664

661665
flextype('entries')->copy($id, $id . '-duplicate-' . $random_date, true);
666+
flextype('media_folders')->copy('entries/' . $id, 'entries/' . $id . '-duplicate-' . $random_date, true);
662667

663668
if (Filesystem::has(PATH['project'] . '/uploads' . '/entries/' . $id)) {
664-
Filesystem::copy(PATH['project'] . '/uploads' . '/entries/' . $id, PATH['project'] . '/uploads' . '/entries/' . $id . '-duplicate-' . $random_date, true);
669+
filesystem()
670+
->directory(PATH['project'] . '/uploads' . '/entries/' . $id)
671+
->copy(PATH['project'] . '/uploads' . '/entries/' . $id . '-duplicate-' . $random_date);
665672
} else {
666673
Filesystem::createDir(PATH['project'] . '/uploads' . '/entries/' . $id . '-duplicate-' . $random_date);
667674
}
@@ -697,7 +704,7 @@ public function edit(Request $request, Response $response) : Response
697704
flextype('registry')->set('entries.fields.parsers.settings.enabled', false);
698705

699706
// Get Entry
700-
$entry = flextype('entries')->fetch($this->getEntryID($query));
707+
$entry = flextype('entries')->fetchSingle($this->getEntryID($query))->toArray();
701708

702709
Arrays::delete($entry, 'slug');
703710
Arrays::delete($entry, 'id');
@@ -893,11 +900,10 @@ public function editProcess(Request $request, Response $response) : Response
893900
isset($data['flatpickr-date-format']) and Arrays::delete($data, 'flatpickr-date-format');
894901
isset($data['flatpickr-locale']) and Arrays::delete($data, 'flatpickr-locale');
895902

896-
897-
$data['published_by'] = Session::get('uuid');
903+
$data['published_by'] = flextype('session')->get('uuid');
898904

899905
// Fetch entry
900-
$entry = flextype('entries')->fetch($id);
906+
$entry = flextype('entries')->fetchSingle($id)->toArray();
901907
Arrays::delete($entry, 'slug');
902908
Arrays::delete($entry, 'id');
903909
Arrays::delete($entry, 'modified_at');

0 commit comments

Comments
 (0)