getUnserializedData() public method

get the result of the serialization
public getUnserializedData ( ) : string
return string $serializedData
 /**
  * Test unserializing a float
  */
 public function testFloat()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_GUESS_TYPES, true);
     $xml = '<xml>453.54553</xml>';
     $u->unserialize($xml);
     $this->assertEquals(453.54553, $u->getUnserializedData());
     $xml = '<xml>-1.47</xml>';
     $u->unserialize($xml);
     $this->assertEquals(-1.47, $u->getUnserializedData());
 }
 protected function read($filename)
 {
     $xml = file_get_contents($filename);
     $unserializer = new XML_Unserializer();
     $unserializer->unserialize($xml);
     return $unserializer->getUnserializedData();
 }
Ejemplo n.º 3
0
 function __construct($gmlSource)
 {
     parent::__construct();
     include_once "libs/class_xml_check.php";
     $check = new XML_check();
     if ($check->check_string($gmlSource)) {
         print "GML is well-formed\n";
         //print("Elements      : ".$check->get_xml_elements());
         //print("Attributes    : ".$check->get_xml_attributes());
         //print("Size          : ".$check->get_xml_size());
         //print("Text sections : ".$check->get_xml_text_sections());
         //print("Text size     : ".$check->get_xml_text_size());
     } else {
         print "GML is not well-formed. ";
         print $check->get_full_error() . "\n";
         print "Script terminated\n";
         die;
     }
     $this->gmlSource = $gmlSource;
     $this->gmlCon = new gmlConverter();
     require_once "XML/Unserializer.php";
     $unserializer_options = array('parseAttributes' => TRUE);
     $unserializer = new XML_Unserializer($unserializer_options);
     // Serialize the data structure
     $status = $unserializer->unserialize($this->gmlSource);
     $this->gmlArray = $unserializer->getUnserializedData();
     print date('l jS \\of F Y h:i:s A') . " GML serialized\n";
     // Check if XML is a ServiceException
     if ($unserializer->getRootName() == "ServiceExceptionReport") {
         print "The server returned an exception:\n";
         print $this->gmlSource . "\n";
         print "Script terminated\n";
         die;
     }
 }
 /**
  * Test unserializing simple data
  */
 public function testData()
 {
     $u = new XML_Unserializer();
     $xml = '<xml>data</xml>';
     $u->unserialize($xml);
     $this->assertEquals('data', $u->getUnserializedData());
 }
function _loadAcronymList()
{
    $unser = new XML_Unserializer(array('parseAttributes' => TRUE, 'attributesArray' => '_attrs'));
    $unser->unserialize(PATH_INCLUDE . "xslt/inc/acronyms.xml", true);
    $dat = $unser->getUnserializedData();
    return $dat['word'];
}
Ejemplo n.º 6
0
 function fetchData($username, $password)
 {
     switch ($this->options['cryptType']) {
         case 'blowfish':
             include_once 'Crypt/Blowfish.php';
             $bf = new Crypt_Blowfish($this->options['cryptKey']);
             $password = $bf->encrypt($password);
             $password = base64_encode($password);
             break;
         default:
             if (function_exists($this->options['cryptType'])) {
                 $password = $this->options['cryptType']($password);
             }
             break;
     }
     $req = new HTTP_Request();
     $req->setURL($this->options['URL']);
     $req->setMethod(HTTP_REQUEST_METHOD_GET);
     $req->addQueryString($this->options['usernameKey'], $username);
     $req->addQueryString($this->options['passwordKey'], $password);
     if (!PEAR::isError($req->sendRequest())) {
         $response = $req->getResponseBody();
     } else {
         return false;
     }
     $unserializer = new XML_Unserializer();
     if ($unserializer->unserialize($response)) {
         $this->result_value = $unserializer->getUnserializedData();
         if ($this->result_value[$this->options['resultKey']] == $this->options['correctValue']) {
             return true;
         }
     }
     return false;
 }
 /**
  * Test unserializing an indexed array
  */
 public function testIndexed()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_COMPLEXTYPE, 'array');
     $xml = '<xml><foo>bar</foo><foo>tomato</foo></xml>';
     $u->unserialize($xml);
     $this->assertEquals(array('foo' => array('bar', 'tomato')), $u->getUnserializedData());
 }
