Add new plugins: WIP, Suggestions, Reviews

This commit is contained in:
Joey Kimsey
2024-12-11 08:00:06 -05:00
parent 6a6fe4171f
commit a8a99b37e3
41 changed files with 2079 additions and 0 deletions

View File

@ -0,0 +1,68 @@
<?php
/**
* app/plugins/suggestions/forms.php
*
* This houses all of the form checking functions for this plugin.
*
* @package TP Suggest
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Plugins\Suggestions;
use TheTempusProject\Bedrock\Functions\Input;
use TheTempusProject\Classes\Forms;
class SuggestionForms extends Forms {
/**
* Adds these functions to the form list.
*/
public function __construct() {
self::addHandler( 'newSuggestion', __CLASS__, 'newSuggestion' );
self::addHandler( 'editSuggestion', __CLASS__, 'editSuggestion' );
}
/**
* Validates the suggestion create form.
*
* @return {bool}
*/
public static function newSuggestion() {
if ( !Input::exists( 'title' ) ) {
self::addUserError( 'You must specify title' );
return false;
}
if ( !Input::exists( 'suggestion' ) ) {
self::addUserError( 'You must write a Suggestion' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
/**
* Validates the suggestion create form.
*
* @return {bool}
*/
public static function editSuggestion() {
if ( !Input::exists( 'title' ) ) {
self::addUserError( 'You must specify title' );
return false;
}
if ( !Input::exists( 'suggestion' ) ) {
self::addUserError( 'You must write a Suggestion' );
return false;
}
if ( !self::token() ) {
return false;
}
return true;
}
}
new SuggestionForms;