Menu

[r309]: / trunk / test / issue61.php  Maximize  Restore  History

Download this file

48 lines (41 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once( "Libs/autoload.php" ) ;
/**
* Model Base class
*/
abstract class ModelBase {
/**#@+
* @returns string
*/
/** Drop Table SQL (DDL) */
abstract static public function dropTableSQL() ;
/** Create Table SQL (DDL) */
abstract static public function createTableSQL() ;
/**#@-*/
/**#@+
* @returns boolean
*/
/** Row addition validator */
abstract public function validateForAdd() ;
/** Row update validator */
abstract public function validateForUpdate() ;
/** Row removal validator */
abstract public function validateForDelete() ;
/**
* Validate a numeric ID
*
* @param string
*/
public function validateId( $id ) {
return ( 1 === preg_match( '/^[1-9]([0-9]+)$/', $id ) ) ;
}
/**
* Validate a date
*
* @param string
*/
public function validateDate( $date ) {
return ( 1 === preg_match( '/^20[123][0-9]-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[01])$/', $date ) ) ;
}
/**#@-*/
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.