@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * You should have received a copy of the GNU General Public License |
| 23 | 23 | * along with this program; if not, write to the Free Software |
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | - */ |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * You should have received a copy of the GNU General Public License |
| 23 | 23 | * along with this program; if not, write to the Free Software |
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | - */ |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @file function_string.php |
@@ -1,24 +1,24 @@ |
||
| 1 | 1 | <?php |
| 2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
| 2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
| 3 | 3 | /** |
| 4 | 4 | * Form validation language message (English) |
| 5 | 5 | */ |
| 6 | 6 | $lang['fv_required'] = 'Field %1 is required.'; |
| 7 | - $lang['fv_min_length'] = 'Field %1 must contain at least %2 characters.'; |
|
| 8 | - $lang['fv_max_length'] = 'Field %1 must contain at most %2 characters.'; |
|
| 9 | - $lang['fv_exact_length'] = 'Field %1 must contain exactly %2 characters.'; |
|
| 10 | - $lang['fv_less_than'] = 'Field %1 must less than %2.'; |
|
| 11 | - $lang['fv_greater_than'] = 'Field %1 must greater than %2.'; |
|
| 12 | - $lang['fv_matches'] = 'Field %1 must be identical to field %2.'; |
|
| 13 | - $lang['fv_valid_email'] = 'Field %1 must contain a valid E-mail address.'; |
|
| 14 | - $lang['fv_not_equal_post_key'] = 'Field %1 must not be the same as field %2.'; |
|
| 15 | - $lang['fv_not_equal_string'] = 'Field %1 must not contain the value %2.'; |
|
| 16 | - $lang['fv_depends'] = 'Field %1 depends on field %2 which is not valid.'; |
|
| 7 | + $lang['fv_min_length'] = 'Field %1 must contain at least %2 characters.'; |
|
| 8 | + $lang['fv_max_length'] = 'Field %1 must contain at most %2 characters.'; |
|
| 9 | + $lang['fv_exact_length'] = 'Field %1 must contain exactly %2 characters.'; |
|
| 10 | + $lang['fv_less_than'] = 'Field %1 must less than %2.'; |
|
| 11 | + $lang['fv_greater_than'] = 'Field %1 must greater than %2.'; |
|
| 12 | + $lang['fv_matches'] = 'Field %1 must be identical to field %2.'; |
|
| 13 | + $lang['fv_valid_email'] = 'Field %1 must contain a valid E-mail address.'; |
|
| 14 | + $lang['fv_not_equal_post_key'] = 'Field %1 must not be the same as field %2.'; |
|
| 15 | + $lang['fv_not_equal_string'] = 'Field %1 must not contain the value %2.'; |
|
| 16 | + $lang['fv_depends'] = 'Field %1 depends on field %2 which is not valid.'; |
|
| 17 | 17 | $lang['fv_is_unique'] = 'The value of field %1 already exists.'; |
| 18 | 18 | $lang['fv_is_unique_update'] = 'The value of field %1 already exists for another record.'; |
| 19 | - $lang['fv_exists'] = 'The value of the field %1 does not exist.'; |
|
| 20 | - $lang['fv_regex'] = 'The value of the field %1 does not use the correct format.'; |
|
| 21 | - $lang['fv_in_list'] = 'The value of field %1 must be one of the list (%2).'; |
|
| 22 | - $lang['fv_numeric'] = 'The value of field %1 must be a number.'; |
|
| 23 | - $lang['fv_callback'] = 'The value of field %1 is not valid.'; |
|
| 19 | + $lang['fv_exists'] = 'The value of the field %1 does not exist.'; |
|
| 20 | + $lang['fv_regex'] = 'The value of the field %1 does not use the correct format.'; |
|
| 21 | + $lang['fv_in_list'] = 'The value of field %1 must be one of the list (%2).'; |
|
| 22 | + $lang['fv_numeric'] = 'The value of field %1 must be a number.'; |
|
| 23 | + $lang['fv_callback'] = 'The value of field %1 is not valid.'; |
|
| 24 | 24 | |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
| 2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
| 3 | 3 | /** |
| 4 | 4 | * File upload language messages (English) |
| 5 | 5 | */ |
| 6 | 6 | $lang['fu_upload_err_ini_size'] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.'; |
| 7 | - $lang['fu_upload_err_form_size'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'; |
|
| 8 | - $lang['fu_upload_err_partial'] = 'The uploaded file was only partially uploaded.'; |
|
| 9 | - $lang['fu_upload_err_no_file'] = 'No file was choosed. Please select one.'; |
|
| 10 | - $lang['fu_upload_err_no_tmp_dir'] = 'Missing a temporary folder.'; |
|
| 11 | - $lang['fu_upload_err_cant_write'] = 'Failed to write file to disk.'; |
|
| 12 | - $lang['fu_upload_err_extension'] = 'A PHP extension stopped the file upload.'; |
|
| 13 | - $lang['fu_accept_file_types'] = 'Filetype not allowed'; |
|
| 14 | - $lang['fu_file_uploads_disabled'] = 'File uploading option is disabled in php.ini'; |
|
| 15 | - $lang['fu_max_file_size'] = 'The uploaded file size is too big max size is %s'; |
|
| 16 | - $lang['fu_overwritten_not_allowed'] = 'You don\'t allow overwriting existing file'; |
|
| 7 | + $lang['fu_upload_err_form_size'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'; |
|
| 8 | + $lang['fu_upload_err_partial'] = 'The uploaded file was only partially uploaded.'; |
|
| 9 | + $lang['fu_upload_err_no_file'] = 'No file was choosed. Please select one.'; |
|
| 10 | + $lang['fu_upload_err_no_tmp_dir'] = 'Missing a temporary folder.'; |
|
| 11 | + $lang['fu_upload_err_cant_write'] = 'Failed to write file to disk.'; |
|
| 12 | + $lang['fu_upload_err_extension'] = 'A PHP extension stopped the file upload.'; |
|
| 13 | + $lang['fu_accept_file_types'] = 'Filetype not allowed'; |
|
| 14 | + $lang['fu_file_uploads_disabled'] = 'File uploading option is disabled in php.ini'; |
|
| 15 | + $lang['fu_max_file_size'] = 'The uploaded file size is too big max size is %s'; |
|
| 16 | + $lang['fu_overwritten_not_allowed'] = 'You don\'t allow overwriting existing file'; |
|
| 17 | 17 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * You should have received a copy of the GNU General Public License |
| 23 | 23 | * along with this program; if not, write to the Free Software |
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | - */ |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @file constants.php |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * You should have received a copy of the GNU General Public License |
| 23 | 23 | * along with this program; if not, write to the Free Software |
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | - */ |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | function & class_loader($class, $dir = 'libraries', $params = null){ |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * @test |
|
| 96 | - */ |
|
| 95 | + * @test |
|
| 96 | + */ |
|
| 97 | 97 | function get_config($key, $default = null){ |
| 98 | 98 | static $cfg; |
| 99 | 99 | if(empty($cfg)){ |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | - * @test |
|
| 125 | - */ |
|
| 124 | + * @test |
|
| 125 | + */ |
|
| 126 | 126 | function is_url($url){ |
| 127 | 127 | return preg_match('/^(http|https|ftp):\/\/(.*)/', $url); |
| 128 | 128 | } |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | - * @test |
|
| 146 | - */ |
|
| 145 | + * @test |
|
| 146 | + */ |
|
| 147 | 147 | function attributes_to_string(array $attributes){ |
| 148 | 148 | $str = ' '; |
| 149 | 149 | //we check that the array passed as an argument is not empty. |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | - * @test |
|
| 177 | - */ |
|
| 176 | + * @test |
|
| 177 | + */ |
|
| 178 | 178 | function clean_input($str){ |
| 179 | 179 | if(is_array($str)){ |
| 180 | 180 | $str = array_map('clean_input', $str); |
@@ -193,8 +193,8 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * @test |
|
| 197 | - */ |
|
| 196 | + * @test |
|
| 197 | + */ |
|
| 198 | 198 | function string_hidden($str, $startCount = 0, $endCount = 0, $hiddenChar = '*'){ |
| 199 | 199 | //get the string length |
| 200 | 200 | $len = strlen($str); |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Function to test private & protected method |
|
| 5 | - */ |
|
| 4 | + * Function to test private & protected method |
|
| 5 | + */ |
|
| 6 | 6 | function runPrivateOrProtectedMethod($object, $method, array $args = array()){ |
| 7 | 7 | $r = new ReflectionClass(get_class($object)); |
| 8 | 8 | $m = $r->getMethod($method); |
@@ -3,66 +3,66 @@ discard block |
||
| 3 | 3 | class FormValidationTest extends TestCase |
| 4 | 4 | { |
| 5 | 5 | public static function setUpBeforeClass() |
| 6 | - { |
|
| 6 | + { |
|
| 7 | 7 | |
| 8 | - } |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | 10 | public static function tearDownAfterClass() |
| 11 | - { |
|
| 11 | + { |
|
| 12 | 12 | |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - protected function setUp() |
|
| 16 | - { |
|
| 15 | + protected function setUp() |
|
| 16 | + { |
|
| 17 | 17 | |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - protected function tearDown() |
|
| 21 | - { |
|
| 20 | + protected function tearDown() |
|
| 21 | + { |
|
| 22 | 22 | |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - // tests |
|
| 28 | - public function testValidationDataIsEmpty() |
|
| 29 | - { |
|
| 27 | + // tests |
|
| 28 | + public function testValidationDataIsEmpty() |
|
| 29 | + { |
|
| 30 | 30 | $fv = new FormValidation(); |
| 31 | 31 | $this->assertEmpty($fv->getData()); |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | public function testValidationDataIsNotEmpty() |
| 35 | - { |
|
| 35 | + { |
|
| 36 | 36 | $fv = new FormValidation(); |
| 37 | 37 | $fv->setData(array('name' => 'mike')); |
| 38 | 38 | $this->assertNotEmpty($fv->getData()); |
| 39 | 39 | $this->assertArrayHasKey('name', $fv->getData()); |
| 40 | - } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | public function testCannotDoValidation() |
| 43 | - { |
|
| 43 | + { |
|
| 44 | 44 | $fv = new FormValidation(); |
| 45 | 45 | $this->assertFalse($fv->canDoValidation()); |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | public function testSettingErrorDelimiter() |
| 49 | - { |
|
| 49 | + { |
|
| 50 | 50 | $fv = new FormValidation(); |
| 51 | 51 | $fv->setErrorDelimiter('<a>', '</b>'); |
| 52 | 52 | $this->assertContains('<a>', $fv->getErrorDelimiter()); |
| 53 | 53 | $this->assertContains('</b>', $fv->getErrorDelimiter()); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | public function testSettingErrorsDelimiter() |
| 57 | - { |
|
| 57 | + { |
|
| 58 | 58 | $fv = new FormValidation(); |
| 59 | 59 | $fv->setErrorsDelimiter('<foo>', '</bar>'); |
| 60 | 60 | $this->assertContains('<foo>', $fv->getErrorsDelimiter()); |
| 61 | 61 | $this->assertContains('</bar>', $fv->getErrorsDelimiter()); |
| 62 | - } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | public function testSettingErrorMessageOverride() |
| 65 | - { |
|
| 65 | + { |
|
| 66 | 66 | |
| 67 | 67 | //field specific message for the rule |
| 68 | 68 | $fv = new FormValidation(); |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $this->assertFalse($fv->run()); |
| 84 | 84 | $this->assertContains('global required message error', $fv->returnErrors()); |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | public function testSettingCustomErrorMessage() |
| 88 | - { |
|
| 88 | + { |
|
| 89 | 89 | |
| 90 | 90 | $fv = new FormValidation(); |
| 91 | 91 | $fv->setData(array('foo' => '')); |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $this->assertFalse($fv->run()); |
| 105 | 105 | $this->assertContains('custom "bar" message error', $fv->returnErrors()); |
| 106 | - } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | public function testReturnErrorsArray() |
| 109 | - { |
|
| 109 | + { |
|
| 110 | 110 | $fv = new FormValidation(); |
| 111 | 111 | $fv->setRule('name', 'name', 'required'); |
| 112 | 112 | $fv->setData(array('name' => '')); |
| 113 | 113 | $this->assertFalse($fv->run()); |
| 114 | 114 | $this->assertNotEmpty($fv->returnErrors()); |
| 115 | - } |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | public function testRequiredRule() |
| 119 | - { |
|
| 119 | + { |
|
| 120 | 120 | $fv = new FormValidation(); |
| 121 | 121 | $fv->setRule('name', 'name', 'required'); |
| 122 | 122 | $fv->setData(array('name' => '')); |
@@ -131,5 +131,5 @@ discard block |
||
| 131 | 131 | $fv->setRule('name', 'name', 'required'); |
| 132 | 132 | $fv->setData(array('name' => 'tony')); |
| 133 | 133 | $this->assertTrue($fv->run()); |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * You should have received a copy of the GNU General Public License |
| 23 | 23 | * along with this program; if not, write to the Free Software |
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | - */ |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @file common.php |
@@ -438,13 +438,13 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | |
| 440 | 440 | /** |
| 441 | - * Function to stringfy PHP variable, useful in debug situation |
|
| 442 | - * |
|
| 443 | - * @param mixed $var the variable to stringfy |
|
| 444 | - * @codeCoverageIgnore |
|
| 445 | - * |
|
| 446 | - * @return string the stringfy value |
|
| 447 | - */ |
|
| 441 | + * Function to stringfy PHP variable, useful in debug situation |
|
| 442 | + * |
|
| 443 | + * @param mixed $var the variable to stringfy |
|
| 444 | + * @codeCoverageIgnore |
|
| 445 | + * |
|
| 446 | + * @return string the stringfy value |
|
| 447 | + */ |
|
| 448 | 448 | function stringfy_vars($var){ |
| 449 | 449 | return print_r($var, true); |
| 450 | 450 | } |
@@ -586,15 +586,15 @@ discard block |
||
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /** |
| 589 | - * This function is very useful, it allows to recover the instance of the global controller. |
|
| 590 | - * Note this function always returns the address of the super instance. |
|
| 591 | - * For example : |
|
| 592 | - * $obj = & get_instance(); |
|
| 593 | - * |
|
| 594 | - * @codeCoverageIgnore |
|
| 595 | - * |
|
| 596 | - * @return object the instance of the "Controller" class |
|
| 597 | - */ |
|
| 589 | + * This function is very useful, it allows to recover the instance of the global controller. |
|
| 590 | + * Note this function always returns the address of the super instance. |
|
| 591 | + * For example : |
|
| 592 | + * $obj = & get_instance(); |
|
| 593 | + * |
|
| 594 | + * @codeCoverageIgnore |
|
| 595 | + * |
|
| 596 | + * @return object the instance of the "Controller" class |
|
| 597 | + */ |
|
| 598 | 598 | function & get_instance(){ |
| 599 | 599 | return Controller::get_instance(); |
| 600 | 600 | } |