You are here

function sms_valid_sms_validate in SMS Framework 6

Same name and namespace in other branches
  1. 6.2 modules/sms_valid/sms_valid.module \sms_valid_sms_validate()

Implement hook_sms_validate()

Parameters

$op: Validation operation to work on.

$number: Phone number string.

$options: Array of options.

Return value

NULL if validation succeeded. Error string if failed.

File

modules/sms_valid/sms_valid.module, line 26
Number validation feature module for Drupal SMS Framework.

Code

function sms_valid_sms_validate($op, &$number, &$options) {
  if ($op == 'process') {
    if (variable_get('sms_valid_use_rulesets', FALSE) || array_key_exists('test', $options)) {
      $result = sms_valid_validate($number, $options);
      if ($result['pass']) {
        return NULL;
      }
      else {
        return array_pop($result['log']);
      }
    }
  }
}