Ejemplo n.º 8
0
 function readData()
 {
     require_once 'XML/Unserializer.php';
     $xmlEngine = new XML_Unserializer();
     if ($xmlEngine->unserialize($this->getFile())) {
         return $xmlEngine->getUnserializedData();
     }
     return false;
 }
 /**
  * Test unserializing from UTF-8 to ISO-8859-1
  */
 public function testUtf8ToIso()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_ENCODING_SOURCE, 'UTF-8');
     $u->setOption(XML_UNSERIALIZER_OPTION_ENCODING_TARGET, 'ISO-8859-1');
     $xml = '<xml>' . utf8_encode('A string containing ü ä Ãê') . '</xml>';
     $u->unserialize($xml);
     $this->assertEquals('A string containing ü ä Ãê', $u->getUnserializedData());
 }
Ejemplo n.º 10
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_reserved_driver_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId));
     $options = array('complexType' => 'array', 'parseAttributes' => TRUE);
     $Unserializer = new XML_Unserializer($options);
     //$Unserializer->setOption('parseAttributes', TRUE);
     $status = $Unserializer->unserialize($b->getResponseText());
     $this->list = $Unserializer->getUnserializedData();
 }
Ejemplo n.º 11
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new sfForm();
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_profile_url'), array('id' => $this->getRequestParameter('m_id')));
     $Unserializer = new XML_Unserializer($options);
     $status = $Unserializer->unserialize($b->getResponseText());
     $this->profile = $Unserializer->getUnserializedData();
 }
 /**
  * Unpack definition procedure
  *
  * @return array
  * @author Sergey Startsev
  */
 protected function doUnpack($definition)
 {
     $unserializer = new XML_Unserializer($this->unserialize_options);
     // check unserialize status
     $status = $unserializer->unserialize(trim($definition), false);
     if (!$status) {
         throw new afsXmlDefinitionException($status->getMessage());
     }
     // get unserialized data
     return $unserializer->getUnserializedData();
 }
 /**
  * Test unserializing with a setter method
  */
 public function testSetterMethod()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_COMPLEXTYPE, 'object');
     $u->setOption(XML_UNSERIALIZER_OPTION_DEFAULT_CLASS, 'Foo');
     $xml = '<SetterExample><foo>tomato</foo></SetterExample>';
     $u->unserialize($xml);
     $result = new SetterExample();
     $result->setFoo('tomato');
     $this->assertEquals($result, $u->getUnserializedData());
 }
Ejemplo n.º 14
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $b = new sfWebBrowser();
     $b->get(sfConfig::get('sf_takutomo_get_attend_event_url'), array('guid' => 'DEBUG,sample_member_001'));
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $Unserializer = new XML_Unserializer($options);
     $status = $Unserializer->unserialize($b->getResponseText());
     //if ($status === true) {
     $this->get_attend_event_list = $Unserializer->getUnserializedData();
 }
Ejemplo n.º 15
0
 private function setEventDetail()
 {
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_event_detail_url'), array('event_id' => $this->getRequestParameter('event_id')));
     if ((int) $xml->status->code >= 1000) {
         $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
     } else {
         $Unserializer = new XML_Unserializer($this->options);
         $status = $Unserializer->unserialize($b->getResponseText());
         $this->event_detail = $Unserializer->getUnserializedData();
     }
 }
Ejemplo n.º 16
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     //$mixi_persistence = $persistence->entry->{'mixi.jp:'.MixiAppMobileApi::$ownerId};
     $b = new sfWebBrowser();
     $b->get(sfConfig::get('sf_takutomo_get_attend_event_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId));
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $Unserializer = new XML_Unserializer($options);
     $status = $Unserializer->unserialize($b->getResponseText());
     //if ($status === true) {
     $this->get_attend_event_list = $Unserializer->getUnserializedData();
 }
Ejemplo n.º 17
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $Unserializer = new XML_Unserializer($options);
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_profile_url'), array('id' => $this->getRequestParameter('id')));
     if ((int) $xml->status->code >= 1000) {
         $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
     } else {
         $status = $Unserializer->unserialize($b->getResponseText());
         $this->member = $Unserializer->getUnserializedData();
     }
     $b->post(sfConfig::get('sf_takutomo_get_eval_comments_url'), array('id' => $this->getRequestParameter('m_id')));
     if ((int) $xml->status->code >= 1000) {
         $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
     } else {
         $status = $Unserializer->unserialize($b->getResponseText());
         $this->comments = $Unserializer->getUnserializedData();
     }
 }
