-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ARCANEDEV/patch-1
Cleaning the package
- Loading branch information
Showing
19 changed files
with
177 additions
and
160 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
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
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,38 +1,44 @@ | ||
<?php | ||
|
||
return [ | ||
/* ------------------------------------------------------------------------------------------------ | ||
|
||
/* ----------------------------------------------------------------- | ||
| Source | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
| The blacklisted spammers source file. | ||
*/ | ||
|
||
'source' => base_path('vendor/piwik/referrer-spam-blacklist/spammers.txt'), | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Include | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
| Include new hosts to the blacklist. | ||
*/ | ||
|
||
'include' => [ | ||
// | ||
], | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Exclude | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
| Exclude hosts from the blacklist. | ||
*/ | ||
|
||
'exclude' => [ | ||
// | ||
], | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Cache | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
'cache' => [ | ||
'key' => 'arcanedev.spammers', | ||
|
||
'expires' => 24 * 60, // 1 day | ||
], | ||
|
||
]; |
File renamed without changes.
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 |
---|---|---|
|
@@ -2,29 +2,32 @@ | |
|
||
use Illuminate\Contracts\Support\Arrayable; | ||
use Illuminate\Contracts\Support\Jsonable; | ||
use JsonSerializable; | ||
|
||
/** | ||
* Class Spammer | ||
* | ||
* @package Entities | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class Spammer implements Arrayable, Jsonable | ||
class Spammer implements Arrayable, Jsonable, JsonSerializable | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Properties | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** @var string */ | ||
protected $host; | ||
|
||
/** @var bool */ | ||
protected $blocked; | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Constructor | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Spammer constructor. | ||
* | ||
|
@@ -37,10 +40,11 @@ public function __construct($host, $blocked) | |
$this->setBlocked($blocked); | ||
} | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Getters & Setters | ||
| ------------------------------------------------------------------------------------------------ | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Get the host url. | ||
* | ||
|
@@ -89,10 +93,11 @@ public function setBlocked($blocked) | |
return $this; | ||
} | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Main Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Main Methods | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Make a spammer instance. | ||
* | ||
|
@@ -118,10 +123,11 @@ public function isSameHost($host) | |
return $this->host() === trim(utf8_encode($host)); | ||
} | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Other Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
/* ----------------------------------------------------------------- | ||
| Other Methods | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Get the instance as an array. | ||
* | ||
|
@@ -135,6 +141,16 @@ public function toArray() | |
]; | ||
} | ||
|
||
/** | ||
* Convert the object into something JSON serializable. | ||
* | ||
* @return array | ||
*/ | ||
public function jsonSerialize() | ||
{ | ||
return $this->toArray(); | ||
} | ||
|
||
/** | ||
* Convert the object to its JSON representation. | ||
* | ||
|
@@ -144,6 +160,6 @@ public function toArray() | |
*/ | ||
public function toJson($options = 0) | ||
{ | ||
return json_encode($this->toArray(), $options); | ||
return json_encode($this->jsonSerialize(), $options); | ||
} | ||
} |
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
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
Oops, something went wrong.