mirror of
https://github.com/flextype/flextype.git
synced 2025-08-12 08:04:05 +02:00
fix(core): Fix all namespaces #437
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Cache\Common\AcpuCache;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\ArrayCache;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
use function clearstatcache;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\FilesystemCache;
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\MemcachedCache;
|
||||
use Memecached;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\RedisCache;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\SQLite3Cache;
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\WinCacheCache;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Flextype\Cache;
|
||||
namespace Flextype\Foundation\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\ZendDataCache;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
namespace Flextype\Foundation;
|
||||
|
||||
use Flextype\Component\Arr\Arr;
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
@@ -43,7 +43,7 @@ class Config
|
||||
$config_file = $this->getFileLocation($config);
|
||||
|
||||
if (Filesystem::has($config_file)) {
|
||||
return Arr::get($this->flextype->serializer->decode(Filesystem::read($config_file), 'yaml'), $key, $default);
|
||||
return Arr::get($this->flextype->yaml->decode(Filesystem::read($config_file)), $key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,12 @@ class Config
|
||||
$config_file = $this->getFileLocation($config);
|
||||
|
||||
if (Filesystem::has($config_file)) {
|
||||
$config_file_data = $this->flextype->serializer->decode(Filesystem::read($config_file), 'yaml');
|
||||
$config_file_data = $this->flextype->yaml->decode(Filesystem::read($config_file));
|
||||
|
||||
if (! Arr::keyExists($config_file_data, $key)) {
|
||||
if (! array_has($config_file_data, $key)) {
|
||||
Arr::set($config_file_data, $key, $value);
|
||||
|
||||
return Filesystem::write($config_file, $this->flextype->serializer->encode($config_file_data, 'yaml'));
|
||||
return Filesystem::write($config_file, $this->flextype->yaml->encode($config_file_data));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -85,12 +85,12 @@ class Config
|
||||
$config_file = $this->getFileLocation($config);
|
||||
|
||||
if (Filesystem::has($config_file)) {
|
||||
$config_file_data = $this->flextype->serializer->decode(Filesystem::read($config_file), 'yaml');
|
||||
$config_file_data = $this->flextype->yaml->decode(Filesystem::read($config_file));
|
||||
|
||||
if (Arr::keyExists($config_file_data, $key)) {
|
||||
if (array_has($config_file_data, $key)) {
|
||||
Arr::set($config_file_data, $key, $value);
|
||||
|
||||
return Filesystem::write($config_file, $this->flextype->serializer->encode($config_file_data, 'yaml'));
|
||||
return Filesystem::write($config_file, $this->flextype->yaml->encode($config_file_data));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -110,12 +110,12 @@ class Config
|
||||
$config_file = $this->getFileLocation($config);
|
||||
|
||||
if (Filesystem::has($config_file)) {
|
||||
$config_file_data = $this->flextype->serializer->decode(Filesystem::read($config_file), 'yaml');
|
||||
$config_file_data = $this->flextype->yaml->decode(Filesystem::read($config_file));
|
||||
|
||||
if (Arr::keyExists($config_file_data, $key)) {
|
||||
Arr::delete($config_file_data, $key);
|
||||
if (array_has($config_file_data, $key)) {
|
||||
array_delete($config_file_data, $key);
|
||||
|
||||
return Filesystem::write($config_file, $this->flextype->serializer->encode($config_file_data, 'yaml'));
|
||||
return Filesystem::write($config_file, $this->flextype->yaml->encode($config_file_data));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -135,9 +135,9 @@ class Config
|
||||
$config_file = $this->getFileLocation($config);
|
||||
|
||||
if (Filesystem::has($config_file)) {
|
||||
$config_file_data = $this->flextype->serializer->decode(Filesystem::read($config_file), 'yaml');
|
||||
$config_file_data = $this->flextype->yaml->decode(Filesystem::read($config_file));
|
||||
|
||||
if (Arr::keyExists($config_file_data, $key)) {
|
||||
if (array_has($config_file_data, $key)) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype (https://flextype.org)
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
class Container
|
||||
{
|
||||
/**
|
||||
* Flextype Dependency Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*/
|
||||
public function __construct($container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* __get
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if ($this->container->{$property}) {
|
||||
return $this->container->{$property};
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
namespace Flextype\Foundation;
|
||||
|
||||
use function count;
|
||||
use function implode;
|
||||
@@ -66,5 +66,6 @@ class Cors
|
||||
->withHeader('Access-Control-Allow-Expose', $expose)
|
||||
->withHeader('Access-Control-Allow-Credentials', $credentials);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
namespace Flextype\Foundation;
|
||||
|
||||
use Flextype\Component\Arr\Arr;
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
@@ -152,7 +152,7 @@ class Entries
|
||||
}
|
||||
|
||||
// Try to get requested entry from the filesystem
|
||||
$entry_decoded = $this->flextype['serializer']->decode(Filesystem::read($entry_file), 'frontmatter');
|
||||
$entry_decoded = $this->flextype['frontmatter']->decode(Filesystem::read($entry_file));
|
||||
|
||||
// Set system entry fields
|
||||
|
||||
@@ -209,8 +209,8 @@ class Entries
|
||||
}
|
||||
|
||||
if ($parser_name === 'markdown') {
|
||||
if (Arr::keyExists($entry_decoded, $field)) {
|
||||
Arr::set($entry_decoded, $field, $this->flextype['parser']->parse(Arr::get($entry_decoded, $field), 'markdown', $cache));
|
||||
if (array_has($entry_decoded, $field)) {
|
||||
array_set($entry_decoded, $field, $this->flextype['parser']->parse(Arr::get($entry_decoded, $field), 'markdown', $cache));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,11 +218,11 @@ class Entries
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! Arr::keyExists($entry_decoded, $field)) {
|
||||
if (! array_has($entry_decoded, $field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Arr::set($entry_decoded, $field, $this->flextype['parser']->parse(Arr::get($entry_decoded, $field), 'shortcodes', $cache));
|
||||
array_set($entry_decoded, $field, $this->flextype['parser']->parse(Arr::get($entry_decoded, $field), 'shortcodes', $cache));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,9 +335,9 @@ class Entries
|
||||
|
||||
if (Filesystem::has($entry_file)) {
|
||||
$body = Filesystem::read($entry_file);
|
||||
$entry = $this->flextype['serializer']->decode($body, 'frontmatter');
|
||||
$entry = $this->flextype['frontmatter']->decode($body);
|
||||
|
||||
return Filesystem::write($entry_file, $this->flextype['serializer']->encode(array_merge($entry, $data), 'frontmatter'));
|
||||
return Filesystem::write($entry_file, $this->flextype['frontmatter']->encode(array_merge($entry, $data)));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -380,7 +380,7 @@ class Entries
|
||||
$data['visibility'] = 'visible';
|
||||
}
|
||||
|
||||
return Filesystem::write($entry_file, $this->flextype['serializer']->encode($data, 'frontmatter'));
|
||||
return Filesystem::write($entry_file, $this->flextype['frontmatter']->encode($data));
|
||||
}
|
||||
|
||||
return false;
|
@@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
namespace Flextype\Foundation\Media;
|
||||
|
||||
use Flextype\Component\Filesystem\Filesystem;
|
||||
use Intervention\Image\ImageManagerStatic as Image;
|
||||
@@ -182,17 +182,17 @@ class MediaFiles
|
||||
|
||||
// now you are able to resize the instance
|
||||
if ($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_width') > 0 && $this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_height') > 0) {
|
||||
$img->resize($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_width'), $this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_height'), static function ($constraint) : void {
|
||||
$img->resize($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_width'), $this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_height'), function ($constraint) : void {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
} elseif ($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_width') > 0) {
|
||||
$img->resize($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_width'), null, static function ($constraint) : void {
|
||||
$img->resize($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_width'), null, function ($constraint) : void {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
} elseif ($this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_height') > 0) {
|
||||
$img->resize(null, $this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_height'), static function ($constraint) : void {
|
||||
$img->resize(null, $this->flextype['registry']->get('plugins.admin.settings.entries.media.upload_images_height'), function ($constraint) : void {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
@@ -224,7 +224,7 @@ class MediaFiles
|
||||
|
||||
Filesystem::write(
|
||||
$upload_metadata_folder . basename($filename) . '.yaml',
|
||||
$this->flextype['serializer']->encode($metadata, 'yaml')
|
||||
$this->flextype['yaml']->encode($metadata)
|
||||
);
|
||||
|
||||
// Return new file path
|
||||
@@ -269,7 +269,7 @@ class MediaFiles
|
||||
$result = [];
|
||||
|
||||
if (Filesystem::has($this->flextype['media_files_meta']->getFileMetaLocation($path))) {
|
||||
$result = $this->flextype['serializer']->decode(Filesystem::read($this->flextype['media_files_meta']->getFileMetaLocation($path)), 'yaml');
|
||||
$result = $this->flextype['yaml']->decode(Filesystem::read($this->flextype['media_files_meta']->getFileMetaLocation($path)));
|
||||
|
||||
$result['filename'] = pathinfo(str_replace('/.meta', '', $this->flextype['media_files_meta']->getFileMetaLocation($path)))['filename'];
|
||||
$result['basename'] = explode('.', basename($this->flextype['media_files_meta']->getFileMetaLocation($path)))[0];
|
||||
@@ -302,7 +302,7 @@ class MediaFiles
|
||||
$result = [];
|
||||
|
||||
foreach (Filesystem::listContents($this->flextype['media_folders_meta']->getDirMetaLocation($path)) as $file) {
|
||||
$result[$file['basename']] = $this->flextype['serializer']->decode(Filesystem::read($file['path']), 'yaml');
|
||||
$result[$file['basename']] = $this->flextype['yaml']->decode(Filesystem::read($file['path']));
|
||||
|
||||
$result[$file['basename']]['filename'] = pathinfo(str_replace('/.meta', '', $this->flextype['media_files_meta']->getFileMetaLocation($file['basename'])))['filename'];
|
||||
$result[$file['basename']]['basename'] = explode('.', basename($this->flextype['media_files_meta']->getFileMetaLocation($file['basename'])))[0];
|
||||
|
@@ -44,12 +44,12 @@ class MediaFilesMeta
|
||||
*/
|
||||
public function update(string $id, string $field, string $value) : bool
|
||||
{
|
||||
$file_data = $this->flextype['serializer']->decode(Filesystem::read($this->getFileMetaLocation($id)), 'yaml');
|
||||
$file_data = $this->flextype['yaml']->decode(Filesystem::read($this->getFileMetaLocation($id)));
|
||||
|
||||
if (Arr::keyExists($file_data, $field)) {
|
||||
Arr::set($file_data, $field, $value);
|
||||
if (array_has($file_data, $field)) {
|
||||
array_set($file_data, $field, $value);
|
||||
|
||||
return Filesystem::write($this->getFileMetaLocation($id), $this->flextype['serializer']->encode($file_data, 'yaml'));
|
||||
return Filesystem::write($this->getFileMetaLocation($id), $this->flextype['yaml']->encode($file_data));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -68,12 +68,12 @@ class MediaFilesMeta
|
||||
*/
|
||||
public function add(string $id, string $field, string $value) : bool
|
||||
{
|
||||
$file_data = $this->flextype['serializer']->decode(Filesystem::read($this->getFileMetaLocation($id)), 'yaml');
|
||||
$file_data = $this->flextype['yaml']->decode(Filesystem::read($this->getFileMetaLocation($id)));
|
||||
|
||||
if (! Arr::keyExists($file_data, $field)) {
|
||||
Arr::set($file_data, $field, $value);
|
||||
if (! array_has($file_data, $field)) {
|
||||
array_set($file_data, $field, $value);
|
||||
|
||||
return Filesystem::write($this->getFileMetaLocation($id), $this->flextype['serializer']->encode($file_data, 'yaml'));
|
||||
return Filesystem::write($this->getFileMetaLocation($id), $this->flextype['yaml']->encode($file_data));
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -91,12 +91,12 @@ class MediaFilesMeta
|
||||
*/
|
||||
public function delete(string $id, string $field) : bool
|
||||
{
|
||||
$file_data = $this->flextype['serializer']->decode(Filesystem::read($this->getFileMetaLocation($id)), 'yaml');
|
||||
$file_data = $this->flextype['yaml']->decode(Filesystem::read($this->getFileMetaLocation($id)));
|
||||
|
||||
if (Arr::keyExists($file_data, $field)) {
|
||||
Arr::delete($file_data, $field);
|
||||
if (array_has($file_data, $field)) {
|
||||
array_delete($file_data, $field);
|
||||
|
||||
return Filesystem::write($this->getFileMetaLocation($id), $this->flextype['serializer']->encode($file_data, 'yaml'));
|
||||
return Filesystem::write($this->getFileMetaLocation($id), $this->flextype['yaml']->encode($file_data));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -7,7 +7,7 @@ declare(strict_types=1);
|
||||
* Founded by Sergey Romanenko and maintained by Flextype Community.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
namespace Flextype\Foundation;
|
||||
|
||||
use Composer\Semver\Semver;
|
||||
use Flextype\Component\Arr\Arr;
|
||||
@@ -44,7 +44,7 @@ class Plugins
|
||||
public function __construct($flextype, $app)
|
||||
{
|
||||
$this->flextype = $flextype;
|
||||
$this->locales = $this->flextype['serializer']->decode(Filesystem::read(ROOT_DIR . '/src/flextype/locales.yaml'), 'yaml');
|
||||
$this->locales = $this->flextype['yaml']->decode(Filesystem::read(ROOT_DIR . '/src/flextype/locales.yaml'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ class Plugins
|
||||
|
||||
// Get default plugin settings content
|
||||
$default_plugin_settings_file_content = Filesystem::read($default_plugin_settings_file);
|
||||
$default_plugin_settings = $this->flextype['serializer']->decode($default_plugin_settings_file_content, 'yaml');
|
||||
$default_plugin_settings = $this->flextype['yaml']->decode($default_plugin_settings_file_content);
|
||||
|
||||
// Create project plugin settings file
|
||||
! Filesystem::has($project_plugin_settings_file) and Filesystem::write($project_plugin_settings_file, $default_plugin_settings_file_content);
|
||||
@@ -136,7 +136,7 @@ class Plugins
|
||||
if (trim($project_plugin_settings_file_content) === '') {
|
||||
$project_plugin_settings = [];
|
||||
} else {
|
||||
$project_plugin_settings = $this->flextype['serializer']->decode($project_plugin_settings_file_content, 'yaml');
|
||||
$project_plugin_settings = $this->flextype['yaml']->decode($project_plugin_settings_file_content);
|
||||
}
|
||||
|
||||
// Check if default plugin manifest file exists
|
||||
@@ -146,7 +146,7 @@ class Plugins
|
||||
|
||||
// Get default plugin manifest content
|
||||
$default_plugin_manifest_file_content = Filesystem::read($default_plugin_manifest_file);
|
||||
$default_plugin_manifest = $this->flextype['serializer']->decode($default_plugin_manifest_file_content, 'yaml');
|
||||
$default_plugin_manifest = $this->flextype['yaml']->decode($default_plugin_manifest_file_content);
|
||||
|
||||
// Merge plugin settings and manifest data
|
||||
$plugins[$plugin['dirname']]['manifest'] = $default_plugin_manifest;
|
||||
@@ -167,7 +167,7 @@ class Plugins
|
||||
|
||||
// ... and delete tmp _priority field for sorting
|
||||
foreach ($plugins as $plugin_name => $plugin_data) {
|
||||
Arr::delete($plugins, $plugin_name . '._priority');
|
||||
array_delete($plugins, $plugin_name . '._priority');
|
||||
}
|
||||
|
||||
// Get Valid Plugins Dependencies
|
||||
@@ -207,7 +207,7 @@ class Plugins
|
||||
throw new RuntimeException('Load file: ' . $language_file . ' - failed!');
|
||||
}
|
||||
|
||||
$translates = $this->flextype['serializer']->decode($content, 'yaml');
|
||||
$translates = $this->flextype['yaml']->decode($content);
|
||||
|
||||
I18n::add($translates, $locale);
|
||||
}
|
||||
@@ -386,7 +386,7 @@ class Plugins
|
||||
continue;
|
||||
}
|
||||
|
||||
include_once PATH['project'] . '/plugins/' . $plugin_name . '/bootstrap.php';
|
||||
//include_once PATH['project'] . '/plugins/' . $plugin_name . '/bootstrap.php';
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user