You are here

public static function Messaging_Destination::validate_method in Messaging 7

Same name and namespace in other branches
  1. 6.4 includes/messaging_destination.class.inc \Messaging_Destination::validate_method()

Validate values to create a destination

Parameters

$method: Send method

$address: Address value

$account: Optional user id or account object the destination is intended for

1 call to Messaging_Destination::validate_method()
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Exercise basic API functions

File

./messaging.destination.inc, line 179
Drupal Messaging Framework - Default class file

Class

Messaging_Destination
Message destination class

Code

public static function validate_method($method, $address, $account = NULL) {

  // First validate address and check permission
  $send_method = messaging_send_method($method);
  if (!$send_method || !$send_method
    ->address_validate($address)) {
    return FALSE;
  }
  if (isset($account)) {
    $account = messaging_user_object($account);
    if (!$account || !$send_method
      ->user_access($account)) {
      return FALSE;
    }
  }
  if ($type = messaging_method_info($method, 'address_type')) {
    return self::validate_type($type, $address, $account);
  }
}