From ded26ae8f55496e67e19515e1d73cfa41f6b2c75 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Thu, 11 Mar 2010 16:40:16 -0500 Subject: Fixes the indenting bug for geo anchor. Also mention in trac ticket 2235 --- lib/noticelist.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index 88a925241..811b7e4f1 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -442,11 +442,13 @@ class NoticeListItem extends Widget 'title' => $latlon), $name); } else { - $this->out->elementStart('a', array('href' => $url)); - $this->out->element('abbr', array('class' => 'geo', - 'title' => $latlon), - $name); - $this->out->elementEnd('a'); + $xstr = new XMLStringer(false); + $xstr->elementStart('a', array('href' => $url)); + $xstr->element('abbr', array('class' => 'geo', + 'title' => $latlon), + $name); + $xstr->elementEnd('a'); + $this->out->raw($xstr->getString()); } $this->out->elementEnd('span'); } -- cgit v1.2.3-54-g00ecf From 53bed00f9028523ba003956ed88f9549ec203e3b Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sun, 14 Mar 2010 14:11:21 -0400 Subject: Added rel=external to geo location link --- lib/noticelist.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index 811b7e4f1..0d4cd4dd9 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -443,7 +443,8 @@ class NoticeListItem extends Widget $name); } else { $xstr = new XMLStringer(false); - $xstr->elementStart('a', array('href' => $url)); + $xstr->elementStart('a', array('href' => $url, + 'rel' => 'external')); $xstr->element('abbr', array('class' => 'geo', 'title' => $latlon), $name); -- cgit v1.2.3-54-g00ecf From b10ff031d9ba8c5e3b5267a469e8332011149fee Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 2 Apr 2010 09:32:03 -0700 Subject: Ticket 2271: extra whitespace in underlined link for username in notice lists Switching to a raw() output for the of the nickname removes the extra whitespace and fixes display. --- lib/noticelist.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index 0d4cd4dd9..83c8de9f6 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -340,8 +340,9 @@ class NoticeListItem extends Widget function showNickname() { - $this->out->element('span', array('class' => 'nickname fn'), - $this->profile->nickname); + $this->out->raw('' . + htmlspecialchars($this->profile->nickname) . + ''); } /** -- cgit v1.2.3-54-g00ecf From d00942cce185e24e5d67a1e2ccb92faf5be7d1d4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 9 Apr 2010 11:36:51 -0700 Subject: Fix for conversation check in @-reply notification email; i18n cleanup on mail messages: fixed some bad gettext usage, added trans doc comments. --- classes/Notice.php | 21 +++++++++++++++++++++ lib/mail.php | 45 +++++++++++++++++++++++++++++++-------------- lib/noticelist.php | 13 +------------ 3 files changed, 53 insertions(+), 26 deletions(-) (limited to 'lib/noticelist.php') diff --git a/classes/Notice.php b/classes/Notice.php index b416e2ff2..998e9c92b 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -699,6 +699,27 @@ class Notice extends Memcached_DataObject return $ids; } + /** + * Is this notice part of an active conversation? + * + * @return boolean true if other messages exist in the same + * conversation, false if this is the only one + */ + function hasConversation() + { + if (!empty($this->conversation)) { + $conversation = Notice::conversationStream( + $this->conversation, + 1, + 1 + ); + if ($conversation->N > 0) { + return true; + } + } + return false; + } + /** * @param $groups array of Group *objects* * @param $recipients array of profile *ids* diff --git a/lib/mail.php b/lib/mail.php index 807b6a363..c38d9f2f5 100644 --- a/lib/mail.php +++ b/lib/mail.php @@ -170,8 +170,10 @@ function mail_to_user(&$user, $subject, $body, $headers=array(), $address=null) function mail_confirm_address($user, $code, $nickname, $address) { + // TRANS: Subject for address confirmation email $subject = _('Email address confirmation'); + // TRANS: Body for address confirmation email. $body = sprintf(_("Hey, %s.\n\n". "Someone just entered this email address on %s.\n\n" . "If it was you, and you want to confirm your entry, ". @@ -237,11 +239,13 @@ function mail_subscribe_notify_profile($listenee, $other) $headers = _mail_prepare_headers('subscribe', $listenee->nickname, $other->nickname); $headers['From'] = mail_notify_from(); $headers['To'] = $name . ' <' . $listenee->email . '>'; + // TRANS: Subject of new-subscriber notification e-mail $headers['Subject'] = sprintf(_('%1$s is now listening to '. 'your notices on %2$s.'), $other->getBestName(), common_config('site', 'name')); + // TRANS: Main body of new-subscriber notification e-mail $body = sprintf(_('%1$s is now listening to your notices on %2$s.'."\n\n". "\t".'%3$s'."\n\n". '%4$s'. @@ -255,10 +259,13 @@ function mail_subscribe_notify_profile($listenee, $other) common_config('site', 'name'), $other->profileurl, ($other->location) ? + // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Location: %s"), $other->location) . "\n" : '', ($other->homepage) ? + // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Homepage: %s"), $other->homepage) . "\n" : '', ($other->bio) ? + // TRANS: Profile info line in new-subscriber notification e-mail sprintf(_("Bio: %s"), $other->bio) . "\n\n" : '', common_config('site', 'name'), common_local_url('emailsettings')); @@ -287,9 +294,11 @@ function mail_new_incoming_notify($user) $headers['From'] = $user->incomingemail; $headers['To'] = $name . ' <' . $user->email . '>'; + // TRANS: Subject of notification mail for new posting email address $headers['Subject'] = sprintf(_('New email address for posting to %s'), common_config('site', 'name')); + // TRANS: Body of notification mail for new posting email address $body = sprintf(_("You have a new posting address on %1\$s.\n\n". "Send email to %2\$s to post new messages.\n\n". "More email instructions at %3\$s.\n\n". @@ -414,6 +423,7 @@ function mail_send_sms_notice_address($notice, $smsemail, $incomingemail) $headers['From'] = ($incomingemail) ? $incomingemail : mail_notify_from(); $headers['To'] = $to; + // TRANS: Subject line for SMS-by-email notification messages $headers['Subject'] = sprintf(_('%s status'), $other->getBestName()); @@ -440,11 +450,11 @@ function mail_confirm_sms($code, $nickname, $address) $headers['From'] = mail_notify_from(); $headers['To'] = $nickname . ' <' . $address . '>'; + // TRANS: Subject line for SMS-by-email address confirmation message $headers['Subject'] = _('SMS confirmation'); - // FIXME: I18N - - $body = "$nickname: confirm you own this phone number with this code:"; + // TRANS: Main body heading for SMS-by-email address confirmation message + $body = sprintf(_("%s: confirm you own this phone number with this code:"), $nickname); $body .= "\n\n"; $body .= $code; $body .= "\n\n"; @@ -464,10 +474,12 @@ function mail_confirm_sms($code, $nickname, $address) function mail_notify_nudge($from, $to) { common_init_locale($to->language); + // TRANS: Subject for 'nudge' notification email $subject = sprintf(_('You\'ve been nudged by %s'), $from->nickname); $from_profile = $from->getProfile(); + // TRANS: Body for 'nudge' notification email $body = sprintf(_("%1\$s (%2\$s) is wondering what you are up to ". "these days and is inviting you to post some news.\n\n". "So let's hear from you :)\n\n". @@ -514,10 +526,12 @@ function mail_notify_message($message, $from=null, $to=null) } common_init_locale($to->language); + // TRANS: Subject for direct-message notification email $subject = sprintf(_('New private message from %s'), $from->nickname); $from_profile = $from->getProfile(); + // TRANS: Body for direct-message notification email $body = sprintf(_("%1\$s (%2\$s) sent you a private message:\n\n". "------------------------------------------------------\n". "%3\$s\n". @@ -565,8 +579,10 @@ function mail_notify_fave($other, $user, $notice) common_init_locale($other->language); + // TRANS: Subject for favorite notification email $subject = sprintf(_('%s (@%s) added your notice as a favorite'), $bestname, $user->nickname); + // TRANS: Body for favorite notification email $body = sprintf(_("%1\$s (@%7\$s) just added your notice from %2\$s". " as one of their favorites.\n\n" . "The URL of your notice is:\n\n" . @@ -622,24 +638,25 @@ function mail_notify_attn($user, $notice) common_init_locale($user->language); - if ($notice->conversation != $notice->id) { - $conversationEmailText = "The full conversation can be read here:\n\n". - "\t%5\$s\n\n "; - $conversationUrl = common_local_url('conversation', - array('id' => $notice->conversation)).'#notice-'.$notice->id; - } else { - $conversationEmailText = "%5\$s"; - $conversationUrl = null; - } + if ($notice->hasConversation()) { + $conversationUrl = common_local_url('conversation', + array('id' => $notice->conversation)).'#notice-'.$notice->id; + // TRANS: Line in @-reply notification e-mail. %s is conversation URL. + $conversationEmailText = sprintf(_("The full conversation can be read here:\n\n". + "\t%s"), $conversationUrl) . "\n\n"; + } else { + $conversationEmailText = ''; + } $subject = sprintf(_('%s (@%s) sent a notice to your attention'), $bestname, $sender->nickname); + // TRANS: Body of @-reply notification e-mail. $body = sprintf(_("%1\$s (@%9\$s) just sent a notice to your attention (an '@-reply') on %2\$s.\n\n". "The notice is here:\n\n". "\t%3\$s\n\n" . "It reads:\n\n". "\t%4\$s\n\n" . - $conversationEmailText . + "%5\$s" . "You can reply back here:\n\n". "\t%6\$s\n\n" . "The list of all @-replies for you here:\n\n" . @@ -652,7 +669,7 @@ function mail_notify_attn($user, $notice) common_local_url('shownotice', array('notice' => $notice->id)),//%3 $notice->content,//%4 - $conversationUrl,//%5 + $conversationEmailText,//%5 common_local_url('newnotice', array('replyto' => $sender->nickname, 'inreplyto' => $notice->id)),//%6 common_local_url('replies', diff --git a/lib/noticelist.php b/lib/noticelist.php index 83c8de9f6..4f997a328 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -543,18 +543,7 @@ class NoticeListItem extends Widget function showContext() { - $hasConversation = false; - if (!empty($this->notice->conversation)) { - $conversation = Notice::conversationStream( - $this->notice->conversation, - 1, - 1 - ); - if ($conversation->N > 0) { - $hasConversation = true; - } - } - if ($hasConversation) { + if ($this->notice->hasConversation()) { $conv = Conversation::staticGet( 'id', $this->notice->conversation -- cgit v1.2.3-54-g00ecf From 86a3016a6f85b87fd26c8e61f3cb89c453404042 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 10 Apr 2010 01:49:25 +0200 Subject: Document messages for which clarification was requested. Because N/S/E/W were on the same lines, and the "// TRANS:" comment must be directly above the line in which the message is located to work, I added the messages to a variable first. --- lib/noticelist.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index 4f997a328..b78550487 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -426,10 +426,18 @@ class NoticeListItem extends Widget if (empty($name)) { $latdms = $this->decimalDegreesToDMS(abs($lat)); $londms = $this->decimalDegreesToDMS(abs($lon)); + // TRANS: Used in coordinates as abbreviation of north + $north = _('N') + // TRANS: Used in coordinates as abbreviation of south + $south = _('S') + // TRANS: Used in coordinates as abbreviation of east + $east = _('E') + // TRANS: Used in coordinates as abbreviation of west + $west = _('W') $name = sprintf( _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'), - $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0?_('N'):_('S')), - $londms['deg'],$londms['min'], $londms['sec'],($lon>0?_('E'):_('W'))); + $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south)), + $londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west)); } $url = $location->getUrl(); -- cgit v1.2.3-54-g00ecf From 7fada4ddcc1908829a4c45a02c7ecb3ef3ba60e8 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 10 Apr 2010 19:38:58 -0700 Subject: Fix syntax errors that snuck in while documenting translations --- lib/noticelist.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index b78550487..5265326b2 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -427,16 +427,16 @@ class NoticeListItem extends Widget $latdms = $this->decimalDegreesToDMS(abs($lat)); $londms = $this->decimalDegreesToDMS(abs($lon)); // TRANS: Used in coordinates as abbreviation of north - $north = _('N') + $north = _('N'); // TRANS: Used in coordinates as abbreviation of south - $south = _('S') + $south = _('S'); // TRANS: Used in coordinates as abbreviation of east - $east = _('E') + $east = _('E'); // TRANS: Used in coordinates as abbreviation of west - $west = _('W') + $west = _('W'); $name = sprintf( _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'), - $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south)), + $latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south), $londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west)); } -- cgit v1.2.3-54-g00ecf From 22fde00defe79a153ed77ddf6a4e63dd7fef6743 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 6 May 2010 00:20:10 -0700 Subject: Refactor and centralize notice source link calculation --- actions/twitapisearchatom.php | 15 ++++++++++-- classes/Notice.php | 39 +++++++++++++++++++++++++++++- lib/apiaction.php | 51 ++++++++++----------------------------- lib/noticelist.php | 56 ++++++++++++++++++++----------------------- 4 files changed, 90 insertions(+), 71 deletions(-) (limited to 'lib/noticelist.php') diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php index 24aa619bd..3eb54ccc3 100644 --- a/actions/twitapisearchatom.php +++ b/actions/twitapisearchatom.php @@ -342,10 +342,21 @@ class TwitapisearchatomAction extends ApiAction 'rel' => 'related', 'href' => $profile->avatarUrl())); - // TODO: Here is where we'd put in a link to an atom feed for threads + // @todo: Here is where we'd put in a link to an atom feed for threads + + $source = null; + + $ns = $notice->getSource(); + if ($ns) { + if (!empty($ns->name) && !empty($ns->url)) { + $source = '' . $ns->name . ''; + } else { + $source = $ns->code; + } + } $this->element("twitter:source", null, - htmlentities($this->sourceLink($notice->source))); + htmlentities($source)); $this->elementStart('author'); diff --git a/classes/Notice.php b/classes/Notice.php index e82a82526..cd27376a4 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -704,7 +704,7 @@ class Notice extends Memcached_DataObject /** * Is this notice part of an active conversation? - * + * * @return boolean true if other messages exist in the same * conversation, false if this is the only one */ @@ -1812,4 +1812,41 @@ class Notice extends Memcached_DataObject return $result; } + + /** + * Get the source of the notice + * + * @return Notice_source $ns A notice source object. 'code' is the only attribute + * guaranteed to be populated. + */ + function getSource() + { + $ns = new Notice_source(); + if (!empty($this->source)) { + switch ($this->source) { + case 'web': + case 'xmpp': + case 'mail': + case 'omb': + case 'system': + case 'api': + $ns->code = $this->source; + break; + default: + $ns = Notice_source::staticGet($this->source); + if (!$ns) { + $ns = new Notice_source(); + $ns->code = $this->source; + $app = Oauth_application::staticGet('name', $this->source); + if ($app) { + $ns->name = $app->name; + $ns->url = $app->source_url; + } + } + break; + } + } + return $ns; + } + } diff --git a/lib/apiaction.php b/lib/apiaction.php index a3c34a91b..8c4dc6c26 100644 --- a/lib/apiaction.php +++ b/lib/apiaction.php @@ -313,7 +313,19 @@ class ApiAction extends Action $twitter_status['created_at'] = $this->dateTwitter($notice->created); $twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ? intval($notice->reply_to) : null; - $twitter_status['source'] = $this->sourceLink($notice->source); + + $source = null; + + $ns = $notice->getSource(); + if ($ns) { + if (!empty($ns->name) && !empty($ns->url)) { + $source = '' . $ns->name . ''; + } else { + $source = $ns->code; + } + } + + $twitter_status['source'] = $source; $twitter_status['id'] = intval($notice->id); $replier_profile = null; @@ -1354,43 +1366,6 @@ class ApiAction extends Action } } - function sourceLink($source) - { - $source_name = _($source); - switch ($source) { - case 'web': - case 'xmpp': - case 'mail': - case 'omb': - case 'api': - break; - default: - - $name = null; - $url = null; - - $ns = Notice_source::staticGet($source); - - if ($ns) { - $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 = '' . $name . ''; - } - - break; - } - return $source_name; - } - /** * Returns query argument or default value if not found. Certain * parameters used throughout the API are lightly scrubbed and diff --git a/lib/noticelist.php b/lib/noticelist.php index 5265326b2..c42e4fb60 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -488,48 +488,44 @@ class NoticeListItem extends Widget function showNoticeSource() { - if ($this->notice->source) { + $ns = $this->notice->getSource(); + + if ($ns) { + $source_name = _($ns->code); $this->out->text(' '); $this->out->elementStart('span', 'source'); $this->out->text(_('from')); - $source_name = _($this->notice->source); $this->out->text(' '); - switch ($this->notice->source) { - case 'web': - case 'xmpp': - case 'mail': - case 'omb': - case 'system': - case 'api': - $this->out->element('span', 'device', $source_name); - break; - default: - $name = $source_name; - $url = null; + // if $ns->name and $ns->url are populated we have + // configured a source attr somewhere + if (empty($ns->name) && empty($ns->url)) { + // otherwise it's from normal channel such as web or api + $this->out->element('span', 'device', $source_name); + } else { + $name = null; + $url = null; + $title = null; if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) { - $ns = Notice_source::staticGet($this->notice->source); - - 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; - } - } + $name = $source_name; + $url = $ns->url; } Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title)); if (!empty($name) && !empty($url)) { $this->out->elementStart('span', 'device'); - $this->out->element('a', array('href' => $url, - 'rel' => 'external', - 'title' => $title), - $name); + + $attrs = array( + 'href' => $url, + 'rel' => 'external' + ); + + if (isset($title)) { + $attrs['title'] = $title; + } + + $this->out->element('a', $attrs, $name); $this->out->elementEnd('span'); } else { $this->out->element('span', 'device', $name); -- cgit v1.2.3-54-g00ecf From ce177400f876a1e48f38ef18635d5ecf486a6867 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 6 May 2010 19:52:25 +0000 Subject: - OStatusPlugin should return true if it doesn't need to handle source attribution - Remove stray break statement from NoticeList --- lib/noticelist.php | 1 - plugins/OStatus/OStatusPlugin.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index c42e4fb60..c7dc9d29d 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -530,7 +530,6 @@ class NoticeListItem extends Widget } else { $this->out->element('span', 'device', $name); } - break; } $this->out->elementEnd('span'); } diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index f183bc7ae..d3a92755c 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -452,6 +452,7 @@ class OStatusPlugin extends Plugin return false; } } + return true; } /** -- cgit v1.2.3-54-g00ecf From ee8c9d142251566f87ee0780b5788549cc0a0c12 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 6 May 2010 20:25:20 +0000 Subject: Allow OStatusPlugin to set the source attribution title --- lib/noticelist.php | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index c7dc9d29d..432ea78d5 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -497,40 +497,37 @@ class NoticeListItem extends Widget $this->out->text(_('from')); $this->out->text(' '); - // if $ns->name and $ns->url are populated we have - // configured a source attr somewhere - if (empty($ns->name) && empty($ns->url)) { - // otherwise it's from normal channel such as web or api - $this->out->element('span', 'device', $source_name); - } else { - $name = null; - $url = null; - $title = null; + $name = $source_name; + $url = $ns->url; + $title = null; - if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) { - $name = $source_name; - $url = $ns->url; - } - Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title)); + if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) { + $name = $source_name; + $url = $ns->url; + } + Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title)); - if (!empty($name) && !empty($url)) { - $this->out->elementStart('span', 'device'); + // if $ns->name and $ns->url are populated we have + // configured a source attr somewhere + if (!empty($name) && !empty($url)) { - $attrs = array( - 'href' => $url, - 'rel' => 'external' - ); + $this->out->elementStart('span', 'device'); - if (isset($title)) { - $attrs['title'] = $title; - } + $attrs = array( + 'href' => $url, + 'rel' => 'external' + ); - $this->out->element('a', $attrs, $name); - $this->out->elementEnd('span'); - } else { - $this->out->element('span', 'device', $name); + if (!empty($title)) { + $attrs['title'] = $title; } + + $this->out->element('a', $attrs, $name); + $this->out->elementEnd('span'); + } else { + $this->out->element('span', 'device', $name); } + $this->out->elementEnd('span'); } } -- cgit v1.2.3-54-g00ecf From b2ad8ec571bd68a92e433e817531151ebf8aa4d0 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 28 Jun 2010 14:41:33 -0400 Subject: Fix for PHP notice when given an integer degrees in decimalDegreesToDMS(); using math instead of string manipulation to split integer portion from decimal remainder. --- lib/noticelist.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/noticelist.php') diff --git a/lib/noticelist.php b/lib/noticelist.php index 432ea78d5..e23cf3b6d 100644 --- a/lib/noticelist.php +++ b/lib/noticelist.php @@ -463,12 +463,14 @@ class NoticeListItem extends Widget $this->out->elementEnd('span'); } + /** + * @param number $dec decimal degrees + * @return array split into 'deg', 'min', and 'sec' + */ function decimalDegreesToDMS($dec) { - - $vars = explode(".",$dec); - $deg = $vars[0]; - $tempma = "0.".$vars[1]; + $deg = intval($dec); + $tempma = abs($dec) - abs($deg); $tempma = $tempma * 3600; $min = floor($tempma / 60); -- cgit v1.2.3-54-g00ecf