/**
  * Extracts the data from the raw XML into a useful Array that the plugin can use to
  * check which features are enabled or disabled.
  * 
  * @param String $rawXML The raw XML from STW
  * @return Array The account details as an array.
  */
 private function extractAccountDetails($rawXML)
 {
     $accountDetails = array();
     $raw_Status = false;
     $raw_AccountLevel = false;
     // Use SimpleXML if we have it.
     if (!extension_loaded('simplexml')) {
         // Load XML into DOM object
         $dom = new DOMDocument();
         $dom->loadXML($rawXML);
         $xml = simplexml_import_dom($dom);
         $xmlLayout = 'http://www.shrinktheweb.com/doc/stwacctresponse.xsd';
         // Pull response codes from XML feed
         $raw_Status = (string) $xml->children($xmlLayout)->Response->Status->StatusCode;
         // Request valid or not
         $raw_AccountLevel = (string) $xml->children($xmlLayout)->Response->Account_Level->StatusCode;
         // Account level
         // Features
         $accountDetails['embedded_pro_inside'] = (string) $xml->children($xmlLayout)->Response->Inside_Pages->StatusCode;
         // Inside Pages
         $accountDetails['embedded_pro_full_length'] = (string) $xml->children($xmlLayout)->Response->Full_Length->StatusCode;
         // Full Length
         $accountDetails['embedded_pro_custom_size'] = (string) $xml->children($xmlLayout)->Response->Custom_Size->StatusCode;
         // Custom Size
         $accountDetails['embedded_pro_refresh_on_demand'] = (string) $xml->children($xmlLayout)->Response->Refresh_OnDemand->StatusCode;
         // Refresh On Demand
         $accountDetails['embedded_pro_custom_delay'] = (string) $xml->children($xmlLayout)->Response->Custom_Delay->StatusCode;
         // Custom Delay
         $accountDetails['embedded_pro_custom_quality'] = (string) $xml->children($xmlLayout)->Response->Custom_Quality->StatusCode;
         // Custom Quality
         $accountDetails['embedded_pro_custom_messages'] = (string) $xml->children($xmlLayout)->Response->Custom_Messages->StatusCode;
         // Custom Quality
         $accountDetails['embedded_pro_custom_resolution'] = (string) $xml->children($xmlLayout)->Response->Custom_Resolution->StatusCode;
         // Custom Resolution
     } else {
         $raw_Status = STWSettingsForm::xml_getLegacyResponse('Status', $rawXML);
         $raw_AccountLevel = STWSettingsForm::xml_getLegacyResponse('Account_Level', $rawXML);
         // Features
         $accountDetails['embedded_pro_inside'] = STWSettingsForm::xml_getLegacyResponse('Inside_Pages', $rawXML);
         // Inside Pages
         $accountDetails['embedded_pro_full_length'] = STWSettingsForm::xml_getLegacyResponse('Full_Length', $rawXML);
         // Full Length
         $accountDetails['embedded_pro_custom_size'] = STWSettingsForm::xml_getLegacyResponse('Custom_Size', $rawXML);
         // Custom Size
         $accountDetails['embedded_pro_refresh_on_demand'] = STWSettingsForm::xml_getLegacyResponse('Refresh_OnDemand', $rawXML);
         // Refresh On Demand
         $accountDetails['embedded_pro_custom_delay'] = STWSettingsForm::xml_getLegacyResponse('Custom_Delay', $rawXML);
         // Custom Delay
         $accountDetails['embedded_pro_custom_quality'] = STWSettingsForm::xml_getLegacyResponse('Custom_Quality', $rawXML);
         // Custom Quality
         $accountDetails['embedded_pro_custom_messages'] = STWSettingsForm::xml_getLegacyResponse('Custom_Messages', $rawXML);
         // Custom Quality
         $accountDetails['embedded_pro_custom_resolution'] = STWSettingsForm::xml_getLegacyResponse('Custom_Resolution', $rawXML);
         // Custom Resolution
     }
     // ### Convert all details into an actual validated array
     // Success or fail, plus account type.
     if ($raw_Status == 'Success') {
         // Convert account number to a string.
         switch ($raw_AccountLevel) {
             case 1:
                 $accountDetails['account_type'] = 'basic';
                 break;
             case 2:
                 $accountDetails['account_type'] = 'plus';
                 break;
             default:
                 $accountDetails['account_type'] = 'free';
                 break;
         }
     } else {
         $accountDetails['account_type'] = 'invalid';
     }
     // All done and standardised.
     return $accountDetails;
 }