You are here

function brightcove_mapi_path in Brightcove Video Connect 6

Same name and namespace in other branches
  1. 6.2 brightcove.module \brightcove_mapi_path()
  2. 7.2 brightcove.module \brightcove_mapi_path()
  3. 7.3 brightcove.module \brightcove_mapi_path()
  4. 7.4 brightcove.module \brightcove_mapi_path()
  5. 7.5 brightcove.module \brightcove_mapi_path()

Return the path to the Brightcove MAPI library.

If brightcove_variable_get('brightcove_mapi_path') has not yet been set, then this will attempt to autodiscover the path if the bc-mapi.php file exists within sites/all/libraries/* or sites/example.com/libraries/*. It will also set the path to media_brightcove_variable_get('brightcove_mapi_path').

The library is available from http://opensource.brightcove.com/project/PHP-MAPI-Wrapper/.

Parameters

boolean $reset: (Optional) If TRUE, then reset the variable and attempt a new autodiscovery.

Return value

string The path to the bc-mapi.php file.

1 call to brightcove_mapi_path()
brightcove_autoload in ./brightcove.module
Autoload the BCMAPI class when needed.
1 string reference to 'brightcove_mapi_path'
brightcove_requirements in ./brightcove.install
Implementation of hook_requirements().

File

./brightcove.module, line 82
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_mapi_path($reset = FALSE) {
  static $path;
  if (!isset($path) || $reset) {
    if (!($path = variable_get('brightcove_mapi_path', FALSE)) || $reset) {
      $files = drupal_system_listing('^bc-mapi.php$', 'libraries', 'basename', 0);
      if (isset($files['bc-mapi.php'])) {
        $path = dirname($files['bc-mapi.php']->filename);
        variable_set('brightcove_mapi_path', $path);
      }
    }
  }
  return $path;
}