diff --git a/flextype/Fieldsets.php b/flextype/Fieldsets.php index 409fed0e..f752c5f3 100644 --- a/flextype/Fieldsets.php +++ b/flextype/Fieldsets.php @@ -180,7 +180,7 @@ class Fieldsets */ private function _dir_location() : string { - return PATH['themes'] . '/' . $this->flextype['registry']->get('settings.theme') . '/fieldsets/'; + return PATH['site'] . '/fieldsets/'; } /** @@ -192,6 +192,6 @@ class Fieldsets */ private function _file_location(string $id) : string { - return PATH['themes'] . '/' . $this->flextype['registry']->get('settings.theme') . '/fieldsets/' . $id . '.json'; + return PATH['site'] . '/fieldsets/' . $id . '.json'; } } diff --git a/site/themes/default/fieldsets/about.json b/site/fieldsets/about.json similarity index 100% rename from site/themes/default/fieldsets/about.json rename to site/fieldsets/about.json diff --git a/site/themes/default/fieldsets/blog-post.json b/site/fieldsets/blog-post.json similarity index 100% rename from site/themes/default/fieldsets/blog-post.json rename to site/fieldsets/blog-post.json diff --git a/site/themes/default/fieldsets/blog.json b/site/fieldsets/blog.json similarity index 100% rename from site/themes/default/fieldsets/blog.json rename to site/fieldsets/blog.json diff --git a/site/themes/default/fieldsets/default.json b/site/fieldsets/default.json similarity index 100% rename from site/themes/default/fieldsets/default.json rename to site/fieldsets/default.json diff --git a/site/plugins/admin/app/Controllers/EntriesController.php b/site/plugins/admin/app/Controllers/EntriesController.php index 8f05bd0b..cf807910 100644 --- a/site/plugins/admin/app/Controllers/EntriesController.php +++ b/site/plugins/admin/app/Controllers/EntriesController.php @@ -66,7 +66,7 @@ class EntriesController extends Controller $fieldsets = []; // Get fieldsets files - $_fieldsets = Filesystem::listContents(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/'); + $_fieldsets = Filesystem::listContents(PATH['site'] . '/' . '/fieldsets/'); // If there is any template file then go... if (count($_fieldsets) > 0) { @@ -121,11 +121,11 @@ class EntriesController extends Controller if (!$this->entries->has($entry)) { // Get fieldset - $fieldset = JsonParser::decode(Filesystem::read(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/' . $data['fieldset'] . '.json')); + $fieldset = JsonParser::decode(Filesystem::read(PATH['site'] . '/' . '/fieldsets/' . $data['fieldset'] . '.json')); // We need to check if template for current fieldset is exists // if template is not exist then default template will be used! - $template_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/templates/' . $data['fieldset'] . '.html'; + $template_path = PATH['site'] . '/' . '/templates/' . $data['fieldset'] . '.html'; if (Filesystem::has($template_path)) { $template = $data['fieldset']; } else { @@ -191,7 +191,7 @@ class EntriesController extends Controller $fieldsets = []; // Get fieldsets files - $_fieldsets = Filesystem::listContents(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/'); + $_fieldsets = Filesystem::listContents(PATH['site'] . '/' . '/fieldsets/'); // If there is any template file then go... if (count($_fieldsets) > 0) { @@ -503,7 +503,7 @@ class EntriesController extends Controller $entry = $this->entries->fetch($entry_name); // Fieldset for current entry template - $fieldsets_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/fieldsets/' . (isset($entry['fieldset']) ? $entry['fieldset'] : 'default') . '.json'; + $fieldsets_path = PATH['site'] . '/' . '/fieldsets/' . (isset($entry['fieldset']) ? $entry['fieldset'] : 'default') . '.json'; $fieldsets = JsonParser::decode(Filesystem::read($fieldsets_path)); is_null($fieldsets) and $fieldsets = []; diff --git a/site/plugins/admin/app/Controllers/TemplatesController.php b/site/plugins/admin/app/Controllers/TemplatesController.php index 9056bb21..24d68d49 100644 --- a/site/plugins/admin/app/Controllers/TemplatesController.php +++ b/site/plugins/admin/app/Controllers/TemplatesController.php @@ -59,7 +59,7 @@ class TemplatesController extends Controller $id = Text::safeString($request->getParsedBody()['id'], '-', true) . '.html'; - $file = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $id; + $file = PATH['site'] . '/' . $this->_type_location($type) . $id; if (!Filesystem::has($file)) { if (Filesystem::write( @@ -87,7 +87,7 @@ class TemplatesController extends Controller [ 'menu_item' => 'templates', 'id' => $request->getQueryParams()['id'], - 'data' => Filesystem::read(PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'), + 'data' => Filesystem::read(PATH['site'] . '/' . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'), 'type' => (($request->getQueryParams()['type'] && $request->getQueryParams()['type'] == 'partial') ? 'partial' : 'template'), 'links' => [ 'templates' => [ @@ -111,7 +111,7 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type_current']; - if (Filesystem::write(PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) { + if (Filesystem::write(PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) { $this->flash->addMessage('success', __('admin_message_'.$type.'_saved')); } else { $this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_saved')); @@ -145,10 +145,10 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type_current']; - if (!Filesystem::has(PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) { + if (!Filesystem::has(PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) { if (Filesystem::rename( - PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html', - PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html' + PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html', + PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html' ) ) { $this->flash->addMessage('success', __('admin_message_'.$type.'_renamed')); @@ -166,7 +166,7 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type']; - $file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html'; + $file_path = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html'; if (Filesystem::delete($file_path)) { $this->flash->addMessage('success', __('admin_message_'.$type.'_deleted')); @@ -181,8 +181,8 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type']; - $file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html'; - $file_path_new = PATH['themes'] . '/' . $this->registry->get('settings.theme') . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '-duplicate-' . date("Ymd_His") . '.html'; + $file_path = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html'; + $file_path_new = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '-duplicate-' . date("Ymd_His") . '.html'; if (Filesystem::copy($file_path, $file_path_new)) { $this->flash->addMessage('success', __('admin_message_'.$type.'_duplicated'));