forked from GNUsocial/gnu-social
User agents and generators changed to GNU social
This commit is contained in:
@@ -165,7 +165,7 @@ class ActivityStreamJSONDocument extends JSONActivityCollection
|
||||
*/
|
||||
function asString()
|
||||
{
|
||||
$this->doc['generator'] = 'StatusNet ' . STATUSNET_VERSION; // extension
|
||||
$this->doc['generator'] = 'GNU social ' . GNUSOCIAL_VERSION; // extension
|
||||
$this->doc['title'] = $this->title;
|
||||
$this->doc['url'] = $this->url;
|
||||
$this->doc['totalItems'] = $this->count;
|
||||
|
@@ -158,7 +158,7 @@ class HTTPClient extends HTTP_Request2
|
||||
}
|
||||
|
||||
parent::__construct($url, $method, $config);
|
||||
$this->setHeader('User-Agent', $this->userAgent());
|
||||
$this->setHeader('User-Agent', self::userAgent());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,9 +247,10 @@ class HTTPClient extends HTTP_Request2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function userAgent()
|
||||
static public function userAgent()
|
||||
{
|
||||
return "GNU Social/".GNUSOCIAL_VERSION." (".GNUSOCIAL_CODENAME.")";
|
||||
return GNUSOCIAL_ENGINE . '/' . GNUSOCIAL_VERSION
|
||||
. ' (' . GNUSOCIAL_CODENAME . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -90,11 +90,11 @@ function ping_broadcast_notice($notice) {
|
||||
|
||||
if ($type === 'get') {
|
||||
$result = $fetcher->get($notify_url . '?' . http_build_query($args),
|
||||
array('User-Agent: StatusNet/'.STATUSNET_VERSION));
|
||||
array('User-Agent: ' . HTTPClient::userAgent()));
|
||||
} else {
|
||||
$result = $fetcher->post($notify_url,
|
||||
http_build_query($args),
|
||||
array('User-Agent: StatusNet/'.STATUSNET_VERSION));
|
||||
array('User-Agent: ' . HTTPClient::userAgent()));
|
||||
}
|
||||
if ($result->status != '200') {
|
||||
common_log(LOG_WARNING,
|
||||
|
@@ -158,12 +158,22 @@ class Plugin
|
||||
$this->log(LOG_DEBUG, $msg);
|
||||
}
|
||||
|
||||
function name()
|
||||
public function name()
|
||||
{
|
||||
$cls = get_class($this);
|
||||
return mb_substr($cls, 0, -6);
|
||||
}
|
||||
|
||||
public function version()
|
||||
{
|
||||
return GNUSOCIAL_VERSION;
|
||||
}
|
||||
|
||||
protected function userAgent() {
|
||||
return HTTPClient::userAgent()
|
||||
. ' (' . get_class($this) . ' v' . $this->version() . ')';
|
||||
}
|
||||
|
||||
function onPluginVersion(&$versions)
|
||||
{
|
||||
$name = $this->name();
|
||||
|
Reference in New Issue
Block a user