Ejemplo n.º 18
0
 /**
  * 
  * @param string $xml
  * @return array
  */
 public static function unserialize($xml)
 {
     if ($xml instanceof ZendT_Type) {
         $xml = $xml->get();
     }
     $unserializer = new XML_Unserializer();
     $status = $unserializer->unserialize($xml);
     if ($status) {
         $array = $unserializer->getUnserializedData();
     }
     return $array;
 }
Ejemplo n.º 19
0
 /**
  * 相乗りリストを返す 
  * errorの場合 null
  */
 private function getAttendEventList()
 {
     $b = new sfWebBrowser();
     $b->get(sfConfig::get('sf_takutomo_get_attend_event_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId));
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $Unserializer = new XML_Unserializer($options);
     $status = $Unserializer->unserialize($b->getResponseText());
     if ($status === true) {
         return $Unserializer->getUnserializedData();
     } else {
         return null;
     }
 }
Ejemplo n.º 20
0
 function readData()
 {
     require_once 'XML/Unserializer.php';
     $xmlEngine = new XML_Unserializer();
     $file_data = $this->getFile();
     if (!$file_data) {
         return false;
     }
     $status = $xmlEngine->unserialize($file_data);
     if (!PEAR::isError($status)) {
         return $xmlEngine->getUnserializedData();
     }
     trigger_error($status->getMessage());
     return false;
 }
    /**
     * Test keep behaviour
     */
    public function testKeep()
    {
        $u = new XML_Unserializer();
        $u->setOption(XML_UNSERIALIZER_OPTION_WHITESPACE, XML_UNSERIALIZER_WHITESPACE_KEEP);
        $u->unserialize($this->xml);
        $expected = array('string' => '

    This XML
    document
    contains
    line breaks.

   ');
        $this->assertEquals($expected, $u->getUnserializedData());
    }
Ejemplo n.º 22
0
 private function getProFileMySelf()
 {
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_profile_myself_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId));
     $xml = new SimpleXMLElement($b->getResponseText());
     $this->profileForm = new sfForm();
     if ((int) $xml->status->code >= 1000) {
         $this->profileForm->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
     } else {
         $options = array('complexType' => 'array');
         $Unserializer = new XML_Unserializer($options);
         $status = $Unserializer->unserialize($b->getResponseText());
         $this->profile = $Unserializer->getUnserializedData();
     }
 }
 public static function Decode($XMLResponse, &$isFault)
 {
     $responseXML = null;
     try {
         if (empty($XMLResponse)) {
             throw new Exception("Given Response is not a valid SOAP response.");
         }
         $xmlDoc = new XMLReader();
         $res = $xmlDoc->XML($XMLResponse);
         if ($res) {
             $xmlDoc->read();
             $responseXML = $xmlDoc->readOuterXml();
             $xmlDOM = new DOMDocument();
             $xmlDOM->loadXML($responseXML);
             $isFault = trim(strtoupper($xmlDoc->localName)) == self::$FaultMessage;
             if ($isFault) {
                 $xmlDOM->loadXML($xmlDoc->readOuterXml());
             }
             switch ($xmlDoc->nodeType) {
                 case XMLReader::ELEMENT:
                     $nodeName = $xmlDoc->localName;
                     $prefix = $xmlDoc->prefix;
                     if (class_exists($nodeName)) {
                         $xmlNodes = $xmlDOM->getElementsByTagName($nodeName);
                         foreach ($xmlNodes as $xmlNode) {
                             //$xmlNode->prefix = "";
                             $xmlNode->setAttribute("_class", $nodeName);
                             $xmlNode->setAttribute("_type", "object");
                         }
                     }
                     break;
             }
             $responseXML = $xmlDOM->saveXML();
             $unserializer = new XML_Unserializer();
             $unserializer->setOption(XML_UNSERIALIZER_OPTION_COMPLEXTYPE, 'object');
             $res = $unserializer->unserialize($responseXML, false);
             if ($res) {
                 $responseXML = $unserializer->getUnserializedData();
             }
             $xmlDoc->close();
         } else {
             throw new Exception("Given Response is not a valid XML response.");
         }
     } catch (Exception $ex) {
         throw new Exception("Error occurred while XML decoding");
     }
     return $responseXML;
 }
Ejemplo n.º 24
0
 /**
  * Process parameters and display the page.
  *
  * @return void
  * @access public
  */
 public function launch()
 {
     global $configArray;
     global $interface;
     // Load SOLR Statistics
     if ($configArray['Index']['engine'] == 'Solr') {
         $xml = @file_get_contents($configArray['Index']['url'] . '/admin/multicore');
         if ($xml) {
             $options = array('parseAttributes' => 'true', 'keyAttribute' => 'name');
             $unxml = new XML_Unserializer($options);
             $unxml->unserialize($xml);
             $data = $unxml->getUnserializedData();
             $interface->assign('data', $data['status']);
         }
     }
     $interface->setTemplate('home.tpl');
     $interface->setPageTitle('Home');
     $interface->display('layout-admin.tpl');
 }
Ejemplo n.º 25
0
function getEval($id)
{
    $result = null;
    $b = new sfWebBrowser();
    $b->post(sfConfig::get('sf_takutomo_get_profile_url'), array('id' => $id));
    $xml = new SimpleXMLElement($b->getResponseText());
    if ((int) $xml->status->code >= 1000) {
        return null;
    } else {
        //xmlを連想配列に変換
        $options = array('complexType' => 'array');
        $Unserializer = new XML_Unserializer($options);
        $status = $Unserializer->unserialize($b->getResponseText());
        if ($status) {
            $member = $Unserializer->getUnserializedData();
            return createStars(calculateEvaluate($member));
        }
        return null;
    }
}
Ejemplo n.º 26
0
/**
 * Purpose:   
 * Function name: GetPageInfo
 * Parameters:
 */
function GetPageInfo($PageID, $Language)
{
    $_Result = array("CAPTIONS" => array());
    // Read XML language file
    $_LanguageFile = $_SERVER["DOCUMENT_ROOT"] . "/languages/" . $Language . ".xml";
    if (file_exists($_LanguageFile)) {
        $_XML = new XML_Unserializer(array("complexType" => "array", "parseAttributes" => TRUE));
        $_XML->unserialize($_LanguageFile, TRUE);
        $_Data = $_XML->getUnserializedData();
        $_Pages = $_Data["pages"];
        // Get page data
        $_Page = array();
        if (!is_array($_Pages["page"][0])) {
            if ($_Pages["page"]["name"] == $PageID) {
                $_Page = $_Pages["page"];
            }
        } else {
            $i = 0;
            $_Length = count($_Pages["page"]);
            while ($_Pages["page"][$i]["name"] != $PageID && $i < $_Length) {
                $i++;
            }
            if ($i < $_Length) {
                $_Page = $_Pages["page"][$i];
            }
        }
        // Get title data
        $_Result["TITLE"] = $_Page["title"];
        // Get caption data
        $_Captions = $_Page["captions"];
        if (!is_array($_Captions["caption"][0])) {
            $_Result["CAPTIONS"][$_Captions["caption"]["name"]] = $_Captions["caption"]["value"];
        } else {
            for ($i = 0; $i < count($_Captions["caption"]); $i++) {
                $_Result["CAPTIONS"][$_Captions["caption"][$i]["name"]] = $_Captions["caption"][$i]["value"];
            }
        }
    }
    // Return data
    return $_Result;
}
Ejemplo n.º 27
0
 public function getInitUrl($returnUrl, $cancelUrl, $sale = true)
 {
     $router = ActiveRecordModel::getApplication()->getRouter();
     $completeUrl = $router->createFullUrl($router->createUrl(array('controller' => 'checkout', 'action' => 'completeExternal', 'id' => $this->order->getID())));
     $handler = $this->getHandler($cancelUrl, $completeUrl);
     $sandbox = $this->getConfigValue('sandbox') ? 'sandbox.' : '';
     $url = $sandbox ? 'https://sandbox.google.com/checkout/api/checkout/v2/merchantCheckout/Merchant/' : 'https://checkout.google.com/api/checkout/v2/merchantCheckout/Merchant/';
     $parsed = new XML_Unserializer();
     $cart = $handler->getCart();
     if (($response = $handler->_getCurlResponse($cart, $url . $this->getConfigValue('merchant_id'))) && $parsed->unserialize($response)) {
         $array = $parsed->getUnserializedData();
         if (empty($array['redirect-url'])) {
             return false;
         }
         $url = $array['redirect-url'];
         $url = str_replace('shoppingcartshoppingcart', 'shoppingcart&shoppingcart', $url);
         return $url;
     } else {
         return false;
     }
 }
Ejemplo n.º 28
0
 function xml2array()
 {
     //converte dati xml in un array
     /**
      * uses PEAR error management
      */
     require_once 'PEAR.php';
     /**
      * uses XML_Parser to unserialize document
      */
     require_once "XML/Parser.php";
     /**
      * uses unserializer 
      */
     require_once "XML/Unserializer.php";
     $xml_data = $this->xml_data;
     $unserializer = new XML_Unserializer();
     $unserializer->unserialize($xml_data);
     $data = $unserializer->getUnserializedData();
     $this->data = $data;
 }
Ejemplo n.º 29
0
 /**
  * execute処理
  *
  * @access  public
  */
 function execute()
 {
     $this->search_result = $this->session->getParameter(array("search_result", $this->block_id, $this->target_module));
     if (!isset($this->search_result)) {
         $this->search_result = array("module_id" => $this->module_obj['module_id'], "offset" => 0, "limit" => SEARCH_DEF_FIRST_LIMIT);
         $this->session->setParameter(array("search_result", $this->block_id, $this->target_module), $this->search_result);
     }
     $this->search_select = $this->session->getParameter(array("search_select", $this->block_id));
     $params = array("block_id" => $this->block_id, "keyword" => $this->search_select["keyword"], "select_kind" => $this->search_select["select_kind"], "handle" => $this->search_select["handle"], "fm_target_date" => $this->search_select["fm_target_date"], "to_target_date" => $this->search_select["to_target_date"], "target_module" => $this->search_result["module_id"], "target_room" => isset($this->search_result["room_id"]) ? $this->search_result["room_id"] : null, "offset" => $this->search_result["offset"], "limit" => $this->search_result["limit"], "_header" => _OFF, "_output" => _OFF);
     $xml = $this->preexecute->preExecute($this->module_obj["search_action"], $params);
     $xml = preg_replace("/nc_rss:/iu", "", $xml);
     $options = array(XML_UNSERIALIZER_OPTION_ATTRIBUTES_PARSE => 'parseAttributes');
     $unserializer = new XML_Unserializer($options);
     $unserializer->unserialize($xml);
     $this->xml_parse = $unserializer->getUnserializedData();
     if ($this->search_result["offset"] == 0) {
         $limit = SEARCH_DEF_FIRST_LIMIT;
     } else {
         $limit = SEARCH_DEF_NEXT_LIMIT;
     }
     $this->next_offset = $this->search_result["offset"] + $limit > $this->xml_parse["count"] ? $this->xml_parse["count"] : $this->search_result["offset"] + $limit;
     $this->prev_offset = $this->search_result["offset"] - $limit < 0 ? 0 : $this->search_result["offset"] - $limit;
     return 'success';
 }
Ejemplo n.º 30
0
 /**
  * Get holdings information for the specified record.
  *
  * @param string $id Record to obtain holdings for.
  *
  * @return array
  * @access public
  */
 public function getHoldings($id)
 {
     $this->client->setMethod(HTTP_REQUEST_METHOD_POST);
     $this->client->setURL('http://www.worldcat.org/webservices/catalog/content/libraries/' . $id);
     $this->client->addRawQueryString("wskey={$this->_wskey}&servicelevel=full");
     if ($this->debug) {
         echo '<pre>Connect: ';
         print_r($this->client->getUrl(true));
         echo "</pre>\n";
     }
     $result = $this->client->sendRequest();
     if (!PEAR::isError($result)) {
         $xml = $this->client->getResponseBody();
         $unxml = new XML_Unserializer();
         $result = $unxml->unserialize($xml);
         if (!PEAR::isError($result)) {
             return $unxml->getUnserializedData();
         } else {
             PEAR::raiseError($result);
         }
     } else {
         return $result;
     }
 }