summaryrefslogtreecommitdiff
path: root/modules/tag/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r--modules/tag/helpers/tags_rest.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/tag/helpers/tags_rest.php b/modules/tag/helpers/tags_rest.php
index 434e774a..975cf140 100644
--- a/modules/tag/helpers/tags_rest.php
+++ b/modules/tag/helpers/tags_rest.php
@@ -18,9 +18,22 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class tags_rest_Core {
+ /**
+ * Possible request parameters:
+ * start=#
+ * start at the Nth comment (zero based)
+ *
+ * num=#
+ * return up to N comments (max 100)
+ */
static function get($request) {
$tags = array();
- foreach (ORM::factory("tag")->find_all() as $tag) {
+
+ $p = $request->params;
+ $num = isset($p->num) ? min((int)$p->num, 100) : 10;
+ $start = isset($p->start) ? (int)$p->start : 0;
+
+ foreach (ORM::factory("tag")->find_all($num, $start) as $tag) {
$tags[] = rest::url("tag", $tag);
}
return array("url" => rest::url("tags"),