]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Poll/Poll.php
AS output/input for poll responses
[quix0rs-gnu-social.git] / plugins / Poll / Poll.php
index f5143c3e573cf60ab8393078bd33c66c5784cde3..1f26bbf6e40b003dc627fba74697ba50f057924b 100644 (file)
@@ -128,6 +128,23 @@ class Poll extends Managed_DataObject
         return explode("\n", $this->options);
     }
 
+    /**
+     * Is this a valid selection index?
+     *
+     * @param numeric $selection (1-based)
+     * @return boolean
+     */
+    function isValidSelection($selection)
+    {
+        if ($selection != intval($selection)) {
+            return false;
+        }
+        if ($selection < 1 || $selection > count($this->getOptions())) {
+            return false;
+        }
+        return true;
+    }
+
     function getNotice()
     {
         return Notice::staticGet('uri', $this->uri);