Initial commit
This commit is contained in:
41
app/plugins/polls/forms.php
Normal file
41
app/plugins/polls/forms.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/polls/forms.php
|
||||
*
|
||||
* This houses all of the form checking functions for this plugin.
|
||||
*
|
||||
* @package TP Polls
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Plugins\Polls;
|
||||
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Classes\Forms;
|
||||
|
||||
class PollForms extends Forms {
|
||||
/**
|
||||
* Adds these functions to the form list.
|
||||
*/
|
||||
public function __construct() {
|
||||
self::addHandler( 'createPoll', __CLASS__, 'createPoll' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the createPoll form.
|
||||
*
|
||||
* @return {bool}
|
||||
*/
|
||||
public static function createPoll() {
|
||||
if ( ! Input::exists( 'poll' ) ) {
|
||||
Check::addUserError( 'You must provide a poll.' );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
new PollForms;
|
Reference in New Issue
Block a user