First thanks for sharing this great component! I use CB API to show the content of some CB fields in my SobiPro entries. CB API imports this js script I would like to remove:
Code:
public static function cb( $id, $mode)
{
global $_CB_framework, $mainframe;
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
if ( ! file_exists( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php' );
}
else {
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
echo 'CB not installed!';
return;
}
include_once( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' );
}
$cbUser =& CBuser::getInstance( $id );
if ( ! $cbUser ) {
$cbUser =& CBuser::getInstance( null );
}
$name = $cbUser->getField( 'name', null, 'csv', 'none', 'list' );
$r = '';
if($mode === 'status') {
$status = $cbUser->getField( 'onlinestatus' , null, 'csv', 'none', 'list' );
if($status === 'true') {
$r .= '<span class="icon-eye-open online hasTip" title="'.Sobi::Txt('ONLINE').'"></span> ';
} else {
$r .= '<span class="icon-eye-close hasTip" title="'.Sobi::Txt('OFFLINE').'"></span> ';
}
}
if($mode === 'link') {
if(!empty($name)) {
$r .= '<a class="url" href="'.$_CB_framework->userProfileUrl( $id, true ).'"><span class="fn name hasTip" title="'.Sobi::Txt('SEE_PROFILE').'" itemprop="name">'.$name.'</span></a>';
} else {
$r .= Sobi::Txt('GUEST');
}
}
if($mode === 'avatar') {
if(!empty($name)) {
$r .= '<a href="'.$_CB_framework->userProfileUrl( $id, true ).'"><img class="photo hasTip" itemprop="image" src="'.$cbUser->getField( 'avatar', null, 'csv', 'none', 'list' ).'" alt="'.$name.'" title="'.$name.'"/></a>';
// $cbUser->getField( 'avatar', null, 'html', 'none', 'list' );
} else {
$r .= '<div class="nouser"><i class="icon-user icon-nouser"></i><div class="clearfix"></div></div>';
}
}
if($mode === 'register') {
$r .= $_CB_framework->viewUrl( 'registers', true );
}
if($mode === 'profile') {
if(!empty($name)) {
$phone = $cbUser->getField( 'cb_phone', null , 'html', 'none', 'list' );
$website = $cbUser->getField( 'cb_website', null, 'html', 'none', 'list' );
$company = $cbUser->getField( 'cb_company', null, 'html', 'none', 'list' );
$occupation = $cbUser->getField( 'cb_occupation', null, 'html', 'none', 'list' );
if(!empty($phone)){
$r .= '<p><i class="icon-phone-sign"></i> <span class="tel" itemprop="telephone">' .$phone.'</span></p>';
}
if(!empty($website)){
$r .= '<p><i class="icon-globe"></i> <span class="url" itemprop="url">' .$website.'</span></p>';
}
$r .= '<div class="adr"><p><b>' .Sobi::Txt('COUNTRY'). '</b><span class="country-name" itemprop="nationality">' .$cbUser->getField( 'cb_country', null , 'html', 'none', 'list' ).'</span></p><p><b>' .Sobi::Txt('CITY'). '</b><span class="locality">'.$cbUser->getField( 'cb_city', null , 'html', 'none', 'list' ).'</span></p></div>';
if(!empty($company)){
$r .= '<p><b>' .Sobi::Txt('COMPANY'). '</b><span class="org" itemprop="worksFor">' .$company. '</span></p>';
}
if(!empty($occupation)){
$r .= '<p><b>'. Sobi::Txt('OCCUPATION'). '</b><span class="title" itemprop="jobTitle">' .$occupation.'</span></p>';
}
}
else {
$r .= '<p>'.Sobi::Txt('NOTAMEMBER').'</p>';
}
}
return $r;
}