rename methods of the Probe class to camelCase

This commit is contained in:
rabuzarus 2017-05-08 16:19:10 +02:00
parent 077941a116
commit cc8a3a4101
3 changed files with 28 additions and 26 deletions

View file

@ -101,7 +101,7 @@ class ostatus {
}
if (count($avatarlist) > 0) {
krsort($avatarlist);
$author["author-avatar"] = Probe::fix_avatar(current($avatarlist), $author["author-link"]);
$author["author-avatar"] = Probe::fixAvatar(current($avatarlist), $author["author-link"]);
}
$displayname = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
@ -1162,7 +1162,7 @@ class ostatus {
$arr["owner-name"] = $single_conv->actor->portablecontacts_net->displayName;
$arr["owner-link"] = $actor;
$arr["owner-avatar"] = Probe::fix_avatar($single_conv->actor->image->url, $arr["owner-link"]);
$arr["owner-avatar"] = Probe::fixAvatar($single_conv->actor->image->url, $arr["owner-link"]);
$arr["author-name"] = $arr["owner-name"];
$arr["author-link"] = $arr["owner-link"];
@ -1227,7 +1227,7 @@ class ostatus {
$arr["author-name"] = $single_conv->object->actor->contact->displayName;
}
$arr["author-link"] = $single_conv->object->actor->url;
$arr["author-avatar"] = Probe::fix_avatar($single_conv->object->actor->image->url, $arr["author-link"]);
$arr["author-avatar"] = Probe::fixAvatar($single_conv->object->actor->image->url, $arr["author-link"]);
$arr["app"] = $single_conv->object->provider->displayName."#";
//$arr["verb"] = $single_conv->object->verb;

View file

@ -133,7 +133,7 @@ function dfrn_request_post(App $a) {
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
}
$invalid = Probe::valid_dfrn($parms);
$invalid = Probe::validDfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",
@ -455,7 +455,7 @@ function dfrn_request_post(App $a) {
$network = $data["network"];
// Canonicalise email-style profile locator
$url = Probe::webfinger_dfrn($url,$hcard);
$url = Probe::webfingerDfrn($url,$hcard);
if (substr($url,0,5) === 'stat:') {
@ -535,7 +535,7 @@ function dfrn_request_post(App $a) {
if (! x($parms,'photo')) {
notice( t('Warning: profile location has no profile photo.') . EOL );
}
$invalid = Probe::valid_dfrn($parms);
$invalid = Probe::validDfrn($parms);
if ($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location",

View file

@ -31,7 +31,7 @@ class Probe {
*
* @return array Ordered data
*/
private function rearrange_data($data) {
private function rearrangeData($data) {
$fields = array("name", "nick", "guid", "url", "addr", "alias",
"photo", "community", "keywords", "location", "about",
"batch", "notify", "poll", "request", "confirm", "poco",
@ -53,6 +53,8 @@ class Probe {
/**
* @brief Probes for XRD data
*
* @param string $host The host part of an url
*
* @return array
* 'lrdd' => Link to LRDD endpoint
* 'lrdd-xml' => Link to LRDD endpoint in XML format
@ -138,12 +140,12 @@ class Probe {
* @return string profile link
*/
public static function webfinger_dfrn($webbie, &$hcard) {
public static function webfingerDfrn($webbie, &$hcard) {
$profile_link = '';
$links = self::lrdd($webbie);
logger('webfinger_dfrn: '.$webbie.':'.print_r($links,true), LOGGER_DATA);
logger('webfingerDfrn: '.$webbie.':'.print_r($links,true), LOGGER_DATA);
if (count($links)) {
foreach ($links as $link) {
if ($link['@attributes']['rel'] === NAMESPACE_DFRN)
@ -296,7 +298,7 @@ class Probe {
$data["network"] = NETWORK_PHANTOM;
}
$data = self::rearrange_data($data);
$data = self::rearrangeData($data);
// Only store into the cache if the value seems to be valid
if (!in_array($data['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
@ -537,7 +539,7 @@ class Probe {
*
* @return array noscrape data
*/
private function poll_noscrape($noscrape, $data) {
private function pollNoscrape($noscrape, $data) {
$ret = z_fetch_url($noscrape);
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
return false;
@ -604,7 +606,7 @@ class Probe {
*
* @return int Number of errors
*/
public static function valid_dfrn($data) {
public static function validDfrn($data) {
$errors = 0;
if(!isset($data['key']))
$errors ++;
@ -634,13 +636,13 @@ class Probe {
// Fetch data via noscrape - this is faster
$noscrape = str_replace(array("/hcard/", "/profile/"), "/noscrape/", $profile);
$data = self::poll_noscrape($noscrape, $data);
$data = self::pollNoscrape($noscrape, $data);
if (!isset($data["notify"]) OR !isset($data["confirm"]) OR
!isset($data["request"]) OR !isset($data["poll"]) OR
!isset($data["poco"]) OR !isset($data["name"]) OR
!isset($data["photo"]))
$data = self::poll_hcard($profile, $data, true);
$data = self::pollHcard($profile, $data, true);
$prof_data = array();
$prof_data["addr"] = $data["addr"];
@ -703,13 +705,13 @@ class Probe {
// Fetch data via noscrape - this is faster
$noscrape = str_replace("/hcard/", "/noscrape/", $hcard);
$data = self::poll_noscrape($noscrape, $data);
$data = self::pollNoscrape($noscrape, $data);
if (isset($data["notify"]) AND isset($data["confirm"]) AND isset($data["request"]) AND
isset($data["poll"]) AND isset($data["name"]) AND isset($data["photo"]))
return $data;
$data = self::poll_hcard($hcard, $data, true);
$data = self::pollHcard($hcard, $data, true);
return $data;
}
@ -723,7 +725,7 @@ class Probe {
*
* @return array hcard data
*/
private function poll_hcard($hcard, $data, $dfrn = false) {
private function pollHcard($hcard, $data, $dfrn = false) {
$ret = z_fetch_url($hcard);
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
return false;
@ -797,7 +799,7 @@ class Probe {
if (sizeof($avatar)) {
ksort($avatar);
$data["photo"] = self::fix_avatar(array_pop($avatar), $data["baseurl"]);
$data["photo"] = self::fixAvatar(array_pop($avatar), $data["baseurl"]);
}
if ($dfrn) {
@ -868,7 +870,7 @@ class Probe {
$data["alias"] = $alias;
// Fetch further information from the hcard
$data = self::poll_hcard($hcard, $data);
$data = self::pollHcard($hcard, $data);
if (!$data)
return false;
@ -968,7 +970,7 @@ class Probe {
$data["nick"] = $feed_data["header"]["author-nick"];
}
if ($feed_data["header"]["author-avatar"] != "") {
$data["photo"] = self::fix_avatar($feed_data["header"]["author-avatar"], $data["url"]);
$data["photo"] = self::fixAvatar($feed_data["header"]["author-avatar"], $data["url"]);
}
if ($feed_data["header"]["author-id"] != "") {
$data["alias"] = $feed_data["header"]["author-id"];
@ -995,7 +997,7 @@ class Probe {
*
* @return array profile data
*/
private function pumpio_profile_data($profile) {
private function pumpioProfileData($profile) {
$doc = new \DOMDocument();
if (!@$doc->loadHTMLFile($profile))
@ -1055,7 +1057,7 @@ class Probe {
} else
return false;
$profile_data = self::pumpio_profile_data($data["url"]);
$profile_data = self::pumpioProfileData($data["url"]);
if (!$profile_data)
return false;
@ -1072,7 +1074,7 @@ class Probe {
*
* @return string feed link
*/
private function get_feed_link($url) {
private function getFeedLink($url) {
$doc = new \DOMDocument();
if (!@$doc->loadHTMLFile($url))
@ -1122,7 +1124,7 @@ class Probe {
if (!$probe)
return false;
$feed_url = self::get_feed_link($url);
$feed_url = self::getFeedLink($url);
if (!$feed_url)
return false;
@ -1236,7 +1238,7 @@ class Probe {
*
* @return string fixed avatar path
*/
public static function fix_avatar($avatar, $base) {
public static function fixAvatar($avatar, $base) {
$base_parts = parse_url($base);
// Remove all parts that could create a problem