Skip to content

Commit

Permalink
Fix typos in example snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 authored Dec 1, 2024
1 parent 957c798 commit 16c13fd
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,34 @@ if (Ban::isUsername('admin')) {
}

if (Ban::isEmail('james@spamhole.com')) {
echo '"@spamhole.com" domain is considered as a email spam host.';
echo '"@spamhole.com" domain is considered a spam email host.';
}

if (Ban::isWord('He is an asshole')) {
echo 'Please watch your mouth :-)';
}

if(Ban::isIp('1.170.36.229')) {
if (Ban::isIp('1.170.36.229')) {
echo 'This IP address is blacklisted';
}

$userinput = 'admin';
if (Ban::isUsername($userinput, ['root', 'sudo', 'admin'])) {
echo "$userinput is not allowed";
$userInput = 'admin';
if (Ban::isUsername($userInput, ['root', 'sudo', 'admin'])) {
echo "$userInput is not allowed";
}

// Validate of the userinput is a banned word _OR_ a banned username
if (Ban::isAny($userinput, email: false, word: true, username: true)) {
echo "$userinput is not allowed";
// Validate if the userInput is a banned word *OR* a banned username
if (Ban::isAny($userInput, email: false, word: true, username: true)) {
echo "$userInput is not allowed";
}
```

### Extending Banned Phrases

You can supply your own values to be merged with the out-of-box banned-data 2 ways

You can supply your own values to be merged with the out-of-box banned data in 2 ways:
1. `Ban::merge(string $scope, string | array $value)`
2. `Ban::mergeFile(string $scope, string $path)`

`$scope` refers to the category of data. Possible values are currently:

- usernames
- words
- ips
Expand All @@ -76,10 +73,9 @@ Ban::mergeFile('emails', './my_banned_emails.txt');
```
</details>

Now simply validate per normal conventions.


Now simply validate per normal conventions

## 🚀 Author

**[Pierre-Henry Soria][author-url]**, a highly passionate, zen &amp; cool software engineer 😊
Expand All @@ -88,10 +84,11 @@ Now simply validate per normal conventions

[![Pierre-Henry Soria](https://avatars0.githubusercontent.com/u/1325411?s=220)](https://pierrehenry.be "Pierre-Henry - Software Developer Website :-)")

## 👩🏻‍💻 Helpers
### 👩🏻‍💻 Helpers

**[soulshined](https://github.com/soulshined)** - just a coder


## 🧐 Used By...

**[pH7Builder][ph7cms-url]**, a social dating webapp builder. Used here: [https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Security/Ban/Ban.class.php](https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Security/Ban/Ban.class.php).
Expand Down

0 comments on commit 16c13fd

Please sign in to comment.