| 1 |
<?php |
| 2 |
|
| 3 |
namespace RadiusTheme\SB\Abstracts; |
| 4 |
|
| 5 |
// Do not allow directly accessing this file. |
| 6 |
use RadiusTheme\SB\Models\DataModel; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit( 'This script cannot be accessed directly.' ); |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Template Related Settings |
| 14 |
*/ |
| 15 |
abstract class AbsSettings { |
| 16 |
/** |
| 17 |
* @var |
| 18 |
*/ |
| 19 |
private $source; |
| 20 |
|
| 21 |
/** |
| 22 |
* Set Source |
| 23 |
*/ |
| 24 |
public function __construct() { |
| 25 |
$this->source = DataModel::source( $this->source() ); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* @return string |
| 30 |
*/ |
| 31 |
abstract public function source(); |
| 32 |
|
| 33 |
/** |
| 34 |
* @param $key |
| 35 |
* @param $value |
| 36 |
* |
| 37 |
* @return void |
| 38 |
*/ |
| 39 |
public function set_option( $key, $value ) { |
| 40 |
$this->source->set_option( $key, $value ); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* @param $key |
| 45 |
* @param $default |
| 46 |
* |
| 47 |
* @return mixed|null |
| 48 |
*/ |
| 49 |
public function get_option( $key, $default = null ) { |
| 50 |
return $this->source->get_option( $key, $default); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* @param $key |
| 55 |
* |
| 56 |
* @return true |
| 57 |
*/ |
| 58 |
public function delete_option( $key ) { |
| 59 |
return $this->source->delete_option( $key); |
| 60 |
} |
| 61 |
|
| 62 |
} |
| 63 |
|