Class Protector_postcommon_post_language_match

extends ProtectorFilterAbstract

Class protector_postcommon_post_language_match

Check post content conformance to the system language. Requires UTF-8 environment with mbstring.

This filter compares post data to the characters that define the current system language. If the number of characters that are not normally used in the language exceeds a threshold, the post will be rejected.

The threshold can be adjusted in $maximumTolerance.

A value of 0.02 (2% non-language characters) can often discriminate between multiple Latin languages, while values approaching 1.0 (100% non-language) indicate totally different alphabets, such as comparing English (Latin) to Russian (Cyrillic.) Some commonalities are always possible with "loanwords," so this number always represents tendency, not absolutes.

Certain ranges are common to all languages, whitespace, punctuations, currency symbols, emoji, etc. These are automatically excluded from the analysis.

If site requirements are for multiple languages concurrently, a $customRange can be set to include the requirements of both languages.

Ranges are in regular expression format as used in preg_replace()

If the language filter detects a mismatch, the post is denied. If the mismatch is more that double (2 times) the configured threshold, the account is deactivated.

Methods
Methods inherited from ProtectorFilterAbstract
__construct(), isMobile()
Properties
Properties inherited from ProtectorFilterAbstract
$protector