[limb-svn] r5971 - 3.x/trunk/limb/validation/src/rule
svn at limb-project.com
svn at limb-project.com
Fri Jun 8 15:37:34 MSD 2007
Author: pachanga
Date: 2007-06-08 15:37:34 +0400 (Fri, 08 Jun 2007)
New Revision: 5971
URL: http://fisheye.limb-project.com/changelog/limb/?cs=5971
Removed:
3.x/trunk/limb/validation/src/rule/lmbFileUploadMaxSizeRule.class.php
3.x/trunk/limb/validation/src/rule/lmbFileUploadMimeTypeRule.class.php
3.x/trunk/limb/validation/src/rule/lmbFileUploadPartialRule.class.php
3.x/trunk/limb/validation/src/rule/lmbFileUploadRequiredRule.class.php
Log:
-- upload rules removed
Deleted: 3.x/trunk/limb/validation/src/rule/lmbFileUploadMaxSizeRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbFileUploadMaxSizeRule.class.php 2007-06-08 10:55:48 UTC (rev 5970)
+++ 3.x/trunk/limb/validation/src/rule/lmbFileUploadMaxSizeRule.class.php 2007-06-08 11:37:34 UTC (rev 5971)
@@ -1,55 +0,0 @@
-<?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/lmbSingleFieldRule.class.php');
-
-/**
- * class lmbFileUploadMaxSizeRule.
- *
- * @package validation
- * @version $Id$
- */
-class lmbFileUploadMaxSizeRule extends lmbSingleFieldRule
-{
- protected $max_size;
-
- function __construct($field_name, $max_size = NULL, $custom_error = '')
- {
- parent :: __construct($field_name, $custom_error);
-
- $this->max_size = $max_size;
- }
-
- function check($value)
- {
- if(!is_null($this->max_size) && ($value['size'] > (int)$this->max_size))
- {
- $this->error('{Field} - uploaded file was too large. Maximum size is {maxsize}.',
- array('maxsize' => $this->_sizeToHuman($this->max_size)));
- return;
- }
-
- if($value['error'] == UPLOAD_ERR_INI_SIZE ||
- $value['error'] == UPLOAD_ERR_FORM_SIZE)
- {
- $this->error('{Field} - file was too large to upload.');
- }
- }
-
- protected function _sizeToHuman($filesize = 0)
- {
- if($filesize < 1024)
- return $filesize . "B";
-
- if($filesize >= 1024 && $filesize < 1048576)
- return sprintf("%.2fKB", $filesize / 1024);
-
- return sprintf("%.2fMB", $filesize / 1048576);
- }
-}
-?>
\ No newline at end of file
Deleted: 3.x/trunk/limb/validation/src/rule/lmbFileUploadMimeTypeRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbFileUploadMimeTypeRule.class.php 2007-06-08 10:55:48 UTC (rev 5970)
+++ 3.x/trunk/limb/validation/src/rule/lmbFileUploadMimeTypeRule.class.php 2007-06-08 11:37:34 UTC (rev 5971)
@@ -1,39 +0,0 @@
-<?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/lmbSingleFieldRule.class.php');
-
-/**
- * class lmbFileUploadMimeTypeRule.
- *
- * @package validation
- * @version $Id$
- */
-class lmbFileUploadMimeTypeRule extends lmbSingleFieldRule
-{
- protected $mime_types = array();
-
- function __construct($field_name, $mime_types = array(), $custom_error = '')
- {
- parent :: __construct($field_name, $custom_error);
-
- $this->mime_types = $mime_types;
- }
-
- function check($value)
- {
- if (! empty($value['type']) &&
- ! in_array($value['type'], $this->mime_types))
- {
- $this->error('{Field} - uploaded file must be of type: {mime_types}.',
- $values = array(),
- $i18n_params = array('mime_types' => implode(', ', $this->mime_types)));
- }
- }
-}
-?>
\ No newline at end of file
Deleted: 3.x/trunk/limb/validation/src/rule/lmbFileUploadPartialRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbFileUploadPartialRule.class.php 2007-06-08 10:55:48 UTC (rev 5970)
+++ 3.x/trunk/limb/validation/src/rule/lmbFileUploadPartialRule.class.php 2007-06-08 11:37:34 UTC (rev 5971)
@@ -1,45 +0,0 @@
-<?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/lmbValidationRule.interface.php');
-
-/**
- * class lmbFileUploadPartialRule.
- *
- * @package validation
- * @version $Id$
- */
-class lmbFileUploadPartialRule implements lmbValidationRule
-{
- protected $field_name;
- /**
- * @var string Custom error message
- */
- protected $custom_error;
-
- function __construct($field_name, $custom_error = '')
- {
- $this->field_name = $field_name;
- $this->custom_error = $custom_error;
- }
-
- function validate($datasource, $error_list)
- {
- $value = $datasource->get($this->field_name);
-
- if (empty($value['name']))
- {
- $error = $this->custom_error ? $this->custom_error : lmb_i18n('{Field} is required.', 'validation');
- $error_list->addError($error, array('Field' => $this->field_name));
- return false;
- }
-
- return true;
- }
-}
-?>
\ No newline at end of file
Deleted: 3.x/trunk/limb/validation/src/rule/lmbFileUploadRequiredRule.class.php
===================================================================
--- 3.x/trunk/limb/validation/src/rule/lmbFileUploadRequiredRule.class.php 2007-06-08 10:55:48 UTC (rev 5970)
+++ 3.x/trunk/limb/validation/src/rule/lmbFileUploadRequiredRule.class.php 2007-06-08 11:37:34 UTC (rev 5971)
@@ -1,44 +0,0 @@
-<?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/lmbValidationRule.interface.php');
-
-/**
- * class lmbFileUploadRequiredRule.
- *
- * @package validation
- * @version $Id$
- */
-class lmbFileUploadRequiredRule implements lmbValidationRule
-{
- protected $field_name;
- /**
- * @var string Custom error message
- */
- protected $custom_error;
-
- function __construct($field_name, $custom_error = '')
- {
- $this->field_name = $field_name;
- $this->custom_error = $custom_error;
- }
-
- function validate($datasource, $error_list)
- {
- $value = $datasource->get($this->field_name);
-
- if (empty($value['name']))
- {
- $error = $this->custom_error ? $this->custom_error : lmb_i18n('{Field} is required.', 'validation');
- $error_list->addError($error, array('Field' => $this->field_name));
- return false;
- }
- return true;
- }
-}
-?>
\ No newline at end of file
More information about the limb-svn
mailing list