Skip to content

Commit

Permalink
Merge pull request #13 from davidpede/apiPagination
Browse files Browse the repository at this point in the history
Add API pagination support
  • Loading branch information
David Pede committed Sep 23, 2014
2 parents 43ca89b + 52b5c05 commit 5534de3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
4 changes: 2 additions & 2 deletions _build/build.transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @package getvimeo
*
* Copyright (C) 2013 David Pede. All rights reserved. <dev@tasianmedia.com>
* Copyright (C) 2014 David Pede. All rights reserved. <dev@tasianmedia.com>
*
* 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
Expand All @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion _build/data/transport.chunks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @package getvimeo
*
* Copyright (C) 2013 David Pede. All rights reserved. <dev@tasianmedia.com>
* Copyright (C) 2014 David Pede. All rights reserved. <dev@tasianmedia.com>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion _build/data/transport.snippets.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @package getvimeo
*
* Copyright (C) 2013 David Pede. All rights reserved. <dev@tasianmedia.com>
* Copyright (C) 2014 David Pede. All rights reserved. <dev@tasianmedia.com>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion _build/properties/properties.getvimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @package getvimeo
*
* Copyright (C) 2013 David Pede. All rights reserved. <dev@tasianmedia.com>
* Copyright (C) 2014 David Pede. All rights reserved. <dev@tasianmedia.com>
*
* 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
Expand Down
4 changes: 4 additions & 0 deletions core/components/getvimeo/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions core/components/getvimeo/docs/readme.txt
Original file line number Diff line number Diff line change
@@ -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 <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>

A simple video retrieval Snippet for MODX Revolution.

Expand Down
23 changes: 16 additions & 7 deletions core/components/getvimeo/elements/snippets/snippet.getvimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* A simple video retrieval Snippet for MODX Revolution.
*
* @author David Pede <dev@tasianmedia.com> <https://twitter.com/davepede>
* @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. <dev@tasianmedia.com>
* Copyright (C) 2014 David Pede. All rights reserved. <dev@tasianmedia.com>
*
* 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
Expand All @@ -29,20 +29,29 @@
$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 = '';

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 ((count($pagedata)) == 20 && $page <= 3);

if (!empty($id)) {
if (!empty($tpl)) {
/* ADD REQUESTED VIDEOS TO ARRAY */
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#getVimeo 1.1.0-pl
#getVimeo 1.1.1-pl
###A simple video retrieval Snippet for MODX Revolution.

####Installation
Expand All @@ -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.
Expand Down

0 comments on commit 5534de3

Please sign in to comment.