-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kyle Gadd
committed
Oct 2, 2016
0 parents
commit 7fd354b
Showing
12 changed files
with
921 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
engines: | ||
phpcodesniffer: | ||
enabled: true | ||
config: | ||
file_extensions: "php" | ||
standard: "PSR1,PSR2" | ||
checks: | ||
Generic Files LineLength TooLong: | ||
enabled: false | ||
Squiz WhiteSpace SuperfluousWhitespace EndLine: | ||
enabled: false | ||
phpmd: | ||
enabled: true | ||
config: | ||
file_extensions: "php" | ||
rulesets: "controversial,design,naming" # "cleancode,codesize,controversial,design,naming,unusedcode" | ||
checks: | ||
Controversial/CamelCaseParameterName: | ||
enabled: false | ||
Controversial/CamelCasePropertyName: | ||
enabled: false | ||
Controversial/CamelCaseVariableName: | ||
enabled: false | ||
Design/CouplingBetweenObjects: | ||
enabled: false | ||
Naming/ShortMethodName: | ||
enabled: false | ||
Naming/ShortVariable: | ||
enabled: false | ||
ratings: | ||
paths: | ||
- "src/" | ||
exclude_paths: | ||
- "tests/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Enforce Unix newlines | ||
* text=lf | ||
|
||
# Exclude unused files | ||
# see: https://redd.it/2jzp6k | ||
/tests export-ignore | ||
/.codeclimate.yml export-ignore | ||
/.editorconfig export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
composer.lock | ||
coverage | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: php | ||
|
||
php: | ||
- '5.4' | ||
- '5.5' | ||
- '5.6' | ||
- '7.0' | ||
- nightly | ||
- hhvm | ||
|
||
before_script: | ||
- composer install --dev | ||
- if [[ $TRAVIS_PHP_VERSION == 5.4 ]]; then composer require codeclimate/php-test-reporter:dev-master; fi | ||
|
||
script: | ||
- if [[ $TRAVIS_PHP_VERSION == 5.4 ]]; | ||
then phpunit --debug --coverage-text --coverage-clover build/logs/clover.xml; | ||
else phpunit --debug; | ||
fi | ||
|
||
after_script: | ||
- if [ $TRAVIS_PHP_VERSION == 5.4 ]; then ./vendor/bin/test-reporter; fi | ||
|
||
addons: | ||
code_climate: | ||
repo_token: 4a40abd1cab819c1120e8884a40a61cdb97bd5cc9618259474d5013b246437fa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Kyle Gadd <[email protected]> | ||
|
||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
> THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# use BootPress\Pagination\Component as Pagination; | ||
|
||
[![Packagist][badge-version]][link-packagist] | ||
[![License MIT][badge-license]](LICENSE.md) | ||
[![HHVM Tested][badge-hhvm]][link-travis] | ||
[![PHP 7 Supported][badge-php]][link-travis] | ||
[![Build Status][badge-travis]][link-travis] | ||
[![Code Climate][badge-code-climate]][link-code-climate] | ||
[![Test Coverage][badge-coverage]][link-coverage] | ||
|
||
Creates customizable pagination and pager links. Limits and offsets arrays and database queries. Built-in styles for Bootstrap, Zurb Foundation, Semantic UI, Materialize, and UIkit. | ||
|
||
## Installation | ||
|
||
Add the following to your ``composer.json`` file. | ||
|
||
``` bash | ||
{ | ||
"require ": { | ||
"bootpress/pagination": "^1.0" | ||
} | ||
} | ||
``` | ||
|
||
## Example Usage | ||
|
||
``` php | ||
<?php | ||
|
||
use BootPress\Pagination\Component as Paginator; | ||
|
||
$pagination = new Paginator; | ||
|
||
// Paginate an array | ||
$records = range(1, 100); | ||
if (!$pagination->set('page', 10, 'http://example.com')) { | ||
$pagination->total(count($records)); | ||
} | ||
$display = array_slice($records, $pagination->offset, $pagination->length); | ||
echo implode(',', $display); // 1,2,3,4,5,6,7,8,9,10 | ||
|
||
// Generate pagination links | ||
echo $pagination->links(); | ||
/* | ||
<ul class="pagination"> | ||
<li class="active"><span>1</span></li> | ||
<li><a href="http://example.com?page=2of10">2</a></li> | ||
<li><a href="http://example.com?page=3of10">3</a></li> | ||
<li><a href="http://example.com?page=4of10">4</a></li> | ||
<li><a href="http://example.com?page=5of10">5</a></li> | ||
<li><a href="http://example.com?page=6of10">6</a></li> | ||
<li><a href="http://example.com?page=7of10">7</a></li> | ||
<li class="disabled"><span>…</span></li> | ||
<li><a href="http://example.com?page=10of10">10</a></li> | ||
<li><a href="http://example.com?page=2of10">»</a></li> | ||
</ul> | ||
*/ | ||
|
||
// And a pager for good measure | ||
echo $pagination->pager(); | ||
/* | ||
<ul class="pager"> | ||
<li class="next"><a href="http://example.com?page=2of10">Next »</a></li> | ||
</ul> | ||
*/ | ||
``` | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. | ||
|
||
[badge-version]: https://img.shields.io/packagist/v/bootpress/pagination.svg?style=flat-square&label=Packagist | ||
[badge-license]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square | ||
[badge-hhvm]: https://img.shields.io/badge/HHVM-Tested-8892bf.svg?style=flat-square | ||
[badge-php]: https://img.shields.io/badge/PHP%207-Supported-8892bf.svg?style=flat-square | ||
[badge-travis]: https://img.shields.io/travis/Kylob/Pagination/master.svg?style=flat-square | ||
[badge-code-climate]: https://img.shields.io/codeclimate/github/Kylob/Pagination.svg?style=flat-square | ||
[badge-coverage]: https://img.shields.io/codeclimate/coverage/github/Kylob/Pagination.svg?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/bootpress/pagination | ||
[link-travis]: https://travis-ci.org/Kylob/Pagination | ||
[link-code-climate]: https://codeclimate.com/github/Kylob/Pagination | ||
[link-coverage]: https://codeclimate.com/github/Kylob/Pagination/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "bootpress/pagination", | ||
"description": "Creates customizable pagination and pager links. Limits and offsets arrays and database queries. Built-in styles for Bootstrap, Zurb Foundation, Semantic UI, Materialize, and UIkit.", | ||
"keywords": ["bootpress", "paginate", "pagination", "paginator", "pager"], | ||
"homepage": "https://www.bootpress.org/components/pagination/", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Kyle Gadd", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4", | ||
"bootpress/page": "^1.0" | ||
}, | ||
"require-dev": { | ||
"bootpress/htmlunit": "^1.0", | ||
"friendsofphp/php-cs-fixer": "^1.0", | ||
"squizlabs/php_codesniffer": "^2.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { "BootPress\\Pagination\\": "src" } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="tests/bootstrap.php" stderr="true"> | ||
|
||
<testsuites> | ||
<testsuite name="BootPress Pagination Component"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
</phpunit> |
Oops, something went wrong.