* a lengthy content page to scrape dfrn attributes
*
* @param string $webbie Address that should be probed
- * @param string $hcard Link to the hcard - is returned by reference
+ * @param string $hcard_url Link to the hcard - is returned by reference
*
* @return string profile link
*/
- public static function webfingerDfrn($webbie, &$hcard) {
+ public static function webfingerDfrn($webbie, &$hcard_url) {
$profile_link = '';
$profile_link = 'stat:'.$link['@attributes']['template'];
}
if ($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard') {
- $hcard = $link['@attributes']['href'];
+ $hcard_url = $link['@attributes']['href'];
}
}
}
* "noscrape" is a faster alternative to fetch the data from the hcard.
* This functionality was originally created for the directory.
*
- * @param string $noscrape Link to the noscrape page
+ * @param string $noscrape_url Link to the noscrape page
* @param array $data The already fetched data
*
* @return array noscrape data
*/
- private function pollNoscrape($noscrape, $data) {
- $ret = z_fetch_url($noscrape);
+ private function pollNoscrape($noscrape_url, $data) {
+ $ret = z_fetch_url($noscrape_url);
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
return false;
}
/**
* @brief Fetch data from a DFRN profile page and via "noscrape"
*
- * @param string $profile Link to the profile page
+ * @param string $profile_link Link to the profile page
*
* @return array profile data
*/
- public static function profile($profile) {
+ public static function profile($profile_link) {
$data = array();
- logger("Check profile ".$profile, LOGGER_DEBUG);
+ logger("Check profile ".$profile_link, LOGGER_DEBUG);
// Fetch data via noscrape - this is faster
- $noscrape = str_replace(array("/hcard/", "/profile/"), "/noscrape/", $profile);
- $data = self::pollNoscrape($noscrape, $data);
+ $noscrape_url = str_replace(array("/hcard/", "/profile/"), "/noscrape/", $profile_link);
+ $data = self::pollNoscrape($noscrape_url, $data);
if (!isset($data["notify"])
OR !isset($data["confirm"])
OR !isset($data["name"])
OR !isset($data["photo"])
) {
- $data = self::pollHcard($profile, $data, true);
+ $data = self::pollHcard($profile_link, $data, true);
}
$prof_data = array();
$prof_data["fn"] = $data["name"];
$prof_data["key"] = $data["pubkey"];
- logger("Result for profile ".$profile.": ".print_r($prof_data, true), LOGGER_DEBUG);
+ logger("Result for profile ".$profile_link.": ".print_r($prof_data, true), LOGGER_DEBUG);
return $prof_data;
}
*/
private function dfrn($webfinger) {
- $hcard = "";
+ $hcard_url = "";
$data = array();
foreach ($webfinger["links"] as $link) {
if (($link["rel"] == NAMESPACE_DFRN) AND ($link["href"] != "")) {
} elseif (($link["rel"] == "http://webfinger.net/rel/profile-page") AND ($link["type"] == "text/html") AND ($link["href"] != "")) {
$data["url"] = $link["href"];
} elseif (($link["rel"] == "http://microformats.org/profile/hcard") AND ($link["href"] != "")) {
- $hcard = $link["href"];
+ $hcard_url = $link["href"];
} elseif (($link["rel"] == NAMESPACE_POCO) AND ($link["href"] != "")) {
$data["poco"] = $link["href"];
} elseif (($link["rel"] == "http://webfinger.net/rel/avatar") AND ($link["href"] != "")) {
}
}
- if (!isset($data["network"]) OR ($hcard == "")) {
+ if (!isset($data["network"]) OR ($hcard_url == "")) {
return false;
}
// Fetch data via noscrape - this is faster
- $noscrape = str_replace("/hcard/", "/noscrape/", $hcard);
- $data = self::pollNoscrape($noscrape, $data);
+ $noscrape_url = str_replace("/hcard/", "/noscrape/", $hcard_url);
+ $data = self::pollNoscrape($noscrape_url, $data);
if (isset($data["notify"])
AND isset($data["confirm"])
return $data;
}
- $data = self::pollHcard($hcard, $data, true);
+ $data = self::pollHcard($hcard_url, $data, true);
return $data;
}
/**
* @brief Poll the hcard page (Diaspora and Friendica specific)
*
- * @param string $hcard Link to the hcard page
+ * @param string $hcard_url Link to the hcard page
* @param array $data The already fetched data
* @param boolean $dfrn Poll DFRN specific data
*
* @return array hcard data
*/
- private function pollHcard($hcard, $data, $dfrn = false) {
- $ret = z_fetch_url($hcard);
+ private function pollHcard($hcard_url, $data, $dfrn = false) {
+ $ret = z_fetch_url($hcard_url);
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
return false;
}
*/
private function diaspora($webfinger) {
- $hcard = "";
+ $hcard_url = "";
$data = array();
foreach ($webfinger["links"] as $link) {
if (($link["rel"] == "http://microformats.org/profile/hcard") AND ($link["href"] != "")) {
- $hcard = $link["href"];
+ $hcard_url = $link["href"];
} elseif (($link["rel"] == "http://joindiaspora.com/seed_location") AND ($link["href"] != "")) {
$data["baseurl"] = trim($link["href"], '/');
} elseif (($link["rel"] == "http://joindiaspora.com/guid") AND ($link["href"] != "")) {
}
}
- if (!isset($data["url"]) OR ($hcard == "")) {
+ if (!isset($data["url"]) OR ($hcard_url == "")) {
return false;
}
}
// Fetch further information from the hcard
- $data = self::pollHcard($hcard, $data);
+ $data = self::pollHcard($hcard_url, $data);
if (!$data) {
return false;
AND isset($data["guid"])
AND isset($data["baseurl"])
AND isset($data["pubkey"])
- AND ($hcard != "")
+ AND ($hcard_url != "")
) {
$data["network"] = NETWORK_DIASPORA;
/**
* @brief Fetch data from a pump.io profile page
*
- * @param string $profile Link to the profile page
+ * @param string $profile_link Link to the profile page
*
* @return array profile data
*/
- private function pumpioProfileData($profile) {
+ private function pumpioProfileData($profile_link) {
$doc = new \DOMDocument();
- if (!@$doc->loadHTMLFile($profile)) {
+ if (!@$doc->loadHTMLFile($profile_link)) {
return false;
}