* Copyright (C) 2011, StatusNet, Inc.
*
* A single list item for showing in a message list
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
*
* @return void
*/
-
function show()
{
$this->out->elementStart('li', array('class' => 'hentry notice',
if ($this->message->source) {
$this->out->elementStart('span', 'source');
// FIXME: bad i18n. Device should be a parameter (from %s).
+ // TRANS: Followed by notice source (usually the client used to send the notice).
$this->out->text(_('from'));
- $this->out->element('span', 'device', $this->out->showSource($this->message->source));
+ $this->showSource($this->message->source);
$this->out->elementEnd('span');
}
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
+ /**
+ * Dummy method. Serves no other purpose than to make strings available used
+ * in self::showSource() through xgettext.
+ *
+ * @return void
+ */
+ function messageListItemDummyMessages()
+ {
+ // A dummy array with messages. These will get extracted by xgettext and
+ // are used in self::showSource().
+ $dummy_messages = array(
+ // TRANS: A possible notice source (web interface).
+ _m('SOURCE','web'),
+ // TRANS: A possible notice source (XMPP).
+ _m('SOURCE','xmpp'),
+ // TRANS: A possible notice source (e-mail).
+ _m('SOURCE','mail'),
+ // TRANS: A possible notice source (OpenMicroBlogging).
+ _m('SOURCE','omb'),
+ // TRANS: A possible notice source (Application Programming Interface).
+ _m('SOURCE','api'),
+ );
+ }
+
+ /**
+ * Show the source of the message
+ *
+ * Returns either the name (and link) of the API client that posted the notice,
+ * or one of other other channels.
+ *
+ * @param string $source the source of the message
+ *
+ * @return void
+ */
+ function showSource($source)
+ {
+ $source_name = _m('SOURCE',$source);
+ switch ($source) {
+ case 'web':
+ case 'xmpp':
+ case 'mail':
+ case 'omb':
+ case 'api':
+ $this->out->element('span', 'device', $source_name);
+ break;
+ default:
+ $ns = Notice_source::staticGet($source);
+ if ($ns) {
+ $this->out->elementStart('span', 'device');
+ $this->out->element('a', array('href' => $ns->url,
+ 'rel' => 'external'),
+ $ns->name);
+ $this->out->elementEnd('span');
+ } else {
+ $this->out->element('span', 'device', $source_name);
+ }
+ break;
+ }
+ return;
+ }
+
/**
* Return the profile to show in the message item
*