/[drupal]/contributions/modules/votesmart/votesmart.api.inc
ViewVC logotype

Diff of /contributions/modules/votesmart/votesmart.api.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2, Sun Aug 10 01:42:51 2008 UTC revision 1.3, Sun Aug 17 15:36:33 2008 UTC
# Line 1  Line 1 
1  <?php // $Id: votesmart.api.inc,v 1.1 2008/08/06 00:27:37 vauxia Exp $  <?php // $Id: votesmart.api.inc,v 1.2 2008/08/10 01:42:51 vauxia Exp $
2    
3  function _votesmart_api($request, $args = array(), $item = null) {  function _votesmart_api($request, $args = array(), $item = null) {
4    $key = variable_get('votesmart_key', '');    $key = variable_get('votesmart_key', '');
# Line 16  function _votesmart_api($request, $args Line 16  function _votesmart_api($request, $args
16    $ret = (array) new SimpleXMLElement($res->data, LIBXML_NOCDATA);    $ret = (array) new SimpleXMLElement($res->data, LIBXML_NOCDATA);
17    
18    // TODO check $ret['errorMessage']    // TODO check $ret['errorMessage']
19      if (isset($ret['errorMessage'])) {
20        drupal_set_message(t('Vote Smart API error: %err', array('%err' => $ret['errorMessage'])), 'error');
21      }
22    
23    // Return specified element (e.g. 'details', 'list', etc.);    // Return specified element (e.g. 'details', 'list', etc.);
24    if ($item) return $ret[$item];    if ($item) {
25        foreach (explode('.', $item) as $key) {
26          $ret = (array) $ret[$key];
27        }
28      }
29    
30    // Nothing specified, return the entire object.    // Nothing specified, return the entire object.
31    return $ret;    return $ret;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2