Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

View File

@ -0,0 +1,56 @@
<?php
/**
* app/plugins/feedback/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @package TP Feedback
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Feedback;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Bedrock\Functions\Check;
use TheTempusProject\Classes\Forms;
class FeedbackForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'feedback', __CLASS__, 'feedback' );
}
/**
* Validates the feedback form.
*
* @return {bool}
*/
public static function feedback() {
if ( !Input::exists( 'name' ) ) {
Check::addUserError( 'You must provide a name.' );
return false;
}
if ( !Check::name( Input::post( 'name' ) ) ) {
Check::addUserError( 'Invalid name.' );
return false;
}
if ( !empty( Input::post( 'feedbackEmail' ) ) && !Check::email( Input::post( 'feedbackEmail' ) ) ) {
Check::addUserError( 'Invalid Email.' );
return false;
}
if ( Input::post( 'entry' ) == '' ) {
Check::addUserError( 'Feedback cannot be empty.' );
return false;
}
if ( !Check::token() ) {
return false;
}
return true;
}
}
new FeedbackForms;