1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

Dynamically generated API documentation links for social_ui

This commit is contained in:
Nick Liu 2020-02-26 22:12:11 +01:00
parent 5646635cc4
commit 4d7ce7ea4f
No known key found for this signature in database
GPG Key ID: 1167C5F9C9897637

@ -146,20 +146,6 @@ class social_ui extends e_admin_ui
{
$this->prefs['sharing_providers']['writeParms']['optArray'][$k] = $k;
}
$this->social_external = array(
"Facebook" => "https://developers.facebook.com/apps",
"Twitter" => "https://dev.twitter.com/apps/new",
"Google" => "https://code.google.com/apis/console/",
"Live" => "https://manage.dev.live.com/ApplicationOverview.aspx",
"LinkedIn" => "https://www.linkedin.com/secure/developer",
"Foursquare" => "https://www.foursquare.com/oauth/",
"GitHub" => "https://github.com/settings/applications/new",
"Steam" => "http://steamcommunity.com/dev/apikey",
"Instagram" => "http://instagram.com/developer"
);
}
@ -410,7 +396,7 @@ class social_ui extends e_admin_ui
$frm = e107::getForm();
$textKeys = '';
$textScope = '';
$label = varset($this->social_external[$provider_name]) ? "<a class='e-tip' rel='external' title=' " . LAN_SOCIAL_ADMIN_10 . "' href='" . $this->social_external[$provider_name] . "'>" . $pretty_provider_name . "</a>" : $pretty_provider_name;
$label = varset(self::getApiDocumentationUrlFor($provider_name)) ? "<a class='e-tip' rel='external' title=' " . LAN_SOCIAL_ADMIN_10 . "' href='" . self::getApiDocumentationUrlFor($provider_name) . "'>" . $pretty_provider_name . "</a>" : $pretty_provider_name;
$radio_label = strtolower($provider_name);
$text = "
<tr>
@ -505,6 +491,21 @@ class social_ui extends e_admin_ui
}
}
private static function getApiDocumentationUrlFor($providerName)
{
try
{
$class = "\Hybridauth\Provider\\$providerName";
$reflection = new ReflectionClass($class);
$properties = $reflection->getDefaultProperties();
return isset($properties['apiDocumentation']) ? $properties['apiDocumentation'] : null;
}
catch (ReflectionException $e)
{
return null;
}
}
private function generateAdminFormJs()
{
return <<<EOD