From a14283778ff2f6be57a275a6fdd515480b05ffaa Mon Sep 17 00:00:00 2001 From: David Pede Date: Wed, 3 Sep 2014 15:25:59 +0100 Subject: [PATCH 1/5] Support API Pagination Increases max videos from 20 to 60 (3 pages) --- .../elements/snippets/snippet.getvimeo.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php index 116f45e..d9de60f 100644 --- a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php +++ b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php @@ -41,8 +41,20 @@ $output = ''; if (!empty($channel)) { - $url = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php")) - or $modx->log(modX::LOG_LEVEL_ERROR, 'getVimeo() - Unable to find Channel: ' . $channel); + + $url = array(); + $page = 1; + + do { + $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php?page=$page")) + or $modx->log(modX::LOG_LEVEL_ERROR, 'getVimeo() - Unable to find Channel: ' . $channel); + + $url = array_merge($url,$pagedata); + $page++; + + } while ($pagedata != null && $page < 4); + + if (!empty($id)) { if (!empty($tpl)) { /* ADD REQUESTED VIDEOS TO ARRAY */ From f3c32a966e5eac10e19adbeaf8455f6186f33415 Mon Sep 17 00:00:00 2001 From: David Pede Date: Wed, 3 Sep 2014 17:21:20 +0100 Subject: [PATCH 2/5] Fix error reporting --- .../getvimeo/elements/snippets/snippet.getvimeo.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php index d9de60f..6902474 100644 --- a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php +++ b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php @@ -42,12 +42,14 @@ if (!empty($channel)) { + $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php")) + or $modx->log(modX::LOG_LEVEL_ERROR, 'getVimeo() - Unable to find Channel: ' . $channel); + $url = array(); $page = 1; do { - $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php?page=$page")) - or $modx->log(modX::LOG_LEVEL_ERROR, 'getVimeo() - Unable to find Channel: ' . $channel); + $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php?page=$page")); $url = array_merge($url,$pagedata); $page++; From e02cfe0358eb7909ce3eb4a454ffffc7c01ac896 Mon Sep 17 00:00:00 2001 From: David Pede Date: Thu, 4 Sep 2014 14:17:32 +0100 Subject: [PATCH 3/5] Improve while loop checks --- .../getvimeo/elements/snippets/snippet.getvimeo.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php index 6902474..0d497ce 100644 --- a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php +++ b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php @@ -42,20 +42,15 @@ if (!empty($channel)) { - $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php")) - or $modx->log(modX::LOG_LEVEL_ERROR, 'getVimeo() - Unable to find Channel: ' . $channel); - $url = array(); $page = 1; do { - $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php?page=$page")); - + $pagedata = unserialize(file_get_contents("http://vimeo.com/api/v2/channel/$channel/videos.php?page=$page")) + or $modx->log(modX::LOG_LEVEL_ERROR, 'getVimeo() - Unable to find Channel: ' . $channel); $url = array_merge($url,$pagedata); $page++; - - } while ($pagedata != null && $page < 4); - + } while ((count($pagedata)) == 20 && $page <= 3); if (!empty($id)) { if (!empty($tpl)) { From feae7f3ba3a923b250690b18b76065a0095cbf64 Mon Sep 17 00:00:00 2001 From: David Pede Date: Tue, 23 Sep 2014 10:40:29 +0100 Subject: [PATCH 4/5] Remove hardcoded default property values --- .../getvimeo/elements/snippets/snippet.getvimeo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php index 0d497ce..7404f0b 100644 --- a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php +++ b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php @@ -29,13 +29,13 @@ $tpl = !empty($tpl) ? $tpl : ''; $tplAlt = !empty($tplAlt) ? $tplAlt : ''; $tplWrapper = !empty($tplWrapper) ? $tplWrapper : ''; // Blank default makes '&tplWrapper' optional -$sortby = !empty($sortby) ? $sortby : 'upload_date'; +$sortby = !empty($sortby) ? $sortby : ''; $sortdir = !empty($sortdir) && ($sortdir == "ASC") ? SORT_ASC : SORT_DESC; // If parameter is not empty AND equals 'ASC' assign 'SORT_ASC' $toPlaceholder = !empty($toPlaceholder) ? $toPlaceholder : ''; // Blank default makes '&toPlaceholder' optional $limit = isset($limit) ? (integer) $limit : 0; $offset = isset($offset) ? (integer) $offset : 0; -$totalVar = !empty($totalVar) ? $totalVar : 'total'; +$totalVar = !empty($totalVar) ? $totalVar : ''; $total = 0; $output = ''; From 52b5c05840eee959c4b6abd1b7ee9185d29b28fc Mon Sep 17 00:00:00 2001 From: David Pede Date: Tue, 23 Sep 2014 10:55:43 +0100 Subject: [PATCH 5/5] Bump version to 1.1.1-pl --- _build/build.transport.php | 4 ++-- _build/data/transport.chunks.php | 2 +- _build/data/transport.snippets.php | 2 +- _build/properties/properties.getvimeo.php | 2 +- core/components/getvimeo/docs/changelog.txt | 4 ++++ core/components/getvimeo/docs/readme.txt | 6 +++--- .../getvimeo/elements/snippets/snippet.getvimeo.php | 6 +++--- readme.md | 4 ++-- 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/_build/build.transport.php b/_build/build.transport.php index 6621a7e..7dc3ca1 100644 --- a/_build/build.transport.php +++ b/_build/build.transport.php @@ -2,7 +2,7 @@ /** * @package getvimeo * - * Copyright (C) 2013 David Pede. All rights reserved. + * Copyright (C) 2014 David Pede. All rights reserved. * * getVimeo is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software @@ -29,7 +29,7 @@ /* define package names */ define('PKG_NAME','getVimeo'); define('PKG_NAME_LOWER','getvimeo'); -define('PKG_VERSION','1.1.0'); +define('PKG_VERSION','1.1.1'); define('PKG_RELEASE','pl'); /* define sources */ diff --git a/_build/data/transport.chunks.php b/_build/data/transport.chunks.php index 4a1cbe1..9ad5c2c 100644 --- a/_build/data/transport.chunks.php +++ b/_build/data/transport.chunks.php @@ -2,7 +2,7 @@ /** * @package getvimeo * - * Copyright (C) 2013 David Pede. All rights reserved. + * Copyright (C) 2014 David Pede. All rights reserved. * * getVimeo is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software diff --git a/_build/data/transport.snippets.php b/_build/data/transport.snippets.php index 7e4dbc3..5320115 100644 --- a/_build/data/transport.snippets.php +++ b/_build/data/transport.snippets.php @@ -2,7 +2,7 @@ /** * @package getvimeo * - * Copyright (C) 2013 David Pede. All rights reserved. + * Copyright (C) 2014 David Pede. All rights reserved. * * getVimeo is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software diff --git a/_build/properties/properties.getvimeo.php b/_build/properties/properties.getvimeo.php index 853c795..c00266f 100644 --- a/_build/properties/properties.getvimeo.php +++ b/_build/properties/properties.getvimeo.php @@ -2,7 +2,7 @@ /** * @package getvimeo * - * Copyright (C) 2013 David Pede. All rights reserved. + * Copyright (C) 2014 David Pede. All rights reserved. * * getVimeo is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software diff --git a/core/components/getvimeo/docs/changelog.txt b/core/components/getvimeo/docs/changelog.txt index 5635bf5..2cda2e1 100644 --- a/core/components/getvimeo/docs/changelog.txt +++ b/core/components/getvimeo/docs/changelog.txt @@ -1,5 +1,9 @@ Changelog for getVimeo. +getVimeo 1.1.1-pl (September 23, 2014) +==================================== +- Add API pagination support to increase video limit from 20 to 60. + getVimeo 1.1.0-pl (October 16, 2013) ==================================== - Add getPage compatibility to allow output pagination. diff --git a/core/components/getvimeo/docs/readme.txt b/core/components/getvimeo/docs/readme.txt index 2af526d..4a8c216 100644 --- a/core/components/getvimeo/docs/readme.txt +++ b/core/components/getvimeo/docs/readme.txt @@ -1,11 +1,11 @@ -------------------- Extra: getVimeo -------------------- -Version: 1.1.0-pl -Released: October 16, 2013 +Version: 1.1.1-pl +Released: September 23, 2014 Since: June 12, 2013 Author: David Pede -Copyright: (C) 2013 David Pede. All rights reserved. +Copyright: (C) 2014 David Pede. All rights reserved. A simple video retrieval Snippet for MODX Revolution. diff --git a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php index 7404f0b..b8e2d5a 100644 --- a/core/components/getvimeo/elements/snippets/snippet.getvimeo.php +++ b/core/components/getvimeo/elements/snippets/snippet.getvimeo.php @@ -3,12 +3,12 @@ * A simple video retrieval Snippet for MODX Revolution. * * @author David Pede - * @version 1.1.0-pl - * @released October 16, 2013 + * @version 1.1.1-pl + * @released September 23, 2014 * @since June 12, 2013 * @package getvimeo * - * Copyright (C) 2013 David Pede. All rights reserved. + * Copyright (C) 2014 David Pede. All rights reserved. * * getVimeo is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software diff --git a/readme.md b/readme.md index 25c346c..d9691ca 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -#getVimeo 1.1.0-pl +#getVimeo 1.1.1-pl ###A simple video retrieval Snippet for MODX Revolution. ####Installation @@ -14,7 +14,7 @@ If you have a bug fix or improvement and would like to submit a Pull Request, pl ####Details Author: David Pede (dev@tasianmedia.com) (https://twitter.com/davepede) -Copyright: (C) 2013 David Pede. All rights reserved. (dev@tasianmedia.com) +Copyright: (C) 2014 David Pede. All rights reserved. (dev@tasianmedia.com) ####Please Note getVimeo is not associated with or endorsed by Vimeo, LLC.