Skip to content

Commit

Permalink
Rename lib & classes
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Oct 17, 2013
1 parent a13142b commit a64e2d3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 31 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
CallbackValidator
=================
JsonpCallbackValidator
======================

**CallbackValidator** allows you to **validate a JSONP callback** in order to
prevent XSS attacks.
**JsonpCallbackValidator** allows you to **validate a JSONP callback** in order
to prevent XSS attacks.

[![Build
Status](https://travis-ci.org/willdurand/CallbackValidator.png?branch=master)](https://travis-ci.org/willdurand/CallbackValidator)
Status](https://travis-ci.org/willdurand/JsonpCallbackValidator.png?branch=master)](https://travis-ci.org/willdurand/JsonpCallbackValidator)


Usage
-----

```php
$validator = new \CallbackValidator\CallbackValidator();
$validator = new \JsonpCallbackValidator();

$validator->validate('JSONP.callback');
// returns `true`
Expand All @@ -25,19 +25,19 @@ $validator->validate('(function xss(x){evil()})');
Installation
------------

The recommended way to install CallbackValidator is through
The recommended way to install JsonpCallbackValidator is through
[Composer](http://getcomposer.org/):

``` json
{
"require": {
"willdurand/callback-validator": "@stable"
"willdurand/jsonp-callback-validator": "@stable"
}
}
```

**Protip:** you should browse the
[`willdurand/callback-validator`](https://packagist.org/packages/willdurand/callback-validator)
[`willdurand/jsonp-callback-validator`](https://packagist.org/packages/willdurand/jsonp-callback-validator)
page to choose a stable version to use, avoid the `@stable` meta constraint.


Expand Down Expand Up @@ -69,5 +69,5 @@ Credits
License
-------

CallbackValidator is released under the MIT License. See the bundled LICENSE
file for details.
JsonpCallbackValidator is released under the MIT License. See the bundled
LICENSE file for details.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "willdurand/callback-validator",
"name": "willdurand/jsonp-callback-validator",
"description": "JSONP callback validator.",
"type": "library",
"license": "MIT",
Expand All @@ -16,7 +16,7 @@
"phpunit/phpunit": "~3.7"
},
"autoload": {
"psr-0": { "CallbackValidator": "src/" }
"psr-0": { "JsonpCallbackValidator": "src/" }
},
"config": {
"bin-dir": "bin"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<?php

namespace CallbackValidator;

/**
* Most of the code above took inspiration from:
* https://gist.github.com/ptz0n/1217080.
*
* @author William Durand <[email protected]>
*/
class CallbackValidator
class JsonpCallbackValidator
{
private $reservedKeywords = array(
'break',
Expand Down
7 changes: 0 additions & 7 deletions tests/CallbackValidator/Tests/TestCase.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?php

namespace CallbackValidator\Tests;

use CallbackValidator\CallbackValidator;

class CallbackValidatorTest extends TestCase
class JsonpCallbackValidatorTest extends \PHPUnit_Framework_TestCase
{
const IS_VALID = true;

Expand All @@ -15,7 +11,7 @@ class CallbackValidatorTest extends TestCase
*/
public function testValidate($callback, $expected)
{
$validator = new CallbackValidator();
$validator = new \JsonpCallbackValidator();
$this->assertEquals($expected, $validator->validate($callback));
}

Expand Down
2 changes: 0 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@
EOT
);
}

$loader->add('CallbackValidator\Tests', __DIR__);

0 comments on commit a64e2d3

Please sign in to comment.