first commit
This commit is contained in:
43
autoload/front/factory/class.Settings.php
Normal file
43
autoload/front/factory/class.Settings.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace front\factory;
|
||||
|
||||
class Settings
|
||||
{
|
||||
public static function settings_details( $admin = false )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$cacheHandler = new \CacheHandler();
|
||||
$cacheKey = "\front\factory\Settings::settings_details";
|
||||
|
||||
$objectData = $cacheHandler->get($cacheKey);
|
||||
|
||||
if ( !$objectData or $admin )
|
||||
{
|
||||
$results = $mdb -> select( 'pp_settings', '*' );
|
||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
||||
$settings[ $row['param'] ] = $row['value'];
|
||||
|
||||
$cacheHandler -> set( $cacheKey, $settings );
|
||||
}
|
||||
else
|
||||
{
|
||||
return unserialize( $objectData );
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
static public function get_single_settings_value( $param ) {
|
||||
|
||||
global $mdb;
|
||||
|
||||
if ( !$value = \Cache::fetch( "get_single_settings_value:$param" ) ) {
|
||||
|
||||
$value = $mdb -> get( 'pp_settings', 'value', [ 'param' => 'firm_name' ] );
|
||||
\Cache::store( "get_single_settings_value:$param", $value );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user