Commit b046cf06 authored by Simonas's avatar Simonas

contact form update

parent 5b7a47ce
...@@ -100,77 +100,4 @@ class Biuro_Contacts_Admin { ...@@ -100,77 +100,4 @@ class Biuro_Contacts_Admin {
} }
// date DEFAULT '0000-00-00 00:00:00',
// name tinytext,
// surname tinytext,
// email varchar(128) DEFAULT '',
// phone varchar(128) DEFAULT '',
// city varchar(255) DEFAULT '',
// comment longtext DEFAULT '',
// cv text DEFAULT '',
public function get_rows_from_db_as_associative_array() {
global $wpdb;
$sql = "SELECT * FROM `" . $wpdb->prefix . "biuro_employees` ORDER BY id DESC";
return $wpdb->get_results( $sql, ARRAY_A );
}
public function insert_row_to_db() {
global $wpdb;
$table = $wpdb->prefix . 'biuro_employees';
$data = array(
'db_field_tinytext' => 'SOME TEXT',
'db_field_datetime' => date( 'Y-m-d H:i:s' ),
'db_field_varchar' => 'SOME OTHER TEXT',
'db_field_mediumint' => 123,
'db_field_text' => 'LONGER TEXT',
);
$format = array( '%s','%s', '%s', '%d', '%s' );
$wpdb->insert( $table, $data, $format );
return $wpdb->insert_id;
}
public function update_row_in_db() {
global $wpdb;
$table = $wpdb->prefix . 'biuro_employees';
$data = array(
'db_field_tinytext' => 'SOME TEXT',
'db_field_datetime' => date( 'Y-m-d H:i:s' ),
'db_field_varchar' => 'SOME OTHER TEXT',
'db_field_mediumint' => 123,
'db_field_text' => 'LONGER TEXT',
);
$format = array( '%s','%s', '%s', '%d', '%s' );
$where = array(
'ID' => 1
);
$where_format = array(
'%d'
);
return $wpdb->insert( $table, $data, $where, $format, $where_format );
}
public function delete_row_from_db() {
global $wpdb;
$table = $wpdb->prefix . 'biuro_employees';
$where = array(
'ID' => 1
);
$where_format = array(
'%d'
);
return $wpdb->delete( $table, $where, $where_format );
}
public function use_prepare_db_query() {
global $wpdb;
$sql = "UPDATE $wpdb->posts SET post_parent = %d WHERE ID = %d AND post_status = %s";
return $wpdb->query( $wpdb->prepare( $sql, 7, 15, 'static' ) );
}
} }
...@@ -52,7 +52,7 @@ class Biuro_Contacts_Activator { ...@@ -52,7 +52,7 @@ class Biuro_Contacts_Activator {
global $wpdb; global $wpdb;
$table_name = $wpdb->prefix . "biuro_employees"; $table_name = $wpdb->prefix . "biuro_employees";
$plugin_name_db_version = get_option( 'biuro-contacts_db_version', '1.0' ); $version = get_option( 'biuro-contacts_db_version', '1.0' );
if( $wpdb->get_var( "show tables like '{$table_name}'" ) != $table_name || if( $wpdb->get_var( "show tables like '{$table_name}'" ) != $table_name ||
version_compare( $version, '1.0' ) < 0 ) { version_compare( $version, '1.0' ) < 0 ) {
...@@ -61,13 +61,16 @@ class Biuro_Contacts_Activator { ...@@ -61,13 +61,16 @@ class Biuro_Contacts_Activator {
id mediumint(9) NOT NULL AUTO_INCREMENT, id mediumint(9) NOT NULL AUTO_INCREMENT,
created datetime DEFAULT '0000-00-00 00:00:00', created datetime DEFAULT '0000-00-00 00:00:00',
name tinytext, name tinytext,
surname tinytext,
email varchar(128) DEFAULT '', email varchar(128) DEFAULT '',
phone varchar(128) DEFAULT '', phone varchar(128) DEFAULT '',
city varchar(255) DEFAULT '', city varchar(255) DEFAULT null,
comment longtext DEFAULT '', city_id int DEFAULT null,
cv text DEFAULT '', message longtext DEFAULT null,
PRIMARY KEY (id) cv text DEFAULT null,
updated datetime DEFAULT '0000-00-00 00:00:00',
confirm tinyint DEFAULT 0,
job_id int DEFAULT null,
PRIMARY KEY (id)
) $charset_collate;"; ) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
......
...@@ -40,8 +40,12 @@ class Biuro_Contacts_Public { ...@@ -40,8 +40,12 @@ class Biuro_Contacts_Public {
*/ */
private $version; private $version;
const fields = [ const FIELDS = [
'employees-quick' => ['name', 'phone', 'email', 'agree', 'city', 'comment', 'cv'] 'employees-quick' => ['name', 'phone', 'email', 'agree']
];
const DB_NAMES = [
'employees-quick' => ['name', 'phone', 'email']
]; ];
/** /**
...@@ -105,6 +109,61 @@ class Biuro_Contacts_Public { ...@@ -105,6 +109,61 @@ class Biuro_Contacts_Public {
} }
// id mediumint(9) NOT NULL AUTO_INCREMENT,
// created datetime DEFAULT '0000-00-00 00:00:00',
// name tinytext,
// surname tinytext,
// email varchar(128) DEFAULT '',
// phone varchar(128) DEFAULT '',
// city varchar(255) DEFAULT '',
// message longtext DEFAULT '',
// cv text DEFAULT '',
// updated datetime DEFAULT '0000-00-00 00:00:00',
// confirm tinyint,
// job_id int,
// public function get_rows_from_db_as_associative_array() {
// global $wpdb;
// $sql = "SELECT * FROM `" . $wpdb->prefix . "biuro_employees` ORDER BY id DESC";
// return $wpdb->get_results( $sql, ARRAY_A );
// }
public static function insert_row_to_db($data) {
global $wpdb;
$table = $wpdb->prefix . 'biuro_employees';
$format = array( '%s', '%s', '%s', '%s' );
$wpdb->insert( $table, $data, $format );
return $wpdb->insert_id;
}
public static function update_row_in_db($data, $insert_id) {
global $wpdb;
$table = $wpdb->prefix . 'biuro_employees';
$format = array( '%s','%s', '%s', '%d', '%s' );
$where = array('id' => $insert_id);
$where_format = array('%d');
return $wpdb->update( $table, $data, $where, $format, $where_format );
}
// public function use_prepare_db_query() {
// global $wpdb;
// $sql = "UPDATE $wpdb->posts SET post_parent = %d WHERE ID = %d AND post_status = %s";
// return $wpdb->query( $wpdb->prepare( $sql, 7, 15, 'static' ) );
// }
/** /**
* Processes shortcode biuro-contacts--employees * Processes shortcode biuro-contacts--employees
* *
...@@ -232,7 +291,7 @@ class Biuro_Contacts_Public { ...@@ -232,7 +291,7 @@ class Biuro_Contacts_Public {
} }
public static function delete_transients( $str ) { public static function delete_transients( $str ) {
foreach (static::fields[$str] as $key) { foreach (static::FIELDS[$str] as $key) {
delete_transient($str . '--' . $key . '-value'); delete_transient($str . '--' . $key . '-value');
delete_transient($str . '--' . $key . '-status'); delete_transient($str . '--' . $key . '-status');
delete_transient($str . '--' . $key . '-message'); delete_transient($str . '--' . $key . '-message');
...@@ -243,25 +302,11 @@ class Biuro_Contacts_Public { ...@@ -243,25 +302,11 @@ class Biuro_Contacts_Public {
$success = ['status' => 'success', 'message' => '']; $success = ['status' => 'success', 'message' => ''];
$required = ['status' => 'error', 'message' => 'This field is required']; $required = ['status' => 'error', 'message' => 'This field is required'];
if ($str == 'employees-quick'): if ($str == 'employees-quick'):
switch($key) { switch($key) {
case 'name': case 'name':
if (!$value): return (!$value) ? $required : $success;
return $required;
endif;
$arr = explode(' ', $value);
if (count($arr) < 2):
return [
'status' => 'warning',
'message' => 'Name and surname are required'
];
else:
return $success;
endif;
case 'phone': case 'phone':
if (!$value && !is_email($post['email'])): if (!$value && !is_email($post['email'])):
...@@ -290,7 +335,7 @@ class Biuro_Contacts_Public { ...@@ -290,7 +335,7 @@ class Biuro_Contacts_Public {
if (!$post['phone'] && !is_email($value)): if (!$post['phone'] && !is_email($value)):
return [ return [
'status' => 'warning', 'status' => 'error',
'message' => 'Email format is incorrect' 'message' => 'Email format is incorrect'
]; ];
else: else:
...@@ -306,7 +351,7 @@ class Biuro_Contacts_Public { ...@@ -306,7 +351,7 @@ class Biuro_Contacts_Public {
endif; endif;
case 'agree': case 'agree':
if ($value != 1): if ($value != "1"):
return [ return [
'status' => 'error', 'status' => 'error',
'message' => 'You have to agree with conditions' 'message' => 'You have to agree with conditions'
...@@ -318,7 +363,7 @@ class Biuro_Contacts_Public { ...@@ -318,7 +363,7 @@ class Biuro_Contacts_Public {
endif; endif;
return ; return $success;
} }
public static function getValue( $key, $value ) { public static function getValue( $key, $value ) {
...@@ -326,60 +371,51 @@ class Biuro_Contacts_Public { ...@@ -326,60 +371,51 @@ class Biuro_Contacts_Public {
switch($key) { switch($key) {
case 'name': case 'name':
case 'phone': case 'phone':
case 'agree':
case 'city': case 'city':
return sanitize_text_field($value); return sanitize_text_field($value);
case 'email': case 'email':
return sanitize_email($value); return sanitize_email($value);
case 'comment': case 'message':
return sanitize_textarea_field($value); return sanitize_textarea_field($value);
case 'cv': case 'cv':
return sanitize_file_name($value); return sanitize_file_name($value);
case 'agree':
case 'confirm':
return filter_var($value, FILTER_VALIDATE_INT) ? $value : 0;
} }
return ''; return '';
} }
public static function set_transients( $str, $post ) { public static function set_transients( $str, $post ) {
$canSubmit = true;
$data = [
// set_transient( 'employees-quick--name-value', $_POST['name'] ); 'created' => current_time('Y-m-d H:i:s')
// set_transient( 'employees-quick--name-status', 'success' ); ];
// set_transient( 'employees-quick--name-message', '' ); foreach (static::FIELDS[$str] as $key) {
// set_transient( 'employees-quick--phone-value', $_POST['phone'] );
// set_transient( 'employees-quick--phone-status', 'error' );
// set_transient( 'employees-quick--phone-message', 'Phone or email field is required' );
// set_transient( 'employees-quick--email-value', $_POST['email'] );
// set_transient( 'employees-quick--email-status', 'error' );
// set_transient( 'employees-quick--email-message', 'Email or phone field is required' );
// set_transient( 'employees-quick--agree-value', $_POST['agree'] );
// set_transient( 'employees-quick--agree-status', 'error' );
// set_transient( 'employees-quick--agree-message', 'You have to agree with conditions' );
// set_transient( 'employees-quick--city-value', $_POST['city'] );
// set_transient( 'employees-quick--city-status', 'warning' );
// set_transient( 'employees-quick--city-message', 'You have to agree with conditions' );
// set_transient( 'employees-quick--comment-value', $_POST['comment'] );
// set_transient( 'employees-quick--comment-status', 'warning' );
// set_transient( 'employees-quick--comment-message', 'You have to agree with conditions' );
// set_transient( 'employees-quick--cv-value', $_POST['cv'] );
// set_transient( 'employees-quick--cv-status', 'warning' );
// set_transient( 'employees-quick--cv-message', 'You have to agree with conditions' );
foreach (static::fields[$str] as $key) {
$value = static::getValue($key, $post[$key]); $value = static::getValue($key, $post[$key]);
$validation = static::validate($str, $key, $value, $post); $validation = static::validate($str, $key, $value, $post);
if ($validation['status'] == 'error'):
$canSubmit = false;
endif;
if ( in_array($key, static::DB_NAMES[$str])):
$data[$key] = $value;
endif;
set_transient($str . '--' . $key . '-value', $value); set_transient($str . '--' . $key . '-value', $value);
set_transient($str . '--' . $key . '-status', $validation['status']); set_transient($str . '--' . $key . '-status', $validation['status']);
set_transient($str . '--' . $key . '-message', $validation['message']); set_transient($str . '--' . $key . '-message', $validation['message']);
} }
if ($canSubmit):
$insert_id = static::insert_row_to_db($data);
set_transient($str . '--step', 2);
set_transient($str . '--id', $insert_id);
endif;
} }
/** /**
...@@ -409,49 +445,32 @@ class Biuro_Contacts_Public { ...@@ -409,49 +445,32 @@ class Biuro_Contacts_Public {
$referer = $_POST['_wp_http_referer']; $referer = $_POST['_wp_http_referer'];
if ( !isset( $nonce ) || !wp_verify_nonce($nonce, 'employees_quick_post_nonce' ) ) { if ( !isset( $nonce ) || !wp_verify_nonce($nonce, 'employees_quick_post_nonce' ) ) {
// Nonce not match
// Diplay some error
wp_redirect( $referer ); wp_redirect( $referer );
exit; exit;
} }
// set_transient( 'employees-quick--status', '' ); delete_transient('employees-quick--step');
// set_transient( 'employees-quick--message', '' );
static::set_transients('employees-quick', $_POST); if ($_POST['submit'] == "1"):
wp_redirect( $referer ); static::set_transients('employees-quick', $_POST);
exit;
// /* elseif ($_POST['submit'] == "2" && get_transient( 'employees-quick--id' )):
// * May prehandle file upload
// */
// // Set an array containing a list of acceptable formats
// // $allowed_file_types = array('image/jpg','image/jpeg','image/gif','image/png');
// // $allowed_file_types = array('doc','docx','pdf', 'rtf', 'jpg', 'jpeg', 'gif', 'png');
// // $allowed_file_types = array('doc','docx','pdf');
// $allowed_file_types = array('application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document');
// // Check file types
// foreach( $_FILES as $file ) {
// // Get the type of the uploaded file. This is returned as "type/extension"
// $arr_file_type = wp_check_filetype( basename( $file['name'] ) );
// $uploaded_file_type = $arr_file_type['type'];
// if( ! in_array( $uploaded_file_type, $allowed_file_types ) ) {
// // Diplay some error
// wp_redirect( $referer );
// exit;
// }
// }
// // delog($nonce, 'nonce');
// // Optional: Now you can redirect the user to your confirmation page using wp_redirect()
// // ob_start();
// wp_redirect( $referer );
// exit;
// wp_redirect(admin_url('admin.php?page=' . $_POST['_wp_http_referer'])); $data = [
// die(); 'city' => static::getValue('city', $_POST['city']),
//apparently when finished, die(); is required. 'message' => static::getValue('message', $_POST['message']),
'cv' => static::getValue('cv', $_POST['cv']),
'confirm' => static::getValue('confirm', $_POST['confirm']),
'updated' => current_time('Y-m-d H:i:s')
];
static::update_row_in_db($data, get_transient( 'employees-quick--id' ));
endif;
wp_redirect( $referer );
exit;
} }
public function employers_quick_post() { public function employers_quick_post() {
......
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<?php
$nameValue = get_transient( 'employees-quick--name-value' );
$nameStatus = get_transient( 'employees-quick--name-status' );
$nameMessage = get_transient( 'employees-quick--name-message' );
?>
<div class="c-form--row">
<label class="c-form--label" for="form-name">Name, Surname*</label>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>" autofocus="autofocus">
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
<?php echo $nameMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = get_transient( 'employees-quick--phone-value' );
$phoneStatus = get_transient( 'employees-quick--phone-status' );
$phoneMessage = get_transient( 'employees-quick--phone-message' );
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone">Phone no.*</label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
<input type="tel" class="c-form--input" id="form-phone" name="phone" value="<?php echo $phoneValue; ?>">
</div>
<?php if ($phoneMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $phoneStatus; ?>">
<?php echo $phoneMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = get_transient( 'employees-quick--email-value' );
$emailStatus = get_transient( 'employees-quick--email-status' );
$emailMessage = get_transient( 'employees-quick--email-message' );
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email">Email address*</label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
<input type="email" class="c-form--input" id="form-email" name="email" value="<?php echo $emailValue; ?>">
</div>
<?php if ($emailMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $emailStatus; ?>">
<?php echo $emailMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="c-form--submit" name="submit" value="1">Submit</button>
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = get_transient( 'employees-quick--agree-value' );
$agreeStatus = get_transient( 'employees-quick--agree-status' );
$agreeMessage = get_transient( 'employees-quick--agree-message' );
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
<label class="c-form--label-checkbox" for="form-agree">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem possimus, delectus unde enim dolores doloribus, recusandae a veritatis ducimus repudiandae iste eos voluptatum architecto mollitia?</label>
</div>
<?php if ($agreeMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $agreeStatus; ?>">
<?php echo $agreeMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
/**
* Provide a public-facing view for the plugin
*
* This file is used to markup the public-facing aspects of the plugin.
*
* @link https://www.biuro.lt
* @since 1.0.0
*
* @package Biuro_Contacts
* @subpackage Biuro_Contacts/public/partials
*/
/**
* @link https://codex.wordpress.org/Creating_Options_Pages
* @link https://www.smashingmagazine.com/2016/04/three-approaches-to-adding-configurable-fields-to-your-plugin/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) die;
?>
<div class="c-form--row">
<label class="c-form--label" for="form-city">City</label>
<div class="c-form--input-wrap">
<input type="text" class="c-form--input" id="form-city" name="city" value="" autofocus="autofocus">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-message">Message</label>
<div class="c-form--textarea-wrap">
<textarea name="message" id="form-message" cols="30" rows="3" class="c-form--textarea"></textarea>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<label class="c-form--label" for="form-cv">CV</label>
<div class="c-form--input-wrap">
<input type="file" class="c-form--input" id="form-cv" name="cv" value="">
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="c-form--submit" name="submit" value="2">Submit</button>
</div>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-confirm" type="checkbox" class="c-form--checkbox" name="confirm" value="1">
<label class="c-form--label-checkbox" for="form-confirm">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem possimus, delectus unde enim dolores doloribus, recusandae?</label>
</div>
</div><!-- .c-form--row -->
...@@ -23,80 +23,12 @@ if ( ! defined( 'WPINC' ) ) die; ...@@ -23,80 +23,12 @@ if ( ! defined( 'WPINC' ) ) die;
<form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post" enctype="multipart/form-data" class="c-form"> <form action="<?php echo esc_url( admin_url('admin-post.php') ); ?>" method="post" enctype="multipart/form-data" class="c-form">
<?php <?php
$nameValue = get_transient( 'employees-quick--name-value' ); if ( !get_transient( 'employees-quick--step' ) ):
$nameStatus = get_transient( 'employees-quick--name-status' ); include_once('biuro-contacts-public--employees-quick--step-1.php');
$nameMessage = get_transient( 'employees-quick--name-message' ); else:
?> include_once('biuro-contacts-public--employees-quick--step-2.php');
<div class="c-form--row"> endif;
<label class="c-form--label" for="form-name">Name, Surname*</label> ?>
<div class="c-form--input-wrap <?php if ($nameStatus) { echo "c-form--input-wrap--$nameStatus"; } ?>"> <input type="hidden" name="action" value="employees_quick_post">
<input type="text" class="c-form--input" id="form-name" name="name" value="<?php echo $nameValue; ?>"> <?php wp_nonce_field('employees_quick_post_nonce'); ?>
</div>
<?php if ($nameMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $nameStatus; ?>">
<?php echo $nameMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$phoneValue = get_transient( 'employees-quick--phone-value' );
$phoneStatus = get_transient( 'employees-quick--phone-status' );
$phoneMessage = get_transient( 'employees-quick--phone-message' );
?>
<div class="c-form--row">
<label class="c-form--label" for="form-phone">Phone no.*</label>
<div class="c-form--input-wrap <?php if ($phoneStatus) { echo "c-form--input-wrap--$phoneStatus"; } ?>">
<input type="tel" class="c-form--input" id="form-phone" name="phone" value="<?php echo $phoneValue; ?>">
</div>
<?php if ($phoneMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $phoneStatus; ?>">
<?php echo $phoneMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<?php
$emailValue = get_transient( 'employees-quick--email-value' );
$emailStatus = get_transient( 'employees-quick--email-status' );
$emailMessage = get_transient( 'employees-quick--email-message' );
?>
<div class="c-form--row">
<label class="c-form--label" for="form-email">Email address*</label>
<div class="c-form--input-wrap <?php if ($emailStatus) { echo "c-form--input-wrap--$emailStatus"; } ?>">
<input type="email" class="c-form--input" id="form-email" name="email" value="<?php echo $emailValue; ?>">
</div>
<?php if ($emailMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $emailStatus; ?>">
<?php echo $emailMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<div class="c-form--row">
<div class="c-form--submit-wrap">
<button type="submit" class="c-form--submit" name="submit" value="1">Submit</button>
</div>
</div><!-- .c-form--row -->
<?php
$agreeValue = get_transient( 'employees-quick--agree-value' );
$agreeStatus = get_transient( 'employees-quick--agree-status' );
$agreeMessage = get_transient( 'employees-quick--agree-message' );
?>
<div class="c-form--row">
<div class="c-form--checkbox-wrap">
<input id="form-agree" type="checkbox" class="c-form--checkbox <?php if ($agreeStatus) { echo "c-form--checkbox--$agreeStatus"; } ?>" name="agree" value="1" <?php if ($agreeValue): ?> checked="checked"<?php endif; ?>>
<label class="c-form--label-checkbox" for="form-agree">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem possimus, delectus unde enim dolores doloribus, recusandae a veritatis ducimus repudiandae iste eos voluptatum architecto mollitia?</label>
</div>
<?php if ($agreeMessage): ?>
<div class="c-form--validation c-form--validation-<?php echo $agreeStatus; ?>">
<?php echo $agreeMessage; ?>
</div>
<?php endif; ?>
</div><!-- .c-form--row -->
<input type="hidden" name="action" value="employees_quick_post">
<?php wp_nonce_field('employees_quick_post_nonce'); ?>
</form> </form>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment