Ajaxel content management system and framework

Ajaxel content management system v9.1 and framework

Very simple ajaxified CMS and framework for any project needs. Edit your website content from backend or front end. Try and see how good this stuff is!

Ajaxel intranet system

Ajaxel orders intranet system

List of new incoming orders (from remote websites) with possibility to send mass E-mails with generated PDF attachments and SMS-es. Changing statuses, saving answers and others. Comes with Ajaxel CMS

Ajaxel live slot-machine game

Ajaxel live slot-machine game

Check this game, see how cool this is) 5x3 board to spin for win. Nice animations, playing music, bonuses, winner lists. Possible to make own icons, lines and prizes... Comes with Ajaxel CMS. Also, I have online poker game coming.

Timemonkey - efficient time management web based software

TimeMonkey - Efficient time management web-based

Think positive, save ideas, save thoughts, manage you tasks and control your calendar. Export calendar to your web site!

Ajaxel customer relationship manager

PollExpert - Professional survey web-based

Create your individual, corporate-, secure- or step-by-step online poll. You don't need to be an IT expert. Export results to excel.

Ajaxel customer relationship manager

Any other flying website with Ajaxel CMS. Development

Create your own desired project with help of Ajaxel Studio!

Conf class - Ajaxel data holder

Home :: PHP lessons :: Conf class - Ajaxel data holderReply
Conf class - Ajaxel data holder
Posted by Alexander Shatalov
I guess many people would as about this question....
Enjoy wink
PHP
class Conf {
        private $vars = array();
        private static $_instance = false;
        private static $seen = false;
       
