Skip to content

Commit

Permalink
getPage 1.2.3-pl
Browse files Browse the repository at this point in the history
Merge branch 'develop'

* develop:
  Bump version for 1.2.3-pl release
  [#15] Add ability to specify pageNavScheme for navigation links
  [#14] Avoid adding pageVarKey to query string when page = 1
  [#12] Fix cacheKey when multi-dimensional arrays used in $_REQUEST
  Bump version for 1.2.3-dev
  Refactor include loading to allow out-of-webroot dev; update .gitignore
  • Loading branch information
opengeek committed Jun 20, 2012
2 parents 34cc50c + cea67c2 commit 83eebfa
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
_build/build.config.php
_build/build.config.php
.idea
.buildpath
.project
.settings/
nbproject/
.htaccess
web.config
.DS_Store
6 changes: 3 additions & 3 deletions _build/build.transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* @package getpage
* @subpackage build
* @version 1.1.0-pl
* @author Jason Coward <jason@modxcms.com>
* @version 1.2.3-pl
* @author Jason Coward <jason@modx.com>
*/
$mtime = microtime();
$mtime = explode(" ", $mtime);
Expand All @@ -25,7 +25,7 @@

/* package defines */
define('PKG_NAME','getPage');
define('PKG_VERSION','1.2.2');
define('PKG_VERSION','1.2.3');
define('PKG_RELEASE','pl');
define('PKG_LNAME',strtolower(PKG_NAME));

Expand Down
7 changes: 7 additions & 0 deletions _build/properties/properties.getpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@
'options' => '',
'value' => false,
)
,array(
'name' => 'pageNavScheme',
'desc' => 'Optionally specify a scheme for use when generating page navigation links; will use link_tag_scheme if empty or not specified (default is empty).',
'type' => 'textfield',
'options' => '',
'value' => '',
)
);

return $properties;
6 changes: 6 additions & 0 deletions core/components/getpage/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Changelog for getPage.

getPage 1.2.3-pl (June 20, 2012)
====================================
- [#15] Add ability to specify pageNavScheme for navigation links
- [#14] Avoid adding pageVarKey to query string when page = 1
- [#12] Fix cacheKey when multi-dimensional arrays used in $_REQUEST

getPage 1.2.2-pl (December 9, 2011)
====================================
- Check $_GET before $_REQUEST for pageVarKey and limit overrides
Expand Down
6 changes: 3 additions & 3 deletions core/components/getpage/docs/readme.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
--------------------
Snippet: getPage
--------------------
Version: 1.2.2-pl
Released: December 9, 2011
Version: 1.2.3-pl
Released: June 20, 2012
Since: March 19, 2010
Author: Jason Coward <jason@modxcms.com>
Author: Jason Coward <jason@modx.com>

A generic wrapper snippet for returning paged results and navigation from snippets that return limitable collections. This release requires MODX Revolution 2.1+.

Expand Down
9 changes: 7 additions & 2 deletions core/components/getpage/include.getpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ function getpage_buildControls(& $modx, $properties) {

function getpage_makeUrl(& $modx, $properties, $pageNo, $tpl) {
$qs = $properties['qs'];
$qs[$properties['pageVarKey']] = $pageNo;
$properties['href'] = $modx->makeUrl($modx->resource->get('id'), '', $qs);
if ($pageNo === 1) {
unset($qs[$properties['pageVarKey']]);
} else {
$qs[$properties['pageVarKey']] = $pageNo;
}
$scheme = !empty($properties['pageNavScheme']) ? $properties['pageNavScheme'] : $modx->getOption('link_tag_scheme', $properties, -1);
$properties['href'] = $modx->makeUrl($modx->resource->get('id'), '', $qs, $scheme);
$properties['pageNo'] = $pageNo;
$nav= $modx->newObject('modChunk')->process($properties, $tpl);
return $nav;
Expand Down
4 changes: 2 additions & 2 deletions core/components/getpage/snippet.getpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

if ($properties['cache']) {
$properties['cachePageKey'] = $modx->resource->getCacheKey() . '/' . $properties['page'] . '/' . md5(implode('', $modx->request->getParameters()));
$properties['cachePageKey'] = $modx->resource->getCacheKey() . '/' . $properties['page'] . '/' . md5(http_build_query($modx->request->getParameters()));
$properties['cacheOptions'] = array(
xPDO::OPT_CACHE_KEY => $properties[xPDO::OPT_CACHE_KEY],
xPDO::OPT_CACHE_HANDLER => $properties[xPDO::OPT_CACHE_HANDLER],
Expand All @@ -65,7 +65,7 @@
}
}

include_once $modx->getOption('core_path', $properties, MODX_CORE_PATH) . 'components/getpage/include.getpage.php';
include_once $modx->getOption('getpage.core_path',$properties,$modx->getOption('core_path', $properties, MODX_CORE_PATH) . 'components/getpage/').'include.getpage.php';

$qs = $modx->request->getParameters();
$properties['qs'] =& $qs;
Expand Down

0 comments on commit 83eebfa

Please sign in to comment.