"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/web/helpers/CHtml.php" between
yii-1.1.21.733ac5.tar.gz and yii-1.1.22.bf1d26.tar.gz

About: Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Hint: Yii 1.1 is now in maintenance mode.

CHtml.php  (yii-1.1.21.733ac5):CHtml.php  (yii-1.1.22.bf1d26)
skipping to change at line 2387 skipping to change at line 2387
* @param string $name name from which to generate HTML ID * @param string $name name from which to generate HTML ID
* @return string the ID generated based on name. * @return string the ID generated based on name.
*/ */
public static function getIdByName($name) public static function getIdByName($name)
{ {
return str_replace(array('[]','][','[',']',' '),array('','_','_', '','_'),$name); return str_replace(array('[]','][','[',']',' '),array('','_','_', '','_'),$name);
} }
/** /**
* Generates input field ID for a model attribute. * Generates input field ID for a model attribute.
* @param CModel $model the data model * @param CModel|string $model the data model
* @param string $attribute the attribute * @param string $attribute the attribute
* @return string the generated input field ID * @return string the generated input field ID
*/ */
public static function activeId($model,$attribute) public static function activeId($model,$attribute)
{ {
return self::getIdByName(self::activeName($model,$attribute)); return self::getIdByName(self::activeName($model,$attribute));
} }
/** /**
* Generates HTML name for given model. * Generates HTML name for given model.
skipping to change at line 2434 skipping to change at line 2434
self::$_modelNameConverter=$converter; self::$_modelNameConverter=$converter;
elseif($converter===null) elseif($converter===null)
self::$_modelNameConverter=null; self::$_modelNameConverter=null;
else else
throw new CException(Yii::t('yii','The $converter argumen t must be a valid callback or null.')); throw new CException(Yii::t('yii','The $converter argumen t must be a valid callback or null.'));
} }
/** /**
* Generates input field name for a model attribute. * Generates input field name for a model attribute.
* Unlike {@link resolveName}, this method does NOT modify the attribute name. * Unlike {@link resolveName}, this method does NOT modify the attribute name.
* @param CModel $model the data model * @param CModel|string $model the data model
* @param string $attribute the attribute * @param string $attribute the attribute
* @return string the generated input field name * @return string the generated input field name
*/ */
public static function activeName($model,$attribute) public static function activeName($model,$attribute)
{ {
$a=$attribute; // because the attribute name may be changed by re solveName $a=$attribute; // because the attribute name may be changed by re solveName
return self::resolveName($model,$a); return self::resolveName($model,$a);
} }
/** /**
skipping to change at line 2680 skipping to change at line 2680
else else
$cs->registerScript('Yii.CHtml.#' . $id,"jQuery('#$id').o n('$event', function(){{$handler}});"); $cs->registerScript('Yii.CHtml.#' . $id,"jQuery('#$id').o n('$event', function(){{$handler}});");
unset($htmlOptions['params'],$htmlOptions['submit'],$htmlOptions[ 'ajax'],$htmlOptions['confirm'],$htmlOptions['return'],$htmlOptions['csrf']); unset($htmlOptions['params'],$htmlOptions['submit'],$htmlOptions[ 'ajax'],$htmlOptions['confirm'],$htmlOptions['return'],$htmlOptions['csrf']);
} }
/** /**
* Generates input name and ID for a model attribute. * Generates input name and ID for a model attribute.
* This method will update the HTML options by setting appropriate 'name' and 'id' attributes. * This method will update the HTML options by setting appropriate 'name' and 'id' attributes.
* This method may also modify the attribute name if the name * This method may also modify the attribute name if the name
* contains square brackets (mainly used in tabular input). * contains square brackets (mainly used in tabular input).
* @param CModel $model the data model * @param CModel|string $model the data model
* @param string $attribute the attribute * @param string $attribute the attribute
* @param array $htmlOptions the HTML options * @param array $htmlOptions the HTML options
*/ */
public static function resolveNameID($model,&$attribute,&$htmlOptions) public static function resolveNameID($model,&$attribute,&$htmlOptions)
{ {
if(!isset($htmlOptions['name'])) if(!isset($htmlOptions['name']))
$htmlOptions['name']=self::resolveName($model,$attribute) ; $htmlOptions['name']=self::resolveName($model,$attribute) ;
if(!isset($htmlOptions['id'])) if(!isset($htmlOptions['id']))
$htmlOptions['id']=self::getIdByName($htmlOptions['name'] ); $htmlOptions['id']=self::getIdByName($htmlOptions['name'] );
elseif($htmlOptions['id']===false) elseif($htmlOptions['id']===false)
unset($htmlOptions['id']); unset($htmlOptions['id']);
} }
/** /**
* Generates input name for a model attribute. * Generates input name for a model attribute.
* Note, the attribute name may be modified after calling this method if the name * Note, the attribute name may be modified after calling this method if the name
* contains square brackets (mainly used in tabular input) before the rea l attribute name. * contains square brackets (mainly used in tabular input) before the rea l attribute name.
* @param CModel $model the data model * @param CModel|string $model the data model
* @param string $attribute the attribute * @param string $attribute the attribute
* @return string the input name * @return string the input name
*/ */
public static function resolveName($model,&$attribute) public static function resolveName($model,&$attribute)
{ {
$modelName=self::modelName($model); $modelName=self::modelName($model);
if(($pos=strpos($attribute,'['))!==false) if(($pos=strpos($attribute,'['))!==false)
{ {
if($pos!==0) // e.g. name[a][b] if($pos!==0) // e.g. name[a][b]
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)