Linkify notice source when posting from registered OAuth apps
This commit is contained in:
parent
3906713b2a
commit
dae28d98d1
19
lib/api.php
19
lib/api.php
@ -1249,10 +1249,27 @@ class ApiAction extends Action
|
|||||||
case 'api':
|
case 'api':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
$name = null;
|
||||||
|
$url = null;
|
||||||
|
|
||||||
$ns = Notice_source::staticGet($source);
|
$ns = Notice_source::staticGet($source);
|
||||||
|
|
||||||
if ($ns) {
|
if ($ns) {
|
||||||
$source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
|
$name = $ns->name;
|
||||||
|
$url = $ns->url;
|
||||||
|
} else {
|
||||||
|
$app = Oauth_application::staticGet('name', $source);
|
||||||
|
if ($app) {
|
||||||
|
$name = $app->name;
|
||||||
|
$url = $app->source_url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($name) && !empty($url)) {
|
||||||
|
$source_name = '<a href="' . $url . '">' . $name . '</a>';
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $source_name;
|
return $source_name;
|
||||||
|
@ -486,12 +486,28 @@ class NoticeListItem extends Widget
|
|||||||
$this->out->element('span', 'device', $source_name);
|
$this->out->element('span', 'device', $source_name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
|
$name = null;
|
||||||
|
$url = null;
|
||||||
|
|
||||||
$ns = Notice_source::staticGet($this->notice->source);
|
$ns = Notice_source::staticGet($this->notice->source);
|
||||||
|
|
||||||
if ($ns) {
|
if ($ns) {
|
||||||
|
$name = $ns->name;
|
||||||
|
$url = $ns->url;
|
||||||
|
} else {
|
||||||
|
$app = Oauth_application::staticGet('name', $this->notice->source);
|
||||||
|
if ($app) {
|
||||||
|
$name = $app->name;
|
||||||
|
$url = $app->source_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($name) && !empty($url)) {
|
||||||
$this->out->elementStart('span', 'device');
|
$this->out->elementStart('span', 'device');
|
||||||
$this->out->element('a', array('href' => $ns->url,
|
$this->out->element('a', array('href' => $url,
|
||||||
'rel' => 'external'),
|
'rel' => 'external'),
|
||||||
$ns->name);
|
$name);
|
||||||
$this->out->elementEnd('span');
|
$this->out->elementEnd('span');
|
||||||
} else {
|
} else {
|
||||||
$this->out->element('span', 'device', $source_name);
|
$this->out->element('span', 'device', $source_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user