You are here

function shrinktheweb_getAccXMLResponse in ShrinkTheWeb 8

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

Store the Account XML response in an array.

Parameters

$sResponse:

Return value

mixed

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

File

./shrinktheweb.api.inc, line 887

Code

function shrinktheweb_getAccXMLResponse($sResponse) {

  // If simplexml is available, we can do more stuff!
  if (extension_loaded('simplexml')) {
    $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;

    // Check for enabled upgrades.
    // Inside Pages.
    $aResponse['stw_inside_pages'] = $sXML
      ->children($sXMLLayout)->Response->Inside_Pages->StatusCode;

    // Custom Size.
    $aResponse['stw_custom_size'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Size->StatusCode;

    // Full Length.
    $aResponse['stw_full_length'] = $sXML
      ->children($sXMLLayout)->Response->Full_Length->StatusCode;

    // Refresh OnDemand.
    $aResponse['stw_refresh_ondemand'] = $sXML
      ->children($sXMLLayout)->Response->Refresh_OnDemand->StatusCode;

    // Custom Delay.
    $aResponse['stw_custom_delay'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Delay->StatusCode;

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

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

    // Custom Messages.
    $aResponse['stw_custom_messages'] = $sXML
      ->children($sXMLLayout)->Response->Custom_Messages->StatusCode;
  }
  else {

    // LEGACY SUPPORT.
    $aResponse['stw_response_status'] = shrinktheweb_getLegacyResponse('Status', $sResponse);

    // Account level
    $aResponse['stw_account_level'] = shrinktheweb_getLegacyResponse('Account_Level', $sResponse);

    // Check for enabled upgrades.
    // Inside Pages.
    $aResponse['stw_inside_pages'] = shrinktheweb_getLegacyResponse('Inside_Pages', $sResponse);

    // Custom Size.
    $aResponse['stw_custom_size'] = shrinktheweb_getLegacyResponse('Custom_Size', $sResponse);

    // Full Length.
    $aResponse['stw_full_length'] = shrinktheweb_getLegacyResponse('Full_Length', $sResponse);

    // Refresh OnDemand.
    $aResponse['stw_refresh_ondemand'] = shrinktheweb_getLegacyResponse('Refresh_OnDemand', $sResponse);

    // Custom Delay.
    $aResponse['stw_custom_delay'] = shrinktheweb_getLegacyResponse('Custom_Delay', $sResponse);

    // Custom Quality.
    $aResponse['stw_custom_quality'] = shrinktheweb_getLegacyResponse('Custom_Quality', $sResponse);

    // Custom Resolution.
    $aResponse['stw_custom_resolution'] = shrinktheweb_getLegacyResponse('Custom_Resolution', $sResponse);

    // Custom Messages.
    $aResponse['stw_custom_messages'] = shrinktheweb_getLegacyResponse('Custom_Messages', $sResponse);
  }
  return $aResponse;
}