public function LingotekApi::testAuthentication in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::testAuthentication()
- 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::testAuthentication()
- 7.3 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::testAuthentication()
- 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::testAuthentication()
- 7.6 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::testAuthentication()
Tests the current configuration to ensure that API calls can be made.
Return value
bool TRUE if the configuration is correct, FALSE otherwise.
File
- lib/
Drupal/ lingotek/ LingotekApi.php, line 818 - Defines Drupal\lingotek\LingotekApi
Class
- LingotekApi
- @file Defines Drupal\lingotek\LingotekApi
Code
public function testAuthentication($force = FALSE) {
$valid_connection =& drupal_static(__FUNCTION__);
if ($force || !isset($valid_connection)) {
// Only test the connection if the oauth keys have been setup.
$consumer_key = variable_get('lingotek_oauth_consumer_id', '');
$consumer_secret = variable_get('lingotek_oauth_consumer_secret', '');
if (!empty($consumer_key) && !empty($consumer_secret)) {
$valid_connection = $this
->request('validateApiKeys') ? TRUE : FALSE;
}
else {
$valid_connection = FALSE;
}
}
return $valid_connection;
}