Project

General

Profile

Feature proposal #1895 » 1895-rev3.patch

krileon, 09 February 2011 16:33

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:user(data +field|field +field|tab +tab|position +position|date +date|url +url|config +config)="([a-zA-Z0-9-_/]+)"(?: +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] );
......
$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 ( trim( substr( $input[1], 0, 4 ) ) ) {
case 'data':
return $user->_cbuser->get( $input[2] );
break;
case 'fie':
case 'fiel':
return $user->getField( $input[2], $default, $output, $formatting, $reason );
break;
case 'tab':
return $user->getTab( $input[2], $default, ( $output == 'none' ? null : $output ), $formatting, $reason );
break;
case 'pos':
case 'posi':
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 'conf':
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 '';
}
(3-3/4)