Skip to content

Instantly share code, notes, and snippets.

@donquixote
Created November 5, 2012 18:43
Show Gist options
  • Save donquixote/4019518 to your computer and use it in GitHub Desktop.
Save donquixote/4019518 to your computer and use it in GitHub Desktop.
<?php
function taleo_libraries_info() {
return array(
'Taleo' => array(
'name' => 'Taleo PHP Library',
'xautoload' => '_taleo_xautoload',
),
);
}
function _taleo_xautoload($api) {
// Load Guzzle
$api->namespaceRoot('Guzzle\Http', 'vendor/guzzle/guzzle/src');
$api->namespaceRoot('Guzzle\Http\Curl', 'vendor/guzzle/guzzle/src');
$api->namespaceRoot('Guzzle\Service', 'vendor/guzzle/guzzle/src');
$api->namespaceRoot('Guzzle\Common', 'vendor/guzzle/guzzle/src');
$api->namespaceRoot('Guzzle\Parser', 'vendor/guzzle/guzzle/src');
// Load Symfony Event Dispatcher
$api->namespaceRoot('Symfony\Component\EventDispatcher', 'vendor/symfony/event-dispatcher');
// Load Monolog
$api->namespaceRoot('Monolog', 'vendor/monolog/monolog/src');
// Load Taleo
$api->namespaceRoot('Taleo\Main', 'src');
}
/**
* Helper function to get all jobs from the Taleo database.
*/
function _taleo_getjobs() {
// Load required procedural code.
_taleo_init();
//libraries_get_path('Taleo');
// returns 'sites/all/libraries/Taleo' (which is good)
$orgCode = variable_get('taleo_company_code', '');
$user = variable_get('taleo_username', '');
$password = variable_get('taleo_password', '');
$taleo = new \Taleo\Main\Taleo($user, $password, $orgCode);
$taleo->login();
}
/**
* Function name should not nameclash with hook_init()
*/
function _taleo_init() {
$path = libraries_get_path('Taleo');
// Include some procedural code.
require_once $path . '/vendor/guzzle/guzzle/src/...';
}
// This returns an error:
// Fatal error: Call to undefined function Guzzle\Http\Curl\curl_version()
// in C:\cygwin\home\DELLAIEP\www\jobs.localhost\sites\all\libraries\Taleo\vendor\guzzle\guzzle\src\Guzzle\Http\Curl\CurlVersion.php on line 47
@drupol
Copy link

drupol commented Nov 5, 2012

I see ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment