You are here

function getid3_load in getID3() 7

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

Load the getID3 library.

Return value

Boolean indicating if the library was successfully loaded.

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

File

./getid3.module, line 55

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 method_exists($getid3, 'version') || defined('GETID3_VERSION');
  }
  elseif ($display_warning) {
    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/config/media/getid3'),
    )), 'error', FALSE);
  }
  return FALSE;
}