]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Poll/Poll_response.php
Merge remote-tracking branch 'origin/1.1.x' into 1.1.x
[quix0rs-gnu-social.git] / plugins / Poll / Poll_response.php
index 88e6ea890cb32cfea4b53c75d70b094bd8d5fa88..2518ac2bebd057f8a35e9b6b5a070c8cd99e6238 100644 (file)
@@ -42,11 +42,11 @@ if (!defined('STATUSNET')) {
  *
  * @see      DB_DataObject
  */
-
 class Poll_response extends Managed_DataObject
 {
     public $__table = 'poll_response'; // table name
     public $id;          // char(36) primary key not null -> UUID
+    public $uri;          // varchar(255)
     public $poll_id;     // char(36) -> poll.id UUID
     public $profile_id;  // int -> profile.id
     public $selection;   // int -> choice #
@@ -63,7 +63,6 @@ class Poll_response extends Managed_DataObject
      * @return User_greeting_count object found, or null for no hits
      *
      */
-
     function staticGet($k, $v=null)
     {
         return Memcached_DataObject::staticGet('Poll_response', $k, $v);
@@ -81,7 +80,6 @@ class Poll_response extends Managed_DataObject
      * @return Bookmark object found, or null for no hits
      *
      */
-
     function pkeyGet($kv)
     {
         return Memcached_DataObject::pkeyGet('Poll_response', $kv);
@@ -120,7 +118,6 @@ class Poll_response extends Managed_DataObject
      *
      * @return Poll_response found response or null
      */
-
     function getByNotice($notice)
     {
         return self::staticGet('uri', $notice->uri);
@@ -159,7 +156,6 @@ class Poll_response extends Managed_DataObject
      *
      * @return Notice saved notice
      */
-
     static function saveNew($profile, $poll, $selection, $options=null)
     {
         if (empty($options)) {
@@ -167,6 +163,7 @@ class Poll_response extends Managed_DataObject
         }
 
         if (!$poll->isValidSelection($selection)) {
+            // TRANS: Client exception thrown when responding to a poll with an invalid option.
             throw new ClientException(_m('Invalid poll selection.'));
         }
         $opts = $poll->getOptions();
@@ -194,19 +191,20 @@ class Poll_response extends Managed_DataObject
         common_log(LOG_DEBUG, "Saving poll response: $pr->id $pr->uri");
         $pr->insert();
 
+        // TRANS: Notice content voting for a poll.
+        // TRANS: %s is the chosen option in the poll.
         $content  = sprintf(_m('voted for "%s"'),
                             $answer);
-        $rendered = sprintf(_m('voted for “<a href="%s">%s</a>”'),
-                            htmlspecialchars($poll->uri),
-                            htmlspecialchars($answer));
+        $link = '<a href="' . htmlspecialchars($poll->uri) . '">' . htmlspecialchars($answer) . '</a>';
+        // TRANS: Rendered version of the notice content voting for a poll.
+        // TRANS: %s a link to the poll with the chosen option as link description.
+        $rendered = sprintf(_m('voted for "%s"'), $link);
 
         $tags    = array();
-        $replies = array();
 
         $options = array_merge(array('urls' => array(),
                                      'rendered' => $rendered,
                                      'tags' => $tags,
-                                     'replies' => $replies,
                                      'reply_to' => $poll->getNotice()->id,
                                      'object_type' => PollPlugin::POLL_RESPONSE_OBJECT),
                                $options);