Exemple #1
0
 public function get_language()
 {
     $obj_io = new cls_io();
     if ($this->obj_session->is_set('core_language')) {
         return $this->obj_session->get('core_language');
     } elseif ($this->obj_cookie->is_set('core_language')) {
         return $obj_io->cin('core_language', 'cookie');
     } else {
         //return difault language
         return $this->localize['language'];
     }
 }
Exemple #2
0
 public static function cin($VaribleName, $Type = "get", $Filter = 515, $Flags = "")
 {
     #change const to integer
     $filter_num = $Filter;
     if ($VaribleName == "" || ($Filter = "")) {
         return 0;
     }
     try {
         switch ($Type) {
             case "get":
                 if ($Flags == "") {
                     $Result = filter_input(INPUT_GET, $VaribleName, $filter_num);
                 } else {
                     $Result = filter_input(INPUT_GET, $VaribleName, $filter_num, $Flags);
                 }
                 break;
             case "post":
                 if ($Flags !== "") {
                     $Result = filter_input(INPUT_POST, $VaribleName, $filter_num);
                 } else {
                     $Result = filter_input(INPUT_POST, $VaribleName, $filter_num, $Flags);
                 }
                 break;
             case "cookie":
                 if ($Flags !== "") {
                     $Result = filter_input(INPUT_COOKIE, $VaribleName, $filter_num);
                 } else {
                     $Result = filter_input(INPUT_COOKIE, $VaribleName, $filter_num, $Flags);
                 }
                 break;
             case "server":
                 if ($Flags !== "") {
                     $Result = filter_input(INPUT_SERVER, $VaribleName, $filter_num);
                 } else {
                     $Result = filter_input(INPUT_SERVER, $VaribleName, $filter_num, $Flags);
                 }
                 break;
             case "request":
                 if ($Flags !== "") {
                     $Result = filter_input(INPUT_SERVER, $VaribleName, $filter_num);
                 } else {
                     $Result = filter_input(INPUT_REQUEST, $VaribleName, $filter_num, $Flags);
                 }
                 break;
         }
     } catch (Exception $ex) {
         #is invalid type
         return 0;
     }
     self::$FilterType = $Filter;
     return $Result;
 }