本文整理汇总了PHP中Hybrid_Logger::dumpData方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Logger::dumpData方法的具体用法?PHP Hybrid_Logger::dumpData怎么用?PHP Hybrid_Logger::dumpData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hybrid_Logger
的用法示例。
在下文中一共展示了Hybrid_Logger::dumpData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserProfile
function getUserProfile()
{
$profile = $this->api->api('me/', 'GET', array('fields' => 'id,username,first_name,last_name,counts,image'));
if (!isset($profile->data->id)) {
throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($profile), 6);
}
$data = $profile->data;
$this->user->profile->identifier = $data->id;
$this->user->profile->firstName = $data->first_name;
$this->user->profile->lastName = $data->last_name;
$this->user->profile->displayName = $data->username;
if (isset($data->image->{'60x60'})) {
$this->user->profile->photoURL = $data->image->{'60x60'}->url;
}
return $this->user->profile;
}
示例2: getUserProfile
/**
* {@inheritdoc}
*/
function getUserProfile()
{
$data = $this->api->api("users/self", "GET", Hybrid_Providers_Foursquare::$apiVersion);
if (!isset($data->response->user->id)) {
throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($data), 6);
}
$data = $data->response->user;
$this->user->profile->identifier = $data->id;
$this->user->profile->firstName = $data->firstName;
$this->user->profile->lastName = $data->lastName;
$this->user->profile->displayName = $this->buildDisplayName($this->user->profile->firstName, $this->user->profile->lastName);
$this->user->profile->photoURL = $this->buildPhotoURL($data->photo->prefix, $data->photo->suffix);
$this->user->profile->profileURL = "https://www.foursquare.com/user/" . $data->id;
$this->user->profile->gender = $data->gender;
$this->user->profile->city = $data->homeCity;
$this->user->profile->email = $data->contact->email;
$this->user->profile->emailVerified = $data->contact->email;
return $this->user->profile;
}
示例3: getUserProfile
/**
* {@inheritdoc}
*/
public function getUserProfile()
{
$data = $this->api->get("me");
if (!isset($data->id)) {
throw new Exception("User profile request failed! {$this->providerId} returned an invalid response: " . Hybrid_Logger::dumpData($data), 6);
}
$this->user->profile->identifier = property_exists($data, 'id') ? $data->id : "";
$this->user->profile->firstName = property_exists($data, 'first_name') ? $data->first_name : "";
$this->user->profile->lastName = property_exists($data, 'last_name') ? $data->last_name : "";
$this->user->profile->displayName = property_exists($data, 'name') ? trim($data->name) : "";
$this->user->profile->gender = property_exists($data, 'gender') ? $data->gender : "";
//wl.basic
$this->user->profile->profileURL = property_exists($data, 'link') ? $data->link : "";
//wl.emails
$this->user->profile->email = property_exists($data, 'emails') ? $data->emails->account : "";
$this->user->profile->emailVerified = property_exists($data, 'emails') ? $data->emails->account : "";
//wl.birthday
$this->user->profile->birthDay = property_exists($data, 'birth_day') ? $data->birth_day : "";
$this->user->profile->birthMonth = property_exists($data, 'birth_month') ? $data->birth_month : "";
$this->user->profile->birthYear = property_exists($data, 'birth_year') ? $data->birth_year : "";
return $this->user->profile;
}
示例4: getUserProfile
/**
* {@inheritdoc}
*/
function getUserProfile()
{
$response = json_decode(json_encode($this->api->api($this->api->userinfo_url)), true);
//$this->user->profile->identifier = ($response["user"]) ? $response["user"]["userid"] : (($response, "userid")) ? $response["userid"] : "";
if ($response["user"]) {
$this->user->profile->identifier = $response["user"] ? $response["user"]["userid"] : "";
$this->user->profile->firstName = $response["user"]["name"] ? $this->get_name_part($response["user"]["name"], 0) : "";
$this->user->profile->lastName = $response["user"]["name"] ? $this->get_name_part($response["user"]["name"], 1) : "";
$this->user->profile->displayName = $response["user"]["name"] ? $response["user"]["name"] : "";
$this->user->profile->photoURL = $response["user"]["profilephoto"] ? "https://api.dataporten.no/userinfo/v1/user/media/" . $response["user"]["profilephoto"] : "";
$this->user->profile->email = $response["user"]["email"] ? $response["user"]["email"] : "";
$this->user->profile->emailVerified = $response["user"]["email"] ? $response["user"]["email"] : "";
} else {
if ($response["name"]) {
$this->user->profile->identifier = $response["userid"] ? $response["userid"] : "";
$this->user->profile->firstName = $response["name"] ? $this->get_name_part($response["name"], 0) : "";
$this->user->profile->lastName = $response["name"] ? $this->get_name_part($response["name"], 1) : "";
$this->user->profile->displayName = $response["name"] ? $response["name"] : "";
} else {
throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($response), 6);
}
}
return $this->user->profile;
}
示例5: getUserProfile
/**
* {@inheritdoc}
*/
function getUserProfile()
{
// refresh tokens if needed
$this->refreshToken();
// ask google api for user infos
if (strpos($this->scope, '/auth/plus.profile.emails.read') !== false) {
$verified = $this->api->api("https://www.googleapis.com/plus/v1/people/me");
if (!isset($verified->id) || isset($verified->error)) {
$verified = new stdClass();
}
} else {
$verified = $this->api->api("https://www.googleapis.com/plus/v1/people/me/openIdConnect");
if (!isset($verified->sub) || isset($verified->error)) {
$verified = new stdClass();
}
}
$response = $this->api->api("https://www.googleapis.com/plus/v1/people/me");
if (!isset($response->id) || isset($response->error)) {
throw new Exception("User profile request failed! {$this->providerId} returned an invalid response:" . Hybrid_Logger::dumpData($response), 6);
}
$this->user->profile->identifier = property_exists($verified, 'id') ? $verified->id : (property_exists($response, 'id') ? $response->id : "");
$this->user->profile->firstName = property_exists($response, 'name') ? $response->name->givenName : "";
$this->user->profile->lastName = property_exists($response, 'name') ? $response->name->familyName : "";
$this->user->profile->displayName = property_exists($response, 'displayName') ? $response->displayName : "";
$this->user->profile->photoURL = property_exists($response, 'image') ? property_exists($response->image, 'url') ? substr($response->image->url, 0, -2) . "200" : '' : '';
$this->user->profile->profileURL = property_exists($response, 'url') ? $response->url : "";
$this->user->profile->description = property_exists($response, 'aboutMe') ? $response->aboutMe : "";
$this->user->profile->gender = property_exists($response, 'gender') ? $response->gender : "";
$this->user->profile->language = property_exists($response, 'locale') ? $response->locale : (property_exists($verified, 'locale') ? $verified->locale : "");
$this->user->profile->email = property_exists($response, 'email') ? $response->email : (property_exists($verified, 'email') ? $verified->email : "");
$this->user->profile->emailVerified = property_exists($verified, 'email') ? $verified->email : "";
if (property_exists($response, 'emails')) {
if (count($response->emails) == 1) {
$this->user->profile->email = $response->emails[0]->value;
} else {
foreach ($response->emails as $email) {
if ($email->type == 'account') {
$this->user->profile->email = $email->value;
break;
}
}
}
if (property_exists($verified, 'emails')) {
if (count($verified->emails) == 1) {
$this->user->profile->emailVerified = $verified->emails[0]->value;
} else {
foreach ($verified->emails as $email) {
if ($email->type == 'account') {
$this->user->profile->emailVerified = $email->value;
break;
}
}
}
}
}
$this->user->profile->phone = property_exists($response, 'phone') ? $response->phone : "";
$this->user->profile->country = property_exists($response, 'country') ? $response->country : "";
$this->user->profile->region = property_exists($response, 'region') ? $response->region : "";
$this->user->profile->zip = property_exists($response, 'zip') ? $response->zip : "";
if (property_exists($response, 'placesLived')) {
$this->user->profile->city = "";
$this->user->profile->address = "";
foreach ($response->placesLived as $c) {
if (property_exists($c, 'primary')) {
if ($c->primary == true) {
$this->user->profile->address = $c->value;
$this->user->profile->city = $c->value;
break;
}
} else {
if (property_exists($c, 'value')) {
$this->user->profile->address = $c->value;
$this->user->profile->city = $c->value;
}
}
}
}
// google API returns multiple urls, but a "website" only if it is verified
// see http://support.google.com/plus/answer/1713826?hl=en
if (property_exists($response, 'urls')) {
foreach ($response->urls as $u) {
if (property_exists($u, 'primary') && $u->primary == true) {
$this->user->profile->webSiteURL = $u->value;
}
}
} else {
$this->user->profile->webSiteURL = '';
}
// google API returns age ranges or min. age only (with plus.login scope)
if (property_exists($response, 'ageRange')) {
if (property_exists($response->ageRange, 'min') && property_exists($response->ageRange, 'max')) {
$this->user->profile->age = $response->ageRange->min . ' - ' . $response->ageRange->max;
} else {
$this->user->profile->age = '> ' . $response->ageRange->min;
}
} else {
$this->user->profile->age = '';
//.........这里部分代码省略.........
示例6: getUserProfile
/**
* {@inheritdoc}
*/
public function getUserProfile()
{
$includeEmail = isset($this->config['includeEmail']) ? (bool) $this->config['includeEmail'] : false;
$response = $this->api->get('account/verify_credentials.json' . ($includeEmail ? '?include_email=true' : ''));
// check the last HTTP status code returned
if ($this->api->http_code != 200) {
throw new Exception("User profile request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus($this->api->http_code), 6);
}
if (!is_object($response) || !isset($response->id)) {
throw new Exception("User profile request failed! {$this->providerId} api returned an invalid response: " . Hybrid_Logger::dumpData($response), 6);
}
# store the user profile.
$this->user->profile->identifier = property_exists($response, 'id') ? $response->id : "";
$this->user->profile->displayName = property_exists($response, 'screen_name') ? $response->screen_name : "";
$this->user->profile->description = property_exists($response, 'description') ? $response->description : "";
$this->user->profile->firstName = property_exists($response, 'name') ? $response->name : "";
$this->user->profile->photoURL = property_exists($response, 'profile_image_url') ? str_replace('_normal', '', $response->profile_image_url) : "";
$this->user->profile->profileURL = property_exists($response, 'screen_name') ? "http://twitter.com/" . $response->screen_name : "";
$this->user->profile->webSiteURL = property_exists($response, 'url') ? $response->url : "";
$this->user->profile->region = property_exists($response, 'location') ? $response->location : "";
if ($includeEmail) {
$this->user->profile->email = property_exists($response, 'email') ? $response->email : "";
}
return $this->user->profile;
}
示例7: getUserProfile
/**
* {@inheritdoc}
*/
function getUserProfile()
{
// request user profile from fb api
try {
$fields = array('id', 'name', 'first_name', 'last_name', 'link', 'website', 'gender', 'locale', 'about', 'email', 'hometown', 'location', 'birthday');
$data = $this->api->api('/me?fields=' . implode(',', $fields));
} catch (FacebookApiException $e) {
throw new Exception("User profile request failed! {$this->providerId} returned an error: {$e->getMessage()}", 6, $e);
}
// if the provider identifier is not received, we assume the auth has failed
if (!isset($data["id"])) {
throw new Exception("User profile request failed! {$this->providerId} api returned an invalid response: " . Hybrid_Logger::dumpData($data), 6);
}
# store the user profile.
$this->user->profile->identifier = array_key_exists('id', $data) ? $data['id'] : "";
$this->user->profile->username = array_key_exists('username', $data) ? $data['username'] : "";
$this->user->profile->displayName = array_key_exists('name', $data) ? $data['name'] : "";
$this->user->profile->firstName = array_key_exists('first_name', $data) ? $data['first_name'] : "";
$this->user->profile->lastName = array_key_exists('last_name', $data) ? $data['last_name'] : "";
$this->user->profile->photoURL = "https://graph.facebook.com/" . $this->user->profile->identifier . "/picture?width=150&height=150";
$this->user->profile->coverInfoURL = "https://graph.facebook.com/" . $this->user->profile->identifier . "?fields=cover&access_token=" . $this->api->getAccessToken();
$this->user->profile->profileURL = array_key_exists('link', $data) ? $data['link'] : "";
$this->user->profile->webSiteURL = array_key_exists('website', $data) ? $data['website'] : "";
$this->user->profile->gender = array_key_exists('gender', $data) ? $data['gender'] : "";
$this->user->profile->language = array_key_exists('locale', $data) ? $data['locale'] : "";
$this->user->profile->description = array_key_exists('about', $data) ? $data['about'] : "";
$this->user->profile->email = array_key_exists('email', $data) ? $data['email'] : "";
$this->user->profile->emailVerified = array_key_exists('email', $data) ? $data['email'] : "";
$this->user->profile->region = array_key_exists("location", $data) && array_key_exists("name", $data['location']) ? $data['location']["name"] : "";
if (!empty($this->user->profile->region)) {
$regionArr = explode(',', $this->user->profile->region);
if (count($regionArr) > 1) {
$this->user->profile->city = trim($regionArr[0]);
$this->user->profile->country = trim($regionArr[1]);
}
}
if (array_key_exists('birthday', $data)) {
list($birthday_month, $birthday_day, $birthday_year) = explode("/", $data['birthday']);
$this->user->profile->birthDay = (int) $birthday_day;
$this->user->profile->birthMonth = (int) $birthday_month;
$this->user->profile->birthYear = (int) $birthday_year;
}
return $this->user->profile;
}
示例8: getCurrentUserId
/**
* Returns current user id
*
* @return int
* @throws Exception
*/
public function getCurrentUserId()
{
$parameters = array();
$parameters['format'] = 'json';
$response = $this->api->get('me/guid', $parameters);
if (!isset($response->guid->value)) {
throw new Exception("User id request failed! {$this->providerId} returned an invalid response: " . Hybrid_Logger::dumpData($response));
}
return $response->guid->value;
}
示例9: setUserStatus
/**
* {@inheritdoc}
*/
public function setUserStatus($status)
{
$parameters = array();
$private = true;
// share with your connections only
if (is_array($status)) {
if (isset($status[0]) && !empty($status[0])) {
$parameters["title"] = $status[0];
}
// post title
if (isset($status[1]) && !empty($status[1])) {
$parameters["comment"] = $status[1];
}
// post comment
if (isset($status[2]) && !empty($status[2])) {
$parameters["submitted-url"] = $status[2];
}
// post url
if (isset($status[3]) && !empty($status[3])) {
$parameters["submitted-image-url"] = $status[3];
}
// post picture url
if (isset($status[4]) && !empty($status[4])) {
$private = $status[4];
}
// true or false
} else {
$parameters["comment"] = $status;
}
try {
$response = $this->api->share('new', $parameters, $private);
} catch (LinkedInException $e) {
throw new Exception("Update user status update failed! {$this->providerId} returned an error: {$e->getMessage()}", 0, $e);
}
if (!$response || !$response['success']) {
throw new Exception("Update user status update failed! {$this->providerId} returned an error in response: " . Hybrid_Logger::dumpData($response));
}
return $response;
}