function alchemy_include_alchemy_class in Alchemy 7
Same name and namespace in other branches
- 6 alchemy.module \alchemy_include_alchemy_class()
Includes the Alchemy API Class, checking first to see if it exists.
2 calls to alchemy_include_alchemy_class()
- alchemy_contentanalysis_analyzer in modules/
alchemy_contentanalysis/ alchemy_contentanalysis.module - Implements hook_analyzer() via custom define callback().
- alchemy_new_alchemy_obj in ./
alchemy.module - @todo Please document this function.
File
- ./
alchemy.module, line 183 - $Id: alchemy.module,v 1.1.2.3 2010/11/17 21:17:48 tomdude48 Exp $
Code
function alchemy_include_alchemy_class() {
// Check if another module has not already included the AlchemyAPI class.
$ver = '';
if (variable_get('alchemy_usecurl', 0)) {
$ver = '_CURL';
}
if (class_exists('AlchemyAPI')) {
return TRUE;
}
$files[] = './' . drupal_get_path('module', 'alchemy') . '/AlchemyAPI/module/AlchemyAPI' . $ver . '.php';
if (module_exists('libraries') && ($p = libraries_get_path('AlchemyAPI'))) {
$files[] = './' . $p . '/module/AlchemyAPI' . $ver . '.php';
}
foreach ($files as $f) {
if (file_exists($f)) {
$file = $f;
break;
}
}
if (!$file) {
$msg = t('The Alchemy module requires the Alchemy SDK. Use the PHP version of the SDK.');
$msg .= ' ' . l(t('Download the SDK here.'), 'http://www.alchemyapi.com/developers/sdks/', array(
'attributes' => array(
'target' => 'alchemy',
),
));
$msg .= "<br /><br />";
$msg .= t('Download the files and place them in a folder named "AlchemyAPI" under the alchemy module directory.');
if ($analysis) {
$analysis['messages'][] = contentanalysis_format_message($msg, 'error');
}
else {
drupal_set_message($msg, 'error');
}
return FALSE;
}
require_once DRUPAL_ROOT . '/' . $file;
return TRUE;
}