Project

General

Profile

Feature proposal #1895 » 1895-rev4.patch

krileon, 09 February 2011 18:32

View differences:

administrator/components/com_comprofiler/plugin.foundation.php
}
function _evaluateCbTags( $input ) {
$regex = '#\[cb:user(data +field|field +field|tab +tab|position +position)="([a-zA-Z0-9_]+)"(?: +user="([^"/\] ]+)")?(?: +default="((?:[^"]|\\")+)")?(?: +output="([a-zA-Z]+)")?(?: +formatting="([a-zA-Z]+)")?(?: +reason="([a-zA-Z]+)")? */\]#';
global $_CB_framework;
$regex = '#\[cb:(userdata +field|userfield +field|usertab +tab|userposition +position|date +format|url +location|config +param)="((?:[^"]|\\\\")+)"(?: +user="([^"/\] ]+)")?(?: +default="((?:[^"]|\\\\")+)")?(?: +output="([a-zA-Z]+)")?(?: +formatting="([a-zA-Z]+)")?(?: +reason="([a-zA-Z]+)")?(?: +list="([0-9]+)")? */\]#';
if ( is_array( $input ) ) {
if ( isset( $input[3] ) ) {
$user =& $this->_evaluateUserAttrib( $input[3] );
......
$user =& $this;
}
if ( ( $user !== null ) && is_object( $user->_cbuser ) && isset( $user->_cbuser->id ) ) {
$type = array_shift( explode( ' ', $input[1] ) );
$default = ( isset( $input[4] ) ? CBTxt::T( str_replace( '\"', '"', $input[4] ) ) : null );
$output = ( isset( $input[5] ) ? ( $input[5] !== '' ? $input[5] : 'html' ) : 'html' );
$formatting = ( isset( $input[6] ) ? ( $input[6] !== '' ? $input[6] : 'none' ) : 'none' );
$reason = ( isset( $input[7] ) ? ( $input[7] !== '' ? $input[7] : 'profile' ) : 'profile' );
$list = ( isset( $input[8] ) ? ( $input[8] !== '' ? $input[8] : null ) : null );
switch ( substr( $input[1], 0, 3 ) ) {
case 'dat':
switch ( $type ) {
case 'userdata':
return $user->_cbuser->get( $input[2] );
break;
case 'fie':
case 'userfield':
return $user->getField( $input[2], $default, $output, $formatting, $reason );
break;
case 'tab':
case 'usertab':
return $user->getTab( $input[2], $default, ( $output == 'none' ? null : $output ), $formatting, $reason );
break;
case 'pos':
case 'userposition':
return $user->getPosition( $input[2] );
break;
case 'date':
return date( $input[2], $_CB_framework->now() );
break;
case 'url':
switch ( $input[2] ) {
case 'login':
case 'logout':
case 'registers':
case 'lostpassword':
case 'manageconnections':
return $_CB_framework->viewUrl( $input[2], false );
break;
case 'profile_view':
return $_CB_framework->userProfileUrl( $user->_cbuser->id, false );
break;
case 'profile_edit':
return $_CB_framework->userProfileEditUrl( $user->_cbuser->id, false );
break;
case 'list':
return $_CB_framework->userProfilesListUrl( $list, false );
break;
case 'itemid':
return getCBprofileItemid( false );
break;
default:
return '';
}
break;
case 'config':
switch ( $input[2] ) {
case 'live_site':
case 'absolute_path':
case 'sitename':
case 'lang':
case 'lang_name':
case 'lang_tag':
case 'new_usertype':
return $_CB_framework->getCfg( $input[2] );
break;
default:
return '';
}
break;
default:
return '';
}
(4-4/4)