本文整理汇总了PHP中Skill::extractRelevantSkills方法的典型用法代码示例。如果您正苦于以下问题:PHP Skill::extractRelevantSkills方法的具体用法?PHP Skill::extractRelevantSkills怎么用?PHP Skill::extractRelevantSkills使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::extractRelevantSkills方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFromMeetup
public function loadFromMeetup($meetup_response = NULL)
{
global $meetup_group_id, $meetup_group_urlname, $meetup_api_key;
$client = DMS\Service\Meetup\MeetupKeyAuthClient::factory(array('key' => $meetup_api_key));
if (!$meetup_response) {
$response = $client->getMember(array('id' => $this->meetup_id));
} else {
$response = $meetup_response;
}
$this->name = $response["name"];
$this->meetup_id = $response["id"];
$this->location = $response["city"] . ", " . $response["country"];
$this->meetup_url = $response["link"];
$this->lat = $response["lat"];
$this->lon = $response["lon"];
$this->name = $response["name"];
if (isset($response["photo"])) {
if (isset($response["photo"]["highres_link"])) {
$this->photo_url = $response["photo"]["highres_link"];
} elseif (isset($response["photo"]["photo_link"])) {
$this->photo_url = $response["photo"]["photo_link"];
} elseif (isset($response["photo"]["thumb_link"])) {
$this->photo_url = $response["photo"]["thumb_link"];
}
} elseif (isset($response["photo_url"])) {
$this->photo_url = $response["photo_url"];
} else {
$email = strtolower($this->meetup_id . "@gmail.com");
$this->photo_url = "http://www.gravatar.com/avatar/" . md5($email);
}
if (isset($response["other_services"]) && is_array($response["other_services"])) {
foreach ($response["other_services"] as $key => $service) {
$s = $service["identifier"];
switch ($key) {
case "twitter":
$this->twitter_url = $s;
break;
case "flickr":
$this->flickr_url = $s;
break;
case "facebook":
$this->facebook_url = $s;
break;
case "linkedin":
$this->linkedin_url = $s;
break;
}
}
}
$service = new Skill();
if (isset($response["topics"]) && is_array($response["topics"])) {
foreach ($response["topics"] as $topic) {
$s = $service->find(array("meetup_skill_id" => $topic["id"]));
if ($s) {
$this->skills[$s["id"]] = $s;
} else {
$this->skills["new_" . $topic["id"]] = array("meetup_skill_id" => $topic["id"], "is_gis" => 0, "synonyms" => NULL, "name" => $topic["name"], "slug" => $topic["urlkey"]);
}
}
}
$options = array('group_urlname' => $meetup_group_urlname, 'group_id' => $meetup_group_id, 'member_id' => $this->meetup_id);
$profiles = $client->getProfiles($options);
if ($profiles->count() > 0) {
// Find relevant skills in open answers and add them to the profile
foreach ($profiles as $p) {
$answers = "";
foreach ($p["answers"] as $a) {
if (isset($a["answer"])) {
$answers .= $a["answer"] . " ";
}
}
$answers = strtolower($answers);
$r = $service->extractRelevantSkills($answers);
$this->merge_skills($r);
//When user joined
$this->joined = $this->parseEpoch($p["created"]);
$this->last_visit = $this->parseEpoch($p["visited"]);
if (isset($p["bio"])) {
$this->bio = $p["bio"];
}
if (isset($p["photo"])) {
if (isset($p["photo"]["highres_link"])) {
$this->photo_url = $p["photo"]["highres_link"];
} elseif (isset($p["photo"]["photo_link"])) {
$this->photo_url = $p["photo"]["photo_link"];
} elseif (isset($p["photo"]["thumb_link"])) {
$this->photo_url = $p["photo"]["thumb_link"];
}
} elseif (isset($p["photo_url"])) {
$this->photo_url = $p["photo_url"];
}
if (isset($p["profile_url"])) {
$this->meetup_url = $p["profile_url"];
}
//TODO: check if other services
}
}
}