* @link https://TheTempusProject.com * @license https://opensource.org/licenses/MIT [MIT LICENSE] */ namespace TheTempusProject\Plugins\Bookmarks; use TheTempusProject\Bedrock\Functions\Input; use TheTempusProject\Bedrock\Functions\Check; use TheTempusProject\Classes\Forms; class BookmarksForms extends Forms { /** * Adds these functions to the form list. */ public function __construct() { self::addHandler( 'createBookmark', __CLASS__, 'createBookmark' ); self::addHandler( 'createFolder', __CLASS__, 'createFolder' ); self::addHandler( 'editBookmark', __CLASS__, 'editBookmark' ); self::addHandler( 'editFolder', __CLASS__, 'editFolder' ); } public static function createBookmark() { // if ( ! Input::exists( 'title' ) ) { // Check::addUserError( 'You must include a title.' ); // return false; // } if ( ! Input::exists( 'url' ) ) { Check::addUserError( 'You must include a url.' ); return false; } // if ( ! Input::exists( 'color' ) ) { // Check::addUserError( 'You must include a color.' ); // return false; // } // if ( ! Input::exists( 'privacy' ) ) { // Check::addUserError( 'You must include a privacy.' ); // return false; // } // if ( !self::token() ) { // Check::addUserError( 'token - comment out later.' ); // return false; // } return true; } public static function createFolder() { if ( ! Input::exists( 'title' ) ) { Check::addUserError( 'You must include a title.' ); return false; } // if ( ! Input::exists( 'color' ) ) { // Check::addUserError( 'You must include a color.' ); // return false; // } // if ( ! Input::exists( 'privacy' ) ) { // Check::addUserError( 'You must include a privacy.' ); // return false; // } // if ( ! self::token() ) { // Check::addUserError( 'token - comment out later.' ); // return false; // } return true; } public static function editBookmark() { // if ( ! Input::exists( 'title' ) ) { // Check::addUserError( 'You must include a title.' ); // return false; // } if ( ! Input::exists( 'url' ) ) { Check::addUserError( 'You must include a url.' ); return false; } // if ( ! Input::exists( 'color' ) ) { // Check::addUserError( 'You must include a color.' ); // return false; // } // if ( ! Input::exists( 'privacy' ) ) { // Check::addUserError( 'You must include a privacy.' ); // return false; // } // if ( !self::token() ) { // Check::addUserError( 'token - comment out later.' ); // return false; // } return true; } public static function editFolder() { if ( ! Input::exists( 'submit' ) ) { return false; } if ( ! Input::exists( 'title' ) ) { Check::addUserError( 'You must include a title.' ); return false; } // if ( ! Input::exists( 'color' ) ) { // Check::addUserError( 'You must include a color.' ); // return false; // } // if ( ! Input::exists( 'privacy' ) ) { // Check::addUserError( 'You must include a privacy.' ); // return false; // } // if ( !self::token() ) { // Check::addUserError( 'token - comment out later.' ); // return false; // } return true; } } new BookmarksForms;