Changeset View
Standalone View
core/kernel/utility/validator.php
<?php | <?php | ||||
/** | /** | ||||
* @version $Id: validator.php 16080 2014-09-19 15:23:59Z alex $ | * @version $Id: validator.php 15522 2012-08-20 15:25:51Z alex $ | ||||
* @package In-Portal | * @package In-Portal | ||||
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved. | * @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved. | ||||
* @license GNU/GPL | * @license GNU/GPL | ||||
alex: The parameter name should be `max_value` to be consistent with other parameter names. | |||||
Not Done ReplyThe array declaration isn't fixed to match coding standard. alex: The array declaration isn't fixed to match coding standard. | |||||
Not Done ReplyThe $params should be used here to make use of newly added {field} parameter as last %s. alex: The `$params` should be used here to make use of newly added `{field}` parameter as last `%s`. | |||||
Context not available. | |||||
$params = array(); | $params = array(); | ||||
} | } | ||||
$field_phrase = $this->Application->isAdmin ? 'la_fld_' . $field : 'lu_fld_' . $field; | $field_options = $this->dataSource->GetFieldOptions($field); | ||||
Not Done ReplyWe need to allow changing this via unit config as well. Here is what needs to be done: $field_options = $this->dataSource->GetFieldOptions($field); if ( $this->Application->isAdmin ) { $field_phrase = !empty($field_options['admin_label']) ? $field_options['admin_label'] : 'la_fld_' . $field; } else { $field_phrase = !empty($field_options['front_label']) ? $field_options['front_label'] : 'lu_fld_' . $field; } Theoretically this would allow to override corresponding phrase in unit config. alex: We need to allow changing this via unit config as well. Here is what needs to be done:
```… | |||||
Not Done ReplyThere is dedicated $this->Application->Phrase method that should be used to translate a phrase. alex: There is dedicated `$this->Application->Phrase` method that should be used to translate a… | |||||
if ( $this->Application->isAdmin ) { | |||||
$field_phrase = !empty($field_options['admin_label']) ? $field_options['admin_label'] : 'la_fld_' . $field; | |||||
} | |||||
Not Done ReplyRename to $replacement_count to add more clarity. alex: Rename to `$replacement_count` to add more clarity. | |||||
else { | |||||
$field_phrase = !empty($field_options['front_label']) ? $field_options['front_label'] : 'lu_fld_' . $field; | |||||
} | |||||
$params['field'] = $this->Application->Phrase($field_phrase); | $params['field'] = $this->Application->Phrase($field_phrase); | ||||
Not Done ReplyNow, when we are not calling vsprintf at the end the parameter unsetting code isn't needed anymore. Same goes for replacement count tracking code. alex: Now, when we are not calling `vsprintf` at the end the parameter unsetting code isn't needed… | |||||
foreach ( $params as $param_name => $param_value ) { | foreach ( $params as $param_name => $param_value ) { | ||||
Context not available. | |||||
Not Done ReplySince introduced {field} parameter isn't currently used anywhere we put vsprintf function call into situation where we always have 1 more parameter given, then %s in the actual error message. Please verify that this doesn't cause vsprintf to return empty string or trigger a warning. If it does, then we should just remove $msg and don't use vsprintf. alex: Since introduced `{field}` parameter isn't currently used anywhere we put `vsprintf` function… |
The parameter name should be max_value to be consistent with other parameter names.