function oauth2_server_init in OAuth2 Server 7
Implements hook_init().
Nags the user about the missing library on OAuth2 admin pages.
File
- ./
oauth2_server.module, line 13 - Provides OAuth2 server functionality.
Code
function oauth2_server_init() {
$item = menu_get_item();
if ($item['access'] && strpos($item['path'], 'admin/structure/oauth2-servers') === 0) {
$path = oauth2_server_get_library_path();
// Check for the existence of one file from the library.
if (!$path || !file_exists($path . '/src/OAuth2/Server.php')) {
$message = t('The OAuth2 server library is required for the OAuth2 module to function.
Download the library from <a href="https://github.com/bshaffer/oauth2-server-php" target="_blank">GitHub</a> and place it in <em>!path</em>.', array(
'!path' => $path,
));
drupal_set_message($message, 'error');
}
}
}