You are here

function jalalidate_verify_requirements in PersianTools 7

This function checks dependencies for using PHP's internal jalalidate. If these dependencies are not met, then the 'Date.php' file included with this module is used for converting dates to jalali calendar. This function is called when 'Run test' is clicked in the module's settings page.

1 call to jalalidate_verify_requirements()
jalalidate_nodes_install in jalalidate_nodes/jalalidate_nodes.install
Implements hook_install().
1 string reference to 'jalalidate_verify_requirements'
jalalidate_nodes_admin_settings in jalalidate_nodes/jalalidate_nodes.admin.inc
Form builder. Configure Jalali Date settings.

File

includes/jalalidate_lib.inc, line 76

Code

function jalalidate_verify_requirements() {
  $php_allowed_version = 50300;
  $intl_allowed_version = 10000;
  $satisfied = 1;

  //Get current PHP version
  $php_id = phpversion();
  $php_version = jalalidate_str2num($php_id);

  //Get current PECL intl version
  $intl_id = phpversion('intl');
  $intl_version = jalalidate_str2num($intl_id);
  if ($php_version <= $php_allowed_version) {
    $satisfied = 0;
    drupal_set_message(t('Current PHP version is less than 5.3.0'), 'warnings');
  }
  if ($intl_version <= $intl_allowed_version) {
    $satisfied = 0;
    drupal_set_message(t('Current PECL intl version is less than 1.0.0'), 'warnings');
  }
  if ($satisfied) {
    drupal_set_message(t('All dependencies are satisfied. Jalali Date will use the internal PHP date (Intl).'), 'status');
  }
  else {
    drupal_set_message(t('The internal PHP date will not be used.'), 'warnings');
  }
}