Feature proposal #2445 ยป 2445.patch
administrator/components/com_comprofiler/plugin.foundation.php | ||
---|---|---|
|
||
$msg = $this->_evaluateIfs( $msg );
|
||
$msg = $this->_evaluateCbTags( $msg );
|
||
$msg = $this->_evaluateCbFields( $msg );
|
||
|
||
if ( is_object( $row ) ) {
|
||
// old legacy modes:
|
||
$array = get_object_vars( $row );
|
||
foreach( $array AS $k => $v ) {
|
||
if( ( ! is_object( $v ) ) && ( ! is_array( $v ) ) ) {
|
||
if ( ! ( ( strtolower( $k ) == "password" ) && ( strlen($v) >= 32 ) ) ) {
|
||
/* do not translate content ! :
|
||
$vTranslated = ( $translateLanguage ? getLangDefinition( $v ) : $v );
|
||
if ( is_array( $htmlspecialchars ) ) {
|
||
$vTranslated = call_user_func_array( $htmlspecialchars, array( $vTranslated ) );
|
||
}
|
||
$msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $vTranslated ) : $vTranslated, $msg );
|
||
*/
|
||
if ( is_array( $htmlspecialchars ) ) {
|
||
$v = call_user_func_array( $htmlspecialchars, array( $v ) );
|
||
}
|
||
$msg = cbstr_ireplace("[".$k."]", $htmlspecialchars === true ? htmlspecialchars( $v ) : $v, $msg );
|
||
}
|
||
}
|
||
}
|
||
}
|
||
foreach( $extraStrings AS $k => $v) {
|
||
if( ( ! is_object( $v ) ) && ( ! is_array( $v ) ) ) {
|
||
/* do not translate content ! :
|
||
... | ... | |
return preg_replace_callback( $regex, array( $this, '_evaluateIfs' ), $input );
|
||
}
|
||
|
||
function _evaluateCbFields( $input ) {
|
||
$regex = '#\[([\w-]+)\]#';
|
||
|
||
if ( is_array( $input ) ) {
|
||
if ( ( $this !== null ) && is_object( $this->_cbuser ) && isset( $this->_cbuser->id ) ) {
|
||
$val = $this->getField( $input[1], null, 'php' );
|
||
|
||
if ( is_array( $val ) || isset( $this->_cbuser->$input[1] ) ) {
|
||
if ( is_array( $val ) ) {
|
||
$val = array_shift( $val );
|
||
}
|
||
|
||
if ( ! $val ) {
|
||
$val = $this->_cbuser->get( $input[1] );
|
||
}
|
||
|
||
if( ( ! is_object( $val ) ) && ( ! is_array( $val ) ) ) {
|
||
if ( ! ( ( strtolower( $input[1] ) == 'password' ) && ( strlen( $val ) >= 32 ) ) ) {
|
||
return $val;
|
||
}
|
||
}
|
||
} else {
|
||
return '[' . $input[1] . ']';
|
||
}
|
||
} else {
|
||
return '[' . $input[1] . ']';
|
||
}
|
||
}
|
||
|
||
return preg_replace_callback( $regex, array( $this, '_evaluateCbFields' ), $input );
|
||
}
|
||
|
||
function _evaluateCbTags( $input ) {
|
||
global $_CB_framework;
|
||
|
||
... | ... | |
|
||
switch ( $type ) {
|
||
case 'userdata':
|
||
return $user->_cbuser->get( $input[2] );
|
||
$val = $user->getField( $input[2], null, 'php' );
|
||
|
||
if ( is_array( $val ) ) {
|
||
$val = array_shift( $val );
|
||
}
|
||
|
||
if ( ! $val ) {
|
||
$val = $user->_cbuser->get( $input[2] );
|
||
}
|
||
|
||
return $val;
|
||
break;
|
||
case 'userfield':
|
||
case 'usertab':
|