42 lines
998 B
PHP
42 lines
998 B
PHP
<?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;
|