"No", 1 => "Yes", ]; public static function checked($value) { return !empty($value) ? "checked" : ""; } public static function checkRecaptcha($required_score = 0.5) { if(!defined("GOOGLE_RECAPTCHA_SECRET")) return true; $json = http::post("https://www.google.com/recaptcha/api/siteverify", [ "secret" => GOOGLE_RECAPTCHA_SECRET, "response" => http::value("g-recaptcha-response"), "remoteip" => $_SERVER["REMOTE_ADDR"] ]); if(!$json) return false; $response = json_decode($json); if(!$response) return false; if(isset($response->score)) { return $response->score >= $required_score; } else { return $response->success; } } public static function renderYearOptions($min = null, $max = null, $selected_value = null) { if(empty($min)) $min = date("Y") - 100; if(empty($max)) $max = date("Y") - 16; for($i = $min; $i <= $max; $i++) { $selected = ($selected_value == $i) ? "selected" : ""; ?> = $min; $i--) { $selected = ($selected_value == $i) ? "selected" : ""; ?> $threshold) { $countries_json = @file_get_contents($file); $countries = json_decode($countries_json); } else { $url = "http://country.io/names.json"; $countries_json = @file_get_contents($url); $countries = json_decode($countries_json); if($countries) { file_put_contents($file, $countries_json); } } if(!$countries) return false; $country_pairs = get_object_vars($countries); sort($country_pairs); $countries = array_values($country_pairs); ?> type) { case "header": self::renderHeader($options); break; case "dropdown": case "select": self::renderSelectField($options); break; case "text": self::renderTextField($options); break; case "number": self::renderNumberField($options); break; case "textarea": self::renderTextareaField($options); break; case "file": self::renderFileField($options); break; } } private static function renderHeader($options) { ?>

content)?>

name); $placeholder = "Enter " . strtolower($options->label); $value = $options->value ?? http::value($options->name); $required = ($options->required ?? false) ? "required" : ""; $help_text = $options->helpText ?? false; $max_length = ($options->maxLength ?? false) ? "maxlength=\"$options->maxLength\"" : ""; ?>
/>
name); $placeholder = "Enter " . strtolower($options->label); $value = $options->value ?? http::value($options->name); $required = ($options->required ?? false) ? "required" : ""; $help_text = $options->helpText ?? false; $min = ($options->min ?? false) ? "min=\"$options->min\"" : ""; $max = ($options->max ?? false) ? "max=\"$options->max\"" : ""; $max_length = ($options->maxLength ?? false) ? "maxlength=\"$options->maxLength\"" : ""; $step = $options->step ?? 1; $prepend_text = $options->prependText ?? ""; ?>
/>
name); $selected_value = $options->value ?? http::value($options->name); $required = ($options->required ?? false) ? "required" : ""; $help_text = $options->helpText ?? false; ?>
name); $placeholder = "Enter " . strtolower($options->label); $required = ($options->required ?? false) ? "required" : ""; $help_text = $options->helpText ?? false; ?>
/>
name); $placeholder = "Enter " . strtolower($options->label); $value = $options->value ?? http::value($options->name); $required = ($options->required ?? false) ? "required" : ""; $help_text = $options->helpText ?? false; $max_length = ($options->maxLength ?? false) ? "maxlength=\"$options->maxLength\"" : ""; ?>