Files
interblue.pl/modules/pshowimporter/system/classes/PShowSettingsAbstract.php
2024-10-25 14:16:28 +02:00

105 lines
2.7 KiB
PHP

<?php
/**
* File from http://PrestaShow.pl
*
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future.
*
* @authors PrestaShow.pl <kontakt@prestashow.pl>
* @copyright 2015 PrestaShow.pl
* @license http://PrestaShow.pl/license
*/
abstract class PShowSettingsAbstract
{
public static $global_settings = array(
array(
'type' => 'switch',
'name' => 'fold_menu_on_enter',
'label' => 'Fold menu after entering the module',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => 'Enabled'
),
array(
'id' => 'active_off',
'value' => 0,
'label' => 'Disabled'
)
)
),
array(
'type' => 'switch',
'name' => 'tips',
'label' => 'Show tips',
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
'label' => 'Enabled'
),
array(
'id' => 'active_off',
'value' => 0,
'label' => 'Disabled'
)
),
'is_bool' => true
),
);
protected static $instance = null;
public static $filepath;
public function __construct()
{
}
public static function getInstance($filepath)
{
self::$filepath = getModulePath($filepath);
if (self::$instance === null) {
self::$instance = new PShow_Settings();
$x = &self::$instance;
if ($filepath !== null && file_exists(getModulePath($filepath) . 'settings.php')) {
$x::$settings = array_merge(self::$global_settings, include(getModulePath($filepath) . 'settings.php'));
}
}
return self::$instance;
}
public function getAll()
{
return static::$settings;
}
/**
* Get setting value
*
* @param string $name
* @return string/null
*/
public function get($name)
{
return Configuration::get(strtolower(getModuleName(self::$filepath)) . '_' . $name);
}
/**
* Set setting value
*
* @param string $name
* @param string $value
* @return string/null
*/
public function set($name, $value)
{
Configuration::updateValue(strtolower(getModuleName(self::$filepath)) . '_' . $name, $value);
}
}