web/lib/Zend/Service/WindowsAzure/Management/Client.php
changeset 1230 68c69c656a2c
parent 808 6b6c2214f778
equal deleted inserted replaced
1229:5a6b6e770365 1230:68c69c656a2c
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Service_WindowsAzure
    16  * @package    Zend_Service_WindowsAzure
    17  * @subpackage Management
    17  * @subpackage Management
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id$
    20  * @version    $Id$
    21  */
    21  */
    22 
    22 
    23 /**
    23 /**
    73 /**
    73 /**
    74  * @see Zend_Service_WindowsAzure_Management_OperatingSystemFamilyInstance
    74  * @see Zend_Service_WindowsAzure_Management_OperatingSystemFamilyInstance
    75  */
    75  */
    76 require_once 'Zend/Service/WindowsAzure/Management/OperatingSystemFamilyInstance.php';
    76 require_once 'Zend/Service/WindowsAzure/Management/OperatingSystemFamilyInstance.php';
    77 
    77 
       
    78 /** @see Zend_Xml_Security */
       
    79 require_once 'Zend/Xml/Security.php';
       
    80 
    78 /**
    81 /**
    79  * @category   Zend
    82  * @category   Zend
    80  * @package    Zend_Service_WindowsAzure
    83  * @package    Zend_Service_WindowsAzure
    81  * @subpackage Management
    84  * @subpackage Management
    82  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    85  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
    83  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    86  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    84  */
    87  */
    85 class Zend_Service_WindowsAzure_Management_Client
    88 class Zend_Service_WindowsAzure_Management_Client
    86 {
    89 {
    87 	/**
    90 	/**
   316 		if (is_null($response)) {
   319 		if (is_null($response)) {
   317 			require_once 'Zend/Service/WindowsAzure/Exception.php';
   320 			require_once 'Zend/Service/WindowsAzure/Exception.php';
   318 			throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
   321 			throw new Zend_Service_WindowsAzure_Exception('Response should not be null.');
   319 		}
   322 		}
   320 		
   323 		
   321         $xml = @simplexml_load_string($response->getBody());
   324         $xml = Zend_Xml_Security::scan($response->getBody());
   322         
   325         
   323         if ($xml !== false) {
   326         if ($xml !== false) {
   324             // Fetch all namespaces 
   327             // Fetch all namespaces 
   325             $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true)); 
   328             $namespaces = array_merge($xml->getNamespaces(true), $xml->getDocNamespaces(true)); 
   326             
   329             
  1426 		}
  1429 		}
  1427 
  1430 
  1428 		$configuration = preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $configuration);
  1431 		$configuration = preg_replace('/(<\?xml[^?]+?)utf-16/i', '$1utf-8', $configuration);
  1429 		//$configuration = '<?xml version="1.0">' . substr($configuration, strpos($configuration, '>') + 2);
  1432 		//$configuration = '<?xml version="1.0">' . substr($configuration, strpos($configuration, '>') + 2);
  1430 
  1433 
  1431 		$xml = simplexml_load_string($configuration); 
  1434 		$xml = Zend_Xml_Security::scan($configuration); 
  1432 		
  1435 		
  1433 		// http://www.php.net/manual/en/simplexmlelement.xpath.php#97818
  1436 		// http://www.php.net/manual/en/simplexmlelement.xpath.php#97818
  1434 		$namespaces = $xml->getDocNamespaces();
  1437 		$namespaces = $xml->getDocNamespaces();
  1435 	    $xml->registerXPathNamespace('__empty_ns', $namespaces['']); 
  1438 	    $xml->registerXPathNamespace('__empty_ns', $namespaces['']); 
  1436 	
  1439