function salesforce_api_locate_toolkit in Salesforce Suite 7.2
Locates the Salesforce PHP Toolkit, if installed.
Return value
string $toolkit_path The path to the Salesforce Toolkit, or an empty string if not found.
1 call to salesforce_api_locate_toolkit()
- salesforce_api.module in salesforce_api/
salesforce_api.module - Defines an API that enables modules to interact with the Salesforce server.
File
- salesforce_api/
salesforce_api.module, line 70 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_locate_toolkit() {
$toolkit_path = variable_get('salesforce_api_toolkit_path', '');
// If the toolkit path is not set or is no longer valid, try to find it.
if ($toolkit_path == '' || !file_exists($toolkit_path . '/soapclient/SforceEnterpriseClient.php')) {
$profile = drupal_get_profile();
$config = conf_path();
// Use Libraries if it is available
if (function_exists('libraries_get_path')) {
$toolkit_path = libraries_get_path('salesforce') . '/toolkit';
}
else {
if (file_exists("profiles/{$profile}/libraries/salesforce/toolkit")) {
$toolkit_path = "profiles/{$profile}/libraries/salesforce/toolkit";
}
else {
if (file_exists("sites/all/libraries/salesforce/toolkit")) {
$toolkit_path = "sites/all/libraries/salesforce/toolkit";
}
else {
if (file_exists("{$config}/libraries/salesforce/toolkit")) {
$toolkit_path = "{$config}/libraries/salesforce/toolkit";
}
else {
$toolkit_path = "";
}
}
}
}
variable_set('salesforce_api_toolkit_path', $toolkit_path);
}
return $toolkit_path;
}