
remove dependence on jQuery add image delete Admin ui fix for mobile image updates to new style update comments
70 lines
2.0 KiB
PHP
70 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* app/plugins/comments/forms.php
|
|
*
|
|
* This houses all of the form checking functions for this plugin.
|
|
*
|
|
* @package TP Comments
|
|
* @version 5.0.1
|
|
* @author Joey Kimsey <Joey@thetempusproject.com>
|
|
* @link https://TheTempusProject.com
|
|
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
|
*/
|
|
namespace TheTempusProject\Plugins\Comments;
|
|
|
|
use TheTempusProject\Bedrock\Functions\Input;
|
|
use TheTempusProject\Bedrock\Functions\Check;
|
|
use TheTempusProject\Classes\Forms;
|
|
|
|
class CommentsForms extends Forms {
|
|
/**
|
|
* Adds these functions to the form list.
|
|
*/
|
|
public function __construct() {
|
|
self::addHandler( 'newComment', __CLASS__, 'newComment' );
|
|
self::addHandler( 'editComment', __CLASS__, 'editComment' );
|
|
}
|
|
|
|
/**
|
|
* Validates the new comment form.
|
|
*
|
|
* @return {bool}
|
|
*/
|
|
public static function newComment() {
|
|
if ( !Input::exists( 'comment' ) ) {
|
|
Check::addUserError( 'You cannot post a blank comment.' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'contentId' ) ) {
|
|
Check::addUserError( 'Content ID was missing.' );
|
|
return false;
|
|
}
|
|
// these are disabled because i need to figure out a solution for pages where images are wrong
|
|
// a missing image loads a new token and messes this up
|
|
// if ( !Check::token() ) {
|
|
// return false;
|
|
// }
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Validates the edit comment form.
|
|
*
|
|
* @return {bool}
|
|
*/
|
|
public static function editComment() {
|
|
if ( !Input::exists( 'comment' ) ) {
|
|
Check::addUserError( 'You cannot post a blank comment.' );
|
|
return false;
|
|
}
|
|
// these are disabled because i need to figure out a solution for pages where images are wrong
|
|
// a missing image loads a new token and messes this up
|
|
// if ( !Check::token() ) {
|
|
// return false;
|
|
// }
|
|
return true;
|
|
}
|
|
}
|
|
|
|
new CommentsForms;
|