This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once dirname(__FILE__) . '/../i18n/I18n.php'; | |
class Validator | |
{ | |
// ... | |
public function isAllValid() | |
{ | |
$this->errors = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once dirname(__FILE__) . '/../i18n/I18n.php'; | |
class Validator | |
{ | |
public static function make($rules, $fields) | |
{ | |
return new static($rules, $fields); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$validator = Validator::make($rules, $_POST); | |
if ($validator->isAllValid()) { | |
// all is well, proceed | |
} else { | |
// oops | |
$errors = $validator->errors(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$rules = [ | |
'name' => ['required'], | |
'email' => ['required', 'email'], | |
'password' => ['required', 'min|6'], | |
'agree_to_terms' => ['required'], | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once dirname(__FILE__) . '/../i18n/I18n.php'; | |
class Validator | |
{ | |
public static function make($rules, $fields) | |
{ | |
return new static($rules, $fields); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'functions.php'; | |
require_once 'partials/html-header.php'; | |
html_header('thank_you'); | |
?> | |
<body> | |
<section class="section"> | |
<div class="container"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'functions.php'; | |
header('Location: /thank-you.php?lang=' . lang()); | |
die(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once dirname(__FILE__) . '/../i18n/I18n.php'; | |
function lang_switcher() | |
{ | |
?> | |
<form action="/" method="GET"> | |
<div class="field is-horizontal"> | |
<div class="field-label is-normal"> | |
<label class="label" for="lang"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once dirname(__FILE__) . '/../i18n/I18n.php'; | |
function html_header($titleKey) | |
{ | |
?> | |
<!DOCTYPE html> | |
<html lang="<?php echo I18n::lang(); ?>" dir="<?php echo I18n::dir() ?>"> | |
<head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'functions.php'; | |
require_once 'form/Input.php'; | |
require_once 'form/Button.php'; | |
require_once 'form/Checkbox.php'; | |
require_once 'partials/html-header.php'; | |
require_once 'partials/lang-switcher.php'; | |
$errors = $errors ?? []; |