
remove dependence on jQuery add image delete Admin ui fix for mobile image updates to new style update comments
82 lines
2.2 KiB
PHP
82 lines
2.2 KiB
PHP
<?php
|
|
/**
|
|
* app/plugins/blog/forms.php
|
|
*
|
|
* This houses all of the form checking functions for this plugin.
|
|
*
|
|
* @package TP Blog
|
|
* @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\Blog;
|
|
|
|
use TheTempusProject\Bedrock\Functions\Input;
|
|
use TheTempusProject\Bedrock\Functions\Check;
|
|
use TheTempusProject\Classes\Forms;
|
|
|
|
class BlogForms extends Forms {
|
|
/**
|
|
* Adds these functions to the form list.
|
|
*/
|
|
public function __construct() {
|
|
self::addHandler( 'newBlogPost', __CLASS__, 'newBlogPost' );
|
|
self::addHandler( 'editBlogPost', __CLASS__, 'editBlogPost' );
|
|
}
|
|
|
|
/**
|
|
* Validates the new blog post form.
|
|
*
|
|
* @return {bool}
|
|
*/
|
|
public static function newBlogPost() {
|
|
if ( !Input::exists( 'title' ) ) {
|
|
self::addUserError( 'You must specify title' );
|
|
return false;
|
|
}
|
|
if ( !self::dataTitle( Input::post( 'title' ) ) ) {
|
|
self::addUserError( 'Invalid title' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'blogPost' ) ) {
|
|
self::addUserError( 'You must specify a post' );
|
|
return false;
|
|
}
|
|
/** You cannot use the token check due to how tinymce reloads the page
|
|
if (!self::token()) {
|
|
return false;
|
|
}
|
|
*/
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Validates the edit blog post form.
|
|
*
|
|
* @return {bool}
|
|
*/
|
|
public static function editBlogPost() {
|
|
if ( !Input::exists( 'title' ) ) {
|
|
self::addUserError( 'You must specify title' );
|
|
return false;
|
|
}
|
|
if ( !self::dataTitle( Input::post( 'title' ) ) ) {
|
|
self::addUserError( 'Invalid title' );
|
|
return false;
|
|
}
|
|
if ( !Input::exists( 'blogPost' ) ) {
|
|
self::addUserError( 'You must specify a post' );
|
|
return false;
|
|
}
|
|
/** You cannot use the token check due to how tinymce reloads the page
|
|
if (!self::token()) {
|
|
return false;
|
|
}
|
|
*/
|
|
return true;
|
|
}
|
|
}
|
|
|
|
new BlogForms;
|