function doStartTag($application, $parentHandler, $args) { $uid = isset($args['uid']) ? $args['uid'] : null; $size = isset($args['size']) ? $args['size'] : "thumb"; $linked = HandlerUtil::checkBoolArg('linked', $args, true); if (empty($uid)) { echo 'RUNTIME ERROR: fb:name: Required attribute "uid" not found in node fb:name'; return false; } if (!array_key_exists($size, self::$sizes)) { echo 'RUNTIME ERROR: fb:profile-pic: Invalid size for profile pic (' . $size . ')'; return false; } // Get pic URL, get Name. $client = $application->getClient(); $response = $client->users_getInfo(array($uid), array('first_name,last_name', 'pic')); if (empty($response) || count($response) == 0) { error_log("fb:profile-pic: could not find user information for {$uid}"); return false; } $name = $response[0]['first_name'] . ' ' . $response[0]['last_name']; $url = $response[0]['pic']; // Make image tag. $imgTag = "<img src=\"{$url}\" alt=\"{$name}\" width=\"" . self::$sizes[$size]['w'] . "\"/>"; // Make anchorTag if ($linked) { $profileLink = RingsideSocialConfig::$webRoot . "/profile.php"; echo "<a href='{$profileLink}?id={$uid}'>{$imgTag}</a>"; } else { echo $imgTag; } return false; }
function doStartTag($application, $parentHandler, $args) { if (!isset($args['uid']) || empty($args['uid'])) { echo 'RUNTIME ERROR: fb:name: Required attribute "uid" not found in node fb:name'; return false; } $uid = $args['uid']; // For using {{*}} FB-specific functions inside the uid field if ($uid == 'loggedinuser') { $uid = $application->getCurrentUser(); } else { if ($uid == 'profileowner') { $uid = $application->getProfileOwner(); } } $subjectId = null; if (isset($args['subjectid'])) { $subjectId = $args['subjectid']; } $firstnameonly = HandlerUtil::checkBoolArg('firstnameonly', $args); $lastnameonly = HandlerUtil::checkBoolArg('lastnameonly', $args); $columns = $this->fbUserColumns($firstnameonly, $lastnameonly, $subjectId); $capitalize = HandlerUtil::checkBoolArg('capitalize', $args); $possessive = HandlerUtil::checkBoolArg('possessive', $args); $reflexive = HandlerUtil::checkBoolArg('reflexive', $args); $useyou = HandlerUtil::checkBoolArg('useyou', $args, true); if (array_key_exists('subjectid', $args)) { $subjectid = $args['subjectid']; if ($uid == $application->getCurrentUser() && $subjectid == $uid) { $reflexive = true; } } if ($uid == $application->getCurrentUser() && $useyou) { echo ($capitalize ? 'Y' : 'y') . 'ou' . ($possessive || $reflexive ? 'r' : '') . ($reflexive ? $possessive ? ' own' : 'self' : ''); } else { $client = $application->getClient(); $response = $client->users_getInfo(array($uid), $columns); // if ( $uid == $application->getCurrentUser() ) { // if ( isset($response[0]['sex']) ) { // echo ($capitalize?'H':'h'); // if ( $response[0]['sex'] == 'M') { // echo ($reflexive?($possessive?'is own':'imself'):'is'); // } else if ( $response[0]['sex'] == 'F') { // echo ($reflexive?($possessive?'er own':'erself'):'ers'); // } // } else { // echo ($capitalize?'I':'t').($possessive?'s':'').($reflexive?($possessive?' own':'self'):''); // } // } // } else { $name = $response[0]; if ($firstnameonly) { echo $name['first_name']; } else { if ($lastnameonly) { echo $name['last_name']; } else { echo $name['first_name'] . ' ' . $name['last_name']; } } if ($possessive) { echo '\'s'; } } // } return false; }