Created
November 5, 2012 16:15
-
-
Save donquixote/4018045 to your computer and use it in GitHub Desktop.
Revisions
-
donquixote revised this gist
Nov 5, 2012 . 1 changed file with 20 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ <?php /** * Implements hook_libraries_info() */ function taleo_libraries_info() { return array( 'Taleo' => array( @@ -9,16 +12,31 @@ function taleo_libraries_info() { ); } /** * xautoload callback for Taleo library. * * Notes: * - We can't name this taleo_xautoload(), because this would * be a recognized as a hook implementation of hook_xautoload(). * - We could make this an anonymous function directly in * hook_libraries_info(). */ function _taleo_xautoload($api) { // $api already knows the library, so all paths are relative, // and we specify them *without preceding slash*. $api->namespaceRoot('Guzzle', 'vendor/guzzle/guzzle/src'); $api->namespaceRoot('Monolog\Handler\StreamHandler', 'vendor/monolog/monolog/src'); $api->namespaceRoot('Monolog\Logger', 'vendor/monolog/monolog/src'); // We want the class Taleo\Main\Taleo, which is NOT in the // namespace Taleo\Main\Taleo\. Therefore the following does not work: // $api->namespaceRoot('Taleo\Main\Taleo', 'src'); // Instead, we register the parent namespace: $api->namespaceRoot('Taleo\Main', 'src'); } /** * Helper function to get all jobs from the Taleo database. * (as an example where the Taleo classes are used) */ function _taleo_getjobs() { $orgCode = variable_get('taleo_company_code', ''); @@ -29,6 +47,3 @@ function _taleo_getjobs() { $taleo->login(); } -
donquixote revised this gist
Nov 5, 2012 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,16 +4,16 @@ function taleo_libraries_info() { return array( 'Taleo' => array( 'name' => 'Taleo PHP Library', 'xautoload' => '_taleo_xautoload', ), ); } function _taleo_xautoload($api) { $api->namespaceRoot('Guzzle', 'vendor/guzzle/guzzle/src'); $api->namespaceRoot('Monolog\Handler\StreamHandler', 'vendor/monolog/monolog/src'); $api->namespaceRoot('Monolog\Logger', 'vendor/monolog/monolog/src'); $api->namespaceRoot('Taleo\Main\Taleo', 'src'); } -
drupol revised this gist
Nov 5, 2012 . 1 changed file with 22 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,10 +8,27 @@ function taleo_libraries_info() { ), ); } function taleo_xautoload($api) { $api->namespaceRoot('Guzzle', '/vendor/guzzle/guzzle/src'); $api->namespaceRoot('Monolog\Handler\StreamHandler', '/vendor/monolog/monolog/src'); $api->namespaceRoot('Monolog\Logger', '/vendor/monolog/monolog/src'); $api->namespaceRoot('Taleo\Main\Taleo', '/src'); } /** * Helper function to get all jobs from the Taleo database. */ function _taleo_getjobs() { $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(); } // This returns an error: // Fatal error: Class 'Taleo\Main\Taleo' not found in // C:\cygwin\home\DELLAIEP\www\jobs.localhost\sites\all\modules\custom\taleo\taleo.module on line 461. -
drupol created this gist
Nov 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ <?php function taleo_libraries_info() { return array( 'Taleo' => array( 'name' => 'Taleo PHP Library', 'xautoload' => 'taleo_xautoload', ), ); } function taleo_xautoload($api) { $path = libraries_get_path('Taleo', TRUE); $api->namespaceRoot('Guzzle', $path . '/vendor/guzzle/guzzle/src'); $api->namespaceRoot('Monolog\Handler\StreamHandler', $path . '/vendor/monolog/monolog/src'); $api->namespaceRoot('Monolog\Logger', $path . '/vendor/monolog/monolog/src'); $api->namespaceRoot('Taleo\Main\Taleo', $path . '/src'); }