[limb-svn] r6353 - in 3.x/trunk/limb/validation: . src/rule
svn at limb-project.com
svn at limb-project.com
Mon Oct 1 22:05:03 MSD 2007
Author: pachanga
Date: 2007-10-01 22:05:02 +0400 (Mon, 01 Oct 2007)
New Revision: 6353
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6353
Modified:
3.x/trunk/limb/validation/common.inc.php
3.x/trunk/limb/validation/src/rule/lmbBaseValidationRule.class.php
3.x/trunk/limb/validation/src/rule/lmbRequiredRule.class.php
Log:
-- i18n includes moved from common.inc.php to the more specific place
Modified: 3.x/trunk/limb/validation/common.inc.php
===================================================================
--- 3.x/trunk/limb/validation/common.inc.php 2007-10-01 18:03:00 UTC (rev 6352)
+++ 3.x/trunk/limb/validation/common.inc.php 2007-10-01 18:05:02 UTC (rev 6353)
@@ -1,17 +1,15 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-
-/**
- * @package validation
- * @version $Id$
- */
-require_once('limb/core/common.inc.php');
-lmb_require('limb/i18n/common.inc.php');
-
-?>
\ No newline at end of file
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+
+/**
+ * @package validation
+ * @version $Id$
+ */
+require_once('limb/core/common.inc.php');
+
Modified: 3.x/trunk/limb/validation/src/rule/lmbBaseValidationRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbBaseValidationRule.class.php 2007-10-01 18:03:00 UTC (rev 6352)
+++ 3.x/trunk/limb/validation/src/rule/lmbBaseValidationRule.class.php 2007-10-01 18:05:02 UTC (rev 6353)
@@ -7,6 +7,7 @@
* @license LGPL http://www.gnu.org/copyleft/lesser.html
*/
lmb_require('limb/validation/src/rule/lmbValidationRule.interface.php');
+lmb_require('limb/i18n/common.inc.php');
/**
* A base class for validation rules.
Modified: 3.x/trunk/limb/validation/src/rule/lmbRequiredRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbRequiredRule.class.php 2007-10-01 18:03:00 UTC (rev 6352)
+++ 3.x/trunk/limb/validation/src/rule/lmbRequiredRule.class.php 2007-10-01 18:05:02 UTC (rev 6353)
@@ -1,61 +1,60 @@
-<?php
-/*
- * Limb PHP Framework
- *
- * @link http://limb-project.com
- * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
- * @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-lmb_require('limb/validation/src/rule/lmbBaseValidationRule.class.php');
-lmb_require('limb/i18n/common.inc.php');
-
-/**
- * Checks that field is present in datasource and has not empty value
- * Example of usage:
- * <code>
- * lmb_require('limb/validation/src/rule/lmbRequiredRule.class.php');
- * $validator->addRule(new lmbRequiredRule('title'));
- * //or
- * $validator->addRule(new lmbHandle('limb/validation/src/rule/lmbRequiredRule', array('title')));
- * // or
- * $validator->addRequiredRule('title');
- * </code>
- * @see lmbValidator :: addRequiredRule()
- * @package validation
- * @version $Id$
- */
-class lmbRequiredRule extends lmbBaseValidationRule
-{
- /**
- * @var string Field name
- */
- protected $field_name;
- /**
- * @var string Custom error message
- */
- protected $custom_error;
-
- /**
- * Constructor
- * @param string Field name
- */
- function __construct($field_name, $custom_error = '')
- {
- $this->field_name = $field_name;
- $this->custom_error = $custom_error;
- }
-
- /**
- * @see lmbBaseValidationRule :: _doValidate()
- */
- protected function _doValidate($datasource)
- {
- $value = $datasource->get($this->field_name);
- if(is_null($value) || (is_string($value) && trim($value) === ''))
- {
- $error = $this->custom_error ? $this->custom_error : lmb_i18n('{Field} is required', 'validation');
- $this->error($error, array('Field' => $this->field_name));
- }
- }
-}
-
+<?php
+/*
+ * Limb PHP Framework
+ *
+ * @link http://limb-project.com
+ * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
+ * @license LGPL http://www.gnu.org/copyleft/lesser.html
+ */
+lmb_require('limb/validation/src/rule/lmbBaseValidationRule.class.php');
+
+/**
+ * Checks that field is present in datasource and has not empty value
+ * Example of usage:
+ * <code>
+ * lmb_require('limb/validation/src/rule/lmbRequiredRule.class.php');
+ * $validator->addRule(new lmbRequiredRule('title'));
+ * //or
+ * $validator->addRule(new lmbHandle('limb/validation/src/rule/lmbRequiredRule', array('title')));
+ * // or
+ * $validator->addRequiredRule('title');
+ * </code>
+ * @see lmbValidator :: addRequiredRule()
+ * @package validation
+ * @version $Id$
+ */
+class lmbRequiredRule extends lmbBaseValidationRule
+{
+ /**
+ * @var string Field name
+ */
+ protected $field_name;
+ /**
+ * @var string Custom error message
+ */
+ protected $custom_error;
+
+ /**
+ * Constructor
+ * @param string Field name
+ */
+ function __construct($field_name, $custom_error = '')
+ {
+ $this->field_name = $field_name;
+ $this->custom_error = $custom_error;
+ }
+
+ /**
+ * @see lmbBaseValidationRule :: _doValidate()
+ */
+ protected function _doValidate($datasource)
+ {
+ $value = $datasource->get($this->field_name);
+ if(is_null($value) || (is_string($value) && trim($value) === ''))
+ {
+ $error = $this->custom_error ? $this->custom_error : lmb_i18n('{Field} is required', 'validation');
+ $this->error($error, array('Field' => $this->field_name));
+ }
+ }
+}
+
More information about the limb-svn
mailing list