User tests: Successful: Unsuccessful:
Now uses strpos instead of preg_match.
In isRobot() use strpos() instead of preg_match() as that is faster.
See https://www.php.net/manual/en/function.preg-match.php#refsect1-function.preg-match-notes
A simple test available in this plugin.
bfisrobottest.zip
Install and on enabling the front-end displays the following on success:
Test (false):
Test (true):1
Test (true):1
Robots detected.
Robots detected.
Its a big list of robots - possibly a detectable performance improvement,
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
Agree I was wondering about the best way forward. See comment I've added to #45323
Would moving this big list into a plugin be a first start? e.g.
plg_browserbot_legacy
Can then investigate other bot detectors like this.
https://fingerprint.com/try/bot-detection/
plg_browserbot_fingerprint
Up to site admin to enable the one(s) they want to use.
| Labels |
Added:
PR-6.1-dev
|
||
Added support for isrobot event in browserbot plugin folder.
Falls through to legacy list if no plugin found.
In future can add browserbot plugins whenever convenient.
Install and enable this plugin to test:
plg_browserbot_test.zip
Invocation:
To emulate a normal user
yourtestsite/index.php?isrobot=0
And to emulate a robot
yourtestsite/index.php?isrobot=1
Legacy isRobot behaviour
yourtestsite/index.php
Could you use in_array()? How would it compare for speed?
As I wrote in the referenced issue we should not be trying to maintain a list of robots ourselves and should be using a well maintained library instead
As I wrote in the referenced issue we should not be trying to maintain a list of robots ourselves and should be using a well maintained library instead
... The plugin solution opens up the possibility to use any number of free / freemium / paid for libraries. Maybe one plugin could be distributed with Joomla Project like Google Captcha is incluided. Other possibilities left to 3rd party developers.
Not an intended outcome of this pull request I have a long-standing use case of the Browser class where it looks like using this plugin approach is worth investigating.
The list is massively out of date
See #45323