Example #1
0
/**
 * Convierte el contenido del archivo a un array
 *
 * @param string $fileName
 * @return array
 */
function xml2array($fileName)
{
    $xml = fileGetContents($fileName);
    $xmlParser = new xmlParser();
    $xmlParser->parse($xml);
    return $xmlParser->data;
}
Example #2
0
 /**
  * Returns domxmlNode of rootnode in supplied xml string.
  *
  * @param string $xmldata
  * @return domxmlNode
  */
 function getRootNode($xmldata)
 {
     $xmlstring = utf8_encode(str_replace(array("\n", "\r"), '', $xmldata));
     $p = new xmlParser();
     if ($p->parse($xmlstring)) {
         return $p->rootnodes[0];
     } else {
         return false;
     }
 }
 public static function readErrors($str_xml)
 {
     $parser = new xmlParser($str_xml);
     $data = $parser->getResult('errors');
     $errors = array();
     if (isset($data['error']) && is_array($data['error'])) {
         if (isset($data['error']['code']) && isset($data['error']['message'])) {
             array_push($errors, new PagSeguroError($data['error']['code'], $data['error']['message']));
         } else {
             foreach ($data['error'] as $key => $value) {
                 if (isset($value['code']) && isset($value['message'])) {
                     array_push($errors, new PagSeguroError($value['code'], $value['message']));
                 }
             }
         }
     }
     return $errors;
 }
