Example #1
0
function __marshal2fruc($phpval)
{
    if (is_bool($phpval)) {
        return F_TrueClass::__from_bool($phpval);
    }
    if (is_numeric($phpval) && !is_string($phpval)) {
        return F_Number::__from_number($phpval);
    }
    if (is_string($phpval)) {
        return F_String::__from_string($phpval);
    }
    if (is_object($phpval)) {
        return F_PHPObject::__from_object($phpval);
    }
    if (is_array($phpval)) {
        // determine if assoc or numeric
        $isAssoc = FALSE;
        foreach (array_keys($phpval) as $k) {
            if (!is_numeric($k)) {
                $isAssoc = TRUE;
                break;
            }
        }
        if (!$isAssoc) {
            return F_Array::__from_array(array_map('__marshal2fruc', $phpval));
        }
        foreach ($phpval as $k => $v) {
            $newarr[] = __marshal2fruc($k);
            $newarr[] = __marshal2fruc($v);
        }
        return F_Hash::__from_flatpairs($newarr);
    }
    return new F_NilClass();
}
Example #2
0
function set_sgs($arr)
{
    foreach ($arr as $sg => $superglobal) {
        global $http_reqarrs;
        global $_globals;
        $pairs = array();
        foreach ($superglobal as $k => $v) {
            if (is_array($v)) {
                $val = array();
                foreach ($v as $_k => $_v) {
                    $str = F_String::__from_string($_v);
                    $str->F_taint(NULL);
                    $val[] = F_Array::__from_array(array(F_Symbol::__from_string($_k), $str));
                }
            } else {
                $val = F_String::__from_string($v);
                $val->F_taint(NULL);
            }
            $pairs[] = F_Array::__from_array(array(F_Symbol::__from_string($k), $val));
        }
        $_globals['F_' . $sg] = F_Hash::__from_pairs($pairs);
    }
}
Example #3
0
 public function F_reject($block)
 {
     $new_pairs = array();
     foreach ($this->__PAIRS as $pair) {
         if (!_isTruthy($block(NULL, $pair->__ARRAY[0], $pair->__ARRAY[1]))) {
             $new_pairs[] = $pair;
         }
     }
     return F_Hash::__from_pairs($new_pairs);
 }
Example #4
0
 public function F_error_info($block)
 {
     $info = $this->__PDO->errorInfo();
     $hash = F_Hash::SF_new(NULL);
     $hash->__operator_arrayset(NULL, F_Symbol::__from_string('state'), F_String::__from_string($info[0]));
     if ($info[1] !== NULL) {
         $hash->__operator_arrayset(NULL, F_Symbol::__from_string('code'), F_String::__from_string($info[1]));
     }
     if ($info[2] !== NULL) {
         $hash->__operator_arrayset(NULL, F_Symbol::__from_string('msg'), F_String::__from_string($info[2]));
     }
     return $hash;
 }