[pLog-svn] r7131 - plog/branches/lifetype-1.2/class/data/validator

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Sep 1 10:02:23 EDT 2011


Author: jondaley
Date: 2011-09-01 10:02:23 -0400 (Thu, 01 Sep 2011)
New Revision: 7131

Added:
   plog/branches/lifetype-1.2/class/data/validator/templatesetnamevalidator.class.php
Log:
new templatesetname validator, which is almost identical to the templatenamevalidator, but just doesn't allow periods

Copied: plog/branches/lifetype-1.2/class/data/validator/templatesetnamevalidator.class.php (from rev 7123, plog/branches/lifetype-1.2/class/data/validator/templatenamevalidator.class.php)
===================================================================
--- plog/branches/lifetype-1.2/class/data/validator/templatesetnamevalidator.class.php	                        (rev 0)
+++ plog/branches/lifetype-1.2/class/data/validator/templatesetnamevalidator.class.php	2011-09-01 14:02:23 UTC (rev 7131)
@@ -0,0 +1,25 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/data/validator/validator.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/rules/regexprule.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/rules/nonemptyrule.class.php" );
+
+    define( "VALID_REGEXP_CHARS", "^([a-z0-9_-]+)$");
+
+    /**
+     * \ingroup Validator
+     *
+     * Checks whether the string is a valid template name
+     *
+     * @see NonEmptyRule
+     */
+    class TemplateSetNameValidator extends Validator 
+    {
+    	function TemplateSetNameValidator()
+        {
+        	$this->Validator();
+			$this->addRule( new NonEmptyRule());
+        	$this->addRule( new RegExpRule(VALID_REGEXP_CHARS, false ));
+        }
+    }
+?>



More information about the pLog-svn mailing list