Example #4
0
// -----------------------------------------------------------------------------
$flickrKey = "3773d42a5766f0bd27caa1d584ae0bc9";
$id = isset($_GET["id"]) ? $_GET["id"] : "";
$tags = isset($_GET["tags"]) ? $_GET["tags"] : "";
echo "\n<ajax-response><response type='object' id='" . $id . "_updater'>";
print "\n<rows update_ui='true'>";
$url = "http://api.flickr.com/services/rest/?method=flickr.photos.search";
$cnt = 0;
if ($tags != "") {
    $url .= "&safe_search=1";
    $url .= "&tag_mode=all";
    $url .= "&sort=interestingness-desc";
    $url .= "&extras=date_taken,owner_name,geo,tags";
    $url .= "&tags=" . $tags;
    $url .= "&api_key=" . $flickrKey;
    $parser = new xmlParser();
    $parser->parse($url);
    $status = $parser->output[0]['attrs']['STAT'];
    // FOR DEBUGGING PURPOSES
    //print $status;
    //print "<hr><pre>";
    //print_r($parser->output);
    //print "</pre>";
    $content =& $parser->output[0]['child'][0]['child'];
    foreach ($content as $item) {
        if ($item['name'] == "PHOTO") {
            print "<tr>";
            // "_s" suffix specifies a 75x75 pixel format
            $photourl = "http://farm" . $item['attrs']['FARM'] . ".static.flickr.com/" . $item['attrs']['SERVER'] . "/" . $item['attrs']['ID'] . "_" . $item['attrs']['SECRET'] . "_s.jpg";
            //print "<p><img src='".$photourl."'>";
            print XmlCell($photourl);
Example #5
0
            $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$_TIME}', '{$_IP}', '1', '{$title}')");
        }
        if ($id and $lastdate) {
            $db->query("UPDATE " . PREFIX . "_rss SET lastdate='{$lastdate}' WHERE id='{$id}'");
        }
        clear_cache();
        msg("info", $lang['addnews_ok'], $lang['rss_added'], "?mod=rss");
    }
    msg("error", $lang['addnews_error'], $lang['rss_notadded'], "?mod=rss");
} elseif ($_REQUEST['action'] == "news" and $id) {
    include_once ENGINE_DIR . '/classes/rss.class.php';
    include_once ENGINE_DIR . '/classes/parse.class.php';
    $parse = new ParseFilter(array(), array(), 1, 1);
    $parse->leech_mode = true;
    $rss = $db->super_query("SELECT * FROM " . PREFIX . "_rss WHERE id='{$id}'");
    $xml = new xmlParser(stripslashes($rss['url']), $rss['max_news']);
    $xml->pre_lastdate = $rss['lastdate'];
    $xml->pre_parse($rss['date']);
    $i = 0;
    foreach ($xml->content as $content) {
        if ($rss['text_type']) {
            $xml->content[$i]['title'] = $parse->decodeBBCodes($xml->content[$i]['title'], false);
            $xml->content[$i]['description'] = $parse->decodeBBCodes($xml->content[$i]['description'], false);
            $xml->content[$i]['date'] = date("Y-m-d H:i:s", $xml->content[$i]['date']);
        } else {
            $xml->content[$i]['title'] = $parse->decodeBBCodes($xml->content[$i]['title'], false);
            $xml->content[$i]['description'] = $parse->decodeBBCodes($xml->content[$i]['description'], true, "yes");
            $xml->content[$i]['date'] = date("Y-m-d H:i:s", $xml->content[$i]['date']);
        }
        $i++;
    }
Example #6
0
session_start();
//////////////////////////////////////////////////
//Este es el director de orquesta del framework, hace los enlaces
//entre las diferentes capas de la aplicacion
//////////////////////////////////////////////////
//////////Carga de el archivo binding.xml////////////
if ($GLOBALS["debugMode"] || empty($_SESSION['CANIS_ROLES'])) {
    $file_name = "binding.xml";
    $parser = new xmlParser();
    $contents = file_get_contents($file_name);
    //Or however you what it
    $_SESSION['CANIS_BINDINGS'] = $parser->xml2array($contents, 1, 'attribute');
}
if ($GLOBALS["debugMode"] || empty($_SESSION['CANIS_ROLES'])) {
    $file_name = "roles.xml";
    $parser = new xmlParser();
    $contents = file_get_contents($file_name);
    //Or however you what it
    $_SESSION['CANIS_ROLES'] = $parser->xml2array($contents, 1, 'attribute');
}
///////////////////////////////////////////////////////////////
if (!isset($_SESSION['user'])) {
    $_SESSION['user'] = new CocoasUser();
}
///////////Empiezo la carga de la informacion dentro de las vistas////////////
$infoManager = new InfoManager($_SESSION['CANIS_BINDINGS'], $_SESSION['CANIS_ROLES']);
$infoManager->setTemplate("default");
//////////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['view'])) {
    $infoManager->get($_REQUEST['view'], 'view');
} else {
function cron_exec()
{
    // do something every hour
    $zanox = new xmlParser();
    echo $zanox->initXmlToHtml();
}
Example #8
0
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" type="text/css" href="cupons-zanox.css">
</head>
<body>
    
<?php 
include 'classXml.php';
$test = new xmlParser();
echo $test->initXmlToHtml();
?>

<div id="lightbox-zanox" class="lightbox-zanox">
    <div class="top row">
        <div class="extra-info">
            <div class="toggle-content" data-toggle-tab="info" style="display:block;">
                <span class="heading">
                        <!--Aqui está seu cupom da <strong>Netshoes</strong>-->
                </span>
                <span class="sub-heading">
                    <!--Cupom 50% OFF no segundo item!-->
                </span>
                <p class="description">
                <!--Ganhe 50% OFF no segundo item de menor valor ao inserir este código no carrinho! Promoção não cumulativa. Exceto combos, bicicletas, equipamentos de fitness, eletrônicos, games, saúde e bem-estar, jogos de mesa e produtos com selo Lançamento, Natal e Collection.--></p>
            </div>
        </div>
        <hr>
        <div class="go-to-wrapper">
Example #9
0
 function getResetEvents($m, $y)
 {
     global $wosterdf_path;
     if (!class_exists("xmlParser")) {
         require WOSTERDF_PATH . "addons/GroupCalendar/guild/include/xmlparse.php";
     }
     $l = 'en';
     $xmlp = new xmlParser();
     $xmlp->parse("http://www.mediocrityinmotion.com/RSS/dungeons.php?month=" . $m . "&year=" . $y . "&lang=" . $l . "");
     $file = $xmlp->output;
     $file = $file[0]['child'];
     for ($i = 0; $i < count($file); $i++) {
         $d = $file[$i]['attrs']['NUMBER'];
         $items = $file[$i]['child'];
         for ($j = 0; $j < count($items); $j++) {
             $abrv = $items[$j]['attrs']['ID'];
             $inst = $items[$j]['child'];
             $name = $icon = $game = $url = $reset = "";
             for ($k = 0; $k < count($inst); $k++) {
                 if ($inst[$k]['name'] == "NAME") {
                     $name = $inst[$k]['content'];
                 }
                 if ($inst[$k]['name'] == "ICON") {
                     $icon = $inst[$k]['content'];
                 }
                 //if($inst[$k]['name'] == "URL") $url = $inst[$k]['content'];
                 if ($inst[$k]['name'] == "RESET") {
                     $reset = $inst[$k]['content'];
                 }
                 if ($inst[$k]['name'] == "GAME_VER") {
                     $game = $inst[$k]['content'];
                 }
             }
             $eventdata[$d]['Name'][] = $name;
             $eventdata[$d]['Icon'][] = $icon;
             //$eventdata[$d]['URL'][] = $url;
             $eventdata[$d]['Time'][] = $reset;
             $eventdata[$d]['Type'][] = $abrv;
             $eventdata[$d]['GAME'][] = $game;
         }
     }
     return $eventdata;
 }
Example #10
0
     $informers[$value['tag']] = "";
     continue;
 }
 $buffer = dle_cache("informer_" . $value['id'], $config['skin']);
 if ($buffer !== false) {
     $file_date = @filemtime(ENGINE_DIR . '/cache/informer_' . $value['id'] . '_' . md5($config['skin']) . '.tmp');
     if ($file_date) {
         if (date("d-H", $file_date) != date("d-H")) {
             $buffer = false;
             @unlink(ENGINE_DIR . '/cache/informer_' . $value['id'] . '_' . md5($config['skin']) . '.tmp');
         }
     }
 }
 if ($buffer === false) {
     include_once ENGINE_DIR . '/classes/rss.class.php';
     $xml = new xmlParser(stripslashes($value['url']), $value['news_max']);
     $xml->pre_parse(0);
     $tpl->load_template($value['template'] . '.tpl');
     foreach ($xml->content as $content) {
         $content['title'] = trim(strip_tags($content['title']));
         $content['category'] = trim(strip_tags($content['category']));
         $content['author'] = trim(strip_tags($content['author']));
         if ($value['tmax'] and dle_strlen($content['title'], $config['charset']) > $value['tmax']) {
             $content['title'] = dle_substr($content['title'], 0, $value['tmax'], $config['charset']) . " ...";
         }
         if (stripos($tpl->copy_template, "{image-") !== false) {
             $images = array();
             preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $content['description'], $media);
             $data = preg_replace('/(img|src)("|\'|="|=\')(.*)/i', "\$3", $media[0]);
             foreach ($data as $url) {
                 $info = pathinfo($url);
Example #11
0
     $informers[$value['tag']] = "";
     continue;
 }
 $buffer = dle_cache("informer_" . $value['id'], $config['skin']);
 if ($buffer) {
     $file_date = @filemtime(ENGINE_DIR . '/cache/informer_' . $value['id'] . '_' . md5(totranslit($config['skin'])) . '.tmp');
     if ($file_date) {
         if (date("d-H", $file_date) != date("d-H")) {
             $buffer = false;
             @unlink(ENGINE_DIR . '/cache/informer_' . $value['id'] . '_' . md5(totranslit($config['skin'])) . '.tmp');
         }
     }
 }
 if (!$buffer) {
     include_once ENGINE_DIR . '/classes/rss.class.php';
     $xml = new xmlParser(stripslashes($value['url']), $value['news_max']);
     if ($xml->rss_option == "UTF-8") {
         $xml->convert("UTF-8", strtolower($config['charset']));
     } elseif ($xml->rss_charset != strtolower($config['charset'])) {
         $xml->convert($xml->rss_charset, strtolower($config['charset']));
     }
     $xml->pre_parse(0);
     $tpl->load_template($value['template'] . '.tpl');
     foreach ($xml->content as $content) {
         $content['title'] = trim(strip_tags($content['title']));
         $content['category'] = trim(strip_tags($content['category']));
         $content['author'] = trim(strip_tags($content['author']));
         if ($value['tmax'] and dle_strlen($content['title'], $config['charset']) > $value['tmax']) {
             $content['title'] = dle_substr($content['title'], 0, $value['tmax'], $config['charset']) . " ...";
         }
         if (stripos($tpl->copy_template, "{image-") !== false) {
 public static function readTransaction($str_xml)
 {
     // Parser
     $parser = new xmlParser($str_xml);
     // <transaction>
     $data = $parser->getResult('transaction');
     $transaction = new Transaction();
     // <transaction> <lastEventDate>
     if (isset($data["lastEventDate"])) {
         $transaction->setLastEventDate($data["lastEventDate"]);
     }
     // <transaction> <date>
     if (isset($data["date"])) {
         $transaction->setDate($data["date"]);
     }
     // <transaction> <code>
     if (isset($data["code"])) {
         $transaction->setCode($data["code"]);
     }
     // <transaction> <reference>
     if (isset($data["reference"])) {
         $transaction->setReference($data["reference"]);
     }
     // <transaction> <type>
     if (isset($data["type"])) {
         $transaction->setType(new TransactionType($data["type"]));
     }
     // <transaction> <status>
     if (isset($data["status"])) {
         $transaction->setStatus(new TransactionStatus($data["status"]));
     }
     if (isset($data["paymentMethod"]) && is_array($data["paymentMethod"])) {
         // <transaction> <paymentMethod>
         $paymentMethod = new PaymentMethod();
         // <transaction> <paymentMethod> <type>
         if (isset($data["paymentMethod"]['type'])) {
             $paymentMethod->setType(new PaymentMethodType($data["paymentMethod"]['type']));
         }
         // <transaction> <paymentMethod> <code>
         if (isset($data["paymentMethod"]['code'])) {
             $paymentMethod->setCode(new PaymentMethodCode($data["paymentMethod"]['code']));
         }
         $transaction->setPaymentMethod($paymentMethod);
     }
     // <transaction> <grossAmount>
     if (isset($data["grossAmount"])) {
         $transaction->setGrossAmount($data["grossAmount"]);
     }
     // <transaction> <discountAmount>
     if (isset($data["discountAmount"])) {
         $transaction->setDiscountAmount($data["discountAmount"]);
     }
     // <transaction> <feeAmount>
     if (isset($data["feeAmount"])) {
         $transaction->setFeeAmount($data["feeAmount"]);
     }
     // <transaction> <netAmount>
     if (isset($data["netAmount"])) {
         $transaction->setNetAmount($data["netAmount"]);
     }
     // <transaction> <extraAmount>
     if (isset($data["extraAmount"])) {
         $transaction->setExtraAmount($data["extraAmount"]);
     }
     // <transaction> <installmentCount>
     if (isset($data["installmentCount"])) {
         $transaction->setInstallmentCount($data["installmentCount"]);
     }
     if (isset($data["items"]['item']) && is_array($data["items"]['item'])) {
         $items = array();
         $i = 0;
         if (isset($data["items"]['item'][0])) {
             foreach ($data["items"]['item'] as $key => $value) {
                 $item = self::parseTransactionItem($value);
                 $items[$i] = $item;
                 $i++;
             }
         } else {
             $items[0] = self::parseTransactionItem($data["items"]['item']);
         }
         // <transaction> <items>
         $transaction->setItems($items);
     }
     if (isset($data["sender"])) {
         // <transaction> <sender>
         $sender = new Sender();
         // <transaction> <sender> <name>
         if (isset($data["sender"]["name"])) {
             $sender->setName($data["sender"]["name"]);
         }
         // <transaction> <sender> <email>
         if (isset($data["sender"]["email"])) {
             $sender->setEmail($data["sender"]["email"]);
         }
         if (isset($data["sender"]["phone"])) {
             // <transaction> <sender> <phone>
             $phone = new Phone();
             // <transaction> <sender> <phone> <areaCode>
             if (isset($data["sender"]["phone"]["areaCode"])) {
                 $phone->setAreaCode($data["sender"]["phone"]["areaCode"]);
             }
             // <transaction> <sender> <phone> <number>
             if (isset($data["sender"]["phone"]["number"])) {
                 $phone->setNumber($data["sender"]["phone"]["number"]);
             }
             $sender->setPhone($phone);
         }
         $transaction->setSender($sender);
     }
     if (isset($data["shipping"]) && is_array($data["shipping"])) {
         // <transaction> <shipping>
         $shipping = new Shipping();
         // <transaction> <shipping> <type>
         if (isset($data["shipping"]["type"])) {
             $shipping->setType(new ShippingType($data["shipping"]["type"]));
         }
         // <transaction> <shipping> <cost>
         if (isset($data["shipping"]["cost"])) {
             $shipping->setCost($data["shipping"]["cost"]);
         }
         if (isset($data["shipping"]["address"]) && is_array($data["shipping"]["address"])) {
             // <transaction> <shipping> <address>
             $address = new Address();
             // <transaction> <shipping> <address> <street>
             if (isset($data["shipping"]["address"]["street"])) {
                 $address->setStreet($data["shipping"]["address"]["street"]);
             }
             // <transaction> <shipping> <address> <number>
             if (isset($data["shipping"]["address"]["number"])) {
                 $address->setNumber($data["shipping"]["address"]["number"]);
             }
             // <transaction> <shipping> <address> <complement>
             if (isset($data["shipping"]["address"]["complement"])) {
                 $address->setComplement($data["shipping"]["address"]["complement"]);
             }
             // <transaction> <shipping> <address> <city>
             if (isset($data["shipping"]["address"]["city"])) {
                 $address->setCity($data["shipping"]["address"]["city"]);
             }
             // <transaction> <shipping> <address> <state>
             if (isset($data["shipping"]["address"]["state"])) {
                 $address->setState($data["shipping"]["address"]["state"]);
             }
             // <transaction> <shipping> <address> <district>
             if (isset($data["shipping"]["address"]["district"])) {
                 $address->setDistrict($data["shipping"]["address"]["district"]);
             }
             // <transaction> <shipping> <address> <postalCode>
             if (isset($data["shipping"]["address"]["postalCode"])) {
                 $address->setPostalCode($data["shipping"]["address"]["postalCode"]);
             }
             // <transaction> <shipping> <address> <country>
             if (isset($data["shipping"]["address"]["country"])) {
                 $address->setCountry($data["shipping"]["address"]["country"]);
             }
             $shipping->setAddress($address);
         }
         // <transaction> <shipping>
         $transaction->setShipping($shipping);
     }
     return $transaction;
 }
Example #13
0
\t<table class="settop"><tr><td class="settop_left"><img src="../language/{$cache_langs[$_SYS['alangid']]['directory']}/flag.gif" title="{$effect_lang}" /></td><td><div id="smalltab_container"></div></td></tr></table>
\t<div class="smalltab_line"></div>
\t<div class="div_clear" style="height:10px;"></div>
\t<div id="t1">
\t\t<form id="templatesform" onsubmit="return false;">
\t{$_AL['template.ad']}
\t\t<div class="tips_1">{$_AL['template.tips']}</div>
\t\t<div class="div_clear" style="height:10px;"></div>
\t\t<table class="table_1" width="100%">
\t\t\t<tr style="font-weight:bold;color:#333333;"><td class="td_6"><div class="rowdiv_0" style="width:{$dwidth[1]}px;">{$_AL['template.preview']}</div><div class="rowdiv_0" style="width:{$dwidth[2]}px;">{$_AL['template.name.dir']}</div><div class="rowdiv_0" style="width:{$dwidth[4]}px;">{$_AL['template.use']}</div><div class="rowdiv_0" style="width:{$dwidth[5]}px;"><img src="../language/{$lang_item['directory']}/flag.gif" /> {$lang_item['name']}{$_AL['template.langpack']}</div><div class="rowdiv_0" style="width:{$dwidth[3]}px;">{$_AL['template.author']}</div></td></tr>
\t\t
EOT;
        $narray = array();
        $dir = '../template';
        $templatedir = dir($dir);
        $xml = new xmlParser();
        $defaultstyle = "";
        $tmporder = array();
        while ($entry = $templatedir->read()) {
            $tpldir = realpath($dir . '/' . $entry);
            if (!in_array($entry, array('.', '..')) && is_dir($tpldir)) {
                $tmporder[$entry] = '0';
            }
        }
        foreach ($tmporder as $entry => $order) {
            $tpldir = realpath($dir . '/' . $entry);
            if (!in_array($entry, array('.', '..')) && is_dir($tpldir)) {
                $config = array();
                $xmlstr = @file_get_contents("{$dir}/{$entry}/config.xml");
                if ($xmlstr) {
                    $config = $xml->xml2array($xmlstr);
 function testGoogleXMLParserGetRootXMLNotFolding()
 {
     $xml = '<addresses>
             <anonymous-address id="123">
               <test>data 1 </test>
             </anonymous-address>
             <anonymous-address id="456">
               <test>data 2 </test>
             </anonymous-address>
         </addresses>';
     $xml_parsed = new xmlParser($xml, array());
     $this->assertEquals($xml_parsed->getRoot(), 'ADDRESSES', 'Should be root in UpperCase');
 }
 public static function readSuccessXml($str_xml)
 {
     $parser = new xmlParser($str_xml);
     $data = $parser->getResult('checkout');
     $PaymentParserData = new PaymentParserData();
     $PaymentParserData->setCode($data['code']);
     $PaymentParserData->setRegistrationDate($data['date']);
     return $PaymentParserData;
 }