### 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.
$help = '';
$status = true;
- if (function_exists('apache_get_modules')) {
- if (!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;
- }
+ 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);
$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())) {
- $status = false;
- $help = DI::l10n()->t('Error: The MySQL driver for PDO is not installed.');
- $returnVal = false;
- }
+ } 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;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
use GuzzleHttp\Psr7\Uri;
-use IntlChar;
use LanguageDetection\Language;
class Item
*/
private static function splitByBlocks(string $body): array
{
+ if (class_exists('IntlChar')) {
+ return [$body];
+ }
+
$blocks = [];
$previous_block = 0;
$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);
*/
private static function getBlockCode(string $character): int
{
- if (!IntlChar::isalpha($character)) {
+ if (!\IntlChar::isalpha($character)) {
return 0;
}
return self::isLatin($character) ? 1 : 2;
*/
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
]);
}