-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
16 changed files
with
318 additions
and
816 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,10 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/tests 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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
/framework | ||
/spamprotection | ||
/vendor | ||
build | ||
composer.lock | ||
docs | ||
framework | ||
cms | ||
spamprotection | ||
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 |
---|---|---|
@@ -1,4 +1,35 @@ | ||
inherit: true | ||
filter: | ||
excluded_paths: [tests/*] | ||
checks: | ||
php: | ||
code_rating: true | ||
remove_extra_empty_lines: true | ||
remove_php_closing_tag: true | ||
remove_trailing_whitespace: true | ||
fix_use_statements: | ||
remove_unused: true | ||
preserve_multiple: false | ||
preserve_blanklines: true | ||
order_alphabetically: true | ||
fix_php_opening_tag: true | ||
fix_linefeed: true | ||
fix_line_ending: true | ||
fix_identation_4spaces: true | ||
fix_doc_comments: true | ||
tools: | ||
external_code_coverage: | ||
timeout: 600 | ||
external_code_coverage: | ||
timeout: 600 | ||
runs: 3 | ||
php_analyzer: true | ||
php_code_coverage: true | ||
php_code_sniffer: | ||
config: | ||
standard: PSR2 | ||
filter: | ||
paths: ['src'] | ||
php_loc: | ||
enabled: true | ||
excluded_dirs: [_config, assets, lang, templates, framework, cms, vendor, tests] | ||
php_cpd: | ||
enabled: true | ||
excluded_dirs: [_config, assets, lang, templates, framework, cms, vendor, 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
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,38 @@ | ||
# Changelog | ||
|
||
All Notable changes to `studiobonito/silverstripe-spamprotection-honeypot` will be documented in this file | ||
|
||
## [Unreleased] | ||
|
||
## [1.1.0] - 2015-09-28 | ||
### Added | ||
- Included changelog. | ||
- Included `.gitattributes` file. | ||
- Included `php` version `>=5.3.0` as a dependency. | ||
- Included `scrutinizer/ocular` version `~1.1` as a development dependency. | ||
- Updated license. | ||
- Update Scrutinizer configuration. | ||
- Update Travis configuration (include PHP 5.6, 7 and HHVM). | ||
- Update PHPUnit configuration. | ||
- Include contributing guide. | ||
- Update readme. | ||
- Included test case for failed validation. | ||
|
||
### Fixed | ||
- Removed `composer.lock` file. | ||
- Updated `.gitignore` file. | ||
- Updated `composer.json` file. | ||
- Improved PSR-1 and PSR-2 conformance. | ||
- Included safe mocking of translation function. | ||
- Corrected `getValidator()` to return `MockInterface`. | ||
|
||
## [1.0.1] - 2014-09-09 | ||
### Added | ||
- Included `silverstripe/spamprotection` version `~1.2.0` as a dependency. | ||
|
||
### Changed | ||
- Excluded methods from code coverage calculations. | ||
|
||
[Unreleased]: https://github.com/studiobonito/silverstripe-spamprotection-honeypot/compare/1.1.0...HEAD | ||
[1.1.0]: https://github.com/studiobonito/silverstripe-spamprotection-honeypot/compare/1.0.1...1.1.0 | ||
[1.0.1]: https://github.com/studiobonito/silverstripe-spamprotection-honeypot/compare/1.0.0...1.0.1 |
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 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/studiobonito/silverstripe-google-analytics/tree/develop). | ||
|
||
|
||
## Pull Requests | ||
|
||
- **Development branch** - You're pull request should be made against the `develop` branch. | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. | ||
|
||
|
||
## Running Tests | ||
|
||
``` bash | ||
$ phpunit | ||
``` | ||
|
||
|
||
**Happy coding**! |
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,27 @@ | ||
# Copyright (c) 2014, Studio Bonito Ltd. | ||
|
||
All rights reserved. | ||
|
||
> Redistribution and use in source and binary forms, with or without modification, are | ||
> permitted provided that the following conditions are met: | ||
> | ||
> 1. Redistributions of source code must retain the above copyright notice, this list of | ||
> conditions and the following disclaimer. | ||
> | ||
> 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
> of conditions and the following disclaimer in the documentation and/or other materials | ||
> provided with the distribution. | ||
> | ||
> THIS SOFTWARE IS PROVIDED BY STUDIO BONITO LTD "AS IS" AND ANY EXPRESS OR IMPLIED | ||
> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STUDIO BONITO LTD OR | ||
> CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
> CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
> SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
> ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
> NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
> ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
> | ||
> The views and conclusions contained in the software and documentation are those of the | ||
> authors and should not be interpreted as representing official policies, either expressed | ||
> or implied, of Studio Bonito Ltd. |
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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
# SpamProtection Honeypot Module | ||
|
||
[![Build Status](https://travis-ci.org/studiobonito/silverstripe-spamprotection-honeypot.svg?branch=master)](https://travis-ci.org/studiobonito/silverstripe-spamprotection-honeypot) | ||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/studiobonito/silverstripe-spamprotection-honeypot/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/studiobonito/silverstripe-spamprotection-honeypot/?branch=master) | ||
[![Code Coverage](https://scrutinizer-ci.com/g/studiobonito/silverstripe-spamprotection-honeypot/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/studiobonito/silverstripe-spamprotection-honeypot/?branch=master) | ||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Software License][ico-license]](LICENSE.md) | ||
[![Build Status][ico-travis]][link-travis] | ||
[![Coverage Status][ico-scrutinizer]][link-scrutinizer] | ||
[![Quality Score][ico-code-quality]][link-code-quality] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
|
||
## Overview | ||
|
||
|
@@ -13,31 +16,81 @@ Also invalidate submissions that respond to quickly. | |
## Requirements | ||
|
||
- SilverStripe 3.1 or newer. | ||
- SilverStripe [SpamProtection](https://github.com/silverstripe/silverstripe-framework) 1.2 or newer. | ||
- SilverStripe [SpamProtection](https://github.com/silverstripe/silverstripe-spamprotection) 1.2 or newer. | ||
|
||
## Installation Instructions | ||
## Install | ||
|
||
### Composer | ||
### Via Composer | ||
|
||
Run the following to add this module as a requirement and install it via composer. | ||
|
||
```bash | ||
$ composer require studiobonito/silverstripe-spamprotection-honeypot | ||
``` | ||
|
||
### Manual | ||
### Manually | ||
|
||
Copy the 'honeypot' folder to the root of your SilverStripe installation. | ||
Copy the 'silverstripe-spamprotection-honeypot' folder to the root of your SilverStripe installation. | ||
|
||
## Contributing | ||
## Usage | ||
|
||
Create a configuration file `spamprotection.yml` in `mysite/_config` with the following configuration. | ||
|
||
```yaml | ||
--- | ||
name: spamprotection | ||
--- | ||
FormSpamProtectionExtension: | ||
default_spam_protector: '\StudioBonito\SilverStripe\SpamProtection\Honeypot\SpamProtector\HoneypotSpamProtector' | ||
``` | ||
Then enable spam protection on your form by calling `Form::enableSpamProtection()`. | ||
|
||
```php | ||
public function ExampleForm() | ||
{ | ||
$form = new ExampleForm($this, 'Example'); | ||
$form->enableSpamProtection(); | ||
return $form; | ||
} | ||
``` | ||
|
||
### Unit Testing | ||
## Testing | ||
|
||
```bash | ||
$ composer install --prefer-dist --dev | ||
$ phpunit | ||
``` | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [Tom Densham][link-author] | ||
- [All Contributors][link-contributors] | ||
|
||
## License | ||
|
||
All work copyright [Studio Bonito Ltd.](http://www.studiobonito.co.uk/) under BSD-2-Clause license. | ||
The BSD-2-Clause License. Please see [License File](LICENSE.md) for more information. | ||
|
||
[ico-version]: https://img.shields.io/github/release/studiobonito/silverstripe-spamprotection-honeypot.svg?style=flat-square | ||
[ico-license]: https://img.shields.io/badge/license-BSD-brightgreen.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/studiobonito/silverstripe-spamprotection-honeypot/master.svg?style=flat-square | ||
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/studiobonito/silverstripe-spamprotection-honeypot.svg?style=flat-square | ||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/studiobonito/silverstripe-spamprotection-honeypot.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/studiobonito/silverstripe-spamprotection-honeypot.svg?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/studiobonito/silverstripe-spamprotection-honeypot | ||
[link-travis]: https://travis-ci.org/studiobonito/silverstripe-spamprotection-honeypot | ||
[link-scrutinizer]: https://scrutinizer-ci.com/g/studiobonito/silverstripe-spamprotection-honeypot/code-structure | ||
[link-code-quality]: https://scrutinizer-ci.com/g/studiobonito/silverstripe-spamprotection-honeypot | ||
[link-downloads]: https://packagist.org/packages/studiobonito/silverstripe-spamprotection-honeypot | ||
[link-author]: https://github.com/nedmas | ||
[link-contributors]: ../../contributors |
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 |
---|---|---|
|
@@ -2,27 +2,44 @@ | |
"name": "studiobonito/silverstripe-spamprotection-honeypot", | ||
"description": "Provide Honeypot spam protection for SilverStripe CMS.", | ||
"type": "silverstripe-module", | ||
"keywords": ["silverstripe", "spam", "protection", "honeypot", "form"], | ||
"keywords": [ | ||
"studiobonito", | ||
"silverstripe-spamprotection-honeypot", | ||
"silverstripe", | ||
"spam", | ||
"protection", | ||
"honeypot", | ||
"form" | ||
], | ||
"homepage": "https://github.com/studiobonito/silverstripe-spamprotection-honeypot", | ||
"license": "BSD-2-Clause", | ||
"authors": [ | ||
{ | ||
"name": "Tom Densham", | ||
"email": "[email protected]" | ||
"email": "[email protected]", | ||
"homepage": "http://www.studiobonito.co.uk", | ||
"role": "Developer" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"StudioBonito\\SilverStripe\\SpamProtection\\Honeypot\\": "src/", | ||
"StudioBonito\\SilverStripe\\SpamProtection\\Honeypot\\Tests\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": ">=5.3.0", | ||
"silverstripe/framework": "~3.1.0", | ||
"silverstripe/spamprotection": "~1.2.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~3.7.0", | ||
"mockery/mockery": "~0.9.0", | ||
"symfony/class-loader": "~2.3" | ||
"phpunit/phpunit": "4.*", | ||
"mockery/mockery": "0.9.*", | ||
"symfony/class-loader": "~2.3", | ||
"scrutinizer/ocular": "~1.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"StudioBonito\\SilverStripe\\SpamProtection\\Honeypot\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"StudioBonito\\SilverStripe\\SpamProtection\\Honeypot\\Tests\\": "tests" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.