You are here

function shrinktheweb_getAccXMLResponse in ShrinkTheWeb 6

Same name and namespace in other branches
  1. 8 shrinktheweb.api.inc \shrinktheweb_getAccXMLResponse()
  2. 7 shrinktheweb.api.inc \shrinktheweb_getAccXMLResponse()

store the Account XML response in an array

1 call to shrinktheweb_getAccXMLResponse()
shrinktheweb_getAccountInfo in ./shrinktheweb.api.inc
Get Account Info and return it as array

File

./shrinktheweb.api.inc, line 650

Code

function shrinktheweb_getAccXMLResponse($sResponse) {
  if (extension_loaded('simplexml')) {

    // If simplexml is available, we can do more stuff!
    $oDOM = new DOMDocument();
    $oDOM
      ->loadXML($sResponse);
    $sXML = simplexml_import_dom($oDOM);
    $sXMLLayout = 'http://www.shrinktheweb.com/doc/stwacctresponse.xsd';

    // Pull response codes from XML feed
    $aResponse['stw_response_status'] = $sXML
      ->children($sXMLLayout)->Response->Status->StatusCode;

    // Response Code
    $aResponse['stw_account_level'] = $sXML
      ->children($sXMLLayout)->Response->Account_Level->StatusCode;

    // Account level
    // check for enabled upgrades
    $aResponse['stw_inside_pages'] = $sXML
      ->children($sXMLLayout)->Response->Inside_Pages->StatusCode;

    // Inside Pages
    $aResponse['stw_custom_size'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Size->StatusCode;

    // Custom Size
    $aResponse['stw_full_length'] = $sXML
      ->children($sXMLLayout)->Response->Full_Length->StatusCode;

    // Full Length
    $aResponse['stw_refresh_ondemand'] = $sXML
      ->children($sXMLLayout)->Response->Refresh_OnDemand->StatusCode;

    // Refresh OnDemand
    $aResponse['stw_custom_delay'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Delay->StatusCode;

    // Custom Delay
    $aResponse['stw_custom_quality'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Quality->StatusCode;

    // Custom Quality
    $aResponse['stw_custom_resolution'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Resolution->StatusCode;

    // Custom Resolution
    $aResponse['stw_custom_messages'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Messages->StatusCode;

    // Custom Messages
  }
  else {

    // LEGACY SUPPPORT
    $aResponse['stw_response_status'] = shrinktheweb_getLegacyResponse('Status', $sRemoteData);
    $aResponse['stw_account_level'] = shrinktheweb_getLegacyResponse('Account_Level', $sRemoteData);

    // Account level
    // check for enabled upgrades
    $aResponse['stw_inside_pages'] = shrinktheweb_getLegacyResponse('Inside_Pages', $sRemoteData);

    // Inside Pages
    $aResponse['stw_custom_size'] = shrinktheweb_getLegacyResponse('Custom_Size', $sRemoteData);

    // Custom Size
    $aResponse['stw_full_length'] = shrinktheweb_getLegacyResponse('Full_Length', $sRemoteData);

    // Full Length
    $aResponse['stw_refresh_ondemand'] = shrinktheweb_getLegacyResponse('Refresh_OnDemand', $sRemoteData);

    // Refresh OnDemand
    $aResponse['stw_custom_delay'] = shrinktheweb_getLegacyResponse('Custom_Delay', $sRemoteData);

    // Custom Delay
    $aResponse['stw_custom_quality'] = shrinktheweb_getLegacyResponse('Custom_Quality', $sRemoteData);

    // Custom Quality
    $aResponse['stw_custom_resolution'] = shrinktheweb_getLegacyResponse('Custom_Resolution', $sRemoteData);

    // Custom Resolution
    $aResponse['stw_custom_messages'] = shrinktheweb_getLegacyResponse('Custom_Messages', $sRemoteData);

    // Custom Messages
  }
  return $aResponse;
}