Added check for IntlChar module
This commit is contained in:
parent
f4591b2cc7
commit
a6bbbd738f
|
@ -28,9 +28,9 @@ Due to the large variety of operating systems and PHP platforms in existence we
|
|||
### Requirements
|
||||
|
||||
* Apache with mod-rewrite enabled and "Options All" so you can use a local `.htaccess` file
|
||||
* PHP 7.3+ (PHP8 is not fully supported yet)
|
||||
* PHP 7.3+
|
||||
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
||||
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip and OpenSSL extensions
|
||||
* Curl, GD, GMP, PDO, mbstrings, MySQLi, hash, xml, zip, IntlChar and OpenSSL extensions
|
||||
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
||||
* Some form of email server or email gateway such that PHP mail() works.
|
||||
If you cannot set up your own email server, you can use the [phpmailer](https://github.com/friendica/friendica-addons/tree/develop/phpmailer) addon and use a remote SMTP server.
|
||||
|
|
|
@ -384,13 +384,11 @@ class Installer
|
|||
|
||||
$help = '';
|
||||
$status = true;
|
||||
if (function_exists('apache_get_modules')) {
|
||||
if (!in_array('mod_rewrite', apache_get_modules())) {
|
||||
if (function_exists('apache_get_modules') && !in_array('mod_rewrite', apache_get_modules())) {
|
||||
$help = DI::l10n()->t('Error: Apache webserver mod-rewrite module is required but not installed.');
|
||||
$status = false;
|
||||
$returnVal = false;
|
||||
}
|
||||
}
|
||||
$this->addCheck(DI::l10n()->t('Apache mod_rewrite module'), $status, true, $help);
|
||||
|
||||
$help = '';
|
||||
|
@ -399,15 +397,22 @@ class Installer
|
|||
$status = false;
|
||||
$help = DI::l10n()->t('Error: PDO or MySQLi PHP module required but not installed.');
|
||||
$returnVal = false;
|
||||
} else {
|
||||
if (!function_exists('mysqli_connect') && class_exists('pdo') && !in_array('mysql', \PDO::getAvailableDrivers())) {
|
||||
} elseif (!function_exists('mysqli_connect') && class_exists('pdo') && !in_array('mysql', \PDO::getAvailableDrivers())) {
|
||||
$status = false;
|
||||
$help = DI::l10n()->t('Error: The MySQL driver for PDO is not installed.');
|
||||
$returnVal = false;
|
||||
}
|
||||
}
|
||||
$this->addCheck(DI::l10n()->t('PDO or MySQLi PHP module'), $status, true, $help);
|
||||
|
||||
$help = '';
|
||||
$status = true;
|
||||
if (!class_exists('IntlChar')) {
|
||||
$status = false;
|
||||
$help = DI::l10n()->t('Error: The IntlChar module is not installed.');
|
||||
$returnVal = false;
|
||||
}
|
||||
$this->addCheck(DI::l10n()->t('IntlChar PHP module'), $status, true, $help);
|
||||
|
||||
// check for XML DOM Documents being able to be generated
|
||||
$help = '';
|
||||
$status = true;
|
||||
|
|
|
@ -49,7 +49,6 @@ use Friendica\Util\Proxy;
|
|||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use IntlChar;
|
||||
use LanguageDetection\Language;
|
||||
|
||||
class Item
|
||||
|
@ -2064,6 +2063,10 @@ class Item
|
|||
*/
|
||||
private static function splitByBlocks(string $body): array
|
||||
{
|
||||
if (class_exists('IntlChar')) {
|
||||
return [$body];
|
||||
}
|
||||
|
||||
$blocks = [];
|
||||
$previous_block = 0;
|
||||
|
||||
|
@ -2072,12 +2075,12 @@ class Item
|
|||
$previous = ($i > 0) ? mb_substr($body, $i - 1, 1) : '';
|
||||
$next = ($i < mb_strlen($body)) ? mb_substr($body, $i + 1, 1) : '';
|
||||
|
||||
if (!IntlChar::isalpha($character)) {
|
||||
if (($previous != '') && (IntlChar::isalpha($previous))) {
|
||||
if (!\IntlChar::isalpha($character)) {
|
||||
if (($previous != '') && (\IntlChar::isalpha($previous))) {
|
||||
$previous_block = self::getBlockCode($previous);
|
||||
}
|
||||
|
||||
$block = (($next != '') && IntlChar::isalpha($next)) ? self::getBlockCode($next) : $previous_block;
|
||||
$block = (($next != '') && \IntlChar::isalpha($next)) ? self::getBlockCode($next) : $previous_block;
|
||||
$blocks[$block] = ($blocks[$block] ?? '') . $character;
|
||||
} else {
|
||||
$block = self::getBlockCode($character);
|
||||
|
@ -2103,7 +2106,7 @@ class Item
|
|||
*/
|
||||
private static function getBlockCode(string $character): int
|
||||
{
|
||||
if (!IntlChar::isalpha($character)) {
|
||||
if (!\IntlChar::isalpha($character)) {
|
||||
return 0;
|
||||
}
|
||||
return self::isLatin($character) ? 1 : 2;
|
||||
|
@ -2117,11 +2120,11 @@ class Item
|
|||
*/
|
||||
private static function isLatin(string $character): bool
|
||||
{
|
||||
return in_array(IntlChar::getBlockCode($character), [
|
||||
IntlChar::BLOCK_CODE_BASIC_LATIN, IntlChar::BLOCK_CODE_LATIN_1_SUPPLEMENT,
|
||||
IntlChar::BLOCK_CODE_LATIN_EXTENDED_A, IntlChar::BLOCK_CODE_LATIN_EXTENDED_B,
|
||||
IntlChar::BLOCK_CODE_LATIN_EXTENDED_C, IntlChar::BLOCK_CODE_LATIN_EXTENDED_D,
|
||||
IntlChar::BLOCK_CODE_LATIN_EXTENDED_E, IntlChar::BLOCK_CODE_LATIN_EXTENDED_ADDITIONAL
|
||||
return in_array(\IntlChar::getBlockCode($character), [
|
||||
\IntlChar::BLOCK_CODE_BASIC_LATIN, \IntlChar::BLOCK_CODE_LATIN_1_SUPPLEMENT,
|
||||
\IntlChar::BLOCK_CODE_LATIN_EXTENDED_A, \IntlChar::BLOCK_CODE_LATIN_EXTENDED_B,
|
||||
\IntlChar::BLOCK_CODE_LATIN_EXTENDED_C, \IntlChar::BLOCK_CODE_LATIN_EXTENDED_D,
|
||||
\IntlChar::BLOCK_CODE_LATIN_EXTENDED_E, \IntlChar::BLOCK_CODE_LATIN_EXTENDED_ADDITIONAL
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user