You are here

function getid3_load in getID3() 5

Same name and namespace in other branches
  1. 8 getid3.module \getid3_load()
  2. 6 getid3.module \getid3_load()
  3. 7.2 getid3.module \getid3_load()
  4. 7 getid3.module \getid3_load()

Loads the getID3 library once and returns whether it was successfully loaded.

Return value

Boolean indicating if the library was loaded

4 calls to getid3_load()
getid3_enable in ./getid3.install
Implementation of hook_enable()
getid3_get_version in ./getid3.module
Returns the version number of getID3() that's installed.
getid3_instance in ./getid3.module
Create and initialize an instance of getID3 class.
getid3_requirements in ./getid3.module
Implementation of hook_requirements()

File

./getid3.module, line 38

Code

function getid3_load($display_warning = TRUE) {
  $getid3_path = getid3_get_path();
  if (file_exists($getid3_path . '/getid3.php') && file_exists($getid3_path . '/write.php')) {

    // A little workaround for getID3 on Windows.
    if (!defined('GETID3_HELPERAPPSDIR')) {
      define('GETID3_HELPERAPPSDIR', realpath($getid3_path . '/../helperapps') . '/');
    }
    include_once $getid3_path . '/getid3.php';

    // Initialize getID3 tag-writing module. NOTE: Their wanky dependency setup
    // requires that this file must be included AFTER an instance of the getID3
    // class has been instantiated.
    $getid3 = new getID3();
    require_once $getid3_path . '/write.php';
    return defined('GETID3_VERSION');
  }
  else {
    drupal_set_message(t("The getID3() module cannot find the getID3 library used to read and write ID3 tags. The site administrator will need to verify that it is installed and then update the <a href='!admin-settings-audio-getid3'>settings</a>.", array(
      '!admin-settings-audio-getid3' => url('admin/settings/getid3'),
    )), 'error', FALSE);
    return FALSE;
  }
}