%PDF- %PDF-
Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/inc/classes/ |
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/inc/classes/rdy-config.php |
<?php // File Security Check if ( ! defined( 'ABSPATH' ) ) { exit; } interface Levelup_Config_Interface { public function set( $name, $value = null, $default = null ); public function reset( $options = array() ); public function get( $name = '' ); } class Levelup_Config implements Levelup_Config_Interface{ public static function get_instance() { if ( !self::$instance ) { self::$instance = new Levelup_Config(); } return self::$instance; } protected function __construct() {} private function __clone() {} private function __wakeup() {} private static $instance = null; private $options = array(); private $options_statistic = array( 'miss' => array() ); public function set( $name, $value = null, $default = null ) { if ( ('' === $value || null === $value) && isset($default) ) { $this->options[ $name ] = $default; } else { $this->options[ $name ] = $value; } } public function reset( $options = array() ) { $this->options = $options; } public function get( $name = '' ) { if ( '' == $name ) { return $this->options; } if ( isset( $this->options[ $name ] ) ) { return $this->options[ $name ]; } else { // debug array_push( $this->options_statistic['miss'], $name ); } return null; } } if ( ! function_exists( 'levelup_config' ) ) { function levelup_config() { return Levelup_Config::get_instance(); } }