        public function __construct($default = array()) {
                $this->vars = $default;
        }
        public static function &getInstance() {
                if (!self::$_instance) {
                        self::$_instance = new self;   
                }
                return self::$_instance;
        }
        public function __set($key, $val) {
                return $this->s($key, $val);   
        }
        public function __get($key) {
                return $this->g($key); 
        }
        public function __toString() {
                return p($this->vars,0);       
        }
        public function __call($name, $args) {
                if (!self::$seen) p($this);
                self::$seen = true;
        }
        // key
        public function key($key) {
                return @key($this->vars[$key]);
        }
        // set
        public function s($key, $val='') {
                $this->vars[$key] = $val;
        }
        public function s2($key, $_key, $val='') {
        //      if ($_key && is_array($_key)) $_key = 0;
                $this->vars[$key][$_key] = $val;       
        }
        public function s3($key, $_key, $__key, $val='') {
                $this->vars[$key][$_key][$__key] = $val;       
        }
        // collect
        public function c($key, $add=NULL) {
                if ($add) $this->vars[$key] .= $add; else $this->vars[$key] = '';
        }
        public function c2($key, $_key, $add = '') {
                if ($add) $this->vars[$key][$_key] .= $add; else $this->vars[$key][$_key] = '';
        }
        // plus
        public function plus($key,$num = 0) {
                if (!isset($this->vars[$key])) $this->vars[$key] = 0;
                $this->vars[$key] += $num;     
        }
        public function plus2($key,$_key,$num = 0) {
                if (!is_array($this->vars[$key])) $this->vars[$key] = array();
                $this->vars[$key][$_key] += $num;
        }
        public function plus3($key,$_key,$__key,$num = 0) {
                if (!isset($this->vars[$key]) || !is_array($this->vars[$key])) $this->vars[$key] = array();
                if (!isset($this->vars[$key][$_key])) $this->vars[$key][$_key] = array();
                if (!isset($this->vars[$key][$_key][$__key])) $this->vars[$key][$_key][$__key] = 0;
                $this->vars[$key][$_key][$__key] += $num;
        }
        // minus
        public function minus($key,$num = 0) {
                $this->vars[$key] -= $num;
        }
        public function minus2($key,$_key,$num = 0) {
                if (!is_array($this->vars[$key])) $this->vars[$key] = array();
                $this->vars[$key][$_key] -= $num;
        }
        // array fill
        public function fill($key,$val) {
                if (!isset($this->vars[$key]) || !is_array($this->vars[$key])) $this->vars[$key] = array();
                $this->vars[$key][] = $val;    
        }
        public function unfill($key, $val) {
                unset($this->vars[$key][array_search($val,$this->vars[$key])]);
        }
        public function get() {
                $a = func_get_args();
                switch (func_num_args()) {
                        case 1:
                                return @$this->vars[$a[0]];
                        break;
                        case 2:
                                return @$this->vars[$a[0]][$a[1]];
                        break;
                        case 3:
                                return @$this->vars[$a[0]][$a[1]][$a[2]];
                        break;
                        case 4:
                                return @$this->vars[$a[0]][$a[1]][$a[2]][$a[4]];
                        break;
                }
        }
        public function set() {
                $a = func_get_args();
                switch (func_num_args()) {
                        case 2:
                                @$this->vars[$a[0]] = $a[1];
                        break;
                        case 3:
                                @$this->vars[$a[0]][$a[1]] = $a[2];
                        break;
                        case 4:
                                @$this->vars[$a[0]][$a[1]][$a[2]] = $a[3];
                        break;
                }
                return $this;
        }
        // get
        public function g($key,$default = false) {
                return (isset($this->vars[$key]) ? $this->vars[$key] : $default);
        }
        public function g2($key,$_key,$default = false) {
                if ($_key && is_array($_key)) $_key = 0;
                if (!isset($this->vars[$key]) || !is_array($this->vars[$key])) $this->vars[$key] = array();
                return isset($this->vars[$key][$_key]) ? $this->vars[$key][$_key] : $default;
        }
        public function g3($key,$_key,$__key,$default = false) {
                if (!isset($this->vars[$key]) || !is_array($this->vars[$key])) $this->vars[$key] = array();
                return isset($this->vars[$key][$_key][$__key]) ? $this->vars[$key][$_key][$__key] : $default;
        }
        public function g4($key,$_key,$__key,$___key,$default = false) {
                if (!isset($this->vars[$key]) || !is_array($this->vars[$key])) $this->vars[$key] = array();
                return isset($this->vars[$key][$_key][$__key][$___key]) ? $this->vars[$key][$_key][$__key][$___key] : $default;
        }
        // is
        public function is($key) {
                if (isset($this->vars[$key])) return true;
                return false;
        }
        // exists
        public function exists($key, $_key) {
                if (isset($this->vars[$key]) && is_array($this->vars[$key])) return array_key_exists($_key, $this->vars[$key]);
                return false;
        }
        // in
        public function in($key, $_key) {
                if (isset($this->vars[$key]) && is_array($this->vars[$key])) return in_array($_key, $this->vars[$key]);
                return false;
        }
        // nulls
        public function n_array() {
                $args = func_get_args();
                foreach ($args as $a) $this->vars[$a] = array();
        }
        public function n_zero() {
                $args = func_get_args();
                foreach ($args as $a) $this->vars[$a] = 0;
        }
        public function n_false() {
                $args = func_get_args();
                foreach ($args as $a) $this->vars[$a] = false;
        }
        public function n_null() {
                $args = func_get_args();
                foreach ($args as $a) $this->vars[$a] = NULL;
        }
        public function n_empty() {
                $args = func_get_args();
                foreach ($args as $a) $this->vars[$a] = '';
        }
        public function n_unset() {
                $args = func_get_args();
                foreach ($args as $a) unset($this->vars[$a]);
        }
        // other
        public function merge($array = array()) {
                if (!is_array($array)) return false;
                $this->vars = array_merge((array)$this->vars,$array);
        }
        public function merge2($key, $array = array()) {
                if (!is_array($array)) return false;
                if (isset($this->vars[$key])) {
                        $this->vars[$key] = array_merge((array)$this->vars[$key],$array);
                } else {
                        $this->vars[$key] = $array;    
                }
        }
        public function getAll() {
                return $this->vars;    
        }
}

Complete this survey before you download :)


Which website you like to create:
Your plan:
Tell us more about the website you wish to have: (optional)
Website domain:
Your E-mail:
Survey passed: 314 times, starting from 16.09.2013

Home – Latest News – Partners – Services – Portfolio – Scripts – Quick order – Contact me