*/
class base_controller {
+ public string $page_output = ''; // To keep views working...without Dynamic Variable Error!
public static $params; // To keep Routes working...
public $view;
public $html;
diff --git a/src/classes/common.php b/src/classes/common.php
index bba42f2..1545fea 100644
--- a/src/classes/common.php
+++ b/src/classes/common.php
@@ -89,6 +89,18 @@ final class common {
}
return $subject;
}
+
+ public static function deprecated_error(string $msg): void {
+ if (\CodeHydrater\bootstrap\configure::get('security', 'show_dumps') !== true) {
+ return; // Avoid Live Deprecated Errors
+ }
+ if (\PHP_VERSION_ID < 80400) {
+ trigger_error($msg);
+ echo "";
+ print_r(debug_backtrace()[1]);
+ echo "
";
+ }
+ }
// Begin Strings Functions here::
public static function string_position(string $string, string $needle, int $offset = 0, $encoding = null) {
diff --git a/src/classes/enums/form_input_types.php b/src/classes/enums/form_input_types.php
new file mode 100644
index 0000000..0a90400
--- /dev/null
+++ b/src/classes/enums/form_input_types.php
@@ -0,0 +1,35 @@
+
+ * @copyright (c) 2025, Robert Strutts
+ * @license MIT
+ */
+namespace CodeHydrater\enums;
+
+enum form_input_types: string {
+ case none = "none"; // Don't Display control
+ case checkbox ="checkbox";
+ case color = "color";
+ case date = "date";
+ case datetime = "datetime-local";
+ case email = "email";
+ case file = "file";
+ case hidden = "hidden";
+ case image = "image";
+ case month = "month";
+ case number = "number";
+ case password = "password";
+ case radio = "radio";
+ case range = "range";
+ case reset = "rest";
+ case search = "search";
+ case submit = "submit";
+ case tel = "tel";
+ case text = "text";
+ case time = "time";
+ case url = "url";
+ case week = "week";
+}
\ No newline at end of file
diff --git a/src/classes/form_builder/html_form.php b/src/classes/form_builder/html_form.php
new file mode 100644
index 0000000..41cfcd6
--- /dev/null
+++ b/src/classes/form_builder/html_form.php
@@ -0,0 +1,210 @@
+
+ * @copyright (c) 2020 Elusive, Modifications by (c) 2025 Robert Strutts
+ * @link https://github.com/elusivecodes/FyreFormBuilder/blob/main/LICENSE
+ * @license MIT
+ */
+namespace CodeHydrater\form_builder;
+
+use \CodeHydrater\form_builder\html_helper as Helper;
+use CodeHydrater\enums\form_input_types as FORM_TYPE;
+
+class html_form {
+ private $output = "";
+ private bool $escape = true;
+
+ public function __construct(protected Helper $html = new Helper()) {}
+
+ public function get_output(): ?string {
+ return $this->output;
+ }
+
+ public function set_escape(bool $escape = true) {
+ $this->escape = $escape;
+ }
+
+ private function append_out(?string $out, int $tabs = 2): ?string {
+ $this->output .= str_repeat("\t", $tabs) . $out . PHP_EOL;
+ return $out;
+ }
+
+ public function __call(string $type, array $arguments): string {
+ // Get all valid values
+ $validTypes = array_column(FORM_TYPE::cases(), 'value');
+ if (!in_array($type, $validTypes, true)) {
+ throw new \InvalidArgumentException(
+ "Invalid input type: '$type'. Must be one of: " .
+ implode(', ', $validTypes)
+ );
+ }
+
+ if ($type === "none") {
+ return "";
+ }
+
+ $name = array_shift($arguments);
+ $options = array_shift($arguments) ?? [];
+
+ $options['type'] = $type;
+
+ return $this->input($name, $options);
+ }
+
+ private function do_escape(string $content, array & $options): ?string {
+ $escape = $options['escape'] ?? $this->escape;
+ if ($escape) {
+ return $this->html->escape($content);
+ }
+ return $content;
+ }
+
+ public function button(string $content = '', array $options = []): string
+ {
+ $options['type'] ??= 'button';
+ return $this->append_out('');
+ }
+
+ public function close(): string
+ {
+ return $this->append_out('', 0);
+ }
+
+ public function fieldset_close(): string
+ {
+ return $this->append_out('');
+ }
+
+ public function fieldset_open(array $options = []): string
+ {
+ return $this->append_out('