Merge pull request #93 from Ctrlpanel-gg/dev_no-encryption

Dev no encryption
This commit is contained in:
Dennis 2023-05-03 15:22:45 +02:00 committed by GitHub
commit 75af4c1e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View file

@ -77,6 +77,10 @@ class CreatePayPalSettings extends SettingsMigration
// Always get the first value of the key.
$old_value = DB::table('settings_old')->where('key', '=', $key)->get(['value', 'type'])->first();
if (is_null($old_value)) {
return null;
}
// Handle the old values to return without it being a string in all cases.
if ($old_value->type === "string" || $old_value->type === "text") {
if (is_null($old_value->value)) {

View file

@ -75,6 +75,10 @@ class CreateStripeSettings extends SettingsMigration
// Always get the first value of the key.
$old_value = DB::table('settings_old')->where('key', '=', $key)->get(['value', 'type'])->first();
if (is_null($old_value)) {
return null;
}
// Handle the old values to return without it being a string in all cases.
if ($old_value->type === "string" || $old_value->type === "text") {
if (is_null($old_value->value)) {

View file

@ -18,8 +18,9 @@ class ExtensionHelper
foreach ($extensionNamespaces as $extensionNamespace) {
$extensions = array_merge($extensions, glob($extensionNamespace . '/*', GLOB_ONLYDIR));
}
// remove base path from every extension but keep app/Extensions/...
$extensions = array_map(fn ($item) => str_replace('/', '\\', str_replace(app_path() . '/', 'App/', $item)), $extensions);
$extensions = array_map(fn ($item) => str_replace(app_path() . '/', 'App/', $item), $extensions);
return $extensions;
}
@ -33,7 +34,7 @@ class ExtensionHelper
{
$extensions = glob(app_path() . '/Extensions/' . $namespace . '/*', GLOB_ONLYDIR);
// remove base path from every extension but keep app/Extensions/...
$extensions = array_map(fn ($item) => str_replace('/', '\\', str_replace(app_path() . '/', 'App/', $item)), $extensions);
$extensions = array_map(fn ($item) => str_replace(app_path() . '/', 'App/', $item), $extensions);
return $extensions;
}
@ -60,6 +61,9 @@ class ExtensionHelper
public static function getAllExtensionClasses()
{
$extensions = self::getAllExtensions();
// replace all slashes with backslashes
$extensions = array_map(fn ($item) => str_replace('/', '\\', $item), $extensions);
// add the ExtensionClass to the end of the namespace
$extensions = array_map(fn ($item) => $item . '\\' . basename($item) . 'Extension', $extensions);
// filter out non existing extension classes
@ -76,6 +80,9 @@ class ExtensionHelper
public static function getAllExtensionClassesByNamespace(string $namespace)
{
$extensions = self::getAllExtensionsByNamespace($namespace);
// replace all slashes with backslashes
$extensions = array_map(fn ($item) => str_replace('/', '\\', $item), $extensions);
// add the ExtensionClass to the end of the namespace
$extensions = array_map(fn ($item) => $item . '\\' . basename($item) . 'Extension', $extensions);
// filter out non existing extension classes
@ -177,10 +184,13 @@ class ExtensionHelper
{
$extensions = self::getAllExtensions();
$settings = [];
foreach ($extensions as $extension) {
$extensionName = basename($extension);
// replace all slashes with backslashes
$extension = str_replace('/', '\\', $extension);
$settingsClass = $extension . '\\' . $extensionName . 'Settings';
if (class_exists($settingsClass)) {
$settings[] = $settingsClass;
@ -193,6 +203,9 @@ class ExtensionHelper
public static function getExtensionSettings(string $extensionName)
{
$extension = self::getExtension($extensionName);
// replace all slashes with backslashes
$extension = str_replace('/', '\\', $extension);
$settingClass = $extension . '\\' . $extensionName . 'Settings';
if (class_exists($settingClass)) {
@ -207,6 +220,6 @@ class ExtensionHelper
*/
private static function extensionNameToPath(string $extensionName)
{
return app_path() . '/' . str_replace('\\', '/', str_replace('App\\', '', $extensionName));
return app_path() . '/' . str_replace('App/', '', $extensionName);
}
}