function brightcove_initialize in Brightcove Video Connect 7.2
Same name and namespace in other branches
- 6.2 brightcove.module \brightcove_initialize()
- 7.3 brightcove.module \brightcove_initialize()
- 7.4 brightcove.module \brightcove_initialize()
- 7.5 brightcove.module \brightcove_initialize()
Initializes the Brightcove Media API and returns an instance of the object.
Parameters
string $read_token: An optional read token instead of the stored one.
string $write_token: An optional write token instead of the stored one.
Return value
BCMAPI Instance of the Brightcove Media API or FALSE if fails to initialize.
11 calls to brightcove_initialize()
- brightcove_field_autocomplete in brightcove_field/
brightcove_field.browse.inc - Menu callback for brightcove_field/autocomplete.
- brightcove_field_browse in brightcove_field/
brightcove_field.browse.inc - This function is a callback for modalframe window, providing an access to browse videos.
- brightcove_field_browser_validate in brightcove_field/
brightcove_field.module - Validate callback for the field.
- brightcove_field_refresh_video_entity_link in brightcove_field/
brightcove_field.module - Updates the video entity link on a video.
- brightcove_media_list in brightcove_media/
brightcove_media.module
File
- ./
brightcove.module, line 159 - Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.
Code
function brightcove_initialize($read_token = NULL, $write_token = NULL) {
if (empty($read_token)) {
$read_token = variable_get('brightcove_read_api_key', '');
}
if (empty($write_token)) {
$write_token = variable_get('brightcove_write_api_key', '');
}
if (empty($read_token)) {
drupal_set_message(t('Cannot initialize Brightcove API. Contact site administrators.'), 'error');
watchdog('brightcove', 'Brightcove Read API keys not found, cannot initialize Brightcove MAPI SDK.', array(), WATCHDOG_ERROR);
return FALSE;
}
include_once brightcove_mapi_path() . '/bc-mapi.php';
$bc = new BCMAPI($read_token, $write_token);
return $bc;
}