You are here

function unicode_requirements in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/unicode.inc \unicode_requirements()

Returns Unicode library status and errors.

1 call to unicode_requirements()
system_requirements in core/modules/system/system.install
Implements hook_requirements().

File

core/includes/unicode.inc, line 13
Provides Unicode-related conversions and operations.

Code

function unicode_requirements() {
  $libraries = array(
    Unicode::STATUS_SINGLEBYTE => t('Standard PHP'),
    Unicode::STATUS_MULTIBYTE => t('PHP Mbstring Extension'),
    Unicode::STATUS_ERROR => t('Error'),
  );
  $severities = array(
    Unicode::STATUS_SINGLEBYTE => REQUIREMENT_WARNING,
    Unicode::STATUS_MULTIBYTE => NULL,
    Unicode::STATUS_ERROR => REQUIREMENT_ERROR,
  );
  $failed_check = Unicode::check();
  $library = Unicode::getStatus();
  $requirements['unicode'] = array(
    'title' => t('Unicode library'),
    'value' => $libraries[$library],
    'severity' => $severities[$library],
  );
  $t_args = array(
    ':url' => 'http://www.php.net/mbstring',
  );
  switch ($failed_check) {
    case 'mb_strlen':
      $requirements['unicode']['description'] = t('Operations on Unicode strings are emulated on a best-effort basis. Install the <a href=":url">PHP mbstring extension</a> for improved Unicode support.', $t_args);
      break;
    case 'mbstring.func_overload':
      $requirements['unicode']['description'] = t('Multibyte string function overloading in PHP is active and must be disabled. Check the php.ini <em>mbstring.func_overload</em> setting. Please refer to the <a href=":url">PHP mbstring documentation</a> for more information.', $t_args);
      break;
    case 'mbstring.encoding_translation':
      $requirements['unicode']['description'] = t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.encoding_translation</em> setting. Please refer to the <a href=":url">PHP mbstring documentation</a> for more information.', $t_args);
      break;
    case 'mbstring.http_input':
      $requirements['unicode']['description'] = t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_input</em> setting. Please refer to the <a href=":url">PHP mbstring documentation</a> for more information.', $t_args);
      break;
    case 'mbstring.http_output':
      $requirements['unicode']['description'] = t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_output</em> setting. Please refer to the <a href=":url">PHP mbstring documentation</a> for more information.', $t_args);
      break;
  }
  return $requirements;
}