Components

Shieldon components are are sets of controller that allow you to add more custom rules to allow or deny before detecting user's behavior.

TrustedBot

TrustedBot component allows popular search engines to crawl your site without limit. please load this commponent at least .

Ip

Ip component allows you to set single IPs or IP ranges in the whitelist or the blacklist.

UserAgent

UserAgent component blocks well-known bad bots by default. You can add your list in UserAgent's blacklist.

Header

Header component blocks vistors without common header information in strict mode,

Rdns

Rdns component blocks vistors without Rdns recond or Rdns not match to IP address in strict mode.


setStrict($bool)

  • param bool $bool - Set true to enble strict mode, false to disable it overwise.
  • return void
$component->setStrict(true);

Denied Trait

  • setDeniedItem
  • setDeniedItems
  • getDeniedItem
  • getDeniedItems
  • removeDeniedItem
  • removeDeniedItems
  • hasDeniedItem
  • getDenyWithPrefix
  • removeDenyWithPrefix
  • isDenied

setDeniedItem($value, $key)

  • param string|array $value - The value of the data.
  • param string $key - The key of the data.
  • return void

Add an item to the blacklist pool.

Example:

$component->setDeniedItem($string);

setDeniedItems($itemList)

  • param array $itemList - String list.
  • return void

Add items to the blacklist pool.

Example:

$component->setDeniedItems($stringList);

getDeniedItem($key)

  • param string $key - The key of the data field.
  • return string|array

Get an item from the blacklist pool.

Example:

$item = $component->getDeniedItems('this_item');

getDeniedItems()

  • return array

Get the items from the blacklist pool.

$list = $component->getDeniedItems();

removeDeniedItem($key)

  • param string $key - The key of the data.
  • return void

Remove a denied item if exists.

$component->removeDeniedItem($string);

removeDeniedItems()

  • return void

Remove all denied items.

$component->removeDeniedItems();

hasDeniedItem($key)

  • param string $key - The key of the data.
  • return bool

Check if a denied item exists.

Example:

if ($component->hasDeniedItem('test')) {
    echo 'item exists';
} else {
    echo 'item does not exist';
}

getDenyWithPrefix($key)

  • param string $key - The key of the data.
  • return array

Check if denied items exist with the same prefix.

Example:

$deniedList = $component->getDenyWithPrefix('test');

removeDenyWithPrefix($key)

  • param string $key - The key of the data.
  • return void

Remove denied items with the same prefix.

$component->removeDenyWithPrefix('test');

isDenied()

  • return bool

This method should adjust in extended class if need.


if ($component->isDenied()) {
    echo 'This user has been denied.';
}

Allowed Trait

  • setAllowedItem
  • setAllowedItems
  • getAllowedItem
  • getAllowedItems
  • removeAllowedItem
  • removeAllowedItems
  • hasAllowedItem
  • getDenyWithPrefix
  • removeDenyWithPrefix
  • isAllowed

setAllowedItem($value, $key)

  • param string|array $value - The value of the data.
  • param string $key - The key of the data.
  • return void

Add an item to the blacklist pool.

Example:

$component->setAllowedItem($string);

setAllowedItems($itemList)

  • param array $itemList - String list.
  • return void

Add items to the blacklist pool.

Example:

$component->setAllowedItems($stringList);

getAllowedItem($key)

  • param string $key - The key of the data field.
  • return string|array

Get an item from the blacklist pool.

Example:

$item = $component->getAllowedItems('this_item');

getAllowedItems()

  • return array

Get the items from the blacklist pool.

$list = $component->getAllowedItems();

removeAllowedItem($key)

  • param string $key - The key of the data.
  • return void

Remove a allowed item if exists.

$component->removeAllowedItem($string);

removeAllowedItems()

  • return void

Remove all allowed items.

$component->removeAllowedItems();

hasAllowedItem($key)

  • param string $key - The key of the data.
  • return bool

Check if a allowed item exists.

Example:

if ($component->hasAllowedItem('test')) {
    echo 'item exists';
} else {
    echo 'item does not exist';
}

getDenyWithPrefix($key)

  • param string $key - The key of the data.
  • return array

Check if a allowed item exists with the same prefix.

Example:

$allowedList = $component->getDenyWithPrefix('test');

removeDenyWithPrefix($key)

  • param string $key - The key of the data.
  • return void

Remove allowed items with the same prefix.

$component->removeDenyWithPrefix('test');

isAllowed()

  • return bool

This method should adjust in extended class if need.


if ($component->isAllowed()) {
    echo 'This user has been allowed.';
}