registry::get PHP Method

get() public static method

public static get ( $key, $default = null )
    public static function get($key, $default = null)
    {
        if (isset(static::$data[$key])) {
            return static::$data[$key];
        }
        return $default;
    }

Usage Example

Example #1
0
 public function add()
 {
     if (isset($_POST['save_user_btn'])) {
         $row = [];
         if ($_GET['id']) {
             $row['id'] = $_GET['id'];
         } else {
             $row['create_date'] = date('Y-m-d H:i:s');
         }
         $row['email'] = $_POST['email'];
         $row['user_name'] = $_POST['user_name'];
         $row['user_surname'] = $_POST['user_surname'];
         $row['user_group_id'] = $_POST['user_group_id'];
         if ($_POST['user_password']) {
             $row['user_password'] = md5($_POST['user_password']);
         }
         $this->model('backend_users')->insert($row);
         if ($_POST['user_password']) {
             $this->logOut();
             $this->auth(registry::get('user')['email'], md5($_POST['user_password']));
             registry::remove('user');
             $this->checkAuth();
         }
         header('Location: ' . SITE_DIR . 'users/');
         exit;
     }
     $this->render('user_groups', $this->model('user_groups')->getAll());
     if ($_GET['id']) {
         $this->render('user', $this->model('backend_users')->getById($_GET['id']));
     }
     $this->view('users' . DS . 'add');
 }
All Usage Examples Of registry::get