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